:root {
  --bg: #070b16;
  --panel: #10182b;
  --panel-2: #151f38;
  --line: #2a395f;
  --text: #f3f6ff;
  --muted: #a7b3d1;
  --faint: #7c89a8;
  --primary: #6ea8ff;
  --primary-2: #3ddc97;
  --accent2: #9b7bff;
  --danger: #ff7ab6;
  --ok: #3ddc97;
  --warn: #ffb454;
  --cyan: #45e0e0;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 16px;
  --font: "SF Pro Display", "PingFang SC", Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 85% 10%, rgba(110,168,255,.12), transparent 28%),
    radial-gradient(900px 500px at 0% 0%, rgba(110,168,255,.10), transparent 55%),
    linear-gradient(180deg, #070b16, #080d18);
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  background: rgba(12,16,24,.92);
  border-right: 1px solid var(--line);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 4px 10px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display:grid; place-items:center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px rgba(109,94,252,.35);
}
.brand-name { font-weight: 700; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.side-block { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.side-block.grow {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.side-label { color: var(--muted); font-size: 12px; }
.row-between { display:flex; justify-content:space-between; align-items:center; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 10px;
  padding: 8px 6px;
  cursor: pointer;
}
.mode.active {
  background: linear-gradient(135deg, rgba(110,168,255,.25), rgba(61,220,151,.12));
  border-color: rgba(110,168,255,.45);
  color: white;
}
.chapter-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.chapter-item {
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.chapter-item:hover { border-color: rgba(110,168,255,.3); }
.chapter-item.active {
  border-color: rgba(110,168,255,.5);
  background: rgba(110,168,255,.14);
}
.chapter-item .t { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.chapter-item .s { font-size: 11px; color: var(--muted); }
.side-foot { display:grid; gap:8px; }
.api-chip {
  font-size: 12px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,176,32,.1); color: #ffd089; border: 1px solid rgba(255,176,32,.2);
}
.api-chip.ok { background: rgba(61,220,151,.1); color:#9dffd0; border-color: rgba(61,220,151,.25); }
.nav-mini {
  border: 1px solid var(--line); background: transparent; border-radius: 10px;
  padding: 8px 10px; cursor: pointer; text-align: left; color: var(--muted);
}
.nav-mini:hover { color: var(--text); background: rgba(255,255,255,.04); }

.workspace { display:flex; flex-direction:column; min-width:0; min-height:0; }
.top {
  display:flex; justify-content:space-between; align-items:center;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: rgba(12,16,24,.55); backdrop-filter: blur(10px);
}
.tabs { display:flex; gap: 8px; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
}
.tab.active { background: rgba(110,168,255,.18); color: white; }
.meta { color: var(--muted); font-size: 13px; }
.panel { display:none; flex:1; min-height:0; }
.panel.active { display:flex; flex-direction:column; min-height:0; }

.write-layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.read-layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  transition: grid-template-columns .18s ease;
}
.read-layout.collapsed {
  grid-template-columns: 0 1fr;
}
.chat-pane, .draft-pane, .reader, .read-side {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.chat-pane { border-right: 1px solid var(--line); }
.read-side {
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,.12);
  overflow: hidden;
}
.read-layout.collapsed .read-side {
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}
.read-side .chapter-list { padding: 0 8px 12px; }
.read-side .chapter-item { padding: 8px 10px; }
.read-side .chapter-item .t {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.read-side .chapter-item .s { font-size: 10px; }
.reader {
  background:
    radial-gradient(800px 300px at 50% 0%, rgba(109,94,252,.06), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.015), rgba(0,0,0,.08));
}
.reader-top {
  padding: 12px 20px 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: rgba(12,16,24,.35);
}
.reader-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
}
#readerEditor {
  width: min(900px, 100%);
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 28px 40px !important;
  font-size: 16px !important;
  line-height: 1.95 !important;
  border: 0 !important;
  background: transparent !important;
  min-height: 100%;
}
.reader-view {
  width: min(900px, 100%);
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 28px 60px;
  font-size: 17px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  height: 100%;
  color: #e8eefc;
}
.reader-view .sent {
  border-radius: 8px;
  padding: 0 2px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.reader-view .sent:hover {
  background: rgba(109,94,252,.12);
}
.reader-view .sent.active {
  background: linear-gradient(90deg, rgba(109,94,252,.28), rgba(62,207,188,.16));
  box-shadow: inset 0 0 0 1px rgba(109,94,252,.35);
  color: #fff;
}
.reader-view .sent.read {
  color: #b7c1d8;
}
.reader-view .para-gap {
  display: block;
  height: 0.7em;
}
.reader-shell {
  position: relative;
}
.reader-shell.edit-mode .reader-view { display: none; }
.reader-shell.edit-mode #readerEditor { display: block !important; }
.reader-shell:not(.edit-mode) #readerEditor { display: none !important; }

.pane-head {
  display:flex; justify-content:space-between; align-items:flex-start;
  gap: 12px; padding: 14px 16px 10px;
}
.pane-head.compact { padding-bottom: 8px; }
.pane-head h2 { margin: 0; font-size: 16px; }
.pane-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.chat-stream {
  flex: 1; overflow: auto; padding: 8px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(109,94,252,.35), rgba(109,94,252,.18));
  border: 1px solid rgba(109,94,252,.3);
}
.msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.msg .actions { margin-top: 8px; display:flex; gap:8px; }
.msg .actions button {
  border: 1px solid var(--line); background: rgba(0,0,0,.2);
  border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; color: var(--muted);
}
.msg .actions button:hover { color: white; border-color: rgba(109,94,252,.4); }
.msg.system {
  align-self: center; color: var(--muted); background: transparent; border: 0; font-size: 12px;
}

.composer { border-top: 1px solid var(--line); padding: 10px 16px 14px; background: rgba(0,0,0,.15); }
.quick-prompts { display:flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quick-prompts button {
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--muted); border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.quick-prompts button:hover { color: white; border-color: rgba(109,94,252,.4); }
#chatInput, #draftEditor, #readerEditor, input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
input[type="checkbox"],
input[type="radio"],
input[type="range"],
input[type="file"] {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
#chatInput:focus, #draftEditor:focus, #readerEditor:focus, input:focus, select:focus, textarea:focus {
  border-color: rgba(109,94,252,.5);
  box-shadow: 0 0 0 3px rgba(109,94,252,.12);
}
#chatInput { resize: none; min-height: 78px; }
.composer-bar { display:flex; justify-content:space-between; align-items:center; margin-top: 8px; }
#draftEditor, #readerEditor {
  flex: 1; resize: none; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
  font-family: var(--font); font-size: 15px; line-height: 1.85; padding: 8px 22px 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.12));
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,.07); }
.btn.primary {
  border: 0;
  background: linear-gradient(135deg, var(--primary), #8fb7ff);
  color: #081018;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(110,168,255,.28);
}
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { border:0; background:transparent; color: #b7c0ff; cursor:pointer; font-size:12px; }
.row { display:flex; align-items:center; }
.gap { gap: 8px; }
.check { display:flex; align-items:center; gap: 6px; color: var(--muted); font-size: 13px; }
.check.tiny { font-size: 12px; }
.check input { width: auto; }
.muted { color: var(--muted); font-size: 12px; }

.settings-wrap { max-width: 860px; margin: 24px auto; padding: 0 18px 40px; width: 100%; }
.cardish {
  background: rgba(21,26,35,.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.form-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display:grid; gap: 6px; font-size: 13px; color: #c5cee3; }
.form-grid .full { grid-column: 1 / -1; }
.badge {
  display:inline-flex; align-items:center; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; background: rgba(255,176,32,.12); color:#ffd089; border:1px solid rgba(255,176,32,.25);
}
.badge.on { background: rgba(61,220,151,.12); color:#8dffc9; border-color: rgba(61,220,151,.25); }
.hint { margin-top: 12px; color: var(--muted); font-size: 12px; }
.console {
  margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.35);
  border: 1px solid var(--line); white-space: pre-wrap; font-family: var(--mono); font-size: 12px;
}
.hidden { display:none; }
.help { line-height: 1.9; color: #d5def2; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  background: rgba(20,26,40,.96); border: 1px solid rgba(109,94,252,.35);
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow);
  transform: translateY(12px); opacity: 0; transition: .18s ease; pointer-events: none;
  max-width: 420px;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .write-layout { grid-template-columns: 1fr; }
  .read-layout { grid-template-columns: 1fr; }
  .read-layout.collapsed { grid-template-columns: 1fr; }
  .chat-pane { border-right: 0; border-bottom: 1px solid var(--line); max-height: 48vh; }
  .read-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 28vh; }
  .read-layout.collapsed .read-side { display:none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}



/* TTS / A方案语音播报 */
.tts-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(620px, 100%);
}
.tts-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
  align-items: center;
}
.tts-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.tts-controls select {
  width: 180px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
}
.tts-controls input[type="range"] {
  width: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.tts-controls input[type="range"]:focus {
  box-shadow: none;
  border: 0;
}
.tts-progress-wrap {
  width: min(420px, 100%);
}
.tts-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  margin-bottom: 6px;
}
#ttsProgressBar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .18s ease;
}
.wrap { flex-wrap: wrap; }
#ttsStatus { text-align: right; font-size: 12px; }
@media (max-width: 1100px) {
  .tts-bar { align-items: stretch; max-width: 100%; }
  .tts-controls { justify-content: flex-start; }
  #ttsStatus { text-align: left; }
  .tts-progress-wrap { width: 100%; }
}


