@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  font-family: 'DM Sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #17221e;
  background: #f5f6f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #17221e;
  --muted: #77817d;
  --line: #e7eae8;
  --green: #087c59;
  --green-dark: #066647;
  --green-pale: #e8f5ef;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 88% 0%, rgba(214, 231, 222, .24), transparent 34rem),
    #f5f6f8;
}

button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100% - 48px, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(222, 227, 224, .8);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; letter-spacing: -.025em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: var(--green); font: 700 17px Georgia, serif; box-shadow: 0 3px 8px #087c5926; }
.privacy-note { display: flex; align-items: center; gap: 8px; color: #697671; font-size: 12px; }
.privacy-dot, .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 99px; background: #36a979; box-shadow: 0 0 0 3px #36a97919; }

.welcome-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 458px;
  margin: 70px 0 auto;
  padding: 64px 75px 64px 78px;
  overflow: hidden;
  border: 1px solid #e9ecea;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 16px 55px rgba(36, 53, 46, .055), 0 2px 7px rgba(36, 53, 46, .025);
}

.welcome-copy { position: relative; z-index: 1; max-width: 480px; }
.eyebrow { margin: 0 0 17px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .055em; }
h1 { margin: 0; font-size: clamp(35px, 4vw, 46px); line-height: 1.31; letter-spacing: -.065em; font-weight: 800; }
.intro { max-width: 360px; margin: 18px 0 26px; color: #697570; font-size: 14px; line-height: 1.8; letter-spacing: -.025em; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 600; letter-spacing: -.02em; cursor: pointer; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
.button:focus-visible { outline: 3px solid #0c956d55; outline-offset: 2px; }
.button:active { transform: translateY(1px); }
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: #fff; background: var(--green); box-shadow: 0 3px 7px #087c5926; }
.button-primary:hover:not(:disabled) { background: var(--green-dark); box-shadow: 0 4px 10px #087c5935; }
.button-primary:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.button-secondary { color: #38453f; border-color: #e1e6e3; background: #fff; }
.button-secondary:hover { border-color: #cbd6d0; background: #f8faf9; }
.button-large { min-height: 48px; padding: 0 21px; border-radius: 9px; font-size: 14px; }
.button-large svg { width: 18px; height: 18px; }
.helper { margin: 13px 0 0; color: #9aa29e; font-size: 11px; }

.welcome-art { position: relative; width: 340px; height: 300px; flex: 0 0 340px; margin-left: 25px; }
.art-shadow { position: absolute; inset: 49px 31px 25px 40px; border-radius: 40px; background: #eaf4ef; transform: rotate(-6deg); }
.art-sheet { position: absolute; top: 24px; left: 68px; width: 220px; height: 252px; border: 1px solid #e6ece8; border-radius: 11px; background: #fff; box-shadow: 0 13px 35px #274d3a15; transform: rotate(3deg); }
.art-head { height: 32px; display: flex; align-items: center; gap: 5px; padding: 0 12px; border-bottom: 1px solid #f0f2f1; }
.art-head span { width: 6px; height: 6px; border-radius: 50%; background: #e4e9e6; }
.art-head span:first-child { background: #a9d8c1; }
.art-lines { position: absolute; top: 57px; left: 28px; display: flex; flex-direction: column; gap: 17px; }
.art-lines i { display: block; width: 116px; height: 5px; border-radius: 5px; background: #e9eeeb; }
.art-lines i:nth-child(2) { width: 146px; }.art-lines i:nth-child(3) { width: 130px; }.art-lines i:nth-child(4) { width: 102px; }.art-lines i:nth-child(5) { width: 139px; }
.art-highlight { position: absolute; top: 105px; left: 19px; width: 174px; height: 25px; border: 1px solid #bce7d3; border-radius: 5px; background: #eff9f4; }
.art-cursor { position: absolute; top: 110px; left: 137px; width: 2px; height: 14px; border-radius: 2px; background: #16845e; }
.art-badge { position: absolute; right: 8px; bottom: 34px; display: grid; place-items: center; width: 56px; height: 56px; border: 4px solid #fff; border-radius: 17px; color: #fff; background: #16835e; box-shadow: 0 8px 18px #087c5935; font: 600 15px 'DM Mono', monospace; transform: rotate(8deg); }

.editor-card { flex: 1; min-height: 510px; margin: 35px 0 24px; overflow: hidden; border: 1px solid #e5e9e6; border-radius: 14px; background: #fff; box-shadow: 0 10px 35px rgba(36, 53, 46, .045); }
.filebar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.file-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.file-icon { display: grid; place-items: center; width: 36px; height: 40px; flex: 0 0 auto; border: 1px solid #dce9e1; border-radius: 7px; color: var(--green); background: #f0f8f3; font: 500 9px 'DM Mono', monospace; letter-spacing: -.04em; }
.file-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.file-meta strong { overflow: hidden; max-width: 390px; color: #26332d; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { color: #8a9590; font-size: 11px; }
.file-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.editor-toolbar { height: 38px; display: flex; align-items: center; gap: 11px; padding: 0 17px; border-bottom: 1px solid #eff1f0; color: #84908a; font: 11px 'DM Mono', monospace; }
.toolbar-separator { width: 1px; height: 13px; background: #e4e8e6; }.toolbar-spacer { flex: 1; }
.edit-state { color: #7d8882; font-family: 'DM Sans', 'Noto Sans KR', sans-serif; font-size: 11px; }
.edit-state.changed { color: #b16d11; }
.editor-wrap { display: flex; height: min(55vh, 570px); min-height: 290px; overflow: hidden; background: #fff; }
.line-numbers { width: 55px; flex: 0 0 55px; overflow: hidden; padding: 18px 12px 24px 0; border-right: 1px solid #f0f2f1; color: #aab3ae; background: #fcfdfc; text-align: right; white-space: pre; user-select: none; font: 12px/1.75 'DM Mono', monospace; }
#text-editor { width: 100%; height: 100%; resize: none; padding: 18px 20px 24px; overflow: auto; border: 0; outline: none; color: #25352d; background: #fff; tab-size: 2; white-space: pre; font: 13px/1.75 'DM Mono', 'Noto Sans KR', monospace; }
#text-editor:disabled { background: #fff; }
.status { min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 18px; border-top: 1px solid #eff1f0; color: #6f7c75; font-size: 11px; }
.status.error { color: #b34d44; }.status.error .status-dot { background: #d45c50; box-shadow: 0 0 0 3px #d45c5019; }
.status.busy .status-dot { background: #d39735; box-shadow: 0 0 0 3px #d3973519; }
.editor-footnote { padding: 0 18px 15px; color: #9ba49f; font-size: 10px; }
.page-footer { margin-top: auto; padding: 30px 0 24px; color: #929c97; text-align: center; font-size: 11px; }.page-footer span { padding: 0 5px; color: #c1c7c3; }

.notice-dialog { width: min(420px, calc(100% - 32px)); padding: 29px; border: 1px solid #e7ebe8; border-radius: 15px; color: var(--ink); background: #fff; box-shadow: 0 22px 80px #162c2230; }
.notice-dialog::backdrop { background: #17251e73; backdrop-filter: blur(3px); }
.dialog-icon { display: grid; place-items: center; width: 37px; height: 37px; margin-bottom: 16px; border-radius: 11px; color: #a76314; background: #fff4df; font-weight: 700; }
.notice-dialog h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.04em; }
.notice-dialog p { margin: 0 0 22px; color: #697570; font-size: 13px; line-height: 1.7; white-space: pre-line; }
.notice-dialog .button { min-width: 82px; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 32px, 560px); }
  .topbar { height: 68px; }
  .privacy-note { font-size: 10px; }
  .welcome-card { min-height: 0; flex-direction: column; align-items: flex-start; margin: 25px 0 auto; padding: 38px 28px 20px; border-radius: 16px; }
  .welcome-copy { width: 100%; }
  h1 { font-size: clamp(33px, 9vw, 42px); }
  .intro { margin: 14px 0 21px; font-size: 13px; }
  .welcome-art { align-self: center; width: 280px; height: 208px; flex-basis: 208px; margin: 15px 0 0; transform: scale(.83); transform-origin: top center; }
  .art-sheet { top: 10px; left: 40px; }
  .art-shadow { inset: 35px 12px 0; }
  .art-badge { right: 0; bottom: 18px; }
  .page-footer { padding: 22px 0 16px; font-size: 10px; }
  .editor-card { min-height: 0; margin: 20px 0 12px; border-radius: 11px; }
  .filebar { min-height: 67px; padding: 10px 12px; gap: 8px; }
  .file-identity { gap: 8px; }
  .file-icon { width: 31px; height: 36px; }
  .file-meta strong { max-width: 38vw; font-size: 12px; }
  .file-meta span { font-size: 10px; }
  .file-actions { gap: 6px; }
  .file-actions .button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  #download svg { display: none; }
  .editor-toolbar { height: 34px; padding: 0 12px; font-size: 10px; }
  .editor-wrap { height: calc(100dvh - 270px); min-height: 250px; max-height: 650px; }
  .line-numbers { width: 42px; flex-basis: 42px; padding-right: 9px; font-size: 11px; }
  #text-editor { padding: 14px 13px 18px; font-size: 12px; }
  .status { min-height: 37px; padding: 0 12px; font-size: 10px; }
  .editor-footnote { padding: 0 12px 12px; font-size: 9px; }
}

@media (max-width: 375px) {
  .app-shell { width: calc(100% - 24px); }
  .privacy-note { max-width: 148px; text-align: right; }
  .file-meta strong { max-width: 31vw; }
  .file-actions .button { padding: 0 8px; }
  #open-another { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
