:root {
  --ink: #18221e;
  --muted: #78817c;
  --faint: #a7aea9;
  --paper: #f7f5ef;
  --paper-deep: #efede5;
  --white: #fffefa;
  --line: #e3e0d7;
  --forest: #18342b;
  --forest-2: #23473b;
  --mint: #ccded4;
  --sage: #769587;
  --gold: #c7a462;
  --red: #a6534c;
  --shadow: 0 18px 50px rgba(25, 42, 35, .12);
  --serif: Georgia, "Times New Roman", "Noto Serif KR", serif;
  --sans: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #ecefe9;
  --muted: #a2ada6;
  --faint: #727d76;
  --paper: #151a17;
  --paper-deep: #101411;
  --white: #1c231f;
  --line: #313a34;
  --forest: #101a16;
  --forest-2: #263d34;
  --mint: #526a5f;
  --sage: #9bb8aa;
  --gold: #d5b679;
  --shadow: 0 18px 50px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button, input, textarea { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.sidebar { background: var(--forest); color: #eef4f0; display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 30; }
.sidebar::after { content: ""; position: absolute; inset: auto 0 0; height: 200px; pointer-events: none; background: radial-gradient(circle at 20% 100%, rgba(142, 174, 157, .11), transparent 67%); }
.sidebar-top { display: flex; align-items: center; gap: 12px; padding: 28px 24px 25px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.2); border-radius: 11px; color: #eff6f1; font: italic 600 24px/1 var(--serif); background: rgba(255,255,255,.045); }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-family: var(--serif); font-size: 19px; letter-spacing: .02em; }
.brand-copy span { color: rgba(238,244,240,.47); font-size: 10px; letter-spacing: .08em; }
.sidebar-close { display: none !important; margin-left: auto; }

.search-box { height: 39px; margin: 0 18px 14px; padding: 0 12px; display: flex; align-items: center; gap: 9px; color: rgba(238,244,240,.52); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.07); border-radius: 9px; }
.search-box svg { width: 15px; }
.search-box input { width: 100%; min-width: 0; border: 0; background: transparent; color: white; font-size: 13px; }
.search-box input::placeholder { color: rgba(238,244,240,.42); }
kbd { border: 0; color: inherit; font: 10px/1 var(--sans); white-space: nowrap; }
.search-box kbd { padding: 4px 5px; border: 1px solid rgba(255,255,255,.1); border-radius: 5px; color: rgba(255,255,255,.35); }

.new-note { margin: 0 18px 8px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 9px; color: #f1f6f2; background: transparent; font-size: 13px; font-weight: 600; text-align: left; transition: background .16s; }
.new-note:hover { background: rgba(255,255,255,.075); }
.new-note > span { display: grid; place-items: center; width: 24px; height: 24px; color: var(--forest); background: #d5e2db; border-radius: 7px; }
.new-note svg { width: 15px; height: 15px; }
.new-note kbd { margin-left: auto; color: rgba(255,255,255,.34); }
.library-nav-link { margin: 0 18px 25px; padding: 9px 10px; display: grid; grid-template-columns: 24px minmax(0,1fr) 15px; align-items: center; gap: 10px; border-radius: 9px; color: rgba(241,246,242,.68); text-decoration: none; transition: background .16s, color .16s; }
.library-nav-link:hover, .library-nav-link.active { color: #f1f6f2; background: rgba(255,255,255,.075); }
.library-nav-link.active { box-shadow: inset 2px 0 #b8cfc1; }
.library-nav-link > span:first-child { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; }
.library-nav-link svg { width: 14px; height: 14px; }
.library-nav-link > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.library-nav-link strong { font-size: 12px; }
.library-nav-link small { overflow: hidden; color: rgba(238,244,240,.35); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.library-nav-arrow { width: 12px !important; color: rgba(238,244,240,.3); }

.note-nav { flex: 1; overflow: auto; padding: 0 12px 28px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.note-nav section + section { margin-top: 24px; }
.nav-label { display: flex; justify-content: space-between; padding: 0 12px 8px; color: rgba(238,244,240,.35); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.note-item { width: 100%; min-height: 55px; padding: 9px 12px; display: grid; grid-template-columns: 20px 1fr; gap: 9px; border: 0; border-radius: 10px; color: rgba(238,244,240,.66); background: transparent; text-align: left; transition: background .16s, color .16s; }
.note-item:hover { background: rgba(255,255,255,.05); color: white; }
.note-item.active { color: white; background: rgba(255,255,255,.105); box-shadow: inset 2px 0 #b8cfc1; }
.note-item > svg { width: 15px; height: 15px; margin-top: 2px; }
.note-item.active > svg { color: #c6dbce; }
.note-item-copy { min-width: 0; }
.note-item-title { display: block; overflow: hidden; color: inherit; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.note-item-meta { display: flex; gap: 5px; margin-top: 3px; color: rgba(238,244,240,.3); font-size: 9px; }
.nav-empty { padding: 9px 12px; color: rgba(238,244,240,.28); font-size: 11px; }
.sidebar-footer { position: relative; z-index: 1; padding: 17px 22px calc(17px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.07); }
.storage-line { display: flex; align-items: center; gap: 8px; color: rgba(238,244,240,.38); font-size: 10px; }
.storage-line i { flex: 1; height: 1px; background: rgba(255,255,255,.09); }
.quiet-button { margin-top: 10px; padding: 3px 0; border: 0; background: transparent; color: rgba(238,244,240,.45); font-size: 11px; }
.quiet-button:hover { color: white; }

.workspace { min-width: 0; height: 100dvh; overflow: auto; position: relative; background: var(--paper); }
.topbar { position: sticky; top: 0; z-index: 20; height: 68px; padding: 0 27px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent); background: color-mix(in srgb, var(--paper) 91%, transparent); backdrop-filter: blur(18px); }
.topbar-left, .topbar-actions, .mode-switch, .save-state { display: flex; align-items: center; }
.topbar-left { min-width: 0; gap: 4px; }
.crumb { color: var(--muted); font-size: 11px; white-space: nowrap; }
.crumb.current { max-width: 230px; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; }
.crumb-arrow { width: 11px; color: var(--faint); }
.topbar-actions { position: relative; gap: 8px; }
.save-state { gap: 7px; margin-right: 8px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: #759b86; box-shadow: 0 0 0 3px color-mix(in srgb, #759b86 16%, transparent); }
.save-state.saving .save-dot { background: var(--gold); animation: breathe 1s infinite; }
.save-state.error .save-dot { background: var(--red); }
@keyframes breathe { 50% { opacity: .35; } }
.mode-switch { padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-deep); }
.mode-switch button { height: 28px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 10px; }
.mode-switch button.active { color: var(--ink); background: var(--white); box-shadow: 0 1px 4px rgba(30,40,35,.08); }
.mode-switch svg { width: 13px; }
.narrate-button, .generate-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; color: #f3f7f4; background: var(--forest); font-size: 11px; font-weight: 650; }
.narrate-button { height: 35px; padding: 0 14px; border-radius: 9px; }
.narrate-button:hover, .generate-button:hover { background: var(--forest-2); }
.narrate-button svg { width: 15px; }
.icon-button { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: var(--white); }
.icon-button svg { width: 15px; height: 15px; }
.mobile-menu { display: none; border: 0; }
.more-menu { position: absolute; right: 0; top: 42px; width: 172px; padding: 6px; display: none; border: 1px solid var(--line); border-radius: 11px; background: var(--white); box-shadow: var(--shadow); }
.more-menu.open { display: block; }
.more-menu button { width: 100%; padding: 9px 10px; display: flex; gap: 9px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; font-size: 11px; }
.more-menu button:hover { background: var(--paper-deep); }
.more-menu button.danger { color: var(--red); }
.more-menu svg { width: 14px; }

.loading-state { height: calc(100dvh - 68px); display: flex; align-items: center; justify-content: center; gap: 6px; }
.loading-state span { width: 5px; height: 5px; border-radius: 50%; background: var(--sage); animation: load 1s infinite alternate; }
.loading-state span:nth-child(2) { animation-delay: .15s; }.loading-state span:nth-child(3) { animation-delay: .3s; }
@keyframes load { to { transform: translateY(-8px); opacity: .35; } }

body.library-active .mode-switch, body.library-active #narrateBtn, body.library-active #moreBtn { display: none; }
.narration-library { width: min(960px, calc(100% - 64px)); min-height: calc(100dvh - 68px); margin: 0 auto; padding: 72px 0 100px; }
.library-hero { position: relative; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.library-hero h1 { margin: 12px 0 10px; font: 500 clamp(38px, 5vw, 58px)/1.1 var(--serif); letter-spacing: -.04em; }
.library-hero > p { margin: 0; color: var(--muted); font-size: 12px; }
.library-summary { position: absolute; right: 0; bottom: 30px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.library-summary strong { color: var(--ink); font-size: 11px; }
.library-summary span::before { content: ""; width: 3px; height: 3px; margin-right: 10px; display: inline-block; vertical-align: middle; border-radius: 50%; background: var(--sage); }
.narration-board { margin-top: 28px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.narration-item { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); box-shadow: 0 8px 24px rgba(25,42,35,.045); }
.narration-item.stale { opacity: .72; }
.narration-item-copy { min-width: 0; display: flex; flex-direction: column; }
.narration-item-kicker { color: var(--sage); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.narration-item-title { margin-top: 9px; overflow: hidden; color: var(--ink); font: 500 21px/1.35 var(--serif); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.narration-item-title:hover { color: var(--sage); }
.narration-item-meta { margin-top: 6px; color: var(--faint); font-size: 9px; }
.narration-item-player { margin-top: 20px; display: flex; align-items: center; gap: 7px; }
.library-listen-button { min-width: 0; flex: 1; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 10px; color: #f3f7f4; background: var(--forest); text-align: left; }
.library-listen-button:hover { background: var(--forest-2); }
.library-listen-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--forest); background: #d5e2db; }
.library-listen-icon svg { width: 11px; height: 11px; fill: currentColor; }
.library-listen-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.library-listen-copy strong { font-size: 10px; }
.library-listen-copy small { overflow: hidden; color: rgba(243,247,244,.55); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.narration-item-player > .audio-duration { margin-left: 3px; }
.narration-item > .audio-seek { margin-top: 13px; }
.library-empty { min-height: 420px; display: grid; place-content: center; justify-items: center; text-align: center; }
.library-empty > span { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; color: var(--sage); background: var(--white); }
.library-empty > span svg { width: 23px; height: 23px; }
.library-empty h2 { margin: 20px 0 7px; font: 24px var(--serif); }
.library-empty p { margin: 0; color: var(--muted); font-size: 11px; }

.editor-page { width: min(760px, calc(100% - 48px)); min-height: calc(100dvh - 68px); margin: 0 auto; padding: 72px 0 90px; }
.page-meta { display: flex; justify-content: space-between; align-items: center; color: var(--faint); font-size: 10px; }
.date-line { display: flex; align-items: center; gap: 7px; }
.date-line svg { width: 13px; }
.read-time { letter-spacing: .03em; }
.title-input { width: 100%; margin-top: 25px; padding: 0; resize: none; overflow: hidden; border: 0; color: var(--ink); background: transparent; font-family: var(--serif); font-size: clamp(36px, 4.5vw, 55px); font-weight: 500; line-height: 1.1; letter-spacing: -.04em; }
.title-input::placeholder { color: color-mix(in srgb, var(--muted) 42%, transparent); }
.tag-row { margin-top: 22px; display: flex; align-items: center; gap: 8px; color: var(--sage); font-size: 11px; }
.tag-row input { width: 100%; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.tag-row input::placeholder { color: var(--faint); }
.editor-rule { width: 100%; height: 1px; margin: 27px 0 25px; background: var(--line); }
.content-input { display: block; width: 100%; min-height: 52vh; padding: 0 0 140px; resize: none; overflow: hidden; border: 0; color: var(--ink); background: transparent; font-family: var(--serif); font-size: 17px; line-height: 1.95; letter-spacing: -.005em; caret-color: var(--sage); }
.content-input::placeholder { color: color-mix(in srgb, var(--muted) 36%, transparent); }
.editor-footer { padding-top: 15px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--faint); font-size: 9px; letter-spacing: .03em; }

.reader-page { min-height: calc(100dvh - 68px); }
.reader-inner { width: min(690px, calc(100% - 48px)); margin: 0 auto; padding: 80px 0 130px; }
.reader-kicker { color: var(--sage); font-size: 9px; font-weight: 800; letter-spacing: .24em; }
.reader-page h1 { margin: 22px 0 20px; font: 500 clamp(38px, 5vw, 58px)/1.18 var(--serif); letter-spacing: -.04em; }
.reader-byline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.dot-separator { width: 3px; height: 3px; border-radius: 50%; background: var(--sage); }
.reader-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.reader-tags span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 9px; }
.reader-audio { margin-top: 30px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--mint) 13%, var(--white)); }
.reader-audio-heading, .reader-audio-title { display: flex; align-items: center; }
.reader-audio-heading { justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.reader-audio-title { min-width: 0; gap: 10px; }
.reader-audio-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--forest); background: var(--mint); }
.reader-audio-icon svg { width: 15px; height: 15px; }
.reader-audio-title div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reader-audio-title strong { font-size: 11px; }
.reader-audio-title small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.reader-audio-heading > button { padding: 6px 9px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--white); font-size: 9px; }
.reader-audio-heading > button:hover { color: var(--ink); border-color: var(--mint); }
.reader-audio-list { display: grid; gap: 8px; }
.reader-audio-card { background: var(--white); }
.reader-audio-empty { padding: 12px 13px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); background: color-mix(in srgb, var(--white) 72%, transparent); font-size: 10px; line-height: 1.6; }
.reader-audio:not([hidden]) + .reader-prose { margin-top: 40px; }
.reader-prose { margin-top: 48px; color: color-mix(in srgb, var(--ink) 92%, transparent); font: 16.5px/2 var(--serif); }
.reader-prose h2, .reader-prose h3 { margin: 2.3em 0 .75em; color: var(--ink); font-family: var(--serif); line-height: 1.35; }
.reader-prose h2 { font-size: 25px; }.reader-prose h3 { font-size: 20px; }
.reader-prose p { margin: 0 0 1.45em; white-space: pre-wrap; }
.reader-prose blockquote { margin: 2em 0; padding: .2em 0 .2em 22px; border-left: 2px solid var(--sage); color: var(--muted); font-style: italic; }
.reader-prose ul, .reader-prose ol { margin: 1.3em 0; padding-left: 1.4em; }
.reader-prose li { margin: .45em 0; padding-left: .3em; }
.reader-prose strong { font-weight: 700; }.reader-prose em { color: var(--muted); }
.reader-prose code { padding: 2px 5px; border-radius: 4px; background: var(--paper-deep); font: .85em ui-monospace, monospace; }
.reader-prose a { color: var(--sage); text-underline-offset: 3px; }
.end-mark { margin-top: 70px; display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--sage); font: italic 16px var(--serif); }
.end-mark span { width: 45px; height: 1px; background: var(--line); }

.empty-page { height: calc(100dvh - 68px); display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-symbol { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; color: var(--sage); font: italic 34px var(--serif); }
.empty-page h2 { margin: 24px 0 8px; font: 28px var(--serif); }.empty-page p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; align-items: stretch; justify-content: flex-end; background: rgba(10,17,14,.45); backdrop-filter: blur(5px); }
.modal-backdrop.open { display: flex; }
.narration-sheet { width: min(510px, 100vw); display: flex; flex-direction: column; background: var(--white); box-shadow: -20px 0 60px rgba(8,20,15,.2); animation: sheet-in .28s cubic-bezier(.2,.75,.25,1); }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
.sheet-header { padding: 32px 34px 25px; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--sage); font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.sheet-header h2 { margin: 9px 0 7px; font: 500 28px var(--serif); letter-spacing: -.025em; }
.sheet-header p { margin: 0; color: var(--muted); font-size: 11px; }
.sheet-scroll { flex: 1; overflow-y: auto; padding: 26px 34px; }
.option-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.option-heading.second { margin-top: 31px; }
.option-heading > span { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 50%; color: var(--sage); font: 9px var(--serif); }
.option-heading div { display: flex; flex-direction: column; gap: 1px; }
.option-heading strong { font-size: 12px; }.option-heading small { color: var(--faint); font-size: 9px; }
.voice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.voice-card { padding: 13px; display: grid; grid-template-columns: 34px 1fr 16px; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: transparent; text-align: left; }
.voice-card:hover { border-color: var(--mint); background: color-mix(in srgb, var(--mint) 12%, transparent); }
.voice-card.active { border-color: var(--sage); background: color-mix(in srgb, var(--mint) 24%, transparent); box-shadow: inset 0 0 0 1px var(--sage); }
.voice-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--forest); background: var(--mint); font: 600 14px var(--serif); }
.voice-card:nth-child(2n) .voice-avatar { background: #e5dac9; }.voice-card:nth-child(3n) .voice-avatar { background: #d3d9e2; }
.voice-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.voice-copy strong { font-size: 11px; }.voice-copy span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.voice-check { width: 15px; height: 15px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.voice-card.active .voice-check { color: white; border-color: var(--sage); background: var(--sage); }
.voice-check svg { width: 10px; height: 10px; }
.style-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.style-card { min-height: 67px; padding: 12px 13px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: transparent; text-align: left; }
.style-card:hover { border-color: var(--mint); }.style-card.active { border-color: var(--sage); background: color-mix(in srgb, var(--mint) 22%, transparent); }
.style-card strong { font-size: 11px; }.style-card span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.sheet-footer { padding: 18px 34px calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.sheet-footer > div { display: flex; flex-direction: column; }.sheet-footer strong { font: 14px var(--serif); }.sheet-footer span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.generate-button { min-width: 166px; height: 42px; padding: 0 17px; border-radius: 9px; }
.generate-button:disabled { cursor: default; opacity: .55; }
.generate-button svg { width: 14px; }

.audio-existing { display: flex; flex-direction: column; gap: 9px; }
.audio-existing:not(:empty) { margin-bottom: 28px; }
.audio-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.audio-label strong { font-size: 11px; }.audio-label span { color: var(--faint); font-size: 9px; }
.audio-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.audio-card.stale { opacity: .7; }
.audio-card-top { display: flex; align-items: center; gap: 10px; }
.play-button { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 50%; color: white; background: var(--forest); }
.audio-play-icon { display: grid; place-items: center; }
.play-button svg { width: 12px; height: 12px; fill: currentColor; }
.audio-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.audio-info strong { font-size: 10px; }.audio-info span { color: var(--muted); font-size: 9px; }
.audio-card-actions { display: flex; align-items: center; gap: 5px; }
.audio-duration { margin-right: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.audio-action { width: 26px; height: 26px; padding: 0; display: inline-grid; place-items: center; border: 0; border-radius: 7px; color: var(--muted); background: transparent; text-decoration: none; }
.audio-action:hover { color: var(--ink); background: var(--paper-deep); }
.audio-action.audio-delete:hover { color: var(--red); }
.audio-action svg { width: 13px; height: 13px; }
.audio-seek { width: 100%; height: 3px; margin-top: 11px; display: block; appearance: none; border-radius: 2px; background: var(--line); }
.audio-seek::-webkit-slider-thumb { width: 10px; height: 10px; appearance: none; border-radius: 50%; background: var(--sage); }
.audio-progress-card { margin-bottom: 28px; padding: 17px; display: flex; align-items: center; gap: 14px; border: 1px solid color-mix(in srgb, var(--sage) 50%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--mint) 18%, var(--white)); }
.progress-orb { position: relative; width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--forest); background: var(--mint); }
.progress-orb span { position: absolute; inset: -3px; border: 1px solid var(--sage); border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-copy { flex: 1; display: flex; flex-direction: column; }.progress-copy strong { font-size: 11px; }.progress-copy > span { margin: 2px 0 8px; color: var(--muted); font-size: 9px; }
.progress-track { height: 3px; overflow: hidden; border-radius: 2px; background: var(--line); }.progress-track i { display: block; width: 5%; height: 100%; border-radius: inherit; background: var(--sage); transition: width .3s; }

.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 330px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s ease-out; }
.toast.error { color: var(--red); }.toast.success { color: var(--forest-2); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }
.sidebar-scrim { display: none; }

.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 28px; background: var(--forest); background-image: radial-gradient(circle at 15% 10%, rgba(174,204,188,.12), transparent 30%), radial-gradient(circle at 90% 90%, rgba(205,182,130,.09), transparent 28%); }
.login-card { width: min(420px, 100%); padding: 48px 45px 42px; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; color: #edf3ef; background: rgba(255,255,255,.055); box-shadow: 0 30px 80px rgba(0,0,0,.2); backdrop-filter: blur(18px); }
.login-brand { width: 50px; height: 50px; margin-bottom: 35px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 14px; font: italic 30px var(--serif); }
.login-card .eyebrow { color: #9eb8aa; }.login-card h1 { margin: 11px 0 9px; font: 500 34px var(--serif); }.login-card > p { margin: 0 0 30px; color: rgba(237,243,239,.52); font-size: 12px; }
.login-card label { display: block; margin-bottom: 7px; color: rgba(237,243,239,.65); font-size: 10px; }
.login-card input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; color: white; background: rgba(0,0,0,.12); font-size: 13px; }
.login-card input:focus { border-color: rgba(198,219,207,.6); box-shadow: 0 0 0 3px rgba(198,219,207,.08); }.login-card input::placeholder { color: rgba(255,255,255,.25); }
.login-card form button { width: 100%; height: 46px; margin-top: 12px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; color: var(--forest); background: #d2e0d8; font-size: 12px; font-weight: 700; }
.login-card > small { display: block; margin-top: 26px; color: rgba(237,243,239,.33); font-size: 9px; text-align: center; }
.login-error { margin: -14px 0 18px; padding: 10px 12px; border-radius: 8px; color: #f0c1bd; background: rgba(166,83,76,.2); font-size: 10px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 245px minmax(0,1fr); }
  .save-state { display: none; }
  .topbar { padding: 0 19px; }
  .editor-page { padding-top: 60px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(292px, 87vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 20px 0 45px rgba(0,0,0,.22); }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(5,10,8,.4); backdrop-filter: blur(2px); }
  .sidebar-scrim.open { display: block; }
  .sidebar-close, .mobile-menu { display: inline-grid !important; }
  .sidebar-close { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.1); }
  .topbar { height: 62px; padding: 0 13px; }
  .crumb:not(.current), .crumb-arrow { display: none; }
  .crumb.current { max-width: 120px; }
  .mode-switch button { padding: 0 8px; }.mode-switch button span { display: none; }
  .narrate-button { width: 34px; padding: 0; }.narrate-button span { display: none; }
  .editor-page, .reader-inner { width: min(100% - 38px, 680px); padding-top: 46px; }
  .title-input { font-size: 38px; }
  .content-input, .reader-prose { font-size: 16px; line-height: 1.9; }
  .reader-page h1 { font-size: 40px; }
  .reader-audio { margin-top: 26px; padding: 13px; }
  .reader-audio-card .audio-duration { display: none; }
  .narration-library { width: min(100% - 38px, 680px); padding: 46px 0 80px; }
  .library-hero { padding-bottom: 23px; }
  .library-summary { position: static; margin-top: 19px; }
  .narration-board { grid-template-columns: 1fr; margin-top: 20px; }
  .narration-sheet { width: 100%; }
  .sheet-header { padding: 26px 22px 21px; }.sheet-scroll { padding: 22px; }.sheet-footer { padding: 15px 22px calc(15px + env(safe-area-inset-bottom)); }
  .toast-stack { right: 14px; bottom: 14px; left: 14px; }.toast { max-width: none; }
}

@media (max-width: 430px) {
  .topbar-actions { gap: 5px; }
  #themeBtn { display: none; }
  .voice-grid, .style-grid { grid-template-columns: 1fr; }
  .sheet-footer > div { display: none; }.generate-button { width: 100%; }
  .login-card { padding: 38px 28px 32px; }
}

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