/* Illustration dock & selection */
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.full-block { display:grid; gap:8px; margin-top: 10px; color:#c5cee3; font-size:13px; }
.full-block textarea { min-height: 140px; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.reader { position: relative; }
.illust-dock {
  border-top: 1px solid var(--line);
  background: rgba(8,12,20,.72);
  padding: 10px 14px 14px;
  max-height: 34vh;
  overflow: auto;
}
.illust-dock-head {
  display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom: 8px;
}
.selected-box, .prompt-box {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.selected-text {
  margin-top: 4px;
  color: #dce5ff;
  font-size: 13px;
  line-height: 1.6;
  max-height: 72px;
  overflow: auto;
  white-space: pre-wrap;
}
.prompt-box textarea { margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.illust-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.illust-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  cursor: pointer;
}
.illust-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #0a0e16;
}
.illust-card .cap {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selection-bar {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(18,22,34,.96);
  border: 1px solid rgba(109,94,252,.4);
  box-shadow: var(--shadow);
  max-width: min(560px, calc(100vw - 24px));
}
.selection-bar span {
  color: #d7def5;
  font-size: 12px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  padding: 18px;
}
.modal.hidden, .selection-bar.hidden, .prompt-box.hidden { display: none; }
.modal-card {
  width: min(820px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #141a27;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.modal-card img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 12px;
  background: #0a0e16;
  margin: 10px 0;
}
.row-between { display:flex; justify-content:space-between; align-items:center; gap:10px; }


/* Library hierarchy */
.side-check { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:11px; margin: 0 0 6px; }
.side-check.tight { margin: 0 14px 8px; }
.side-check input { width:auto; }
.library-tree {
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: block;
  gap: 6px;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.library-tree.big {
  padding: 0 12px 16px;
  flex: 1 1 auto;
  min-height: 0;
}
/* custom scrollbar for long chapter lists */
.library-tree::-webkit-scrollbar { width: 8px; }
.library-tree::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.14);
  border-radius: 999px;
}
.library-tree::-webkit-scrollbar-track { background: transparent; }
.lib-novel, .lib-volume, .lib-chapter {
  border: 1px solid transparent;
  background: rgba(255,255,255,.03);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.lib-novel:hover, .lib-volume:hover, .lib-chapter:hover { border-color: rgba(109,94,252,.28); }
.lib-novel.active, .lib-volume.active, .lib-chapter.active {
  border-color: rgba(109,94,252,.5);
  background: rgba(109,94,252,.14);
}
.lib-novel .t, .lib-volume .t, .lib-chapter .t { font-size: 13px; font-weight: 600; }
.lib-novel .s, .lib-volume .s, .lib-chapter .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.lib-novel.hidden-item, .lib-volume.hidden-item, .lib-chapter.hidden-item { opacity: .55; }
.lib-children { margin-left: 10px; margin-top: 6px; display:flex; flex-direction:column; gap:6px; border-left: 1px dashed rgba(255,255,255,.08); padding-left: 8px; }
.lib-children.collapsed { display: none !important; }
.lib-badge {
  display:inline-block; margin-left:6px; font-size:10px; padding:1px 6px; border-radius:999px;
  background: rgba(255,176,32,.12); color:#ffd089; border:1px solid rgba(255,176,32,.2);
}
.library-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 340px 1fr;
  overflow: hidden;
}
.lib-left {
  border-right: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lib-right { min-height:0; overflow:auto; padding-bottom: 20px; }
.lib-detail {
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.lib-detail .form-grid { margin-top: 10px; }
.import-box {
  margin: 0 16px 20px;
  padding: 14px;
  border: 1px dashed rgba(109,94,252,.35);
  border-radius: 14px;
  background: rgba(109,94,252,.06);
}
.import-box h3 { margin: 0 0 6px; font-size: 15px; }
.input.sm { max-width: 220px; }
@media (max-width: 1100px) {
  .library-layout { grid-template-columns: 1fr; }
  .lib-left { border-right:0; border-bottom:1px solid var(--line); max-height: 42vh; }
}


/* Auto writer monitor */
.auto-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px 1fr;
}
.auto-left, .auto-right { min-height: 0; display: flex; flex-direction: column; }
.auto-left { border-right: 1px solid var(--line); }
.auto-right { overflow: auto; }
.auto-job-list { overflow: auto; padding: 0 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.auto-job {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.auto-job.active { border-color: rgba(109,94,252,.5); background: rgba(109,94,252,.14); }
.auto-job .t { font-weight: 700; margin-bottom: 4px; }
.auto-job .s { color: var(--muted); font-size: 12px; line-height: 1.5; }
.badge-run { background: rgba(61,220,151,.12); color:#8dffc9; border:1px solid rgba(61,220,151,.25); padding:2px 8px; border-radius:999px; font-size:11px; }
.badge-err { background: rgba(255,107,122,.12); color:#ffb1b9; border:1px solid rgba(255,107,122,.25); padding:2px 8px; border-radius:999px; font-size:11px; }
.badge-idle { background: rgba(255,255,255,.06); color:#c5cee3; border:1px solid var(--line); padding:2px 8px; border-radius:999px; font-size:11px; }
.badge-done { background: rgba(109,94,252,.14); color:#d5ccff; border:1px solid rgba(109,94,252,.3); padding:2px 8px; border-radius:999px; font-size:11px; }
.auto-logs {
  margin-top: 10px;
  max-height: 320px;
  overflow: auto;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #d5def2;
}
.cardish-lite {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(62,207,188,.06);
}
.mini-list { margin: 8px 0 0; padding-left: 18px; color: #c9d3ea; line-height: 1.7; font-size: 13px; }
.stat-inline { display:flex; flex-wrap:wrap; gap:8px; margin: 8px 0 12px; }
.stat-chip { font-size:12px; color:#d7def5; background: rgba(255,255,255,.04); border:1px solid var(--line); border-radius:999px; padding:4px 10px; }
@media (max-width: 1100px) {
  .auto-layout { grid-template-columns: 1fr; }
  .auto-left { border-right:0; border-bottom:1px solid var(--line); max-height: 36vh; }
}


/* library row actions */
.lib-block { display: flex; flex-direction: column; gap: 6px; }
.lib-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.03);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.lib-row:hover { border-color: rgba(109,94,252,.28); }
.lib-row.active {
  border-color: rgba(109,94,252,.5);
  background: rgba(109,94,252,.14);
}
.lib-main { min-width: 0; flex: 1; }
.lib-ops {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0.85;
}
.lib-row:hover .lib-ops, .lib-row.active .lib-ops { opacity: 1; }
.lib-op {
  border: 1px solid var(--line);
  background: rgba(0,0,0,.25);
  color: #d7def5;
  border-radius: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.lib-op:hover { border-color: rgba(109,94,252,.45); color: #fff; }
.lib-op.danger { color: #ffb4bc; border-color: rgba(255,107,122,.35); }
.lib-op.danger:hover { background: rgba(255,107,122,.16); color: #fff; border-color: rgba(255,107,122,.55); }
.lib-novel.hidden-item, .lib-volume.hidden-item, .lib-chapter.hidden-item { opacity: .55; }


/* Beautiful auto-job wizard modal */
.wizard-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(109,94,252,.2), transparent 50%),
    radial-gradient(700px 400px at 90% 100%, rgba(62,207,188,.12), transparent 45%),
    rgba(4, 8, 16, .72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 18px;
}
.wizard-modal.hidden { display: none; }
.wizard-card {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.1);
  background:
    linear-gradient(180deg, rgba(28,34,52,.97), rgba(16,20,32,.98));
  box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
}
.wizard-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 20px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.wizard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #b9b0ff;
  background: rgba(109,94,252,.14);
  border: 1px solid rgba(109,94,252,.28);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 8px;
}
.wizard-head h2 { margin: 0; font-size: 22px; }
.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 20px;
}
.w-step {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.w-step.active {
  color: #fff;
  border-color: rgba(109,94,252,.45);
  background: linear-gradient(90deg, rgba(109,94,252,.28), rgba(62,207,188,.12));
  box-shadow: 0 0 0 1px rgba(109,94,252,.12);
}
.w-step.done {
  color: #9dffd0;
  border-color: rgba(61,220,151,.25);
  background: rgba(61,220,151,.08);
}
.wizard-body {
  flex: 1;
  overflow: auto;
  padding: 6px 20px 18px;
}
.wizard-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.16);
}
.wizard-section { margin-top: 8px; }
.wizard-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #dce5ff;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.choice-card {
  text-align: left;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
  color: inherit;
  transition: .15s ease;
}
.choice-card:hover {
  border-color: rgba(109,94,252,.35);
  transform: translateY(-1px);
}
.choice-card.active {
  border-color: rgba(109,94,252,.55);
  background: linear-gradient(180deg, rgba(109,94,252,.2), rgba(109,94,252,.08));
  box-shadow: 0 10px 24px rgba(109,94,252,.15);
}
.choice-card .ct { font-weight: 700; margin-bottom: 4px; }
.choice-card .cd { color: var(--muted); font-size: 12px; line-height: 1.55; }
.choice-card .cm {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-mini {
  font-size: 11px;
  color: #d5def2;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 3px 8px;
}
.ai-banner {
  border: 1px solid rgba(62,207,188,.25);
  background: linear-gradient(135deg, rgba(62,207,188,.1), rgba(109,94,252,.08));
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ai-banner .g { font-weight: 700; margin-bottom: 4px; }
.ai-banner .s { color: #c9d3ea; font-size: 13px; line-height: 1.6; }
.tip-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}
.tip-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  color: #d5def2;
  font-size: 13px;
  line-height: 1.55;
}
.tip-item i {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font-style: normal; font-size: 11px;
  background: rgba(109,94,252,.2); color: #d5ccff;
  flex-shrink: 0; margin-top: 1px;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-choice {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03);
  color: #d7def5;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
}
.pill-choice.active {
  border-color: rgba(109,94,252,.5);
  background: rgba(109,94,252,.18);
  color: #fff;
}
.wizard-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.wizard-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #c5cee3;
}
.wizard-form .full { grid-column: 1 / -1; }
.wizard-form input, .wizard-form select, .wizard-form textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.25);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}
.wizard-form input:focus, .wizard-form select:focus, .wizard-form textarea:focus {
  border-color: rgba(109,94,252,.5);
  box-shadow: 0 0 0 3px rgba(109,94,252,.12);
}
.wizard-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  gap: 10px;
  text-align: center;
}
.loader-dot {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: #8b7dff;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.summary-box {
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 8px;
}
.summary-box .line { display:flex; justify-content: space-between; gap: 12px; color: #d7def5; font-size: 13px; }
.summary-box .line span:last-child { color: #fff; text-align: right; }
@media (max-width: 760px) {
  .wizard-form { grid-template-columns: 1fr; }
  .wizard-steps { grid-template-columns: 1fr; }
}


/* AI chat guide wizard */
.chat-wizard { width: min(860px, 100%); }
.chat-setup { padding: 8px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.setup-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.setup-row label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #c5cee3;
}
.setup-row select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.25);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}
.setup-hint { margin-top: 8px; font-size: 12px; }
.chat-guide-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 0 0 12px;
}
.chat-guide-body.hidden { display: none; }
.chat-guide-stream {
  flex: 1;
  overflow: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 42vh;
}
.cg-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
.cg-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.cg-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(109,94,252,.35), rgba(109,94,252,.16));
  border: 1px solid rgba(109,94,252,.3);
}
.cg-msg .who {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.cg-msg.system {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
}
.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 10px;
}
.chat-quick button {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #d7def5;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
}
.chat-quick button:hover {
  border-color: rgba(109,94,252,.45);
  background: rgba(109,94,252,.14);
  color: #fff;
}
.chat-guide-composer {
  padding: 0 20px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 10px;
}
.chat-guide-composer textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.25);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  resize: none;
  outline: none;
  min-height: 68px;
}
.chat-guide-composer textarea:focus {
  border-color: rgba(109,94,252,.5);
  box-shadow: 0 0 0 3px rgba(109,94,252,.12);
}
.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.plan-card {
  margin: 8px 20px 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(61,220,151,.25);
  background: linear-gradient(180deg, rgba(61,220,151,.08), rgba(109,94,252,.06));
}
.plan-card.hidden { display: none; }
.plan-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.plan-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #c5cee3;
}
.plan-grid input {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.22);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
}
@media (max-width: 760px) {
  .setup-row { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
}


/* collapse / expand */
.lib-children {
  margin-left: 10px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 1px dashed rgba(255,255,255,.08);
  padding-left: 8px;
}
.lib-children.collapsed { display: none !important; }
.lib-toggle {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #c5cee3;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
  padding: 0;
}
.lib-toggle:hover {
  border-color: rgba(109,94,252,.45);
  color: #fff;
  background: rgba(109,94,252,.14);
}
.lib-row .lib-main { min-width: 0; flex: 1; }
.lib-row-left {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.lib-count {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
}
.library-tree .lib-block { margin-bottom: 6px; }
.side-block .library-tree {
  max-height: none;
}

/* ===== Hub + Auto Canvas (product redesign) ===== */
.app.hub {
  grid-template-columns: 1fr;
  grid-template-rows: 60px 1fr;
  height: 100vh;
  background: transparent;
}
.hub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 24, 43, 0.94);
  backdrop-filter: blur(12px);
}
.hub-top .brand { padding: 0; }
.hub-top .logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: none;
}
.brand-name { font-size: 15px; }
.brand-sub { color: var(--faint); font-size: 12px; }
.hub-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.hub-tabs .tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.hub-tabs .tab.active {
  background: var(--primary);
  color: #081018;
  font-weight: 700;
}
.hub-top .top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  justify-content: flex-end;
}
.workspace {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
.canvas-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  min-height: 0;
}
.canvas-side,
.canvas-rail {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgba(10, 15, 28, 0.72);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.canvas-rail {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.canvas-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr minmax(180px, 32%);
  gap: 0;
  background: #080d18;
}
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 24, 43, 0.88);
}
.canvas-toolbar h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: .01em; }
.canvas-toolbar .muted { margin: 0; color: var(--muted); }
.toolbar-kicker {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}
.toolbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.canvas-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.btn.tiny {
  padding: 4px 8px;
  border-radius: 8px;
  min-width: 30px;
}
.infinite-canvas {
  position: relative;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  background:
    linear-gradient(rgba(42,57,95,.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,57,95,.22) 1px, transparent 1px),
    radial-gradient(circle at 80% 10%, rgba(110,168,255,.12), transparent 28%),
    #070b16;
  background-size: 40px 40px, 40px 40px, auto, auto;
}
.infinite-canvas.can-pan,
.infinite-canvas.panning { cursor: grabbing; }
.canvas-hint-bar {
  position: absolute;
  z-index: 3;
  left: 12px;
  top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--faint);
  background: rgba(16,24,43,.78);
  border: 1px solid rgba(42,57,95,.8);
  pointer-events: none;
}
.canvas-viewport {
  position: absolute;
  left: 0;
  top: 0;
  width: 1400px;
  height: 900px;
  transform-origin: 0 0;
  will-change: transform;
}
.canvas-links {
  position: absolute;
  inset: 0;
  width: 1400px;
  height: 900px;
  pointer-events: none;
  overflow: visible;
}
.canvas-nodes {
  position: absolute;
  inset: 0;
  width: 1400px;
  height: 900px;
  margin: 0;
}
.canvas-empty {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 72px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21, 31, 56, 0.92);
  box-shadow: var(--shadow);
}
.canvas-empty .kicker {
  color: var(--primary);
  font-size: 12px;
  letter-spacing: .08em;
  font-weight: 700;
  margin-bottom: 8px;
}
.canvas-empty h3 { margin: 0 0 8px; font-size: 26px; }
.canvas-empty p { color: var(--muted); line-height: 1.6; }
.path-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 18px;
}
.path-steps .step {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.path-steps .step b {
  display: block;
  color: var(--primary);
  margin-bottom: 6px;
  font-size: 12px;
}
.canvas-node {
  position: absolute;
  min-width: 170px;
  max-width: 250px;
  border-radius: 14px;
  background: rgba(21, 31, 56, 0.96);
  border: 1px solid var(--line);
  padding: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  cursor: default;
  user-select: none;
}
.canvas-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(0,0,0,.35);
}
.canvas-node.chapter { cursor: pointer; }
.canvas-node .k {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.canvas-node .t {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.canvas-node .d {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.canvas-node.book { border-color: #5b6f99; }
.canvas-node.bible { border-color: #2f9d6d; }
.canvas-node.job { border-color: #3d6db8; box-shadow: 0 0 0 1px rgba(110,168,255,.12), 0 12px 28px rgba(0,0,0,.28); }
.canvas-node.chapter { border-color: #2f9e9e; }
.canvas-node.chapter.running { border-color: #c48a34; box-shadow: 0 0 0 1px rgba(255,180,84,.18), 0 12px 28px rgba(0,0,0,.28); }
.canvas-node.chapter.queued { border-color: #5b6f99; opacity: .92; }
.canvas-node.guard { border-color: #c45f8d; }
.canvas-node.progress { border-color: #7a63c8; }
.canvas-node .badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge.ok { background: rgba(61,220,151,.12); color: var(--ok); }
.badge.run { background: rgba(255,180,84,.14); color: var(--warn); }
.badge.wait { background: rgba(124,137,168,.16); color: var(--faint); }
.badge.err { background: rgba(255,122,182,.14); color: var(--danger); }
.mini-progress {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: #243356;
  overflow: hidden;
}
.mini-progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.canvas-bottom {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  overflow: auto;
  background: rgba(12, 16, 24, 0.92);
}
.canvas-side .card,
.canvas-rail .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.canvas-side .card .h,
.canvas-rail .card .h {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--primary);
  font-weight: 700;
  margin: 2px 0 10px;
}
.side-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.privacy-card .item,
.canvas-rail .item {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}
.privacy-card .item.soft,
.canvas-rail .item.soft {
  color: var(--text);
}
.progress-block { margin-bottom: 10px; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #243356;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .25s ease;
}
.stat-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.auto-logs {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: #c9d6ff;
  background: #0c1324;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
}
.api-chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.api-chip.ok {
  color: #081018;
  background: linear-gradient(135deg, rgba(61,220,151,.9), rgba(62,207,188,.75));
  border-color: transparent;
  font-weight: 700;
}
#panel-auto.panel.active {
  display: block;
  height: 100%;
}
#panel-auto .canvas-shell { height: 100%; }

/* auto job list polish inside canvas side */
.canvas-side .auto-job-list {
  padding: 0;
  max-height: 280px;
}
.canvas-side .auto-job {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.canvas-side .auto-job.active {
  border-color: #3d6db8;
  box-shadow: inset 0 0 0 1px rgba(110,168,255,.25);
  background: rgba(61,109,184,.16);
}

@media (max-width: 1200px) {
  .canvas-shell {
    grid-template-columns: 240px 1fr;
  }
  .canvas-rail { display: none; }
}
@media (max-width: 900px) {
  .hub-top { flex-wrap: wrap; height: auto; padding: 10px 12px; }
  .canvas-shell { grid-template-columns: 1fr; }
  .canvas-side { display: none; }
  .canvas-stage { grid-template-rows: auto 1fr minmax(220px, 42%); }
  .path-steps { grid-template-columns: 1fr; }
}


/* final control-room polish */
.badge-run, .badge-err, .badge-done, .badge-idle {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-run { background: rgba(255,180,84,.14); color: var(--warn); border: 1px solid rgba(255,180,84,.25); }
.badge-err { background: rgba(255,122,182,.14); color: var(--danger); border: 1px solid rgba(255,122,182,.25); }
.badge-done { background: rgba(61,220,151,.12); color: var(--ok); border: 1px solid rgba(61,220,151,.25); }
.badge-idle { background: rgba(124,137,168,.16); color: var(--faint); border: 1px solid rgba(124,137,168,.25); }
.canvas-side .library-tree { max-height: 220px; overflow: auto; }
.canvas-bottom .form-grid input,
.canvas-bottom .form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0c1324;
  border-radius: 10px;
  padding: 8px 10px;
}


/* settings page simplified */
#panel-settings.panel.active {
  display: block;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 80% 0%, rgba(110,168,255,.10), transparent 30%),
    #070b16;
}
.settings-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 48px;
}
.settings-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.settings-hero h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.settings-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.settings-card {
  background: rgba(16, 24, 43, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.settings-card.full { grid-column: 1 / -1; }
.settings-card.optional { border-color: rgba(110,168,255,.25); }
.settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-card-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.settings-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.must, .opt {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}
.must {
  background: rgba(255,180,84,.14);
  color: var(--warn);
  border: 1px solid rgba(255,180,84,.25);
}
.opt {
  background: rgba(124,137,168,.16);
  color: var(--faint);
  border: 1px solid rgba(124,137,168,.25);
}
.simple-form {
  display: grid;
  gap: 10px;
}
.simple-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #c5cee3;
}
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.switch-line {
  display: flex !important;
  align-items: center;
  gap: 10px;
  grid-template-columns: none !important;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  color: var(--text) !important;
  font-weight: 600;
}
.switch-line input {
  width: 16px !important;
  height: 16px !important;
  margin: 0;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.skill-cols label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #c5cee3;
}
.skill-cols textarea {
  min-height: 140px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-hero { flex-direction: column; }
  .two-cols, .skill-cols { grid-template-columns: 1fr; }
}


.provider-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.chip-btn:hover {
  color: var(--text);
  border-color: rgba(110,168,255,.45);
  background: rgba(110,168,255,.08);
}



/* ===== Simple Auto Canvas (kid-friendly) ===== */
.simple-auto {
  grid-template-columns: 260px 1fr 280px;
}
.simple-side .hero-card,
.simple-side .soft-card,
.simple-rail .card {
  background: rgba(16, 24, 43, 0.96);
}
.side-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.btn.big,
.btn.big-action {
  padding: 14px 18px;
  font-size: 16px;
  border-radius: 14px;
}
.simple-job-list {
  margin-top: 12px;
  max-height: 46vh;
  min-height: 120px;
  padding: 0;
  overflow: auto;
  flex: 1 1 auto;
}
.simple-job-list .auto-job {
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}
.simple-job-list .auto-job .t {
  font-size: 14px;
}
.tip-line {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}
.simple-toolbar {
  padding: 16px 18px 10px;
  border-bottom: 0;
  background: transparent;
}
.simple-toolbar h2 {
  font-size: 26px;
  margin: 0 0 4px;
}
.simple-progress-bar-wrap {
  padding: 0 18px 10px;
}
.simple-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.progress-bar.big {
  height: 12px;
  border-radius: 999px;
}
.simple-stage .infinite-canvas,
.simple-stage .story-board {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.canvas-empty {
  text-align: center;
}
.canvas-empty .empty-emoji {
  font-size: 42px;
  margin-bottom: 8px;
}
.kid-steps .step b {
  font-size: 14px;
}
.center-actions {
  justify-content: center;
}
.simple-bottom {
  border-top: 0;
  background: rgba(10, 14, 24, 0.96);
  padding: 14px 18px 18px;
}
.simple-detail .simple-job-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.summary-pill {
  border: 1px solid var(--line);
  background: rgba(110,168,255,.08);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
.ok-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(61,220,151,.10);
  border: 1px solid rgba(61,220,151,.22);
  color: #b9ffe0;
}
.err-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,122,182,.10);
  border: 1px solid rgba(255,122,182,.25);
  color: #ffd0e6;
}
.auto-advanced {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.kid-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}
.soft-logs {
  max-height: 280px;
  font-size: 12px;
}
.err-text { color: #ffb1cf; }
.canvas-node {
  max-width: 220px;
}
.canvas-node .t {
  font-size: 15px;
}
.simple-rail .stat-chip {
  font-size: 13px;
  padding: 6px 10px;
}

/* make auto page feel roomier */
.simple-auto .canvas-stage {
  grid-template-rows: auto auto 1fr minmax(160px, 28%);
}
.simple-auto .canvas-hint-bar { display: none; }

@media (max-width: 1200px) {
  .simple-auto { grid-template-columns: 240px 1fr; }
  .simple-rail { display: none; }
}
@media (max-width: 900px) {
  .simple-auto { grid-template-columns: 1fr; }
  .simple-side { display: none; }
}


/* ===== Picturebook workbench (storyboard, not infinite canvas) ===== */
#panel-picturebook.panel.active {
  display: block;
  height: 100%;
}
.simple-pb {
  height: 100%;
  display: grid;
  grid-template-columns: 250px 1fr 260px;
  min-height: 0;
}
.simple-pb .pb-side,
.simple-pb .pb-rail {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: rgba(10, 15, 28, 0.72);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.simple-pb .pb-rail {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.simple-pb .pb-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: #080d18;
}
.pb-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px 8px;
}
.pb-top h2 {
  margin: 0 0 4px;
  font-size: 26px;
}
.pb-stepbar {
  display: flex;
  gap: 8px;
  padding: 0 18px 12px;
  flex-wrap: wrap;
}
.pb-step {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.pb-step.active {
  background: rgba(110,168,255,.16);
  color: var(--text);
  border-color: rgba(110,168,255,.45);
}
.pb-step.done {
  background: rgba(61,220,151,.10);
  color: #b9ffe0;
  border-color: rgba(61,220,151,.25);
}
.simple-pb .pb-body {
  min-height: 0;
  overflow: auto;
  padding: 8px 18px 18px;
}
.simple-pb .pb-empty {
  max-width: 720px;
  margin: 36px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21, 31, 56, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
}
.simple-pb .pb-empty .empty-emoji {
  font-size: 42px;
  margin-bottom: 8px;
}
.simple-pb .pb-empty h3 {
  margin: 0 0 8px;
  font-size: 24px;
}
.simple-pb .pb-empty p {
  color: var(--muted);
  line-height: 1.6;
}
.pb-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.pb-filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 170px);
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
}
.pb-strip-item {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(16, 24, 43, 0.96);
  color: var(--text);
  border-radius: 14px;
  padding: 12px;
  min-height: 110px;
  cursor: pointer;
}
.pb-strip-item:hover {
  border-color: rgba(110,168,255,.4);
}
.pb-strip-item.active {
  border-color: rgba(110,168,255,.7);
  box-shadow: inset 0 0 0 1px rgba(110,168,255,.25);
  background: rgba(61,109,184,.16);
}
.pb-strip-item .num {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.pb-strip-item .cap {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  min-height: 36px;
}
.pb-strip-item .st {
  font-size: 12px;
  color: var(--muted);
}
.pb-focus {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 16, 24, 0.92);
  padding: 14px;
}
.pb-focus-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.pb-focus-head .no {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}
.pb-focus-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
}
.pb-focus-img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0c1324;
}
.pb-focus-placeholder {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.02);
}
@media (max-width: 1200px) {
  .simple-pb { grid-template-columns: 230px 1fr; }
  .simple-pb .pb-rail { display: none; }
}
@media (max-width: 900px) {
  .simple-pb { grid-template-columns: 1fr; }
  .simple-pb .pb-side { display: none; }
}


/* ===== Bookshelf library ===== */
#panel-library.panel.active {
  display: block;
  height: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at 12% 0%, rgba(255,180,84,.08), transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(110,168,255,.10), transparent 26%),
    #0a0f1a;
}
.bookshelf-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 18px 28px;
  min-height: 100%;
}
.bookshelf-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.bookshelf-hero h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.bookshelf-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 14px;
  min-height: 0;
}
.shelf-stage {
  position: relative;
  border: 1px solid rgba(90, 64, 40, .45);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(58, 38, 24, .55), rgba(28, 18, 12, .88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 18px 40px rgba(0,0,0,.28);
  padding: 14px;
  min-height: 560px;
  overflow: auto;
}
.shelf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: #f3e2c8;
}
.bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 16px 14px;
  align-content: start;
  min-height: 360px;
  padding-bottom: 28px;
}
.book-spine {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  min-height: 190px;
  border-radius: 10px 14px 12px 10px;
  padding: 14px 12px;
  text-align: left;
  color: #fff8ee;
  position: relative;
  box-shadow:
    inset -8px 0 0 rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 12px 20px rgba(0,0,0,.28);
  transition: transform .14s ease, box-shadow .14s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.book-spine:hover {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow:
    inset -8px 0 0 rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 18px 28px rgba(0,0,0,.35);
}
.book-spine.active {
  outline: 2px solid rgba(255, 226, 168, .9);
  outline-offset: 3px;
  transform: translateY(-8px);
}
.book-spine .book-emoji {
  font-size: 22px;
  margin-bottom: 10px;
}
.book-spine .book-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.book-spine .book-meta {
  margin-top: 12px;
  font-size: 12px;
  opacity: .92;
  line-height: 1.4;
}
.book-spine .book-ribbon {
  position: absolute;
  top: 10px;
  right: -22px;
  transform: rotate(35deg);
  background: rgba(0,0,0,.22);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 26px;
}
.book-spine.tone-0 { background: linear-gradient(160deg, #c46a4a, #8b3a2d); }
.book-spine.tone-1 { background: linear-gradient(160deg, #3f78c8, #244f8d); }
.book-spine.tone-2 { background: linear-gradient(160deg, #3fa57a, #1f6d4d); }
.book-spine.tone-3 { background: linear-gradient(160deg, #8d6ad8, #5a3ea0); }
.book-spine.tone-4 { background: linear-gradient(160deg, #d39a3c, #9a6520); }
.book-spine.tone-5 { background: linear-gradient(160deg, #4f90a8, #2d6176); }
.book-spine.hidden-item { opacity: .55; filter: grayscale(.2); }
.book-add-tile {
  min-height: 190px;
  border-radius: 14px;
  border: 2px dashed rgba(243, 226, 200, .35);
  background: rgba(255,255,255,.04);
  color: #f3e2c8;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
}
.book-add-tile:hover {
  background: rgba(255,255,255,.07);
}
.shelf-plank {
  height: 14px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8a623d, #5b3c24);
  box-shadow: 0 8px 16px rgba(0,0,0,.25);
}
.shelf-detail-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 24, 43, 0.94);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 560px;
  overflow: auto;
}
.shelf-detail-card .pane-head {
  margin-bottom: 10px;
}
.shelf-detail-card h3 {
  margin: 0 0 4px;
  font-size: 20px;
}
.lib-detail-body .vol-card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.lib-detail-body .vol-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.lib-detail-body .chap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lib-detail-body .chap-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  background: rgba(0,0,0,.16);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
}
.lib-detail-body .chap-item:hover,
.lib-detail-body .chap-item.active {
  border-color: rgba(110,168,255,.4);
  background: rgba(110,168,255,.10);
}
.lib-detail-body .chap-item .t { font-weight: 700; font-size: 13px; }
.lib-detail-body .chap-item .s { color: var(--muted); font-size: 12px; }
.shelf-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #f3e2c8;
  padding: 48px 12px;
  opacity: .9;
}
@media (max-width: 1000px) {
  .bookshelf-layout { grid-template-columns: 1fr; }
  .shelf-stage, .shelf-detail-card { min-height: auto; }
}


/* ===== Reader chrome tidy ===== */
#panel-read.panel.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.read-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
.read-layout.collapsed {
  grid-template-columns: 0 1fr;
}
.read-side {
  border-right: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.72);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
}
.read-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 4px;
}
.read-layout.collapsed .read-side {
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}
.reader-shell {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid !important;
  grid-template-rows: auto 1fr auto;
  overflow: hidden !important;
  justify-content: stretch !important;
  position: relative;
  background:
    radial-gradient(800px 320px at 50% 0%, rgba(110,168,255,.06), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.015), rgba(0,0,0,.08));
}
.reader-chrome {
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.88);
  backdrop-filter: blur(10px);
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}
.reader-chrome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reader-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.reader-title-group h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  max-width: 42vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-title-group .muted {
  margin: 2px 0 0;
  font-size: 12px;
}
.reader-action-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.btn-group .btn {
  margin: 0;
}
.tts-row {
  justify-content: flex-start;
}
.reader-shell .tts-bar {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
}
.tts-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.tts-field select {
  width: 180px;
  min-width: 160px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
}
.tts-field input[type="range"] {
  width: 110px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.tts-status {
  margin-left: auto;
  font-size: 12px;
}
.reader-content {
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
}
.reader-content .reader-view,
.reader-content #readerEditor {
  width: min(900px, 100%);
}
.reader-shell.edit-mode .reader-view { display: none; }
.reader-shell.edit-mode #readerEditor { display: block !important; }
.reader-shell:not(.edit-mode) #readerEditor { display: none !important; }

.illust-panel {
  border-top: 1px solid var(--line);
  background: rgba(8,12,20,.82);
  padding: 10px 14px 12px;
  max-height: 28vh;
  overflow: auto;
}
.illust-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.illust-panel-head .muted {
  margin-left: 8px;
}

@media (max-width: 1100px) {
  .read-layout { grid-template-columns: 1fr; }
  .read-layout.collapsed { grid-template-columns: 1fr; }
  .read-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 28vh;
  }
  .read-layout.collapsed .read-side { display: none; }
  .reader-chrome-row {
    flex-direction: column;
    align-items: stretch;
  }
  .reader-action-groups {
    justify-content: flex-start;
  }
  .reader-title-group h2 { max-width: 70vw; }
  .tts-status { margin-left: 0; width: 100%; }
}


/* ===== Write panel tidy ===== */
#panel-write.panel.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.tidy-write {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  overflow: hidden;
}
.tidy-write .chat-pane,
.tidy-write .draft-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  overflow: hidden;
}
.tidy-write .chat-pane {
  grid-template-rows: auto 1fr auto;
  border-right: 1px solid var(--line);
}
.tidy-write .draft-pane {
  grid-template-rows: auto 1fr;
  background:
    radial-gradient(700px 260px at 50% 0%, rgba(110,168,255,.05), transparent 55%),
    rgba(0,0,0,.08);
}
.write-chrome {
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.88);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
}
.write-chrome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.write-title-group {
  min-width: 0;
}
.write-title-group h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.write-title-group .muted,
.write-title-group p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.write-action-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}
.tidy-write .btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.tidy-write .mode-group {
  gap: 6px;
}
.tidy-write .mode {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-width: 64px;
}
.tidy-write .mode:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}
.tidy-write .mode.active {
  color: #081018;
  background: linear-gradient(135deg, rgba(110,168,255,.95), rgba(143,183,255,.85));
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(110,168,255,.22);
}
.write-check {
  padding: 0 6px;
  color: var(--muted);
  white-space: nowrap;
}
.tidy-write .chat-stream {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
  background:
    radial-gradient(700px 240px at 20% 0%, rgba(110,168,255,.05), transparent 50%),
    transparent;
}
.tidy-composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 14px;
  background: rgba(8, 12, 20, 0.9);
}
.tidy-composer .quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.tidy-composer .quick-prompts button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.tidy-composer .quick-prompts button:hover {
  color: var(--text);
  border-color: rgba(110,168,255,.4);
  background: rgba(110,168,255,.08);
}
.tidy-composer .composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.tidy-composer #chatInput {
  min-height: 78px;
  resize: vertical;
  max-height: 180px;
}
.tidy-composer #btnSend {
  min-width: 88px;
  height: 44px;
  align-self: end;
}
.composer-foot {
  margin-top: 8px;
}
.tidy-write #draftEditor {
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  resize: none;
  padding: 18px 20px 28px;
  font-size: 15px;
  line-height: 1.85;
  background: transparent;
}

