:root {
  --bg: #0d1424;
  --panel: #1a2435;
  --panel-2: #202c40;
  --ink: #f7f8ff;
  --muted: #aab4c5;
  --soft: #728099;
  --line: rgba(255, 255, 255, 0.1);
  --copper: #64a8ff;
  --violet: #8e51ff;
  --danger: #d96868;
  --ok: #7fc294;
  --warn: #e0b45a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --editor-page-width: 760px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(81, 141, 255, 0.2), transparent 24rem),
    linear-gradient(160deg, #0d1424 0%, #10192b 52%, #121a2b 100%);
  color: var(--ink);
}
body.warm-mode {
  --bg: #100d10;
  --panel: #1a161b;
  --panel-2: #231d22;
  --copper: #c58b5b;
  --violet: #8c6cb8;
  background:
    radial-gradient(circle at top right, rgba(140, 108, 184, 0.18), transparent 24rem),
    linear-gradient(160deg, #100d10 0%, #161116 55%, #211812 100%);
}
button, input, textarea, select {
  font: inherit;
}
button, .file-button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #62a6ff, #2f64f4);
  color: #07111f;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}
button.secondary, button.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost { box-shadow: none; }
button.full { width: 100%; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  outline: none;
}
textarea { resize: vertical; line-height: 1.65; }
label { display: grid; gap: 0.45rem; color: var(--muted); font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { color: var(--soft); font-size: 0.82rem; }
.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--copper);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.76rem;
  font-weight: 900;
}
.error-text { color: var(--danger); min-height: 1.3rem; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
  background: #000;
  overflow: hidden;
}
.login-scene {
  position: relative;
  width: min(100vw, 760px);
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}
.login-room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: contrast(1.04) saturate(0.9);
}
.login-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.62), transparent 24%, transparent 74%, rgba(0, 0, 0, 0.72)),
    radial-gradient(circle at 52% 62%, transparent 0 18%, rgba(0, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.55) 100%);
}
.login-title {
  position: absolute;
  z-index: 2;
  top: max(1.2rem, 5vh);
  left: clamp(1rem, 6vw, 3rem);
  right: clamp(1rem, 6vw, 3rem);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.72);
}
.login-title h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.2rem, 10vw, 5.4rem);
  line-height: 0.92;
}
.login-title p:not(.eyebrow) {
  max-width: 34rem;
  margin: 0.8rem 0 0;
  color: rgba(247, 248, 255, 0.82);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
}
.tv-login-card {
  position: absolute;
  z-index: 3;
  left: 38%;
  top: 52.7%;
  width: 24%;
  min-width: 168px;
  min-height: 82px;
  border-radius: 12px;
  overflow: hidden;
  background: #07080c;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    inset 0 0 30px rgba(89, 206, 255, 0.2),
    0 10px 30px rgba(0, 0, 0, 0.5);
  transform: perspective(420px) rotateX(1deg) rotateY(-2deg);
}
.tv-noise {
  position: absolute;
  inset: 0;
  opacity: 0.72;
  background:
    linear-gradient(90deg, #17d7ff 0 15%, #30f56d 15% 30%, #ffec38 30% 45%, #ff5047 45% 60%, #a542ff 60% 76%, #ffffff 76% 88%, #1f39ff 88% 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.18) 0 1px, rgba(0,0,0,0.18) 1px 3px);
  background-blend-mode: multiply;
  filter: saturate(1.2);
}
.tv-login-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.38rem;
  padding: 0.55rem;
  min-height: inherit;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(1px);
}
.tv-login-content label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.58rem, 1.2vw, 0.74rem);
  text-transform: uppercase;
}
.terminal-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #66f37f;
  box-shadow: 0 0 12px rgba(102, 243, 127, 0.9);
}
.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  margin-top: 0;
}
.tv-login-card input {
  min-height: 34px;
  border-radius: 9px;
  padding: 0.42rem 0.55rem;
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  font-size: 0.88rem;
}
.tv-login-card button {
  min-height: 34px;
  border-radius: 9px;
  padding: 0.42rem 0.62rem;
  background: #f2f4ff;
  color: #08090d;
  box-shadow: none;
}
.tv-login-card .error-text {
  min-height: 1rem;
  margin: 0;
  color: #ffd1d1;
  font-size: 0.72rem;
}
.login-hint {
  position: absolute;
  z-index: 2;
  left: clamp(1rem, 5vw, 2.5rem);
  bottom: max(1rem, 4vh);
  margin: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(247, 248, 255, 0.72);
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem;
  background: rgba(8, 14, 26, 0.88);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand { display: flex; gap: 0.8rem; align-items: center; padding: 0.35rem; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #111b2e;
  color: var(--copper);
  border: 1px solid rgba(197, 139, 91, 0.45);
  font-weight: 900;
}
.brand small { display: block; color: var(--muted); }
.nav-list { display: grid; gap: 0.35rem; overflow: auto; }
.nav-list button {
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}
.nav-list button.active, .nav-list button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.075);
  border-color: var(--line);
}
.workspace { min-width: 0; padding: 1.1rem 1.3rem 6rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.topbar h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 3rem); }
.status-strip { display: flex; gap: 0.6rem; align-items: center; }
.icon-button {
  width: 48px;
  min-width: 48px;
  padding: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  box-shadow: none;
  font-size: 1.25rem;
}
.pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 0.8rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.view { display: none; }
.view.active { display: block; }
.hero-panel, .panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(31, 44, 64, 0.96), rgba(24, 35, 53, 0.96));
  box-shadow: var(--shadow);
}
.hero-panel {
  min-height: 230px;
  padding: clamp(1.1rem, 4vw, 1.8rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
.hero-panel h2 { margin: 0; max-width: 780px; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; }
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.quick-actions button {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  box-shadow: none;
}
.quick-actions button span {
  font-size: 2rem;
  color: var(--ink);
}
.start-panel {
  margin-top: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(32, 44, 64, 0.94);
  display: grid;
  gap: 1rem;
}
.start-panel h3 { margin: 0; font-size: 1.45rem; }
.start-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat-grid, .project-grid, .tool-grid, .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}
.stat-card, .project-card, .image-card, .check-item {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  padding: 1rem;
}
.stat-card strong { display: block; font-size: 1.65rem; }
.project-card { display: grid; gap: 0.75rem; }
.project-card h3 { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.card-actions button { min-height: 38px; padding: 0.55rem 0.72rem; }
.panel { padding: 1rem; margin-top: 1rem; }
.panel-head, .toolbar, .meta-row, .editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.panel h3 { margin: 0 0 0.8rem; }
.toolbar input { max-width: 320px; }
.toolbar select { max-width: 220px; }
.editor-view {
  margin-top: -0.2rem;
}
.author-ribbon {
  border: 1px solid rgba(100, 168, 255, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(29, 43, 62, 0.98), rgba(20, 29, 43, 0.98));
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 0.9rem;
}
.ribbon-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.ribbon-tabs button {
  min-height: 38px;
  border-radius: 14px 14px 0 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  white-space: nowrap;
}
.ribbon-tabs button.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(100, 168, 255, 0.28);
}
.ribbon-groups {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 0.55rem;
  padding: 0.65rem;
  overflow-x: auto;
}
.ribbon-group {
  min-width: 150px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  transition: opacity 0.18s ease, border-color 0.18s ease;
}
.ribbon-group.is-muted {
  opacity: 0.48;
}
.ribbon-group span {
  grid-column: 1 / -1;
  color: var(--copper);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}
.ribbon-group button {
  min-height: 36px;
  padding: 0.35rem 0.45rem;
  border-radius: 12px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.065);
  color: var(--ink);
  box-shadow: none;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(420px, 1fr) minmax(260px, 330px);
  gap: 1rem;
  align-items: start;
}
.author-workbench .panel { margin-top: 0; }
.book-browser, .inspector-panel {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}
.compact-input {
  min-height: 40px;
  margin-bottom: 0.7rem;
}
.book-tree-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.book-tree-meta span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.structure-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.structure-tools button {
  min-height: 36px;
  padding: 0.35rem;
  border-radius: 12px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  box-shadow: none;
}
.chapter-list { display: grid; gap: 0.45rem; }
.chapter-item {
  width: 100%;
  min-height: 52px;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  box-shadow: none;
}
.chapter-item.active { border-color: rgba(197, 139, 91, 0.65); background: rgba(197, 139, 91, 0.13); }
.editor-panel { margin-top: 0; }
.editor-meta { display: grid; gap: 0.75rem; }
.studio-meta {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}
.title-input { font-size: 1.45rem; font-weight: 900; }
.format-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.85rem 0; }
.format-bar button { min-height: 38px; padding: 0.52rem 0.72rem; }
.compact-ribbon {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 24, 38, 0.92);
  backdrop-filter: blur(10px);
}
.compact-ribbon button {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  box-shadow: none;
}
.page-studio {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 44, 64, 0.96), rgba(17, 25, 38, 0.96));
  background-size: 32px 32px, auto;
}
.canvas-shell {
  max-width: var(--editor-page-width);
  margin: 0 auto;
  padding: clamp(0.55rem, 2vw, 1rem);
  border: 1px solid rgba(100, 168, 255, 0.2);
  border-radius: 22px;
  background: #121b2b;
}
.page-ruler {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--soft);
  font-size: 0.78rem;
  padding: 0 0.25rem 0.5rem;
}
#chapterText {
  min-height: min(62vh, 760px);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  background: #f7f3ea;
  color: #1b1a18;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 18px 34px rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: clamp(1rem, 4vw, 2.4rem);
}
.studio-foot {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.notes-input { min-height: 90px; margin-top: 0.75rem; }
.inspector-panel h4 {
  margin: 0 0 0.65rem;
  color: var(--ink);
}
.inspector-section {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.6rem;
}
.inspector-section:first-of-type { border-top: 0; }
.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.inspector-grid button {
  min-height: 40px;
  padding: 0.45rem;
  border-radius: 13px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  box-shadow: none;
}
.chapter-preview {
  max-height: 260px;
  overflow: auto;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}
.chapter-preview h1, .chapter-preview h2 {
  color: var(--ink);
  margin: 0.2rem 0 0.55rem;
}
.chapter-preview p { margin: 0 0 0.6rem; }
.chapter-preview blockquote {
  margin: 0.5rem 0;
  padding-left: 0.8rem;
  border-left: 3px solid var(--copper);
}
.chapter-preview figure {
  margin: 0.6rem 0;
  padding: 0.7rem;
  border: 1px dashed rgba(100, 168, 255, 0.4);
  border-radius: 12px;
}
.mini-check-list {
  display: grid;
  gap: 0.45rem;
}
.mini-check {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.mini-check strong { color: inherit; }
body[data-editor-profile="children"] #chapterText,
body[data-editor-profile="picture"] #chapterText {
  font-family: "Trebuchet MS", Verdana, sans-serif;
}
body[data-editor-profile="novel"] #chapterText,
body[data-editor-profile="kdp"] #chapterText {
  font-family: Georgia, "Times New Roman", serif;
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}
.image-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #0b090b;
}
.notice {
  border: 1px solid var(--line);
  background: rgba(197, 139, 91, 0.12);
  border-radius: 18px;
  padding: 0.9rem;
  margin-bottom: 1rem;
}
.report-box, .check-list {
  display: grid;
  gap: 0.6rem;
  color: var(--muted);
}
mark {
  padding: 0.08rem 0.22rem;
  border-radius: 0.35rem;
  background: rgba(224, 180, 90, 0.28);
  color: var(--ink);
}
.search-hit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}
.search-hit p {
  margin: 0.35rem 0 0;
}
.search-hit button {
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
}
.production-summary {
  margin: 0.8rem 0;
}
.readiness-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 260px);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
}
.readiness-card h3 {
  margin: 0;
  font-size: 1.6rem;
}
.readiness-card.ok { border-color: rgba(127, 194, 148, 0.45); }
.readiness-card.warn { border-color: rgba(224, 180, 90, 0.5); }
.readiness-card.critical { border-color: rgba(217, 104, 104, 0.55); }
.readiness-meter {
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.readiness-meter span {
  display: block;
  width: var(--ready);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warn), var(--ok));
}
.production-gates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  margin: 0.8rem 0 1rem;
}
.gate-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}
.gate-card span {
  color: var(--muted);
  font-size: 0.9rem;
}
.gate-card.ok strong { color: var(--ok); }
.gate-card.warn strong { color: var(--warn); }
.gate-card.critical strong { color: var(--danger); }
.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0.5rem 0 0.8rem;
}
.picture-preview {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  margin-bottom: 1rem;
}
.picture-page {
  width: min(100%, 360px);
  aspect-ratio: var(--picture-ratio);
  display: grid;
  grid-template-rows: var(--picture-image) 1fr;
  gap: 0.75rem;
  padding: var(--picture-pad);
  border-radius: 18px;
  background: var(--picture-bg);
  color: #1b1a18;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.picture-page.image-bottom { grid-template-rows: 1fr var(--picture-image); }
.picture-page.image-bottom .picture-image { order: 2; }
.picture-page.full-bleed,
.picture-page.text-over-image {
  grid-template-rows: 1fr;
  position: relative;
  padding: 0;
}
.picture-page.full-bleed .picture-image,
.picture-page.text-over-image .picture-image {
  position: absolute;
  inset: 0;
}
.picture-page.full-bleed .picture-text { display: none; }
.picture-page.text-over-image .picture-text {
  position: relative;
  align-self: end;
  margin: var(--picture-pad);
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(247, 243, 234, 0.86);
}
.picture-page.image-only .picture-text { display: none; }
.picture-page.text-only .picture-image { display: none; }
.picture-page.text-only { grid-template-rows: 1fr; }
.picture-page.spread {
  width: min(100%, 560px);
  aspect-ratio: 8 / 3;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}
.picture-image img,
.picture-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}
.picture-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(0, 0, 0, 0.25);
  color: #6f675f;
}
.picture-text {
  font-size: var(--picture-size);
  line-height: 1.22;
  align-self: center;
  overflow: hidden;
}
.code-box {
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0c1320;
  color: #d8e4f7;
  white-space: pre-wrap;
}
.assistant-input {
  min-height: 300px;
  font-family: Georgia, "Times New Roman", serif;
}
.assistant-output {
  display: grid;
  gap: 0.8rem;
}
.assistant-output pre {
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  white-space: pre-wrap;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}
.check-item { display: flex; justify-content: space-between; gap: 1rem; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.critical { color: var(--danger); }
.file-button { display: inline-flex; align-items: center; width: auto; }
.file-button input { display: none; }
.mobile-nav { display: none; }

.focus-mode .sidebar, .focus-mode .topbar, .focus-mode .chapter-panel, .focus-mode .inspector-panel, .focus-mode .author-ribbon, .focus-mode .mobile-nav { display: none; }
.focus-mode .app-shell { grid-template-columns: 1fr; }
.focus-mode .workspace { padding: 1rem; }
.focus-mode .editor-layout { grid-template-columns: 1fr; }
.focus-mode #chapterText { min-height: 78vh; font-size: 1.18rem; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { padding: 0.85rem 0.85rem 6rem; }
  .login-scene { width: 100vw; }
  .login-title { top: 1rem; }
  .login-title h1 { max-width: 10ch; }
  .tv-login-card {
    left: 50%;
    top: auto;
    bottom: 10vh;
    width: min(86vw, 360px);
    min-height: 128px;
    transform: translateX(-50%);
    border-radius: 18px;
  }
  .tv-login-content {
    gap: 0.62rem;
    padding: 0.95rem;
  }
  .tv-login-content label { font-size: 0.78rem; }
  .tv-login-card input,
  .tv-login-card button {
    min-height: 46px;
    border-radius: 14px;
    font-size: 1rem;
  }
  .login-hint { display: none; }
  .topbar { align-items: flex-start; }
  .status-strip { flex-direction: row; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
  .status-strip .pill, .status-strip #manualSaveButton { display: none; }
  .hero-panel { grid-template-columns: 1fr; min-height: auto; }
  .login-row { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .book-browser, .inspector-panel { position: static; max-height: none; }
  .ribbon-groups { grid-template-columns: repeat(7, minmax(145px, 170px)); }
  .author-ribbon { border-radius: 20px; }
  .canvas-shell { max-width: 100%; }
  .chapter-panel { max-height: 260px; overflow: auto; }
  .toolbar input, .toolbar select { max-width: none; }
  .readiness-card, .search-hit { grid-template-columns: 1fr; }
  .mobile-nav {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(13, 20, 36, 0.97);
    border-top: 1px solid var(--line);
    padding: 0.45rem;
    gap: 0.35rem;
  }
  .mobile-nav button {
    min-height: 48px;
    padding: 0.35rem;
    font-size: 0.78rem;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
    border: 1px solid transparent;
    border-radius: 16px;
  }
  .mobile-nav button.active {
    color: var(--ink);
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.08);
  }
  .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-actions button { min-height: 118px; padding: 0.55rem; }
  .start-buttons { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .workspace { padding: 1rem 0.8rem 6rem; }
  .topbar h1 { font-size: 1.7rem; }
  .login-title h1 { font-size: 2.35rem; }
  .login-title p:not(.eyebrow) { display: none; }
  .tv-login-card {
    bottom: 8vh;
    width: calc(100vw - 1.6rem);
  }
  .tv-login-card .login-row { grid-template-columns: 1fr; }
  .hero-panel, .start-panel, .panel { border-radius: 24px; }
  .quick-actions { gap: 0.55rem; }
  .quick-actions button { font-size: 0.9rem; min-height: 104px; }
  .stat-grid, .project-grid, .tool-grid, .form-grid { grid-template-columns: 1fr; }
}
