/* VSB Novella — veeerbooks.in palette (paper, ink and gold), calm Claude-style layout. */
:root {
  --paper: #fbf9f4;
  --paper-2: #f5f2eb;
  --card: #ffffff;
  --ink: #1c1917;
  --ink-2: #3f3a35;
  --muted: #7a736b;
  --line: #e6e1d7;
  --line-2: #efebe3;
  --hover: rgba(28, 25, 23, .05);
  --active: rgba(28, 25, 23, .08);
  --gold: #c5a059;
  --gold-2: #9c7b3c;
  --gold-soft: #fbf3e0;
  --gold-light: #f5d997;
  --gold-line: #dcc69a;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 6px 20px rgba(28, 25, 23, .05);
  --serif: "Source Serif 4 Variable", "Iowan Old Style", Georgia, "Nirmala UI", serif;
  --sans: "Inter Variable", "Segoe UI Variable Text", "Segoe UI", "Nirmala UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #161412;
  --paper-2: #1b1815;
  --card: #221f1b;
  --ink: #f2ede4;
  --ink-2: #d9d3c8;
  --muted: #a39b8f;
  --line: #34302a;
  --line-2: #2a2621;
  --hover: rgba(255, 255, 255, .05);
  --active: rgba(255, 255, 255, .085);
  --gold-2: #d9b871;
  --gold-soft: #2a2416;
  --gold-line: #5a4a2a;
  --green-soft: #12261a;
  --red-soft: #2b1515;
  --amber-soft: #2a2010;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11" 1, "calt" 1; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 450; margin: 0; color: var(--ink); letter-spacing: -.01em; font-variant-numeric: lining-nums; }
b, strong { font-weight: 600; }
::selection { background: rgba(197, 160, 89, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.boot { height: 100vh; display: grid; place-items: center; align-content: center; gap: 14px; font-family: var(--serif); font-size: 22px; color: var(--muted); }
.boot img { width: 72px; height: 72px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ── Frame ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-rows: 40px 1fr; height: 100vh; }
.topbar { -webkit-app-region: drag; background: var(--paper-2); color: var(--ink); display: flex; align-items: center; gap: 10px; padding: 0 150px 0 8px; border-bottom: 1px solid var(--line); user-select: none; }
.topbar .tb-btn { -webkit-app-region: no-drag; border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.topbar .tb-btn:hover { background: var(--hover); color: var(--ink); }
.topbar .tb-btn svg { width: 18px; height: 18px; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; letter-spacing: .01em; padding-left: 4px; }
.topbar .brand img { width: 20px; height: 20px; border-radius: 5px; }
.topbar .brand b { color: var(--gold-2); font-weight: 600; }
.topbar .crumb { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb span { margin: 0 4px; opacity: .6; }
.topbar .spacer { flex: 1; }

.body { display: grid; grid-template-columns: 260px 1fr; min-height: 0; transition: grid-template-columns .18s ease; }
.body.collapsed { grid-template-columns: 60px 1fr; }
.side { background: var(--paper-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px 8px; gap: 1px; min-height: 0; min-width: 0; position: relative; z-index: 6; }
.side-new { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--ink); font-size: 14px; text-align: left; }
.side-new .plus { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #1c1917; display: grid; place-items: center; flex: 0 0 auto; transition: transform .2s; }
.side-new .plus svg { width: 16px; height: 16px; stroke-width: 2.4; }
.side-new:hover { background: var(--hover); }
.side-new:hover .plus { transform: rotate(90deg); }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .8; }
.nav:hover { background: var(--hover); }
.nav.on { background: var(--active); color: var(--ink); font-weight: 600; }
.side-label { font-size: 12px; color: var(--muted); padding: 18px 10px 6px; font-weight: 500; }
.recents { overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 1px; }
.recent { border: 0; background: none; text-align: left; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; flex: 0 0 auto; }
.recent:hover { background: var(--hover); }
.recent.on { background: var(--active); color: var(--ink); font-weight: 500; }
.side-account-wrap { position: relative; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-account { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 8px; border-radius: 10px; cursor: pointer; text-align: left; }
.side-account:hover, .side-account.on { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--gold-light); display: grid; place-items: center; font-weight: 600; font-size: 13.5px; flex: 0 0 auto; }
:root[data-theme="dark"] .avatar { background: var(--gold); color: #1c1917; }
.acct-text { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.acct-text b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-text small { color: var(--muted); font-size: 11.5px; }
.side-account .chev { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; transform: rotate(180deg); }
.body.collapsed .side { align-items: center; padding: 10px 6px 8px; }
.body.collapsed .side .lbl { display: none; }
.body.collapsed .nav, .body.collapsed .side-new, .body.collapsed .side-account { width: 44px; justify-content: center; padding: 8px; }
.body.collapsed .side-new { padding: 6px; }
.body.collapsed .popover.up { left: 0; right: auto; width: 240px; }

.popover { position: absolute; z-index: 40; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(28, 25, 23, .16); padding: 6px; min-width: 220px; animation: pop .12s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
.popover.up { bottom: calc(100% + 6px); left: 0; right: 0; }
.popover.up-left { bottom: calc(100% + 8px); left: 0; }
.popover button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--ink); }
.popover button:hover { background: var(--hover); }
.popover svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.popover hr { border: 0; height: 1px; background: var(--line); margin: 4px 2px; }
.pop-who { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.content { flex: 1; min-height: 0; overflow-y: auto; }
.content.fill { overflow: hidden; display: flex; flex-direction: column; }
.content.fill > * { flex: 1; min-height: 0; }
.bookbar { display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; height: 50px; border-bottom: 1px solid var(--line); background: var(--paper); flex: 0 0 auto; min-width: 0; }
.bb-book { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 8px; max-width: 220px; min-width: 0; }
.bb-book:hover { background: var(--hover); }
.bb-cover { width: 22px; height: 32px; border-radius: 2px 4px 4px 2px; background: linear-gradient(150deg, #3a2f25, #1c1917); color: var(--gold-light); display: grid; place-items: center; font: 500 12px var(--serif); overflow: hidden; flex: 0 0 auto; }
.bb-cover img { width: 100%; height: 100%; object-fit: cover; }
.bb-book b { font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tabs { display: flex; align-items: stretch; align-self: stretch; gap: 2px; min-width: 0; }
.tab { display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 0 11px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
.bb-save { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bb-save svg { width: 14px; height: 14px; color: var(--green); }
.bb-save.error { color: var(--red); }
.c-icon { border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); flex: 0 0 auto; }
.c-icon:hover { background: var(--hover); color: var(--ink); }
.c-icon svg { width: 17px; height: 17px; }
@media (max-width: 1320px) { .tab svg { display: none; } .tab { padding: 0 9px; } }

.page { max-width: 1120px; margin: 0 auto; padding: 32px 40px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }

/* ── Building blocks ───────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mt { margin-top: 16px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fdfbf7; padding: 8px 15px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform .12s, box-shadow .12s, opacity .12s, background .12s; }
:root[data-theme="dark"] .btn { background: #f2ede4; color: #1c1917; border-color: #f2ede4; }
:root[data-theme="dark"] .btn.gold { background: var(--gold); border-color: var(--gold); color: #1c1917; }
:root[data-theme="dark"] .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .btn.ghost:hover { border-color: var(--gold-line); background: var(--hover); }
:root[data-theme="dark"] .btn.danger { background: transparent; color: #f87171; border-color: #5b2626; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(28, 25, 23, .14); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1c1917; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold-line); background: var(--hover); box-shadow: none; }
.btn.danger { background: transparent; color: var(--red); border-color: #f0c7c7; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; width: 32px; height: 32px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--gold-line); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field > small { color: var(--muted); font-size: 12px; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 160, 89, .16); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--paper-2); border-radius: 99px; padding: 4px 10px; font-size: 13px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; font-size: 14px; line-height: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border-radius: 99px; padding: 2px 9px; background: var(--gold-soft); color: var(--gold-2); border: 1px solid var(--gold-line); }
.badge.green { background: var(--green-soft); color: var(--green); border-color: #bbf7d0; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.badge.dark { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }
.note { border-radius: 12px; padding: 12px 14px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--ink-2); font-size: 13.5px; }
.note.green { background: var(--green-soft); border-color: #bbf7d0; }
.note.red { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.kbd { font: 11px ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--paper-2); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fdfbf7; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: 13.5px; animation: up .2s ease; }
:root[data-theme="dark"] .toast { background: #f2ede4; color: #1c1917; }
.toast.err { background: var(--red); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.veil { position: fixed; inset: 40px 0 0; background: rgba(20, 18, 16, .45); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(620px, 100%); max-height: calc(100vh - 100px); overflow: auto; background: var(--card); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); padding: 24px; }
.modal h2 { font-size: 24px; margin-bottom: 6px; }
.meter { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 99px; transition: width .3s; }
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { color: var(--muted); font-size: 13px; }

/* ── Home (Claude-style) ───────────────────────────────────────────────── */
.home2 { min-height: 100%; display: flex; justify-content: center; padding: 0 28px 48px; }
.home-center { width: min(720px, 100%); padding-top: max(36px, 10vh); display: flex; flex-direction: column; align-items: center; }
.plan-pill { border: 1px solid var(--line); background: var(--paper-2); border-radius: 99px; padding: 4px 13px; font-size: 12.5px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.plan-pill b { color: var(--ink); font-weight: 600; }
.plan-pill:hover { border-color: var(--gold-line); }
.plan-pill svg { width: 13px; height: 13px; color: var(--gold-2); }
.greet { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1.15; letter-spacing: -.02em; margin: 22px 0 28px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--ink); text-align: center; }
.spark { color: var(--gold); flex: 0 0 auto; }
.spin-slow { animation: rot 2.6s linear infinite; }
.composer2 { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 6px 22px rgba(28, 25, 23, .06); padding: 12px 12px 10px 16px; cursor: text; transition: border-color .15s, box-shadow .15s; }
.composer2:focus-within { border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(197, 160, 89, .12), 0 6px 22px rgba(28, 25, 23, .07); }
.composer2 textarea { display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent; font-size: 15px; line-height: 1.5; padding: 4px 0 10px; color: var(--ink); }
.composer2.big textarea { font-size: 16px; min-height: 60px; }
.composer2 textarea::placeholder { color: var(--muted); }
.c-bar { display: flex; align-items: center; gap: 6px; cursor: default; }
.c-plus { position: relative; }
.c-plus .c-icon { border: 1px solid var(--line); border-radius: 9px; }
.c-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; height: 30px; color: var(--ink-2); font-size: 12.5px; cursor: pointer; max-width: 240px; min-width: 0; position: relative; }
.c-chip:hover { background: var(--hover); }
.c-chip svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); pointer-events: none; }
.c-chip select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; outline: none; cursor: pointer; font-size: 12.5px; color: inherit; padding: 0 2px; min-width: 0; max-width: 180px; text-overflow: ellipsis; }
.c-chip select option { background: var(--card); color: var(--ink); }
.c-chip .chev { width: 13px; height: 13px; }
.c-note { font-size: 12px; color: var(--muted); margin-right: 4px; white-space: nowrap; }
.c-send { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--gold); color: #1c1917; display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; transition: opacity .15s, transform .12s; }
.c-send svg { width: 18px; height: 18px; stroke-width: 2.3; }
.c-send:disabled { opacity: .35; cursor: default; }
.c-send:not(:disabled):hover { transform: translateY(-1px); }
.chip-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.h-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 7px 13px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.h-chip:hover { background: var(--paper-2); color: var(--ink); border-color: var(--gold-line); }
.h-chip svg { width: 16px; height: 16px; color: var(--gold-2); }
.prompt-list { width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; animation: up .15s; }
.pl-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
.pl-head span { display: inline-flex; gap: 7px; align-items: center; }
.pl-head svg { width: 15px; height: 15px; }
.prompt-list > button { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line-2); background: none; padding: 11px 14px; font-size: 14px; color: var(--ink); cursor: pointer; }
.prompt-list > button:hover { background: var(--paper-2); }
.home-books { width: 100%; margin-top: 44px; }
.hb-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.link-btn:hover { color: var(--ink); background: var(--hover); }
.hb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hb-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.hb-card:hover { border-color: var(--gold-line); box-shadow: var(--shadow); }
.hb-cover { width: 34px; height: 48px; border-radius: 2px 5px 5px 2px; background: linear-gradient(150deg, #3a2f25, #1c1917); color: var(--gold-light); display: grid; place-items: center; font: 500 16px var(--serif); overflow: hidden; flex: 0 0 auto; box-shadow: inset 3px 0 5px rgba(0, 0, 0, .25); }
.hb-cover img { width: 100%; height: 100%; object-fit: cover; }
.hb-meta { min-width: 0; }
.hb-meta b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hb-meta small { color: var(--muted); font-size: 12.5px; }
.hb-start { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hb-option { display: grid; gap: 3px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; justify-items: start; }
.hb-option:hover { border-color: var(--gold-line); box-shadow: var(--shadow); }
.hb-option .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-2); display: grid; place-items: center; margin-bottom: 8px; }
.hb-option .ico svg { width: 18px; height: 18px; }
.hb-option small { color: var(--muted); font-size: 13px; }

/* ── Books ─────────────────────────────────────────────────────────────── */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
.book-card { cursor: pointer; border: 0; background: none; text-align: left; padding: 0; outline: none; }
.book-card .cv { aspect-ratio: 2 / 3; border-radius: 4px 9px 9px 4px; background: linear-gradient(150deg, #3a2f25, #1c1917); box-shadow: inset 6px 0 10px rgba(0, 0, 0, .25), 0 10px 24px rgba(28, 25, 23, .16); display: flex; flex-direction: column; justify-content: center; padding: 14px; color: #f2ede4; overflow: hidden; position: relative; transition: transform .15s; }
.book-card:hover .cv, .book-card:focus-visible .cv { transform: translateY(-4px); }
.book-card .cv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-card .cv b { font-family: var(--serif); font-weight: 450; font-size: 19px; line-height: 1.2; text-align: center; }
.book-card .cv small { color: var(--gold-light); text-align: center; margin-top: 8px; letter-spacing: .1em; text-transform: uppercase; font-size: 10px; }
.cv-del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(20, 18, 16, .65); color: #f2ede4; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.cv-del svg { width: 15px; height: 15px; }
.book-card:hover .cv-del { opacity: 1; }
.cv-del:hover { background: var(--red); }
.book-card .meta { margin-top: 10px; }
.book-card .meta b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-card .meta small { color: var(--muted); }
.new-card { aspect-ratio: 2 / 3; border: 2px dashed var(--line); border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); cursor: pointer; background: transparent; font-weight: 600; }
.new-card:hover { border-color: var(--gold); color: var(--gold-2); }
.new-card span { font-size: 34px; line-height: 1; color: var(--gold); font-weight: 300; }

/* ── Chat (Claude-style) ───────────────────────────────────────────────── */
.chatpage { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 10px 20px; flex: 0 0 auto; min-height: 50px; }
.chat-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); min-width: 0; }
.chat-title svg { width: 16px; height: 16px; }
.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.chat-col { width: min(760px, calc(100% - 48px)); margin: 0 auto; }
.chat-scroll .chat-col { padding: 8px 0 28px; display: flex; flex-direction: column; gap: 24px; }
.chat-dock { flex: 0 0 auto; padding: 0 0 12px; }
.fine { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 9vh; gap: 6px; }
.chat-empty h2 { font-size: 30px; font-weight: 400; margin-top: 12px; }
.chat-empty p { margin: 0; }
.sug-list { display: grid; gap: 8px; width: 100%; max-width: 560px; margin-top: 18px; }
.sug-list button { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 14px; cursor: pointer; color: var(--ink); font-size: 14px; }
.sug-list button:hover { border-color: var(--gold-line); background: var(--paper-2); }
.sug-list svg { width: 16px; height: 16px; color: var(--gold-2); flex: 0 0 auto; }
.m-user { display: flex; justify-content: flex-end; }
.m-user .bubble { max-width: 80%; background: var(--paper-2); border: 1px solid var(--line-2); padding: 10px 15px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.55; }
:root[data-theme="dark"] .m-user .bubble { background: #2a2621; }
.m-ai { display: flex; gap: 12px; align-items: flex-start; }
.m-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); flex: 0 0 auto; margin-top: 1px; }
.m-body { flex: 1; min-width: 0; }
.md { font-family: var(--serif); font-size: 16.5px; line-height: 1.68; color: var(--ink); word-wrap: break-word; }
.md p { margin: 0 0 .8em; }
.md > :last-child { margin-bottom: 0; }
.md h4 { font: 600 15.5px/1.4 var(--sans); margin: 1.1em 0 .45em; }
.md > h4:first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .3em 0; }
.md li::marker { color: var(--gold-2); }
.md blockquote { margin: .6em 0; padding-left: 14px; border-left: 3px solid var(--gold); color: var(--ink-2); }
.md code { font: 13.5px ui-monospace, Consolas, monospace; background: var(--paper-2); padding: 1px 5px; border-radius: 5px; }
.md-math { display: inline-block; padding: 0 .12em; font-family: "Cambria Math", "STIX Two Math", "DejaVu Sans", var(--serif); font-variant-numeric: lining-nums; letter-spacing: .01em; white-space: nowrap; }
.m-acts { display: flex; gap: 2px; margin: 8px 0 0 -8px; opacity: 0; transition: opacity .15s; }
.m-ai:hover .m-acts, .m-ai:last-child .m-acts { opacity: 1; }
.m-act { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.m-act:hover { background: var(--hover); color: var(--ink); }
.m-act svg { width: 14px; height: 14px; }
.m-error { color: var(--red); margin: 0; font-size: 14px; }
.thinking .m-body { padding-top: 4px; font-size: 14px; }
.dock-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); min-height: 46px; }
.dock-head b { font-weight: 600; font-size: 14px; }
.dock-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.dock-msgs .md { font-size: 14.5px; line-height: 1.6; }
.dock-msgs .m-user .bubble { font-size: 13.5px; max-width: 92%; padding: 8px 12px; }
.dock-msgs .m-ai { gap: 9px; }
.dock-msgs .m-av { width: 24px; height: 24px; }
.dock-empty p { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.dock-empty .sug-list { margin-top: 0; }
.dock-empty .sug-list button { font-size: 13px; padding: 9px 12px; }
.dock-foot { padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.dock-foot .composer2 { padding: 8px 8px 8px 12px; border-radius: 14px; box-shadow: none; }
.dock-foot .composer2 textarea { font-size: 14px; padding-bottom: 6px; }
.dock-ctx { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 2px 6px; cursor: pointer; }
.dock-ctx input { accent-color: var(--gold); }

/* ── Onboarding ────────────────────────────────────────────────────────── */
.onb { min-height: calc(100vh - 40px); display: grid; grid-template-columns: 1.05fr 1fr; }
.onb-art { background: radial-gradient(ellipse at 30% 30%, #2f2720, #1c1917 70%); color: #f2ede4; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.onb-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 1px solid #c5a05955; box-shadow: 0 0 0 40px #c5a05911, 0 0 0 90px #c5a05908; }
.onb-art h1 { color: #f2ede4; font-weight: 400; font-size: 44px; line-height: 1.08; margin: 18px 0 14px; }
.onb-art h1 em { color: var(--gold-light); font-style: normal; }
.onb-art p { color: #d6d3d1; max-width: 440px; font-size: 15px; }
.onb-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: #e7e5e4; }
.onb-art li::before { content: "✦"; color: var(--gold); margin-right: 10px; }
.onb-art .logo-row { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.onb-art .logo-row img { width: 40px; height: 40px; background: #fdfbf7; border-radius: 10px; padding: 3px; }
.onb-form { padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 560px; width: 100%; margin: 0 auto; }
.steps { display: flex; gap: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--gold); }
.choice { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--card); text-align: left; width: 100%; }
.choice.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 160, 89, .18); }
.choice b { display: block; }
.choice small { color: var(--muted); }


/* ── Write ─────────────────────────────────────────────────────────────── */
.write { display: grid; grid-template-columns: 250px 1fr; height: 100%; min-height: 0; }
.write.with-ai { grid-template-columns: 250px 1fr 360px; }
.chapters { border-right: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; min-height: 0; }
.layout-nav-title { padding: 12px 14px 6px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.layout-section-head { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.layout-section { display: flex; align-items: center; gap: 9px; flex: 1; border: 1px solid transparent; background: none; color: var(--ink-2); text-align: left; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.layout-section:hover { background: var(--hover); }
.layout-section.on { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); color: var(--ink); }
.layout-section b, .layout-section small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-section b { font-size: 13px; font-weight: 650; }
.layout-section small { color: var(--muted); font-size: 10.5px; }
.layout-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }
.title-dot { background: var(--ink); }.opening-dot { background: #8a6d3b; }.main-dot { background: var(--green); }
.opening-list { padding: 0 8px 6px 28px; max-height: 150px; overflow-y: auto; }
.opening-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.opening-item:hover, .opening-item.on { background: var(--hover); color: var(--ink); }
.opening-item > span { width: 16px; color: var(--muted); font-size: 10px; }
.opening-item b { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.opening-item .acts { display: none; gap: 1px; }.opening-item:hover .acts, .opening-item.on .acts { display: flex; }
.opening-item button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 1px 3px; border-radius: 4px; }.opening-item button:hover { background: var(--line); color: var(--ink); }
.chapters-head { padding: 14px 14px 8px; display: flex; align-items: center; justify-content: space-between; }
.chapters-head b { font-size: 13px; font-weight: 600; color: var(--muted); }
.ch-list { overflow-y: auto; padding: 4px 8px 12px; flex: 1; }
.ch { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.ch:hover { background: var(--hover); }
.ch.on { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.ch .n { font-size: 11px; color: var(--muted); width: 18px; text-align: right; flex: 0 0 auto; }
.ch .t { flex: 1; min-width: 0; }
.ch .t b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch .t small { color: var(--muted); font-size: 11px; }
.ch .acts { display: none; gap: 2px; }
.ch:hover .acts, .ch.on .acts { display: flex; }
.ch .acts button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 5px; font-size: 13px; }
.ch .acts button:hover { background: var(--line); color: var(--ink); }
.goal { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.goal b { color: var(--ink); }
.editor-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: nowrap; }
.ready-banner { display: flex; gap: 10px; align-items: center; padding: 7px 14px; background: var(--gold-soft); border-bottom: 1px solid var(--gold-line); color: var(--ink-2); font-size: 12px; }
.ready-banner b { color: var(--gold-2); text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.tb { border: 1px solid transparent; background: none; border-radius: 7px; min-width: 32px; height: 30px; padding: 0 8px; cursor: pointer; color: var(--ink-2); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tb:hover { background: var(--paper-2); border-color: var(--line); }
.tb svg { width: 16px; height: 16px; }
.tb.ai { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }
.editor-scroll { flex: 1; overflow-y: auto; padding: 36px 24px 120px; }
.sheet { max-width: 720px; margin: 0 auto; }
.ch-title-input { width: 100%; border: 0; background: transparent; outline: none; font-family: var(--serif); font-weight: 450; font-size: 32px; letter-spacing: -.01em; text-align: center; color: var(--ink); margin-bottom: 26px; padding: 4px; }
.prose { outline: none; font-family: var(--serif); font-size: 18.5px; line-height: 1.8; font-variant-numeric: lining-nums; color: var(--ink); min-height: 50vh; caret-color: var(--gold-2); }
.prose p { margin: 0 0 .9em; }
.prose img { display: block; max-width: 100%; height: auto; margin: 1.1em auto; border-radius: 4px; }
.prose h3 { font-size: 21px; margin: 1.4em 0 .6em; font-weight: bold; }
.prose blockquote { margin: 1em 0; padding-left: 18px; border-left: 3px solid var(--gold); font-style: italic; color: var(--ink-2); }
.prose hr { border: 0; text-align: center; margin: 1.6em 0; }
.prose hr::after { content: "✦  ✦  ✦"; color: var(--gold); letter-spacing: .3em; }
.prose:empty::before { content: attr(data-placeholder); color: var(--muted); font-style: italic; }
.title-page-editor { flex: 1; overflow-y: auto; padding: 60px 24px; display: grid; place-items: start center; }
.title-page-card { width: min(560px, 100%); min-height: 560px; padding: 90px 40px 40px; display: grid; align-content: start; justify-items: center; gap: 16px; text-align: center; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.title-page-card h1 { font-size: 42px; font-weight: 450; margin-top: 90px; }.title-page-card p { font-family: var(--serif); font-size: 20px; font-style: italic; color: var(--muted); }.title-page-card .by { margin-top: 80px; text-transform: uppercase; letter-spacing: .12em; }.title-page-card small { color: var(--muted); margin-top: auto; }
.focus .side, .focus .chapters, .focus .toolbar, .focus .bookbar { display: none; }
.focus .body, .focus .write { grid-template-columns: 1fr; }
.statusbar { display: flex; gap: 16px; padding: 6px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--paper); }
.ai-dock { border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }


/* ── Check ─────────────────────────────────────────────────────────────── */
.score { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: 0 0 auto; }
.score b { font-family: var(--serif); font-weight: 450; font-size: 44px; line-height: 1; font-variant-numeric: lining-nums; }
.score span { position: absolute; bottom: 32px; font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.issue { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.issue:last-child { border-bottom: 0; }
.issue .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.issue .dot.high { background: var(--red); } .issue .dot.mid { background: #d97706; } .issue .dot.low { background: var(--gold); } .issue .dot.ok { background: var(--green); }
.issue b { display: block; font-size: 13.5px; }
.issue small { color: var(--muted); }
.issue .go { margin-left: auto; }
.review { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }

/* ── Cover ─────────────────────────────────────────────────────────────── */
.cover-stage { display: grid; grid-template-columns: 330px 1fr; gap: 24px; align-items: start; }
.cover-canvas-wrap { background: repeating-conic-gradient(var(--paper-2) 0 25%, var(--paper) 0 50%) 0 0 / 18px 18px; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; place-items: center; }
.cover-canvas-wrap canvas { width: 270px; height: 432px; border-radius: 4px; box-shadow: 0 16px 40px rgba(28, 25, 23, .3); }
.mock { perspective: 1200px; display: grid; place-items: center; padding: 30px; background: radial-gradient(ellipse at 50% 60%, var(--paper-2), var(--paper)); border-radius: 14px; border: 1px solid var(--line); }
.mock .bk { width: 180px; height: 288px; position: relative; transform-style: preserve-3d; transform: rotateY(-28deg) rotateX(4deg); }
.mock .bk .front { position: absolute; inset: 0; background-size: cover; background-position: center; border-radius: 2px 6px 6px 2px; box-shadow: 18px 22px 40px rgba(0, 0, 0, .35); }
.mock .bk .spine { position: absolute; top: 0; left: 0; width: 26px; height: 100%; transform: rotateY(90deg) translateZ(13px) translateX(-13px); transform-origin: left; background: linear-gradient(90deg, #00000055, #ffffff22, #00000033); }
.templates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tpl { border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: none; aspect-ratio: 2 / 3; }
.tpl.on { border-color: var(--gold); }
.tpl canvas { width: 100%; height: 100%; display: block; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 2px var(--gold); }

/* ── Plans ─────────────────────────────────────────────────────────────── */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.plan { padding: 24px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.plan.pop { border: 2px solid var(--gold); }
.plan.pop::before { content: "Most popular"; font-family: var(--sans); position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #1c1917; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 12px; border-radius: 99px; }
.plan.max { background: linear-gradient(160deg, #2a221a, #1c1917); color: #f2ede4; border-color: #3a3028; }
.plan.max h3, .plan.max .price b { color: var(--gold-light); }
.plan.max .muted, .plan.max li { color: #d6d3d1; }
.plan h3 { font-size: 22px; }
.plan .price b { font-family: var(--serif); font-weight: 450; font-size: 38px; font-variant-numeric: lining-nums; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.plan li::before { content: "✓"; color: var(--gold); font-weight: 800; margin-right: 8px; }
.plan li.no { opacity: .45; }
.plan li.no::before { content: "–"; color: var(--muted); }
.plan .btn { margin-top: auto; }

/* ── Publish ───────────────────────────────────────────────────────────── */
.pub-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.pub-card .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.pub-card ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: 13.5px; }
.export { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.export .ext { width: 44px; height: 52px; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--gold-2); flex: 0 0 auto; }
.export b { display: block; }
.export small { color: var(--muted); }
.export .btn { margin-left: auto; }

@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, 1fr); } }
.write.with-ai { grid-template-columns: 220px 1fr 340px; }
.lbl-short { display: none; }
.write.with-ai .lbl-long { display: none; }
.write.with-ai .lbl-short { display: inline; }
.write.with-ai .statusbar .hint { display: none; }
.statusbar span { white-space: nowrap; }
@media (max-width: 1200px) { .write.with-ai { grid-template-columns: 1fr 320px; } .write.with-ai .chapters { display: none; } }

.write.with-ai .tb .lbl { display: none; }

/* ── Novella "writing" animation ────────────────────────────────────────── */
/* New messages glide in. */
.m-user.new .bubble { animation: bubbleIn .42s cubic-bezier(.2, .9, .25, 1.15) both; transform-origin: 100% 100%; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(12px) scale(.94); } }
.m-ai.new { animation: rowIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }

/* Thinking: an orbiting gold ring round a breathing spark, shimmering status text, soft placeholder lines. */
.m-av { position: relative; }
.m-av.orbit::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 50%, rgba(197, 160, 89, .15) 65%, var(--gold) 92%, transparent 100%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); animation: rot 1s linear infinite; }
.m-av.orbit::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(circle, rgba(197, 160, 89, .28), transparent 65%); animation: halo 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes halo { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
.spark-live { animation: breathe 1.5s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes breathe { 0%, 100% { transform: scale(.82) rotate(0deg); } 50% { transform: scale(1.12) rotate(45deg); } }
.thinking-box { padding-top: 3px; max-width: 560px; }
.think-text { font: 500 14px/1.4 var(--sans); background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 38%, var(--gold-2) 48%, var(--gold-light) 50%, var(--gold-2) 52%, var(--muted) 62%, var(--muted) 100%); background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmerText 1.7s linear infinite, phraseIn .4s ease both; display: inline-block; }
@keyframes shimmerText { from { background-position: 100% 0; } to { background-position: -160% 0; } }
@keyframes phraseIn { from { opacity: 0; transform: translateY(5px); filter: blur(3px); } }
.skel { display: grid; gap: 9px; margin-top: 14px; }
.skel i { display: block; height: 9px; border-radius: 99px; background: linear-gradient(90deg, var(--line-2) 0%, var(--line-2) 35%, rgba(197, 160, 89, .4) 50%, var(--line-2) 65%, var(--line-2) 100%); background-size: 300% 100%; animation: sheen 1.5s ease-in-out infinite, skelIn .5s ease both; }
.skel i:nth-child(1) { width: 94%; }
.skel i:nth-child(2) { width: 81%; animation-delay: .12s, .08s; }
.skel i:nth-child(3) { width: 58%; animation-delay: .24s, .16s; }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes skelIn { from { opacity: 0; transform: scaleX(.6); transform-origin: left; } }

/* Typing: letters appear one by one; fresh ink glows gold, then dries to ink. A blinking gold cursor leads. */
.md .w { animation: inkDry 1.1s ease-out both; }
@keyframes inkDry {
  0% { color: var(--gold); text-shadow: 0 0 10px rgba(197, 160, 89, .55); }
  45% { color: var(--gold-2); text-shadow: 0 0 6px rgba(197, 160, 89, .25); }
  100% { color: var(--ink); text-shadow: none; }
}
.md li.li-in::marker { color: var(--gold-2); }
.md li.li-in { animation: liIn .45s ease both; }
@keyframes liIn { from { opacity: 0; transform: translateX(-6px); } }
.caret { display: inline-block; width: 2.5px; height: 1.08em; margin-left: 2px; border-radius: 2px; background: var(--gold); vertical-align: -0.16em; box-shadow: 0 0 8px rgba(197, 160, 89, .85), 0 0 2px rgba(197, 160, 89, .9); animation: blinkCaret 1s steps(1, end) infinite; }
@keyframes blinkCaret { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .15; } }
.stream.writing .caret { animation-duration: 1.1s; }
.stream.writing { cursor: pointer; }

/* Finished: the spark bursts, a gold flourish signs off the answer, actions fade in. */
.m-ai.is-writing .m-acts { opacity: 0 !important; pointer-events: none; }
.m-ai.just-done .m-acts { animation: actsIn .5s ease .25s both; opacity: 1; }
@keyframes actsIn { from { opacity: 0; transform: translateY(4px); } }
.m-ai.just-done .m-av { animation: burst 1s ease-out; }
@keyframes burst { 0% { box-shadow: 0 0 0 0 rgba(197, 160, 89, .6); } 100% { box-shadow: 0 0 0 16px rgba(197, 160, 89, 0); } }
.m-ai.just-done .m-av .spark { animation: twirl .9s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes twirl { 0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.35) rotate(90deg); } 100% { transform: scale(1) rotate(180deg); } }
.m-ai.just-done .stream::after { content: ""; display: block; height: 2px; margin-top: 12px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-light) 40%, transparent); transform-origin: left; animation: flourish 1.6s cubic-bezier(.25, .8, .25, 1) both; }
@keyframes flourish { 0% { transform: scaleX(0); opacity: 1; } 55% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.review-card .md { font-size: 15.5px; }
.sugg .md { font-size: 14.5px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .md .w, .md li.li-in, .m-user.new .bubble, .m-ai.new, .think-text, .skel i, .spark-live, .m-av.orbit::before, .m-av.orbit::after, .caret,
  .m-ai.just-done .m-av, .m-ai.just-done .m-av .spark, .m-ai.just-done .stream::after, .m-ai.just-done .m-acts { animation: none !important; }
  .think-text { color: var(--muted); background: none; }
}

/* ── AI editor bar (above the chapter) ─────────────────────────────────── */
.aibar { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--gold-soft), var(--paper) 140%); padding: 10px 14px 8px; display: grid; gap: 8px; }
.aibar-row { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--gold-line); border-radius: 14px; padding: 5px 6px 5px 12px; box-shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 4px 14px rgba(197, 160, 89, .12); transition: box-shadow .15s, border-color .15s; }
.aibar-row:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 160, 89, .16); }
.aibar-input { flex: 1; min-width: 120px; border: 0; outline: none; background: transparent; font-size: 14.5px; padding: 6px 2px; color: var(--ink); }
.aibar-input::placeholder { color: var(--muted); }
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; flex: 0 0 auto; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 500; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(28, 25, 23, .1); font-weight: 600; }
.seg button:disabled { opacity: .45; cursor: default; }
.aibar-cost { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.aibar-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: border-color .12s, background .12s; }
.ai-chip:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.aibar-job { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); padding: 2px 2px; }
.aibar-job .spin { color: var(--gold); }
.aibar-job-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.aibar-done { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px 5px 10px; animation: up .25s ease; }
.aibar-done .ok { width: 20px; height: 20px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex: 0 0 auto; }
.aibar-done .ok svg { width: 13px; height: 13px; }
.aibar-done-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.write.with-ai .seg button { padding: 5px 7px; font-size: 12px; }
.write.with-ai .aibar-cost { display: none; }
/* Text Novella just wrote glows gold for a moment. */
.prose .ai-new { animation: aiGlow 2.8s ease-out; border-radius: 4px; }
@keyframes aiGlow { 0% { background: rgba(197, 160, 89, .28); box-shadow: -10px 0 0 rgba(197, 160, 89, .28), 10px 0 0 rgba(197, 160, 89, .28); } 100% { background: transparent; box-shadow: -10px 0 0 transparent, 10px 0 0 transparent; } }
.cmp { margin-bottom: 16px; }
.cmp-title { display: block; margin-bottom: 8px; }
.cmp-box { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: var(--serif); font-size: 14.5px; line-height: 1.65; background: var(--paper); }
.cmp-box.new { border-color: var(--gold); background: var(--card); }
.cmp-box p { margin: 0 0 .7em; }

/* ── veeerbooks.in connector ─────────────────────────────────────────────── */
.vc { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden; border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), var(--card) 46%); }
.vc-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.vc-head .logo { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: #1c1917; color: #f5d997; font: 500 22px var(--serif); box-shadow: 0 6px 18px rgba(28, 25, 23, .18); flex: 0 0 auto; }
.vc-title { font: 500 19px var(--serif); color: var(--ink); }
.vc-tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: #1c1917; color: #f5d997; border: 1px solid var(--gold-line); }
.vc-conn { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
.vc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }
.vc-dot.on, .vc-listing.live .vc-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.vc-state { display: grid; gap: 12px; color: var(--ink-2); }
.vc-state p { margin: 0; max-width: 640px; }
.vc-checks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.vc-check { display: flex; gap: 9px; align-items: flex-start; text-align: left; padding: 10px 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: default; min-width: 0; animation: up .3s both; }
.vc-check:nth-child(2) { animation-delay: .04s; } .vc-check:nth-child(3) { animation-delay: .08s; } .vc-check:nth-child(4) { animation-delay: .12s; } .vc-check:nth-child(5) { animation-delay: .16s; }
.vc-check.no, .vc-check.warn { cursor: pointer; }
.vc-check.no:hover, .vc-check.warn:hover { border-color: var(--gold-line); background: var(--hover); }
.vc-check i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.vc-check.ok i { background: var(--green-soft); color: var(--green); }
.vc-check.warn i { background: var(--amber-soft); color: var(--amber); }
.vc-check.no i { background: var(--red-soft); color: var(--red); }
.vc-check span { display: grid; gap: 1px; min-width: 0; }
.vc-check b { font-size: 13px; }
.vc-check small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.vc-listing { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.vc-listing b { font-size: 14px; }
.vc-go { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.vc-main { box-shadow: 0 10px 26px rgba(197, 160, 89, .35); }
.vc-main:not(:disabled):hover { box-shadow: 0 14px 30px rgba(197, 160, 89, .45); }
.vc-mode { flex: 1; min-width: 220px; font-size: 13px; color: var(--muted); }
.vc-mode b { color: var(--ink-2); }
.vc-confirm { display: grid; gap: 10px; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--gold-soft); border: 1px solid var(--gold-line); font-size: 13.5px; color: var(--ink-2); }
.vc-confirm label { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.vc-confirm input { accent-color: var(--gold); margin-top: 3px; flex: 0 0 auto; }
.vc-run, .vc-done { text-align: center; display: grid; gap: 8px; justify-items: center; padding: 8px 4px; }
.vc-run p, .vc-done p { margin: 0; max-width: 440px; }
.vc-orb { width: 64px; height: 64px; border-radius: 50%; position: relative; background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 60%, var(--gold-2)); box-shadow: 0 0 0 0 rgba(197, 160, 89, .5); animation: burst 1.6s ease-out infinite; margin-bottom: 6px; }
.vc-orb span { position: absolute; inset: -8px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--gold); animation: rot 1.1s linear infinite; }
.vc-bar { width: 100%; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.vc-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-2), var(--gold), var(--gold-light)); background-size: 200% 100%; animation: sheen 1.4s linear infinite; transition: width .5s ease; }
.vc-stages { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 7px; width: 100%; max-width: 340px; text-align: left; }
.vc-stages li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); transition: color .2s; }
.vc-stages li i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line); background: var(--card); flex: 0 0 auto; }
.vc-stages li.now { color: var(--ink); font-weight: 600; }
.vc-stages li.now i { border-color: var(--gold); color: var(--gold-2); animation: burst 1.4s ease-out infinite; }
.vc-stages li.done { color: var(--ink-2); }
.vc-stages li.done i { background: var(--gold); border-color: var(--gold); color: #1c1917; }
.vc-badge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 700; background: var(--gold-soft); color: var(--gold-2); border: 2px solid var(--gold-line); animation: vcPop .55s cubic-bezier(.2,.9,.3,1.3) both; margin-bottom: 4px; }
@keyframes vcPop { 0% { transform: scale(.3); opacity: 0; } 65% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.vc-badge.live { background: #22c55e; color: #fff; border-color: #16a34a; box-shadow: 0 10px 28px rgba(34, 197, 94, .35); }
@media (max-width: 1100px) { .vc-checks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .vc-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Languages (onboarding grid, translate menu, right-to-left) ───────────── */
.onb-langs { display: grid; gap: 12px; max-height: 52vh; overflow: auto; padding-inline-end: 4px; }
.onb-lang-h { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 2px 0 6px; }
.onb-lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.choice.sm { padding: 8px 12px; min-height: 0; }
.choice.sm b { font-size: 14.5px; }
.choice.sm small { font-size: 11.5px; }
select.ai-chip.ai-translate { appearance: auto; padding-inline-end: 6px; cursor: pointer; font: inherit; font-size: 12.5px; }
[dir="rtl"] .side, [dir="rtl"] .aibar-row, [dir="rtl"] .bookbar { direction: rtl; }
[dir="rtl"] .prose { text-align: start; }

/* Tools */
.tools-promo { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; color: var(--gold-2); }
.tools-promo > div { flex: 1; display: grid; gap: 2px; color: var(--ink); }
.tools-promo small { color: var(--muted); }
.tools-group { padding: 0 2px 8px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tool-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; text-align: start; cursor: pointer; border: 1px solid var(--line); transition: border-color .12s, transform .12s, box-shadow .12s; }
.tool-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.tool-card.locked { opacity: .82; }
.tool-card .badge { margin-inline-start: auto; flex: none; }
.tool-txt { display: grid; gap: 4px; flex: 1; min-width: 0; }
.tool-txt b { font-size: 15px; }
.tool-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.tool-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); }
.tool-ic.big { width: 52px; height: 52px; border-radius: 14px; }
.tool-ic.big svg { width: 26px; height: 26px; }
.badge.gold { background: var(--gold-soft); color: var(--gold-2); }
.tools-promo > svg { width: 26px; height: 26px; flex: none; }

/* KDP Studio */
.mt-s { margin-top: 10px; }
.kdp-tabs { margin-bottom: 16px; }
.kdp-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; }
.kdp-tabs svg { width: 15px; height: 15px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.theme-card { display: grid; gap: 6px; text-align: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.theme-card.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 160, 89, .18); }
.theme-card small { font-size: 11.5px; line-height: 1.4; }
.theme-sample { display: grid; justify-items: center; gap: 3px; background: #fff; color: #111; border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 10px 8px; min-height: 104px; font-family: Georgia, serif; overflow: hidden; }
.theme-sample i { font-style: normal; font-size: 10px; letter-spacing: .3em; color: #666; }
.theme-sample b { font-weight: normal; font-size: 14px; }
.theme-sample span { font-size: 8.5px; line-height: 1.45; text-align: justify; color: #333; }
.ts-elegant { font-family: "Palatino Linotype", Palatino, Georgia, serif; } .ts-elegant i { color: #8a6d3b; } .ts-elegant b { font-style: italic; }
.ts-elegant span::first-letter { float: left; font-size: 2.6em; line-height: .8; padding-right: 2px; color: #6b4f24; }
.ts-modern i { font: 800 22px "Segoe UI", Arial, sans-serif; color: #222; letter-spacing: 0; line-height: 1; } .ts-modern b { font: 700 11px "Segoe UI", Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.ts-clean { justify-items: start; font-family: "Segoe UI", Arial, sans-serif; } .ts-clean i { color: #8a6d3b; font-weight: 700; letter-spacing: .15em; } .ts-clean b { font-weight: 700; border-bottom: 2px solid #222; width: 100%; } .ts-clean span { text-align: left; }
.pv-wrap { display: grid; gap: 10px; margin-top: 14px; }
.pv-stage { position: relative; display: grid; place-items: center; min-height: 440px; background: var(--paper-2); border-radius: 12px; padding: 20px; overflow: auto; }
.pv-spread { display: flex; gap: 2px; transition: opacity .15s; } .pv-spread.dim { opacity: .55; }
.pv-page { max-height: 560px; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.pv-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); gap: 8px; }
.pv-nav { justify-content: space-between; align-items: center; }
.device { padding: 18px 14px 14px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; }
.dev-kindle { border-radius: 14px; padding: 22px 18px 40px; }
.device iframe { border: 0; display: block; }
.dev-foot { font-size: 11px; color: #777; text-align: end; padding: 4px 10px 6px; height: 0; overflow: visible; position: relative; top: -22px; background: transparent !important; }
.roy-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.roy-table th, .roy-table td { text-align: start; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.roy-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.roy-table tr:last-child td { border-bottom: 0; }
.roy-table b { font-size: 16px; } .roy-table b.neg { color: var(--red); }
.roy-tip { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.aplus { align-items: start; }
.aplus-stage { display: grid; place-items: center; background: var(--paper-2); }
.aplus-canvas { max-width: 100%; height: auto; box-shadow: 0 6px 24px rgba(0,0,0,.18); border-radius: 4px; }
.swatch { width: 34px; height: 34px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--card) inset; }
.also-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }

/* VSB Novella logo lockup: "VSB" in the logo font + the novella wordmark */
.mark { display: inline-flex; align-items: flex-end; gap: .28em; line-height: 1; color: var(--ink); }
.mark-vsb { font-family: 'ScribeMark', var(--sans); font-weight: 800; letter-spacing: -.04em; font-size: 1em; }
.mark-wm { height: 1.12em; width: auto; display: block; }
.wm-light { display: none; }
:root[data-theme="dark"] .wm-dark { display: none; } :root[data-theme="dark"] .wm-light { display: block; }
.boot .mark { font-size: 34px; } .boot img.mark-wm { width: auto; height: 1.3em; animation: none; }
.topbar .brand .mark { font-size: 15px; align-items: center; } .topbar .brand img.mark-wm { width: auto; height: 19px; background: none; padding: 0; border-radius: 0; }
:root[data-theme="dark"] .topbar .brand > img { box-shadow: 0 0 0 1px rgba(255,255,255,.22); }

/* Chat history in the sidebar */
.recents.chats { flex: 0 1 auto; max-height: 46vh; }
.chat-item { display: flex; align-items: center; gap: 4px; }
.chat-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-t small { color: var(--muted); }
.chat-acts { display: none; gap: 2px; flex: none; }
.chat-item:hover .chat-acts { display: flex; }
.chat-acts button { border: 0; background: none; padding: 2px; border-radius: 5px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.chat-acts button:hover { background: var(--line-2); color: var(--ink); }
.chat-acts svg { width: 13px; height: 13px; }
.chat-rename { margin: 1px 4px; padding: 5px 8px; font-size: 13.5px; border: 1px solid var(--gold); border-radius: 8px; background: var(--card); outline: none; }
.recent.more { color: var(--muted); font-size: 12.5px; }
.chat-name { color: var(--muted); font-weight: 400; }

/* Novella AI replies: tables, charts, code */
.md-table-wrap { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.md-table th { text-align: start; background: var(--paper-2); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.md-code { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font-size: 13px; white-space: pre-wrap; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md-chart { margin: 12px 0 16px; padding: 14px 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.md-chart.wait { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.md-chart figcaption { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.md-chart svg { width: 100%; height: auto; display: block; }
.md-chart .grid { stroke: var(--line-2); stroke-width: 1; }
.md-chart .base { stroke: var(--line); stroke-width: 1.5; }
.md-chart .ax { fill: var(--muted); font-size: 11px; font-family: inherit; }
.md-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.md-legend.col { flex-direction: column; justify-content: center; }
.md-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.md-legend small { color: var(--muted); }
.md-pie { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 16px; align-items: center; }
@media (max-width: 560px) { .md-pie { grid-template-columns: 1fr; } }
.md-table th.num { text-align: end; }

/* Voice typing */
.vt-mic svg { width: 18px; height: 18px; }
.vt-rec { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 2px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--line); }
.vt-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; animation: vtPulse 1.2s ease-in-out infinite; }
.vt-wave { display: flex; align-items: center; gap: 2px; height: 24px; }
.vt-wave i { display: block; width: 3px; border-radius: 2px; background: var(--ink-2); transition: height .08s linear; }
.vt-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 32px; }
.vt-done { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--ink); color: var(--card); display: grid; place-items: center; cursor: pointer; }
.vt-done svg { width: 17px; height: 17px; }
.vt-busy { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.vt-err { font-size: 12px; color: var(--red); max-width: 260px; }
@keyframes vtPulse { 50% { opacity: .35; } }

/* KDP Marketing Studio (Max tool) */
.tool-card.tool-max { background: linear-gradient(135deg, var(--gold-soft), transparent 70%); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mk-tile { position: relative; display: grid; gap: 4px; align-content: start; text-align: start; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card, #fff); cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; font: inherit; color: inherit; }
.mk-tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.mk-tile.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); background: linear-gradient(160deg, var(--gold-soft), transparent 80%); }
.mk-emoji { font-size: 24px; line-height: 1; margin-bottom: 4px; }
.mk-tag { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }
.mk-tile b { font-size: 14.5px; }
.mk-tile small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.mk-done { position: absolute; top: 10px; inset-inline-end: 10px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--green, #16a34a); color: #fff; }
.mk-hint { text-align: center; margin: 6px 0 0; }
.mk-sections { display: grid; gap: 12px; }
.mk-sec { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mk-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mk-sec-head b { font-family: var(--serif); font-size: 16px; font-weight: normal; }

/* ── Writing studio refresh ─────────────────────────────────────────────── */
/* Side panel: one scrolling column, sections sit at the top (they used to stretch to fill the height). */
.chapters { min-width: 0; }
.layout-nav-title { padding: 14px 16px 6px; }
.layout-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.layout-scroll > .layout-section, .layout-section-head { flex: 0 0 auto; padding-right: 0; }
.layout-section { flex: 1 1 auto; width: 100%; min-width: 0; }
.layout-section > span:last-child { min-width: 0; }
.layout-section small { font-size: 11.5px; }
.layout-section b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.layout-section .count { font-style: normal; font-weight: 600; font-size: 11px; color: var(--muted); background: var(--active); border-radius: 99px; padding: 0 7px; line-height: 17px; }
.opening-list { padding: 2px 0 8px 22px; max-height: none; overflow: visible; }
.opening-item { padding: 6px 8px; font-size: 13px; }
.ch-list { padding: 2px 0 8px 0; flex: 0 0 auto; overflow: visible; }
.ch { padding: 8px 8px 8px 10px; }
.ch .t b { font-size: 13.5px; }
.ch .t small { font-size: 11.5px; }
.ch .acts button, .opening-item button { font-size: 14px; min-width: 22px; min-height: 22px; }
.ch:focus-visible, .layout-section:focus-visible, .add-row:focus-visible, .tb:focus-visible, .tb-style:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.add-row { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; padding: 7px 10px; border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.add-row svg { width: 14px; height: 14px; }
.add-row:hover { border-color: var(--gold); color: var(--ink); background: var(--gold-soft); }
.goal { padding: 12px 16px 14px; }

/* Toolbar: grouped, labelled, with visible "on" states. */
.toolbar { gap: 2px; padding: 7px 16px; flex-wrap: wrap; row-gap: 4px; min-height: 46px; }
.tb { min-width: 34px; height: 32px; }
.tb.on { background: var(--active); border-color: var(--line); color: var(--ink); }
.tb.ai { color: var(--gold-2); }
.tb.ai.on { background: var(--gold-soft); border-color: var(--gold-line); }
.tb .tb-lbl { font-size: 12.5px; font-weight: 500; }
.tb-style { height: 32px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 0 28px 0 10px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.tb-style:disabled { opacity: .5; cursor: default; }
.toolbar .sep { margin: 0 6px; }
@media (max-width: 1280px) { .tb .tb-lbl { display: none; } }

/* Writing page */
.editor-scroll { padding: 40px 28px 140px; }
.sheet { max-width: 700px; }
.ch-title-input { font-size: 30px; margin-bottom: 22px; }
.ch-title-input::placeholder { color: var(--muted); opacity: .55; font-style: italic; }
.prose { font-size: 19px; line-height: 1.85; }
.prose ul { margin: 0 0 .9em 1.2em; padding: 0; }
.prose li { margin: .15em 0; }
.prose ::selection, .ch-title-input::selection { background: rgba(197, 160, 89, .32); }

/* Status bar */
.statusbar { gap: 18px; padding: 7px 16px; flex-wrap: wrap; row-gap: 2px; }

/* AI edit bar: sits under the writing, chips stay on one scrollable line. */
.aibar { border-bottom: 0; border-top: 1px solid var(--gold-line); padding: 9px 14px 8px; }
.aibar-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.aibar-chips > * { flex: 0 0 auto; }

/* Focus mode: a clear way out. */
.focus-exit { position: absolute; top: 12px; right: 16px; z-index: 5; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); opacity: .35; transition: opacity .2s; }
.focus-exit svg { width: 15px; height: 15px; }
.editor-wrap { position: relative; }
.focus .editor-wrap:hover .focus-exit, .focus-exit:focus-visible { opacity: 1; }
.focus .editor-scroll { padding-top: 64px; }
@media (prefers-reduced-motion: reduce) { .focus-exit { transition: none; } }

/* Narrow windows and the Novella AI side panel */
.editor-wrap { overflow: hidden; }
.aibar-row { flex-wrap: wrap; row-gap: 6px; }
.aibar-input { flex: 1 1 160px; min-width: 0; }
.write.with-ai .tb-style { width: 118px; padding-left: 8px; padding-right: 22px; }
.write.with-ai .toolbar { padding: 7px 10px; }
.write.with-ai .toolbar .sep { margin: 0 2px; }
.write.with-ai .tb { min-width: 30px; padding: 0 6px; }
.bookbar .tabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bookbar .tabs::-webkit-scrollbar { display: none; }
.bookbar .tab { flex: 0 0 auto; }
.bb-save { white-space: nowrap; flex: 0 0 auto; }
.focus .aibar-chips, .focus .aibar-cost { display: none; }
.tb-note{padding:0 4px}
.write.with-ai .tb-style { width: 134px; }
@media (max-width: 1120px) { .bb-book b { display: none; } .bookbar .tab { padding: 0 9px; } }
@media (max-width: 1240px) { .write.with-ai .tb-focus { display: none; } }

/* Writing flow: templates, chapter end, status toggles, front-page menu */
.start-panel { margin: 28px auto 0; padding: 26px 26px 22px; max-width: 640px; border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: 16px; text-align: center; }
.start-panel h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.start-panel p { margin: 0 0 18px; font-size: 14px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; text-align: left; }
.outline-card { display: grid; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; cursor: pointer; text-align: left; color: var(--ink); }
.outline-card:hover, .outline-card:focus-visible { border-color: var(--gold); box-shadow: var(--shadow); outline: none; }
.outline-card b { font-size: 14px; }
.outline-card span { font-size: 12px; color: var(--gold-2); font-weight: 600; }
.outline-card small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.chapter-end { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 48px 0 0; padding-top: 22px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.sb-toggles { display: inline-flex; gap: 6px; }
.sb-toggle { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 99px; padding: 1px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.sb-toggle:hover { color: var(--ink); border-color: var(--gold-line); }
.sb-toggle.on { background: var(--gold-soft); color: var(--gold-2); border-color: var(--gold-line); }
.front-menu { display: grid; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; box-shadow: var(--shadow); }
.front-menu button { border: 0; background: none; text-align: left; padding: 8px 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.front-menu button:hover, .front-menu button:focus-visible { background: var(--gold-soft); color: var(--ink); outline: none; }
.statusbar .hint { margin-left: 4px; }
.start-panel + .prose { min-height: 22vh; }
.tpl-grid { align-items: start; grid-auto-rows: min-content; }
.outline-card { align-content: start; height: auto; min-height: 0; line-height: 1.35; }
.outline-card b, .outline-card span, .outline-card small { display: block; }

/* AI cover art */
.ai-cover{display:grid;gap:8px;padding:12px;border:1px solid var(--line,#e7e0d4);border-radius:12px;background:var(--panel2,rgba(197,160,89,.07))}
.ai-cover textarea{resize:vertical;min-height:64px}
.ai-cover-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.ai-cover-pick{padding:0;border:2px solid transparent;border-radius:8px;overflow:hidden;cursor:pointer;background:none;aspect-ratio:2/3}
.ai-cover-pick:hover,.ai-cover-pick:focus-visible{border-color:var(--gold,#c5a059)}
.ai-cover-pick img{width:100%;height:100%;object-fit:cover;display:block}
.ai-cover b{display:flex;align-items:center;gap:6px}
.ai-cover b svg{width:16px;height:16px;flex:none}
.ai-cover-grid{grid-template-columns:repeat(2,minmax(0,130px))}
/* AI illustrations */
.illo-preview{display:flex;justify-content:center;padding:10px;border:1px solid var(--line);border-radius:12px;background:var(--bg2,rgba(0,0,0,.03))}
.illo-preview img{max-width:100%;max-height:300px;border-radius:6px;display:block}
.modal h2 svg{width:22px;height:22px;vertical-align:-3px}
.upd-list{margin:10px 0 14px;padding-left:20px;display:grid;gap:8px;line-height:1.45}

/* Calmer writing screen: less on screen until you need it */
.fold-btn { border: 0; background: none; color: var(--muted); cursor: pointer; width: 24px; height: 24px; border-radius: 6px; font-size: 13px; flex: none; }
.fold-btn:hover { background: var(--hover); color: var(--ink); }
.layout-scroll { gap: 2px; }
.layout-scroll > .layout-section-head { margin-top: 6px; }
.layout-section small { display: none; }
.layout-section { padding: 8px 10px; }
.ch .t small { display: none; }
.ch { padding: 9px 8px 9px 10px; }
.ch.on .t small { display: block; }
.goal { padding: 10px 16px 12px; }
.ready-banner { padding: 4px 14px; font-size: 11.5px; justify-content: space-between; background: transparent; border-bottom: 1px solid var(--line); color: var(--muted); }
.toolbar { padding: 6px 16px; min-height: 42px; border-bottom-color: transparent; background: transparent; }
.toolbar .sep { opacity: .5; }
.editor-scroll { padding: 56px 32px 140px; }
.sheet { max-width: 680px; }
.prose { line-height: 1.95; }
/* AI bar: just the box until you click into it */
.aibar { padding: 8px 16px 10px; gap: 8px; background: var(--paper); border-top: 1px solid var(--line); }
.aibar:not(.open) .aibar-row .seg, .aibar:not(.open) .aibar-cost, .aibar:not(.open) .aibar-chips { display: none; }
.aibar-row { box-shadow: none; border-color: var(--line); }
.aibar.open .aibar-row { border-color: var(--gold-line); }
.aibar-chips { overflow-x: auto; scrollbar-width: none; }
.aibar-chips::-webkit-scrollbar { display: none; }
.aibar-done { padding: 3px 6px 3px 10px; font-size: 12.5px; box-shadow: none; }
.statusbar { padding: 6px 18px; gap: 16px; border-top: 1px solid var(--line); }
.statusbar .sb-toggle { opacity: .7; }
.statusbar .sb-toggle.on { opacity: 1; }

/* Title page: publisher + logo */
.title-page-editor { display: grid; gap: 18px; align-content: start; justify-items: center; }
.title-page-card { min-height: 520px; align-content: start; }
.title-page-card .by { margin-top: 50px; }
.tp-pub { margin-top: auto; display: grid; justify-items: center; gap: 8px; padding-top: 30px; }
.tp-logo { width: auto; object-fit: contain; display: block; } .tp-logo.small { height: 36px; } .tp-logo.medium { height: 56px; } .tp-logo.large { height: 80px; }
.tp-pub-name { font: 600 11px var(--sans, inherit); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.tp-pub-empty { font-size: 12px; color: var(--muted); opacity: .6; }
.tp-panel { width: min(560px, 100%); }
.title-page-editor { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 36px 24px 60px; }
.title-page-card, .tp-panel { flex: none; }
.title-page-card { width: min(560px, 100%); min-height: 0; padding: 56px 40px 36px; gap: 12px; }
.title-page-card h1 { margin-top: 40px; }
.title-page-card .by { margin-top: 40px; }
.tp-pub { min-height: 70px; align-content: end; }

/* cover studio: format picker, tabs, wide print preview */
.cf-title{font-weight:600;margin:0 0 8px}
.cf-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:16px}
.cf-card{display:grid;gap:4px;text-align:left;padding:12px 14px;border:2px solid var(--line,#e7e0d4);border-radius:12px;background:none;cursor:pointer;color:inherit;font:inherit}
.cf-card b{font-size:15px}
.cf-card span{font-size:12px;opacity:.7;line-height:1.35}
.cf-card.on{border-color:var(--gold,#c5a059);background:rgba(197,160,89,.1)}
.cv-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--line,#e7e0d4);padding-bottom:10px}
.cv-tab{border:0;background:none;padding:6px 12px;border-radius:999px;cursor:pointer;color:inherit;font:inherit;font-size:13px}
.cv-tab.on{background:var(--gold,#c5a059);color:#1c1917;font-weight:600}
.cover-stage.print{grid-template-columns:1fr}
.cover-canvas-wrap canvas.wrap{width:100%;max-width:760px;height:auto}
.cv-legend{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:10px;font-size:13px}
@media (max-width:700px){.cf-cards{grid-template-columns:1fr}}

/* ───────────── Novella 1.8: calmer layout, motion, pictures and writing tools ───────────── */
/* Motion: one easing everywhere, gentle and quick. Screens fade up when you switch. */
:root { --ease: cubic-bezier(.2, .8, .2, 1); }
.screen-in { animation: screenIn .28s var(--ease) backwards; }
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } }
.btn:active:not(:disabled), .tb:active, .chip:active, .cf-card:active, .lt-card:active { transform: scale(.97); }
.tb, .chip, .nav, .recent, .tab, .c-icon, .sb-toggle { transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.tab { position: relative; border-bottom-color: transparent !important; }
.tab::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab.on::after { transform: scaleX(1); }
.modal { animation: modalIn .22s var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast { animation: toastIn .3s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.card { transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease); }
.book-card, .outline-card, .cf-card, .bible-card { transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.book-card:hover, .outline-card:hover, .cf-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(28, 25, 23, .10); }
.bb-save.saving::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: savePulse 1s ease-in-out infinite; }
@keyframes savePulse { 50% { transform: scale(.55); opacity: .45; } }
.bb-save.saved svg { animation: savedPop .35s var(--ease); }
@keyframes savedPop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } }
.meter > i { transition: width .6s var(--ease); }
.ch { transition: background .15s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.chip { cursor: default; }
button.chip { cursor: pointer; color: var(--ink-2); font: inherit; font-size: 12.5px; }
button.chip:hover { border-color: var(--gold-line); }
button.chip.on { background: var(--ink); color: #fdfbf7; border-color: var(--ink); }
:root[data-theme="dark"] button.chip.on { background: var(--gold); color: #1c1917; border-color: var(--gold); }

/* Confetti for goals and sprints */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: confetti 1.5s cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes confetti { 0% { transform: translate(-50%, -50%) rotate(0); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 260px)) rotate(var(--r)); opacity: 0; } }

/* Write: right panel (notes, story bible, versions) */
.write.with-panel { grid-template-columns: 250px 1fr 330px; }
.write-panel { border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; animation: panelIn .28s var(--ease) backwards; }
@keyframes panelIn { from { opacity: 0; transform: translateX(14px); } }
.wp-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px 12px; border-bottom: 1px solid var(--line); }
.wp-tabs { display: flex; gap: 2px; flex: 1; background: var(--paper-2); padding: 3px; border-radius: 10px; }
.wp-tab { flex: 1; border: 0; background: none; padding: 6px 8px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.wp-tab.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(28, 25, 23, .12); }
.wp-body { flex: 1; overflow-y: auto; padding: 14px; animation: screenIn .22s var(--ease) backwards; }
.wp-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wp-empty { display: grid; justify-items: center; gap: 8px; padding: 26px 10px; color: var(--muted); text-align: center; font-size: 13px; border: 1px dashed var(--line); border-radius: 12px; }
.wp-empty svg { width: 26px; height: 26px; color: var(--gold); }
.status-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.status-chip i, .st-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.status-chip.on { border-color: var(--ink); background: var(--paper-2); font-weight: 600; }
.status-bar .st-idea, .status-chip.st-idea i, .st-dot.st-idea { background: #a8a29e; }
.status-bar .st-draft, .status-chip.st-draft i, .st-dot.st-draft { background: #d6b46a; }
.status-bar .st-revised, .status-chip.st-revised i, .st-dot.st-revised { background: #6b8fb5; }
.status-bar .st-final, .status-chip.st-final i, .st-dot.st-final { background: #3f8f5a; }
.write.with-panel .tb-lbl, .write.with-panel .tb.ai .lbl { display: none; }
.write.with-panel .toolbar { flex-wrap: nowrap; }
.ch .t b .st-dot { margin-right: 6px; vertical-align: 1px; }
.status-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; gap: 2px; margin-top: 6px; background: var(--line-2); }
.status-bar i { transition: flex .4s var(--ease); }
.wp-progress { padding: 10px 12px; border-radius: 12px; background: var(--paper-2); }
.bible-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; background: var(--card); animation: screenIn .25s var(--ease) both; }
.bible-card:hover { border-color: var(--gold-line); }
.bible-card p { margin: 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bible-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--paper-2); color: var(--muted); }
.bible-kind.k-character { background: #fbefe2; color: #a0581d; } .bible-kind.k-place { background: #e7f1ea; color: #2f6b45; } .bible-kind.k-thing { background: #e8eef7; color: #3c5f8a; }
:root[data-theme="dark"] .bible-kind { background: #2a2621; color: var(--gold-light); }
.ver-list { display: grid; gap: 6px; }
.ver { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; animation: screenIn .25s var(--ease) both; }
.ver.locked { opacity: .55; filter: saturate(.4); }
.ver.locked svg { width: 15px; height: 15px; color: var(--muted); }
.ver-main { flex: 1; min-width: 0; display: grid; }
.ver-main b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-main small { font-size: 11.5px; color: var(--muted); }
.ver-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.ver-dot.k-manual { background: var(--gold); } .ver-dot.k-restore { background: #6b8fb5; } .ver-dot.k-auto { background: #a8a29e; }
.ver-diff { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-top: 12px; font-family: var(--serif); font-size: 15px; line-height: 1.6; }
.ver-diff p { margin: 0 0 .6em; padding: 2px 6px; border-radius: 6px; }
.ver-diff .d-del { background: #fdecea; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, .4); color: #7f1d1d; }
.ver-diff .d-add { background: #e9f7ee; color: #14532d; }
:root[data-theme="dark"] .ver-diff .d-del { background: #3a1f1f; color: #fca5a5; } :root[data-theme="dark"] .ver-diff .d-add { background: #1c3324; color: #86efac; }
.d-key { display: inline-block; padding: 0 6px; border-radius: 4px; margin-left: 6px; }
.d-key.del { background: #fdecea; color: #7f1d1d; } .d-key.add { background: #e9f7ee; color: #14532d; }
.ver-text { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; margin-top: 12px; min-height: 0 !important; font-size: 16px !important; }
.upsell { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--ink); }
.upsell svg { width: 18px; height: 18px; color: var(--gold-2); flex: none; }
.upsell span { display: grid; } .upsell small { color: var(--muted); font-size: 12px; }
:root[data-theme="dark"] .upsell { background: #2a2418; }

/* Find & replace */
.find-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--card); animation: barIn .2s var(--ease) both; }
@keyframes barIn { from { opacity: 0; transform: translateY(-6px); } }
.find-bar .input { width: 180px; padding: 5px 10px; font-size: 13px; }
.find-count { min-width: 64px; }
.find-opt { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); cursor: pointer; }

/* Streak, sprint, sounds */
.streak { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 3px 10px 3px 6px; border-radius: 99px; background: var(--gold-soft); color: var(--gold-2); font-weight: 700; font-size: 12px; animation: screenIn .3s var(--ease) both; }
:root[data-theme="dark"] .streak { background: #2a2418; color: var(--gold-light); }
.streak .flame { display: inline-block; animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.12); } }
.sprint-wrap { position: relative; display: inline-flex; }
.sb-menu { position: absolute; bottom: calc(100% + 8px); right: 0; width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(28, 25, 23, .18); padding: 12px; display: grid; gap: 2px; z-index: 30; color: var(--ink); animation: modalIn .2s var(--ease) both; white-space: normal; }
.sprint-on { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sprint-on span { color: var(--green); font-weight: 700; }
.sprint-ring { width: 16px; height: 16px; transform: rotate(-90deg); }
.sprint-ring circle { fill: none; stroke: var(--line); stroke-width: 3; }
.sprint-ring circle.v { stroke: var(--gold); stroke-dasharray: 50.27; transition: stroke-dashoffset 1s linear; }
.sound-list { display: grid; gap: 4px; margin-top: 6px; }
.sound { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: none; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.sound:hover { border-color: var(--gold-line); }
.sound.on { border-color: var(--gold); background: var(--gold-soft); }
.sound svg { width: 14px; height: 14px; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; margin-right: 5px; }
.eq i { width: 2px; background: currentColor; border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* Pictures in the editor (same layouts as the printed book) */
.sheet { position: relative; }
.prose img { cursor: pointer; transition: box-shadow .2s var(--ease), outline-color .2s; outline: 2px solid transparent; outline-offset: 3px; }
.prose img:hover { outline-color: var(--gold-line); }
.prose img.illo-center { width: 70%; } .prose img.illo-full { width: 100%; } .prose img.illo-small { width: 40%; }
.prose img.illo-left { float: left; width: 45%; margin: .3em 1.2em .6em 0; }
.prose img.illo-right { float: right; width: 45%; margin: .3em 0 .6em 1.2em; }
.prose img.illo-header { width: 100%; max-height: 280px; object-fit: cover; border-radius: 8px; }
.prose img.illo-page { width: 100%; max-height: 80vh; object-fit: contain; border: 1px dashed var(--line); padding: 10px; border-radius: 8px; }
.prose p.illo-cap { text-align: center; font-style: italic; font-size: 15px; color: var(--muted); margin: -.4em 0 1.1em; }
/* Wrap layouts: the picture and its caption float together and the text flows beside them. */
.prose p:has(> img.illo-left) { float: left; clear: left; width: 45%; margin: .3em 1.4em .2em 0; }
.prose p:has(> img.illo-right) { float: right; clear: right; width: 45%; margin: .3em 0 .2em 1.4em; }
.prose p:has(> img.illo-left) > img, .prose p:has(> img.illo-right) > img { float: none; width: 100%; margin: 0; }
.prose p:has(> img.illo-left) + p.illo-cap { float: left; clear: left; width: 45%; margin: .4em 1.4em .8em 0; }
.prose p:has(> img.illo-right) + p.illo-cap { float: right; clear: right; width: 45%; margin: .4em 0 .8em 1.4em; }
.prose h3, .prose hr { clear: both; }
.pic-bar { position: absolute; z-index: 20; display: flex; align-items: center; gap: 2px; background: var(--ink); color: #fdfbf7; padding: 4px; border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); animation: barIn .18s var(--ease) both; }
.pic-bar button { border: 0; background: none; color: inherit; border-radius: 8px; padding: 5px 6px; cursor: pointer; display: inline-flex; align-items: center; font: inherit; font-size: 12px; }
.pic-bar button:hover { background: rgba(255, 255, 255, .12); }
.pic-bar button.on { background: var(--gold); color: #1c1917; }
.pic-bar button svg { width: 15px; height: 15px; }
.pic-bar .txt { padding: 5px 9px; font-weight: 600; }
.pic-bar .sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .2); margin: 0 3px; }
.pic-bar .lt { width: 18px; height: 22px; padding: 2px; gap: 1.5px; background: rgba(255, 255, 255, .9); }
:root[data-theme="dark"] .pic-bar { background: #f2ede4; color: #1c1917; }
/* Layout thumbnails */
.lt { display: grid; grid-auto-rows: min-content; align-content: center; gap: 2px; width: 44px; height: 54px; padding: 5px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); position: relative; overflow: hidden; }
.lt-line { display: block; height: 2px; border-radius: 1px; background: #d6d0c4; }
.lt-pic { display: block; background: linear-gradient(135deg, var(--gold), #e8cf94); border-radius: 2px; height: 12px; margin: 1px auto; width: 70%; }
.lt-full .lt-pic { width: 100%; } .lt-small .lt-pic { width: 40%; height: 9px; }
.lt-header { align-content: start; } .lt-header .lt-pic { width: 100%; height: 14px; margin-top: 0; }
.lt-page { display: block; } .lt-page .lt-pic { width: 100%; height: 100%; margin: 0; }
.lt-left .lt-pic, .lt-right .lt-pic { position: absolute; top: 6px; width: 45%; height: 16px; margin: 0; }
.lt-left .lt-pic { left: 5px; } .lt-right .lt-pic { right: 5px; }
.lt-left .lt-line:nth-child(-n+5), .lt-right .lt-line:nth-child(-n+5) { width: 45%; }
.lt-left .lt-line:nth-child(-n+5) { margin-left: auto; }
.lt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lt-card { display: grid; justify-items: center; gap: 4px; border: 2px solid var(--line); border-radius: 12px; padding: 8px 4px 6px; background: none; cursor: pointer; font: inherit; font-size: 11.5px; color: var(--ink-2); transition: border-color .15s var(--ease), background .15s var(--ease), transform .12s var(--ease); }
.lt-card:hover { border-color: var(--gold-line); }
.lt-card.on { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); font-weight: 600; }
.lt-card.on .lt-pic { animation: ltPulse .5s var(--ease); }
@keyframes ltPulse { 0% { transform: scale(.7); } 70% { transform: scale(1.08); } }
:root[data-theme="dark"] .lt-card.on { background: #2a2418; }
/* Picture dialog */
.pic-drop { display: grid; justify-items: center; gap: 6px; padding: 34px 16px; border: 2px dashed var(--line); border-radius: 16px; cursor: pointer; text-align: center; transition: border-color .2s var(--ease), background .2s var(--ease); }
.pic-drop svg { width: 30px; height: 30px; color: var(--gold); transition: transform .3s var(--ease); }
.pic-drop:hover, .pic-drop.on { border-color: var(--gold); background: var(--gold-soft); }
.pic-drop:hover svg, .pic-drop.on svg { transform: translateY(-4px); }
:root[data-theme="dark"] .pic-drop:hover, :root[data-theme="dark"] .pic-drop.on { background: #2a2418; }
.pic-ai { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .2s var(--ease), transform .2s var(--ease); }
.pic-ai:hover { border-color: var(--gold-line); transform: translateY(-1px); }
.pic-ai > svg { width: 20px; height: 20px; color: var(--gold-2); flex: none; }
.pic-ai span { display: grid; flex: 1; } .pic-ai small { color: var(--muted); font-size: 12.5px; }
.pic-ai .chev { width: 16px; height: 16px; transform: rotate(-90deg); color: var(--muted); }
.pic-step { display: grid; grid-template-columns: 250px 1fr; gap: 18px; margin-top: 12px; }
.pic-stage { background: repeating-conic-gradient(var(--paper-2) 0 25%, var(--paper) 0 50%) 0 0 / 16px 16px; border-radius: 14px; padding: 14px; display: grid; place-items: center; }
.pic-page { width: 200px; height: 300px; background: #fffdf8; border-radius: 3px; box-shadow: 0 10px 26px rgba(28, 25, 23, .18); padding: 18px 16px; overflow: hidden; display: block; }
.pic-page .pp-line { display: block; height: 3px; border-radius: 2px; background: #e3ddd1; margin: 0 0 6px; }
.pic-page img { display: block; margin: 6px auto 8px; max-width: 100%; border-radius: 2px; transition: width .3s var(--ease); }
.pic-page img.illo-center { width: 70%; } .pic-page img.illo-full { width: 100%; } .pic-page img.illo-small { width: 40%; }
.pic-page img.illo-left { float: left; width: 46%; margin: 2px 8px 4px 0; } .pic-page img.illo-right { float: right; width: 46%; margin: 2px 0 4px 8px; }
.pic-page img.illo-header { width: 100%; height: 70px; object-fit: cover; margin-top: 0; }
.lt-page .pic-page, .pic-stage.lt-page .pic-page { padding: 14px; display: grid; place-items: center; }
.pic-stage.lt-page .pic-page img { width: 100%; max-height: 100%; object-fit: contain; margin: 0; }
.pic-page .pp-line { overflow: hidden; }
.pp-fig { display: block; }
.pp-fig.illo-left { float: left; width: 46%; margin: 2px 8px 4px 0; } .pp-fig.illo-right { float: right; width: 46%; margin: 2px 0 4px 8px; }
.pp-fig.illo-left img, .pp-fig.illo-right img { width: 100% !important; float: none !important; margin: 0 0 3px !important; }
.pic-page .pp-cap { text-align: center; font-family: var(--serif); font-style: italic; font-size: 9px; color: #6b645b; margin: -2px 0 6px; }
.pic-stage.lt-left .pp-line:nth-of-type(-n+2), .pic-stage.lt-right .pp-line:nth-of-type(-n+2) { display: none; }
@media (max-width: 760px) { .pic-step { grid-template-columns: 1fr; } }

/* Home: progress strip */
.progress-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; width: 100%; max-width: 720px; }
.ps-card { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; animation: screenIn .35s var(--ease) both; text-align: left; }
.ps-card:nth-child(2) { animation-delay: .05s; } .ps-card:nth-child(3) { animation-delay: .1s; }
.ps-card small { color: var(--muted); font-size: 12px; }
.ps-card b { font-family: var(--serif); font-weight: 500; font-size: 24px; letter-spacing: -.01em; }
.ps-bars { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-top: 4px; }
.ps-bars i { flex: 1; background: var(--gold-line); border-radius: 3px 3px 1px 1px; min-height: 3px; transform-origin: bottom; animation: barGrow .6s var(--ease) both; }
.ps-bars i.today { background: var(--gold); }
@keyframes barGrow { from { transform: scaleY(0); } }
.continue-card { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 720px; margin-top: 10px; border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.continue-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(156, 123, 60, .18); }
.continue-card span { display: grid; flex: 1; } .continue-card small { color: var(--muted); }
.continue-card svg { width: 18px; height: 18px; color: var(--gold-2); }
:root[data-theme="dark"] .continue-card { background: #2a2418; }
@media (max-width: 760px) { .progress-strip { grid-template-columns: 1fr; } }

/* Cover: ready print cover + mockup */
.pc-checks { display: grid; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.pc-checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; animation: screenIn .3s var(--ease) both; }
.pc-checks li:nth-child(2) { animation-delay: .06s; } .pc-checks li:nth-child(3) { animation-delay: .12s; }
.pc-checks .ok { color: var(--green); } .pc-checks .bad { color: var(--red); } .pc-checks .warn { color: var(--amber); }
.pc-checks i { font-style: normal; font-weight: 700; width: 16px; flex: none; }
.mockup-stage { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.mockup-stage canvas { width: auto; max-width: 100%; max-height: 620px; justify-self: center; height: auto; border-radius: 14px; box-shadow: var(--shadow); background: var(--paper-2); }
@media (max-width: 900px) { .mockup-stage { grid-template-columns: 1fr; } }
.scene-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scene { border: 2px solid var(--line); border-radius: 10px; height: 46px; cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s var(--ease), transform .12s var(--ease); }
.scene.on { border-color: var(--gold); }
.scene .lock { position: absolute; right: 4px; top: 4px; width: 14px; height: 14px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }

@media (prefers-reduced-motion: reduce) {
  .screen-in, .modal, .toast, .write-panel, .wp-body, .bible-card, .ver, .find-bar, .pic-bar, .ps-card, .ps-bars i, .pc-checks li, .streak .flame, .eq i, .bb-save.saving::before, .lt-card.on .lt-pic { animation: none !important; }
  .tab::after, .meter > i, .card, .book-card, .outline-card { transition: none !important; }
}
.ps-days { display: flex; gap: 4px; font-size: 10px; color: var(--muted); } .ps-days span { flex: 1; text-align: center; }

/* ═════════════════════ Novella 1.7 look: ink frame + floating pages ═════════════════════
   The app chrome (title bar + sidebar) is deep ink in both themes; every screen sits on a rounded
   "page" that floats inside it. Book tabs are a segmented control; page headers are larger. */
:root {
  --frame: #191511; --frame-2: #221d18; --frame-ink: #efe8dc; --frame-muted: #9d9486; --frame-line: rgba(255, 255, 255, .08);
  --frame-hover: rgba(255, 255, 255, .06); --frame-on: rgba(255, 255, 255, .10);
  --radius-page: 18px;
}
:root[data-theme="dark"] { --frame: #0d0b09; --frame-2: #15120f; --frame-line: rgba(255, 255, 255, .06); }
html, body { background: var(--frame); }
.shell { background: var(--frame); }
.topbar { background: var(--frame); color: var(--frame-ink); border-bottom: 0; }
.topbar .tb-btn { color: var(--frame-muted); }
.topbar .tb-btn:hover { background: var(--frame-hover); color: var(--frame-ink); }
.topbar .brand .wm-dark { display: none !important; }
.topbar .brand .wm-light { display: block !important; }
.topbar .crumb { color: var(--frame-muted); }
.body { padding: 0 8px 8px 0; gap: 0; }
.body.collapsed { grid-template-columns: 64px 1fr; }
.focus .body { padding: 0; }
/* Sidebar */
.side { background: transparent; border-right: 0; padding: 6px 10px 6px; color: var(--frame-ink); }
.side-new { background: var(--gold); color: #1c1917; border-radius: 12px; padding: 9px 12px; margin: 2px 0 14px; justify-content: flex-start; box-shadow: 0 6px 18px rgba(197, 160, 89, .25); transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s; }
.side-new:hover { background: #d2ae68; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(197, 160, 89, .35); }
.side-new .plus { width: 22px; height: 22px; background: rgba(28, 25, 23, .14); color: #1c1917; }
.nav { color: var(--frame-muted); position: relative; padding: 8px 12px; border-radius: 10px; }
.nav svg { opacity: 1; }
.nav:hover { background: var(--frame-hover); color: var(--frame-ink); }
.nav.on { background: var(--frame-on); color: #fff; }
.nav.on::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); animation: navOn .3s var(--ease); }
@keyframes navOn { from { transform: scaleY(0); } }
.nav.on svg { color: var(--gold); }
.side-label { color: #6f675c; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 20px 12px 6px; }
.recent { color: var(--frame-muted); padding: 6px 12px; border-radius: 9px; }
.recent:hover { background: var(--frame-hover); color: var(--frame-ink); }
.recent.on { background: var(--frame-on); color: #fff; }
.recent small { color: #6f675c; }
.chat-acts button { color: var(--frame-muted) !important; }
.chat-acts button:hover { background: var(--frame-on) !important; color: #fff !important; }
.chat-rename { background: var(--frame-2); color: var(--frame-ink); border: 1px solid var(--gold-line); }
.side-account-wrap { border-top: 1px solid var(--frame-line); }
.side-account { color: var(--frame-ink); }
.side-account:hover, .side-account.on { background: var(--frame-hover); }
.side-account small { color: var(--frame-muted) !important; }
.side-account .chev { color: var(--frame-muted); }
.side .avatar { background: var(--gold); color: #1c1917; }
.side ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-color: var(--frame); }
.body.collapsed .side { padding: 6px 10px; }
.body.collapsed .side-new { width: 44px; padding: 9px; justify-content: center; }
.body.collapsed .nav.on::before { left: -10px; }
/* The floating page */
.main { background: var(--paper); border-radius: var(--radius-page); overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 20px 50px rgba(0, 0, 0, .35); }
.focus .main { border-radius: 0; }
/* Book bar: title on the left, segmented tabs, save state */
.bookbar { height: 58px; padding: 0 14px 0 16px; gap: 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.bb-book b { font-family: var(--serif); font-weight: 500; font-size: 16px; }
.bookbar .tabs { align-self: center; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.bookbar .tab { border-radius: 9px; padding: 6px 12px; height: auto; margin: 0; border: 0 !important; font-size: 13px; }
.bookbar .tab::after { display: none; }
.bookbar .tab:hover { background: var(--hover); }
.bookbar .tab.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(28, 25, 23, .08), 0 2px 8px rgba(28, 25, 23, .06); }
.bookbar .tab.on svg { color: var(--gold-2); }
.bb-save { padding: 4px 10px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--line); }
.bb-save.saved { color: var(--green); border-color: transparent; background: var(--green-soft); }
/* Pages: bigger headings, a calm rhythm */
.page { padding: 40px 48px 72px; }
.page-head { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.page-head h1 { font-size: 36px; font-weight: 420; letter-spacing: -.02em; }
.page-head .eyebrow { margin-bottom: 4px; }
.page-head.mt2 { border-bottom: 0; padding-bottom: 0; margin-top: 40px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); }
.card { border-radius: 18px; border-color: var(--line); box-shadow: 0 1px 2px rgba(28, 25, 23, .03), 0 8px 28px rgba(28, 25, 23, .05); }
.card.pad, .card .pad { padding: 22px; }
.btn { border-radius: 11px; }
.btn.sm { border-radius: 9px; }
.input, .select, .textarea { border-radius: 11px; background: var(--card); }
.note { border-radius: 12px; }
.modal { border-radius: 22px; padding: 28px; }
.veil { backdrop-filter: blur(3px); background: rgba(20, 18, 16, .5); }
.toast { border-radius: 12px; padding: 11px 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .25); }
/* Home: a warm glow behind the greeting */
.home2 { background: radial-gradient(900px 380px at 50% -40px, rgba(197, 160, 89, .16), transparent 70%); }
.greet { font-size: 46px; margin: 20px 0 30px; }
.composer2 { border-radius: 22px; }
.h-chip { border-radius: 99px; background: var(--card); }
.ps-card, .hb-card, .hb-option { border-radius: 16px; }
.continue-card { border-radius: 16px; }
/* Books */
.book-card { border-radius: 4px 10px 10px 4px; }
.new-card { border-radius: 14px; }
/* Write screen fits the rounded page */
.write .chapters { background: var(--paper-2); }
.statusbar { background: var(--paper-2); }
.toolbar { background: var(--paper); }
/* Dark theme tweaks for the frame */
:root[data-theme="dark"] .main { box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 20px 50px rgba(0, 0, 0, .55); }
:root[data-theme="dark"] .bookbar .tab.on { background: #2a2621; }
@media (prefers-reduced-motion: reduce) { .nav.on::before { animation: none; } .side-new { transition: none; } }
/* Small windows: the sidebar folds to icons automatically so the page keeps its room. */
@media (max-width: 1080px) {
  .body:not(.collapsed) { grid-template-columns: 64px 1fr; }
  .body:not(.collapsed) .side { align-items: center; padding: 6px 10px; }
  .body:not(.collapsed) .side .lbl, .body:not(.collapsed) .side-label, .body:not(.collapsed) .recents { display: none; }
  .body:not(.collapsed) .nav, .body:not(.collapsed) .side-account { width: 44px; justify-content: center; padding: 8px; }
  .body:not(.collapsed) .side-new { width: 44px; padding: 9px; justify-content: center; }
  .body:not(.collapsed) .popover.up { left: 0; right: auto; width: 240px; }
  .body:not(.collapsed) .side-account-wrap { margin-top: auto; }
  .page { padding: 32px 28px 64px; }
}
.body.collapsed .side-account-wrap { margin-top: auto; }

/* ── Bottom bar and its pop-ups (1.7 polish) ─────────────────────────────── */
.statusbar { container-type: inline-size; align-items: center; flex-wrap: nowrap; gap: 14px; min-height: 40px; }
.statusbar .sb-stat { white-space: nowrap; font-variant-numeric: tabular-nums; }
.statusbar .sb-stat + .sb-stat::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--line-2, var(--line)); margin: 0 14px 2px 0; vertical-align: middle; }
.statusbar .sb-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); flex: 0 0 auto; }
.statusbar .sb-toggle, .statusbar .sprint-on { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; opacity: 1; cursor: pointer; white-space: nowrap; }
.statusbar .sb-toggle svg { width: 14px; height: 14px; flex: 0 0 auto; }
.statusbar .sb-toggle:hover, .statusbar .sb-toggle.open { background: var(--gold-soft); color: var(--ink); }
.statusbar .sb-toggle.on { background: var(--gold-soft); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--gold-line); }
:root[data-theme="dark"] .statusbar .sb-toggle.on { color: var(--gold-light); }
.statusbar .sprint-on { background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); }
.statusbar .sprint-on .sb-toggle { height: 20px; padding: 0 8px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
@container (max-width: 640px) { .statusbar .sb-label { display: none; } .statusbar .sb-toggle { padding: 0 8px; } }
@container (max-width: 470px) { .statusbar .sb-stat:nth-child(2) { display: none; } }

.statusbar .sb-menu { position: absolute; bottom: calc(100% + 12px); right: -6px; left: auto; width: 300px; max-width: calc(100vw - 32px); padding: 14px; display: grid; gap: 10px; border-radius: 14px; white-space: normal; text-align: left; font-size: 13px; line-height: 1.45; box-shadow: 0 18px 48px rgba(28, 25, 23, .22); }
.statusbar .sb-menu::after { content: ""; position: absolute; bottom: -6px; right: 22px; width: 11px; height: 11px; background: var(--card); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.statusbar .sb-menu, .statusbar .sb-menu span, .statusbar .sb-menu small, .statusbar .sb-menu p { white-space: normal; }
.sbm-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sbm-head svg { width: 16px; height: 16px; color: var(--gold-2); }
.sbm-sub, .sbm-foot { margin: 0; color: var(--muted); font-size: 12.5px; }
.sbm-foot { padding-top: 8px; border-top: 1px solid var(--line); }
.sbm-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sbm-chip { display: grid; justify-items: center; gap: 0; padding: 8px 0 7px; border: 1px solid var(--line); border-radius: 11px; background: none; color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, background .15s, transform .12s; }
.sbm-chip b { font-size: 17px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sbm-chip small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sbm-chip:hover, .sbm-chip:focus-visible { border-color: var(--gold); background: var(--gold-soft); outline: none; transform: translateY(-1px); }
.statusbar .sound-list { display: grid; gap: 4px; margin: 0; }
.statusbar .sound { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 10px; text-align: left; }
.sound-name { display: grid; gap: 1px; min-width: 0; }
.sound-name b { font-size: 13px; font-weight: 600; }
.sound-name small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.sound.on .eq { color: var(--gold-2); margin: 0; }
.sbm-vol { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.sbm-vol input { width: 100%; accent-color: var(--gold); }
.sbm-vol input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 99px; background: var(--line); outline: none; }
.sbm-vol input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--gold-line), 0 2px 6px rgba(0,0,0,.2); cursor: pointer; }
.sbm-vol input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--gold-line); }

/* ── e-reader preview (Kindle, phone, tablet) ───────────────────────────── */
.rd-dev { position: relative; box-shadow: 0 18px 44px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.06); }
.rd-screen { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.rd-screen iframe { border: 0; display: block; flex: none; }

.rd-kindle::after { content: ""; position: absolute; left: 50%; bottom: 17px; width: 22px; height: 4px; margin-left: -11px; border-radius: 2px; background: #3a3a3a; }
.rd-cam { position: absolute; top: 20px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #1f2128; box-shadow: inset 0 0 0 2px #2c2f38; z-index: 3; }
.rd-status { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 22px 5px; font-size: 11px; font-weight: 700; flex: none; }
.rd-bat { width: 18px; height: 9px; border-radius: 3px; border: 1.5px solid currentColor; position: relative; opacity: .8; }
.rd-bat::after { content: ""; position: absolute; inset: 1px 4px 1px 1px; background: currentColor; border-radius: 1px; }
.rd-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-variant-numeric: tabular-nums; letter-spacing: .01em; pointer-events: none; }
.rd-tap { position: absolute; width: 34%; border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rd-tap-l { left: 0; } .rd-tap-r { right: 0; width: 66%; }
.rd-tap:hover { background: linear-gradient(90deg, rgba(0,0,0,.035), transparent); }
.rd-tap-r:hover { background: linear-gradient(270deg, rgba(0,0,0,.035), transparent); }
.rd-tap:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.rd-tools { gap: 6px; align-items: center; }
.rd-looks { display: inline-flex; gap: 4px; margin-left: 8px; }
.rd-look { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); font: 600 12px/1 Georgia, serif; cursor: pointer; }
.rd-look-light { background: #fff; color: #161616; } .rd-look-sepia { background: #f3ead7; color: #3a2e1d; } .rd-look-dark { background: #16161a; color: #d8d4cb; }
.rd-look.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft), 0 0 0 3px var(--gold); }
@media (prefers-reduced-motion: no-preference) { .rd-screen iframe { animation: rdIn .18s var(--ease, ease) both; } @keyframes rdIn { from { opacity: .4; } to { opacity: 1; } } }

/* Cover wizard */
.wz-steps{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:16px}
.wz-step{display:flex;align-items:center;gap:8px;border:1px solid var(--line,#e7e0d4);background:none;color:inherit;font:inherit;font-size:13px;padding:7px 12px;border-radius:999px;cursor:pointer;opacity:.75}
.wz-step i{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--paper-2,#f1ece2);font-style:normal;font-size:11.5px;font-weight:700}
.wz-step.on{opacity:1;border-color:var(--gold,#c5a059);background:rgba(197,160,89,.14);font-weight:600}
.wz-step.on i{background:var(--gold,#c5a059);color:#1c1917}
.wz-step.done{opacity:1}
.wz-step.done i{background:#16a34a;color:#fff}
.wz-seg{flex-wrap:wrap}
.wz-hr{border:0;border-top:1px solid var(--line,#e7e0d4);margin:2px 0;width:100%}
.wz-nav{border-top:1px solid var(--line,#e7e0d4);padding-top:12px;margin-top:4px}
.wz .cover-stage.print{grid-template-columns:minmax(360px,44%) minmax(0,1fr);align-items:start}
.wz .cover-stage.print .cover-canvas-wrap{position:relative;padding:12px}
.wz .cover-stage.print .cover-canvas-wrap canvas.wrap{max-width:100%}
.wz .cover-stage:not(.print){grid-template-columns:330px minmax(0,1fr)}
@media (max-width:1180px){
  .wz .cover-stage,.wz .cover-stage.print,.wz .cover-stage:not(.print){grid-template-columns:minmax(0,1fr)}
  .wz .cover-stage .cover-canvas-wrap{position:relative}
  .wz .cover-stage .cover-canvas-wrap canvas.wrap{max-height:340px;width:auto;max-width:100%}
  .wz .cover-stage:not(.print) .cover-canvas-wrap canvas{max-height:340px;width:auto}
}

/* Cover wizard: keep the preview simple to paint (no pinning, no big blurred shadow) so scrolling never smears */
.wz .cover-canvas-wrap{contain:paint;isolation:isolate}
.wz .cover-canvas-wrap canvas{box-shadow:0 2px 8px rgba(28,25,23,.25)}

/* Web-only touches on top of the app's own styles.css. */
.topbar { padding-right: 8px !important; -webkit-app-region: no-drag !important; }
html, body { overscroll-behavior: none; }
.bk-btn { position: fixed; right: 14px; top: 5px; z-index: 900; display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(0,0,0,.18); background: #1c1917; color: #f6efe0; font: 600 13px/1 'Inter Variable', system-ui, sans-serif; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.bk-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.bk-btn.due .bk-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.3); }
.bk-wrap { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.bk-card { position: relative; width: min(480px, 100%); max-height: 90vh; overflow: auto; background: #fffdf7; color: #1d1a16; border-radius: 16px; padding: 24px; font: 400 15px/1.5 'Inter Variable', system-ui, sans-serif; display: grid; gap: 12px; }
.bk-card h2 { margin: 0; font: 700 22px/1.2 'Source Serif 4 Variable', Georgia, serif; }
.bk-card p, .bk-card ul { margin: 0; } .bk-card ul { padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.bk-warn { background: #fff4de; border: 1px solid #f0d9a7; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.bk-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 28px; cursor: pointer; color: #6b6254; min-width: 44px; min-height: 44px; }
.bk-primary, .bk-ghost { min-height: 46px; border-radius: 12px; font: 700 15px 'Inter Variable', system-ui, sans-serif; cursor: pointer; }
.bk-primary { background: #1d1a16; color: #f6efe0; border: 0; } .bk-primary:disabled { opacity: .6; }
.bk-ghost { background: #fff; border: 1.5px solid #1d1a16; color: #1d1a16; }
.bk-msg { font-size: 14px; color: #5a4a2a; min-height: 1.2em; }

img[src$="vsb-logo.png"]{display:none}

/* ── Phones and small tablets ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { height: 100dvh; }
  .onb { grid-template-columns: 1fr; min-height: auto; }
  .onb-art { padding: 22px 22px 8px; } .onb-art h1 { font-size: 28px; } .onb-art ul, .onb-art p { display: none; }
  .onb-art::after { display: none; }
  .onb-form { padding: 18px 22px 28px; max-width: none; }
  .page { padding: 20px 16px 48px !important; }
  .topbar .crumb { display: none; }
  .topbar #bk-spacer { display: none; }
}
@media (max-width: 700px) {
  /* The sidebar becomes a bottom bar */
  .body, .body.collapsed, .body:not(.collapsed) { grid-template-columns: 1fr !important; grid-template-rows: 1fr auto; padding: 0 !important; }
  .main { grid-row: 1; grid-column: 1; border-radius: 0 !important; }
  .side, .body.collapsed .side, .body:not(.collapsed) .side { grid-row: 2; grid-column: 1; flex-direction: row !important; align-items: center !important; justify-content: space-around; padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)) !important; border-right: 0; border-top: 1px solid var(--line); }
  .side .side-new, .side .side-label, .side .recents, .side .side-account-wrap, .side .lbl, .side .chat-history, .side .side-sp { display: none !important; }
  .side .nav { width: 56px !important; min-height: 46px; padding: 8px !important; justify-content: center; }
  .topbar .tb-btn:first-child { display: none; }
  .bookbar { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; } .bookbar::-webkit-scrollbar { display: none; }
  .bookbar .tab { flex: 0 0 auto; }
  /* Writing: chapter list on top, editor below; assistant panel covers the screen */
  .write, .write.with-ai, .write.with-panel { grid-template-columns: 1fr !important; grid-template-rows: auto 1fr; }
  .write, .write.with-ai, .write.with-panel { grid-template-rows: 1fr; }
  .chapters, .write.with-ai .chapters { display: none; }
  body.show-chapters .chapters, body.show-chapters .write.with-ai .chapters { display: flex; position: fixed; inset: 40px 0 58px 0; z-index: 55; border: 0; background: var(--paper-2); overflow-y: auto; }
  .ch-fab { position: fixed; right: 12px; bottom: 132px; z-index: 56; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: #c5a059; color: #1c1917; font: 700 13px 'Inter Variable', system-ui, sans-serif; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
  .ai-dock, .write > aside:last-child:not(.chapters) { position: fixed; inset: 40px 0 0 0; z-index: 60; background: var(--paper); overflow: auto; }
  .toolbar, .tb { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .statusbar { flex-wrap: wrap; gap: 6px 14px; }
  .g4, .g3, .g2 { grid-template-columns: 1fr !important; }
  .bk-btn { top: 5px; right: 8px; }
  .bk-card { padding: 18px; }
}