@media (max-width: 1100px) {
  .tidy-write {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(46vh, 1fr) minmax(40vh, 1fr);
  }
  .tidy-write .chat-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .write-chrome-row {
    flex-direction: column;
    align-items: stretch;
  }
  .write-action-groups {
    justify-content: flex-start;
  }
}


/* ===== Picturebook chrome tidy ===== */
#panel-picturebook.panel.active {
  display: block;
  height: 100%;
}
.tidy-pb {
  height: 100%;
  display: grid;
  grid-template-columns: 250px 1fr 260px;
  min-height: 0;
}
.tidy-pb .pb-side,
.tidy-pb .pb-rail {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: rgba(10, 15, 28, 0.72);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tidy-pb .pb-rail {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.tidy-pb .pb-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #080d18;
  overflow: hidden;
}
.pb-chrome {
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.9);
  backdrop-filter: blur(10px);
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pb-chrome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pb-chrome-row.secondary {
  align-items: flex-start;
  flex-wrap: wrap;
}
.pb-title-group {
  min-width: 0;
}
.pb-title-group h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  max-width: 46vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-title-group .muted {
  margin: 4px 0 0;
  font-size: 12px;
}
.pb-action-groups {
  display: flex;
  justify-content: flex-end;
}
.tidy-pb #pbActions.btn-group,
.tidy-pb .btn-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.tidy-pb #pbActions:empty {
  display: none;
}
.tidy-pb .pb-stepbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0;
}
.tidy-pb .pb-step {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.tidy-pb .pb-step.active {
  background: rgba(110,168,255,.16);
  color: var(--text);
  border-color: rgba(110,168,255,.45);
}
.tidy-pb .pb-step.done {
  background: rgba(61,220,151,.10);
  color: #b9ffe0;
  border-color: rgba(61,220,151,.25);
}
.tidy-pb .pb-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin: 0;
}
.tidy-pb .summary-pill {
  border: 1px solid var(--line);
  background: rgba(110,168,255,.08);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.tidy-pb .pb-body {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}
.tidy-pb .pb-empty {
  max-width: 720px;
  margin: 36px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21, 31, 56, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
}
.pb-strip-wrap {
  margin-bottom: 12px;
}
.pb-strip-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}
.tidy-pb .pb-filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 164px);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}
.tidy-pb .pb-strip-item {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(16, 24, 43, 0.96);
  color: var(--text);
  border-radius: 14px;
  padding: 12px;
  min-height: 108px;
  cursor: pointer;
}
.tidy-pb .pb-strip-item:hover {
  border-color: rgba(110,168,255,.4);
}
.tidy-pb .pb-strip-item.active {
  border-color: rgba(110,168,255,.7);
  box-shadow: inset 0 0 0 1px rgba(110,168,255,.25);
  background: rgba(61,109,184,.16);
}
.tidy-pb .pb-strip-item .num {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.tidy-pb .pb-strip-item .cap {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  min-height: 36px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tidy-pb .pb-strip-item .st {
  font-size: 12px;
  color: var(--muted);
}
.tidy-pb .pb-focus {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 16, 24, 0.92);
  padding: 14px;
}
.pb-focus-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.pb-focus-head .no {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}
.pb-focus-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.35;
}
.pb-focus-placeholder {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.02);
  margin-bottom: 12px;
}
.pb-focus-img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0c1324;
  margin-bottom: 12px;
}
.pb-focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pb-focus-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #c5cee3;
}
.pb-focus-grid textarea {
  min-height: 110px;
  resize: vertical;
}
.pb-focus-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.pb-focus-actions .btn-group {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}

@media (max-width: 1200px) {
  .tidy-pb { grid-template-columns: 230px 1fr; }
  .tidy-pb .pb-rail { display: none; }
}
@media (max-width: 900px) {
  .tidy-pb { grid-template-columns: 1fr; }
  .tidy-pb .pb-side { display: none; }
  .pb-chrome-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pb-action-groups,
  .tidy-pb .pb-summary {
    justify-content: flex-start;
  }
  .pb-focus-grid { grid-template-columns: 1fr; }
  .pb-title-group h2 { max-width: 80vw; }
}


/* ===== Story progress board (replaces infinite canvas) ===== */
.story-board {
  position: relative;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 20px;
  background:
    radial-gradient(circle at 12% 0%, rgba(110,168,255,.10), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(155,123,255,.08), transparent 26%),
    #070b16;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.story-board-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
}
.board-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(110,168,255,.28);
  background: linear-gradient(180deg, rgba(28,40,72,.96), rgba(16,24,43,.96));
  box-shadow: 0 16px 36px rgba(0,0,0,.28);
}
.board-kicker {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 6px;
}
.board-hero h3 {
  margin: 0 0 6px;
  font-size: 24px;
}
.board-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.board-next {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(110,168,255,.10);
  border: 1px solid rgba(110,168,255,.18);
  color: #d7e6ff;
  line-height: 1.5;
  font-size: 14px;
}
.board-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.board-hero-side {
  display: grid;
  gap: 10px;
  min-width: 132px;
}
.board-metric {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  text-align: center;
}
.board-metric b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.board-metric span {
  color: var(--muted);
  font-size: 12px;
}
.board-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(16,24,43,.78);
  border: 1px solid var(--line);
}
.flow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid transparent;
  opacity: .78;
}
.flow-step .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #243356;
  color: #c9d5f0;
  flex: 0 0 auto;
}
.flow-step b { display:block; font-size: 13px; }
.flow-step small { color: var(--muted); font-size: 11px; }
.flow-step.done {
  opacity: 1;
  border-color: rgba(61,220,151,.22);
  background: rgba(61,220,151,.08);
}
.flow-step.done .n { background: rgba(61,220,151,.18); color: #9dffd2; }
.flow-step.now {
  opacity: 1;
  border-color: rgba(110,168,255,.35);
  background: rgba(110,168,255,.10);
  box-shadow: 0 0 0 1px rgba(110,168,255,.08);
}
.flow-step.now .n { background: rgba(110,168,255,.22); color: #d7e8ff; }
.flow-arrow { color: var(--faint); font-weight: 700; }
.board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.board-card {
  text-align: left;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(21, 31, 56, 0.96);
  padding: 14px;
  color: inherit;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  min-height: 140px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.board-card:hover {
  transform: translateY(-2px);
  border-color: rgba(110,168,255,.45);
  box-shadow: 0 16px 30px rgba(0,0,0,.28);
}
.board-card .k {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 8px;
  color: #9fb0d0;
}
.board-card .t {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}
.board-card .d {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  min-height: 34px;
}
.board-card .node-act {
  margin-top: 12px;
  font-size: 12px;
  color: #9eb6ff;
  font-weight: 700;
}
.board-card.book { border-color: rgba(91,111,153,.8); }
.board-card.style { border-color: rgba(47,157,109,.65); }
.board-card.outline { border-color: rgba(110,168,255,.45); }
.board-card.guard { border-color: rgba(196,95,141,.65); }
.board-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.board-section-title strong {
  display: block;
  font-size: 15px;
}
.board-section-title .muted {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}
.chapter-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.chapter-card {
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(47,158,158,.45);
  background: rgba(21, 31, 56, 0.96);
  padding: 14px;
  color: inherit;
  cursor: default;
  min-height: 148px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
}
.chapter-card.clickable { cursor: pointer; }
.chapter-card.clickable:hover,
.chapter-card.done:hover {
  transform: translateY(-2px);
  border-color: rgba(69,224,224,.55);
  box-shadow: 0 16px 30px rgba(0,0,0,.28);
}
.chapter-card.running {
  border-color: rgba(196,138,52,.7);
  box-shadow: 0 0 0 1px rgba(255,180,84,.12), 0 10px 24px rgba(0,0,0,.16);
}
.chapter-card.queued {
  border-color: rgba(91,111,153,.7);
  opacity: .92;
}
.chapter-card .num {
  font-size: 11px;
  font-weight: 800;
  color: #7f93b8;
  margin-bottom: 8px;
}
.chapter-card .t {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}
.chapter-card .d {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.chapter-card .badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.chapter-card .node-act {
  margin-top: 10px;
  font-size: 12px;
  color: #9eb6ff;
  font-weight: 700;
}
.board-empty-chapters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgba(110,168,255,.28);
  background: rgba(16,24,43,.72);
  color: var(--muted);
  line-height: 1.5;
}
.board-empty-chapters .empty-emoji {
  font-size: 28px;
}
.kid-status.err,
#autoPrivacyHint.err {
  color: #ffd0e6;
  border-color: rgba(255,122,182,.28);
  background: rgba(255,122,182,.08);
}
.simple-stage .story-board {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.simple-stage .story-board .auto-chat-host {
  min-height: 0;
}
.simple-auto .canvas-stage {
  grid-template-rows: auto auto minmax(320px, 1fr) minmax(150px, 26%);
}
@media (max-width: 1100px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-hero { grid-template-columns: 1fr; }
  .board-hero-side { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .board-grid { grid-template-columns: 1fr; }
  .board-hero-side { grid-template-columns: 1fr; }
}

/* legacy interactive styles retained for other surfaces */
/* ===== Interactive auto canvas ===== */
.canvas-node.clickable {
  cursor: pointer;
}
.canvas-node.clickable:hover {
  transform: translateY(-3px);
  border-color: rgba(110,168,255,.55);
}
.canvas-node .node-act {
  margin-top: 8px;
  font-size: 11px;
  color: #9eb6ff;
  font-weight: 700;
}
.canvas-node .node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.canvas-node .btn.mini {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.canvas-guide {
  position: absolute;
  left: 48px;
  top: 12px;
  z-index: 2;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(110,168,255,.28);
  background: rgba(12, 18, 34, 0.92);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  pointer-events: none;
}
.canvas-guide .g-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.canvas-guide .g-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.simple-auto .canvas-zoom-controls.quiet {
  opacity: 0.7;
}
.simple-auto .canvas-zoom-controls.quiet:hover {
  opacity: 1;
}


/* settings media chips */
.chip-btn.primary-chip {
  border-color: rgba(110,168,255,.45);
  background: rgba(110,168,255,.14);
  color: #d7e8ff;
  font-weight: 700;
}
.settings-badges .badge.on {
  background: rgba(61,220,151,.12);
  color: var(--ok);
  border-color: rgba(61,220,151,.28);
}
.settings-grid {
  align-items: start;
}
#panel-settings .settings-card.optional h3 b {
  font-weight: 800;
}


/* cross project nav - HIGH CONTRAST switch buttons */
.cross-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.cross-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1;
  border: 2px solid transparent;
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.cross-link:hover {
  transform: translateY(-1px) scale(1.03);
  filter: brightness(1.06);
}
.cross-link:active {
  transform: translateY(0) scale(0.99);
}
/* portal = vivid amber, totally different from blue theme */
.cross-link.cross-portal {
  color: #1a1200;
  background: linear-gradient(135deg, #ffd84a 0%, #ffb300 55%, #ff8a00 100%);
  border-color: #ffe89a;
  box-shadow:
    0 0 0 2px rgba(255, 196, 0, .28),
    0 10px 22px rgba(255, 160, 0, .35);
}
/* switch to canvas = hot magenta/pink, strongly separated from novel blue/green */
.cross-link.cross-switch,
.cross-link.primary {
  color: #fff7fb;
  background: linear-gradient(135deg, #ff3d9a 0%, #ff2d6f 48%, #ff6a3d 100%);
  border-color: #ffb3d4;
  box-shadow:
    0 0 0 2px rgba(255, 61, 154, .30),
    0 12px 24px rgba(255, 45, 111, .38);
  animation: crossPulse 1.8s ease-in-out infinite;
}
@keyframes crossPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,61,154,.30), 0 12px 24px rgba(255,45,111,.38); }
  50% { box-shadow: 0 0 0 4px rgba(255,61,154,.18), 0 14px 28px rgba(255,45,111,.48); }
}
.hub-top .top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 900px) {
  .cross-nav { width: 100%; }
  .cross-link { flex: 1 1 auto; min-height: 40px; }
}


/* model picker in settings */
.model-picker-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(110,168,255,.22);
  background: rgba(110,168,255,.06);
}
.model-picker-head {
  align-items: center;
  gap: 8px;
}
.model-picker-block select,
.model-picker-block input {
  width: 100%;
}
.model-picker-block #imageModelMeta,
.model-picker-block #videoModelMeta {
  margin: 0;
  min-height: 18px;
}
.model-picker-block .ok-text { color: #9dffd2; }
.model-picker-block .err-text { color: #ffb1cf; }
.soft-align {
  display: flex;
  align-items: center;
  min-height: 42px;
}


/* ===== TIDY API SETTINGS ===== */
#panel-settings.panel.active {
  display: block;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 80% 0%, rgba(110,168,255,.10), transparent 30%),
    #070b16;
}
.tidy-settings {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}
.tidy-settings .settings-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 24, 43, 0.88);
}
.tidy-settings .settings-hero h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.tidy-settings .settings-hero-copy {
  min-width: 0;
}
.tidy-settings .settings-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tidy-settings .settings-stack {
  display: grid;
  gap: 14px;
}
.tidy-settings .settings-card {
  background: rgba(16, 24, 43, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.tidy-settings .settings-card.optional {
  border-color: rgba(110,168,255,.22);
}
.tidy-settings .settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(91,111,153,.28);
}
.tidy-settings .settings-card-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.tidy-settings .settings-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.tidy-settings .card-index {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--primary);
}
.tidy-settings .settings-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.tidy-settings .form-section {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(91,111,153,.22);
  background: rgba(255,255,255,.02);
}
.tidy-settings .form-section:last-child {
  margin-bottom: 0;
}
.tidy-settings .section-label {
  font-size: 12px;
  font-weight: 800;
  color: #9eb6ff;
  letter-spacing: .04em;
}
.tidy-settings .simple-form,
.tidy-settings .form-grid-3 {
  display: grid;
  gap: 10px;
}
.tidy-settings .form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tidy-settings .form-grid-3 .span-2 {
  grid-column: span 2;
}
.tidy-settings .two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tidy-settings label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #c5cee3;
  min-width: 0;
}
.tidy-settings input,
.tidy-settings select,
.tidy-settings textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0c1324;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
}
.tidy-settings input:focus,
.tidy-settings select:focus,
.tidy-settings textarea:focus {
  outline: none;
  border-color: rgba(110,168,255,.55);
  box-shadow: 0 0 0 3px rgba(110,168,255,.12);
}
.tidy-settings .switch-line.compact {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  color: var(--text) !important;
  font-weight: 700;
  white-space: nowrap;
  grid-template-columns: none !important;
}
.tidy-settings .provider-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tidy-settings .chip-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.tidy-settings .chip-btn:hover,
.tidy-settings .chip-btn.primary-chip {
  color: var(--text);
  border-color: rgba(110,168,255,.45);
  background: rgba(110,168,255,.10);
}
.tidy-settings .model-picker-block {
  border-color: rgba(110,168,255,.28);
  background: rgba(110,168,255,.06);
}
.tidy-settings .model-picker-head {
  align-items: center;
  gap: 8px;
}
.tidy-settings .model-picker-block .hint {
  margin: 0;
  min-height: 18px;
  line-height: 1.45;
}
.tidy-settings .field-note,
.tidy-settings .hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.tidy-settings .settings-actions-card {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  background: rgba(12, 18, 34, 0.96);
  backdrop-filter: blur(10px);
  border-color: rgba(110,168,255,.28);
}
.tidy-settings .settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.tidy-settings .settings-actions .btn {
  min-height: 40px;
}
.tidy-settings .settings-actions .btn.primary {
  min-width: 140px;
}
.tidy-settings .console {
  margin-top: 10px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.tidy-settings .skill-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tidy-settings .skill-cols textarea {
  min-height: 140px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 980px) {
  .tidy-settings .settings-media-grid,
  .tidy-settings .form-grid-3,
  .tidy-settings .two-cols,
  .tidy-settings .skill-cols {
    grid-template-columns: 1fr;
  }
  .tidy-settings .form-grid-3 .span-2 {
    grid-column: auto;
  }
  .tidy-settings .settings-hero {
    flex-direction: column;
  }
  .tidy-settings .settings-badges {
    justify-content: flex-start;
  }
}


/* just saved chapter highlight in bookshelf */
.chap-item.just-saved {
  border-color: #35d0a0 !important;
  box-shadow: 0 0 0 1px rgba(53, 208, 160, 0.35), 0 8px 24px rgba(53, 208, 160, 0.12);
  background: linear-gradient(180deg, rgba(53,208,160,0.14), rgba(53,208,160,0.05));
}
.chap-item.just-saved .muted {
  color: #35d0a0 !important;
  font-weight: 700;
}


/* ===== Reader content visibility hard guarantee ===== */
#panel-read .reader-content {
  min-height: 320px !important;
  flex: 1 1 auto;
  overflow: auto !important;
}
#panel-read .reader-view {
  display: block !important;
  min-height: 280px !important;
  color: #e8eefc !important;
  opacity: 1 !important;
  visibility: visible !important;
}
#panel-read .reader-shell.edit-mode .reader-view {
  display: none !important;
}
#panel-read .reader-shell:not(.edit-mode) #readerEditor {
  display: none !important;
}
#panel-read .reader-shell.edit-mode #readerEditor {
  display: block !important;
  min-height: 280px !important;
  color: #e8eefc !important;
}
#readerCatalog {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#readerCatalog .chapter-item {
  width: 100%;
}


/* ===== Picturebook create modal beauty + progress ===== */
.pb-create-card {
  width: min(980px, 100%);
  background:
    radial-gradient(700px 280px at 12% 0%, rgba(255, 186, 92, .16), transparent 55%),
    radial-gradient(700px 300px at 90% 10%, rgba(109, 94, 252, .22), transparent 50%),
    radial-gradient(600px 280px at 70% 100%, rgba(61, 220, 151, .12), transparent 50%),
    linear-gradient(180deg, rgba(24,30,48,.98), rgba(12,16,28,.99));
}
.pb-create-head {
  align-items: stretch;
  padding-bottom: 14px;
}
.pb-create-hero h2 {
  font-size: 28px;
  letter-spacing: .01em;
}
.pb-create-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #ffe7b8;
  background: linear-gradient(90deg, rgba(255,176,84,.22), rgba(255,120,180,.12));
  border: 1px solid rgba(255,186,92,.35);
}
.pb-create-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.pb-create-steps span {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.pb-create-steps span.on {
  color: #fff;
  border-color: rgba(109,94,252,.45);
  background: linear-gradient(90deg, rgba(109,94,252,.32), rgba(62,207,188,.14));
}
.pb-create-body { padding-top: 8px; }
.pb-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.pb-create-panel {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.03);
}
.pb-create-panel.soft {
  background:
    linear-gradient(180deg, rgba(109,94,252,.08), rgba(255,255,255,.02));
}
.pb-create-label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #b9c6ea;
  margin-bottom: 10px;
}
.pb-style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pb-style-chips .chip {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #e7eeff;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: .15s ease;
}
.pb-style-chips .chip:hover,
.pb-style-chips .chip.active {
  border-color: rgba(109,94,252,.5);
  background: linear-gradient(90deg, rgba(109,94,252,.28), rgba(62,207,188,.12));
  color: #fff;
  transform: translateY(-1px);
}
.pb-create-tip {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,.12);
  color: #c7d2ee;
  font-size: 12px;
  line-height: 1.55;
  background: rgba(0,0,0,.14);
}
.pb-create-foot {
  align-items: center;
}

.pb-progress-card {
  width: min(720px, 100%);
  padding: 22px;
  gap: 14px;
  background:
    radial-gradient(500px 220px at 15% 0%, rgba(109,94,252,.24), transparent 55%),
    radial-gradient(420px 220px at 100% 20%, rgba(61,220,151,.14), transparent 50%),
    linear-gradient(180deg, rgba(22,28,44,.98), rgba(12,16,28,.99));
}
.pb-progress-art {
  position: relative;
  height: 84px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
}
.pb-orb {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(109,94,252,.18) 45%, transparent 70%);
  animation: pbPulse 2.2s ease-in-out infinite;
}
.pb-orb.delay { animation-delay: .6s; transform: scale(.72); opacity: .7; }
.pb-brush {
  position: relative;
  z-index: 1;
  font-size: 34px;
  filter: drop-shadow(0 8px 18px rgba(109,94,252,.35));
  animation: pbFloat 1.8s ease-in-out infinite;
}
.pb-progress-copy h2 { margin: 6px 0 6px; font-size: 24px; }
.pb-progress-meter { margin-top: 4px; }
.pb-progress-top,
.pb-inline-progress .pb-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.pb-progress-top strong,
.pb-inline-progress .pb-progress-top strong {
  font-size: 22px;
  color: #9dffd0;
}
.pb-progress-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.pb-anim-bar {
  position: relative;
  overflow: hidden;
}
.pb-anim-bar > i {
  position: relative;
  transition: width .45s ease;
  background: linear-gradient(90deg, #6ea8ff, #9b7bff 45%, #3ddc97 90%) !important;
}
.pb-anim-bar > i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-100%);
  animation: pbShimmer 1.4s linear infinite;
}
.pb-progress-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  margin-top: 4px;
}
.pb-progress-page {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255,255,255,.03);
  font-size: 12px;
  min-height: 64px;
}
.pb-progress-page .n { color: #9bb0ff; font-size: 11px; margin-bottom: 4px; }
.pb-progress-page .s { color: var(--muted); }
.pb-progress-page.done {
  border-color: rgba(61,220,151,.35);
  background: rgba(61,220,151,.08);
}
.pb-progress-page.running {
  border-color: rgba(109,94,252,.45);
  background: linear-gradient(180deg, rgba(109,94,252,.18), rgba(255,255,255,.02));
  box-shadow: 0 0 0 1px rgba(109,94,252,.12);
}
.pb-progress-page.error {
  border-color: rgba(255,122,182,.4);
  background: rgba(255,122,182,.08);
}
.pb-inline-progress {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(109,94,252,.25);
  background:
    linear-gradient(180deg, rgba(109,94,252,.12), rgba(255,255,255,.02));
}
.pb-inline-progress.hidden { display: none; }
.pb-strip-item.has-image .st { color: #9dffd0; }
.pb-strip-item.running {
  border-color: rgba(109,94,252,.5) !important;
  box-shadow: 0 0 0 1px rgba(109,94,252,.18);
}
.pb-strip-item.error {
  border-color: rgba(255,122,182,.45) !important;
}

@keyframes pbShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes pbPulse {
  0%, 100% { transform: scale(.9); opacity: .55; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes pbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 860px) {
  .pb-create-grid { grid-template-columns: 1fr; }
  .pb-create-hero h2 { font-size: 22px; }
}


/* ===== Library catalog for large chapter counts ===== */
.catalog-panel {
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 12px;
}
.catalog-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.catalog-search {
  width: min(220px, 46vw);
  padding: 7px 10px !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: rgba(0,0,0,.22) !important;
}
.catalog-pagesize {
  width: 88px !important;
  padding: 7px 8px !important;
  border-radius: 10px !important;
}
.catalog-tip {
  margin: 0 0 10px;
  font-size: 12px;
}
.lib-detail-body .vol-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.lib-detail-body .vol-toggle .caret {
  width: 14px;
  color: #9bb0ff;
  font-size: 11px;
}
.lib-detail-body .vol-body.hidden { display: none; }
.lib-detail-body .chap-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.lib-detail-body .chap-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  background: rgba(0,0,0,.16);
  border-radius: 10px;
  padding: 6px 8px;
}
.lib-detail-body .chap-row:hover,
.lib-detail-body .chap-row.just-saved {
  border-color: rgba(110,168,255,.35);
  background: rgba(110,168,255,.08);
}
.lib-detail-body .chap-row.just-saved {
  border-color: rgba(53,208,160,.4);
  box-shadow: 0 0 0 1px rgba(53,208,160,.15);
}
.lib-detail-body .chap-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
  min-width: 0;
}
.lib-detail-body .chap-main .t {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-detail-body .chap-main .s {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.lib-detail-body .chap-ops {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn.tiny {
  padding: 4px 8px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  min-height: auto !important;
}
.btn.danger-lite {
  color: #ffb3cf !important;
  border-color: rgba(255,122,182,.28) !important;
}
.btn.danger-lite:hover {
  background: rgba(255,122,182,.12) !important;
}


/* ===== Local storage / privacy panel ===== */
.settings-card-storage {
  border-color: rgba(61,220,151,.35) !important;
  box-shadow: 0 0 0 1px rgba(61,220,151,.12), var(--shadow);
}
.storage-panel { display: flex; flex-direction: column; gap: 12px; }
.storage-alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(61,220,151,.14), rgba(110,168,255,.10));
  border: 1px solid rgba(61,220,151,.28);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}
.storage-alert.warn {
  background: linear-gradient(135deg, rgba(255,180,84,.16), rgba(255,122,182,.10));
  border-color: rgba(255,180,84,.35);
}
.storage-alert.cloud {
  background: linear-gradient(135deg, rgba(255,122,182,.14), rgba(155,123,255,.10));
  border-color: rgba(255,122,182,.35);
}
.storage-paths {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}
.storage-paths .path-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  font-size: 12px;
}
.storage-paths .path-row span {
  color: var(--muted);
  font-weight: 600;
}
.storage-paths .path-row code {
  font-family: var(--mono);
  color: var(--primary-2);
  word-break: break-all;
  white-space: pre-wrap;
  font-size: 12px;
}
.storage-actions { margin-top: 2px; }
.top-storage-chip {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--primary-2);
  border: 1px solid rgba(61,220,151,.35);
  background: rgba(61,220,151,.10);
  border-radius: 999px;
  padding: 4px 10px;
}
@media (max-width: 1100px) {
  .storage-paths .path-row { grid-template-columns: 1fr; }
}


/* shared root force modal + layout cards */
.modal-mask.force-privacy {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  background: rgba(3, 8, 18, .72);
  backdrop-filter: blur(8px);
  padding: 20px;
}
.modal-mask.force-privacy.show { display: grid; }
.shared-root-modal {
  width: min(560px, 96vw);
  background: linear-gradient(180deg, #121b31, #0d1528);
  border: 1px solid rgba(61,220,151,.35);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.shared-root-modal h3 { margin: 10px 0 8px; font-size: 22px; }
.shared-root-modal .asset-root-desc { color: var(--muted); line-height: 1.6; margin: 0 0 14px; }
.shared-root-modal label { display:flex; flex-direction:column; gap:6px; color: var(--muted); font-size: 13px; }
.shared-root-modal input {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  padding: 12px 12px;
  color: var(--text);
}
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(61,220,151,.14);
  border: 1px solid rgba(61,220,151,.35);
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 700;
}
.layout-preview {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}
.layout-preview > div {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 13px;
}
.layout-preview b { color: var(--primary-2); margin-right: 8px; }
.storage-layout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.layout-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.03);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.layout-card b { color: var(--primary-2); }
.layout-card span { color: var(--muted); font-size: 12px; }
.layout-card code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  word-break: break-all;
}
.top-storage-chip.warn {
  color: #ffd29a;
  border-color: rgba(255,180,84,.45);
  background: rgba(255,180,84,.12);
}
@media (max-width: 1100px) {
  .storage-layout-grid { grid-template-columns: 1fr; }
}
