:root {
  --reader-font-size: 20px;
  --reader-width: min(900px, calc(100vw - 40px));
  --reader-radius: 28px;
  --reader-line-height: 2.05;
  --header-height: 76px;
  --shadow-soft: 0 16px 42px rgba(59, 77, 97, 0.14);
  --shadow-paper: 0 24px 70px rgba(59, 77, 97, 0.12);
  --sans: "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", serif;
  --mono: "Cascadia Code", "Fira Code", Consolas, monospace;
  --bg: #eef3f8;
  --bg-strong: #dfe8f1;
  --bg-fade: rgba(248, 251, 254, 0.82);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --paper: #ffffff;
  --paper-line: rgba(148, 163, 184, 0.22);
  --text: #1f2937;
  --text-soft: #5f6d7c;
  --text-faint: #7f8b99;
  --accent: #2e6c89;
  --accent-2: #6f9dbd;
  --accent-soft: rgba(46, 108, 137, 0.12);
  --accent-border: rgba(46, 108, 137, 0.22);
  --accent-border-strong: rgba(46, 108, 137, 0.3);
  --button: rgba(255, 255, 255, 0.84);
  --button-strong-text: #f8fbff;
  --glow-top-left: rgba(97, 148, 191, 0.16);
  --glow-bottom-right: rgba(97, 126, 156, 0.12);
  --page-gradient-end: var(--bg-strong);
  --app-gradient-end: rgba(230, 238, 246, 0.86);
  --app-surface: color-mix(in srgb, var(--panel-strong) 90%, white 10%);
  --app-surface-soft: color-mix(in srgb, var(--panel-strong) 82%, white 18%);
  --app-surface-muted: rgba(255, 255, 255, 0.72);
  --app-inset: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  --guide-back-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 251, 0.94));
  --guide-stage-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(244, 248, 252, 0.88));
  --guide-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 247, 252, 0.8));
  --guide-card-soft-bg: rgba(255, 255, 255, 0.74);
  --guide-card-ghost-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(242, 247, 252, 0.22));
  --assistant-bubble-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 252, 0.9));
  --assistant-source-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 247, 252, 0.82));
  --assistant-ai-avatar-bg: linear-gradient(135deg, rgba(46, 108, 137, 0.22), rgba(255, 255, 255, 0.92));
  --assistant-user-avatar-bg: linear-gradient(135deg, rgba(111, 157, 189, 0.2), rgba(255, 255, 255, 0.92));
  --assistant-user-bubble-bg: linear-gradient(135deg, rgba(222, 240, 251, 0.98), rgba(239, 247, 252, 0.92));
  --assistant-user-bubble-border: rgba(97, 148, 191, 0.3);
  --assistant-user-bubble-text: #1d4661;
  --assistant-bubble-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

:root[data-theme="sepia"] {
  --bg: #e7d6bf;
  --bg-strong: #d4bb9e;
  --bg-fade: rgba(245, 233, 214, 0.84);
  --panel: rgba(248, 239, 225, 0.86);
  --panel-strong: rgba(250, 244, 234, 0.95);
  --paper: #f6ecde;
  --paper-line: rgba(124, 92, 55, 0.16);
  --text: #302116;
  --text-soft: #6d583f;
  --text-faint: #8f7759;
  --accent: #9d4f2f;
  --accent-2: #d88d62;
  --accent-soft: rgba(157, 79, 47, 0.12);
  --accent-border: rgba(157, 79, 47, 0.22);
  --accent-border-strong: rgba(157, 79, 47, 0.3);
  --button: rgba(246, 235, 218, 0.72);
  --button-strong-text: #fff8f1;
  --glow-top-left: rgba(170, 116, 74, 0.14);
  --glow-bottom-right: rgba(89, 69, 49, 0.12);
  --page-gradient-end: var(--bg-strong);
  --app-gradient-end: rgba(236, 228, 213, 0.78);
  --app-surface: color-mix(in srgb, var(--panel-strong) 90%, white 10%);
  --app-surface-soft: color-mix(in srgb, var(--panel-strong) 82%, white 18%);
  --app-surface-muted: rgba(255, 249, 242, 0.72);
  --app-inset: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  --guide-back-bg: linear-gradient(135deg, rgba(255, 252, 248, 0.98), rgba(248, 242, 232, 0.94));
  --guide-stage-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 251, 246, 0.82));
  --guide-card-bg: linear-gradient(180deg, rgba(255, 252, 248, 0.94), rgba(247, 239, 229, 0.8));
  --guide-card-soft-bg: rgba(255, 249, 242, 0.68);
  --guide-card-ghost-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(247, 239, 229, 0.2));
  --assistant-bubble-bg: linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(247, 239, 229, 0.88));
  --assistant-source-bg: linear-gradient(180deg, rgba(255, 251, 246, 0.94), rgba(246, 237, 226, 0.82));
  --assistant-ai-avatar-bg: linear-gradient(135deg, rgba(39, 96, 125, 0.18), rgba(255, 255, 255, 0.92));
  --assistant-user-avatar-bg: linear-gradient(135deg, rgba(172, 91, 46, 0.18), rgba(255, 255, 255, 0.92));
  --assistant-user-bubble-bg: linear-gradient(135deg, rgba(255, 233, 138, 0.98), rgba(255, 243, 181, 0.92));
  --assistant-user-bubble-border: rgba(209, 167, 44, 0.32);
  --assistant-user-bubble-text: var(--text);
  --assistant-bubble-shadow: 0 14px 34px rgba(74, 48, 34, 0.08);
}

:root[data-theme="night"] {
  --bg: #0f1722;
  --bg-strong: #182432;
  --bg-fade: rgba(16, 23, 33, 0.86);
  --panel: rgba(22, 31, 43, 0.86);
  --panel-strong: rgba(24, 35, 48, 0.96);
  --paper: #17212d;
  --paper-line: rgba(120, 153, 184, 0.18);
  --text: #dbe4ec;
  --text-soft: #a7b7c5;
  --text-faint: #8093a4;
  --accent: #8fc5e8;
  --accent-2: #6494b8;
  --accent-soft: rgba(143, 197, 232, 0.12);
  --accent-border: rgba(143, 197, 232, 0.24);
  --accent-border-strong: rgba(143, 197, 232, 0.34);
  --button: rgba(32, 44, 58, 0.88);
  --button-strong-text: #09131c;
  --glow-top-left: rgba(91, 152, 196, 0.18);
  --glow-bottom-right: rgba(20, 44, 70, 0.24);
  --page-gradient-end: var(--bg-strong);
  --app-gradient-end: rgba(13, 19, 29, 0.94);
  --app-surface: color-mix(in srgb, var(--panel-strong) 92%, #3b4d5f 8%);
  --app-surface-soft: color-mix(in srgb, var(--panel-strong) 86%, #4d6176 14%);
  --app-surface-muted: rgba(38, 49, 63, 0.84);
  --app-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --guide-back-bg: linear-gradient(135deg, rgba(34, 47, 62, 0.98), rgba(18, 27, 38, 0.94));
  --guide-stage-bg: linear-gradient(180deg, rgba(41, 54, 68, 0.92), rgba(18, 27, 38, 0.98));
  --guide-card-bg: linear-gradient(180deg, rgba(40, 53, 68, 0.94), rgba(21, 31, 43, 0.88));
  --guide-card-soft-bg: rgba(32, 43, 57, 0.86);
  --guide-card-ghost-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(17, 24, 39, 0.32));
  --assistant-bubble-bg: linear-gradient(180deg, rgba(40, 52, 66, 0.96), rgba(24, 35, 47, 0.9));
  --assistant-source-bg: linear-gradient(180deg, rgba(37, 48, 62, 0.94), rgba(21, 31, 43, 0.9));
  --assistant-ai-avatar-bg: linear-gradient(135deg, rgba(143, 197, 232, 0.22), rgba(31, 44, 58, 0.92));
  --assistant-user-avatar-bg: linear-gradient(135deg, rgba(143, 197, 232, 0.18), rgba(46, 66, 84, 0.92));
  --assistant-user-bubble-bg: linear-gradient(135deg, rgba(143, 197, 232, 0.94), rgba(99, 145, 179, 0.9));
  --assistant-user-bubble-border: rgba(143, 197, 232, 0.28);
  --assistant-user-bubble-text: #07131c;
  --assistant-bubble-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.34);
  --shadow-paper: 0 26px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html.is-comment-focus {
  scroll-behavior: auto;
  scroll-padding-top: 20px;
  scroll-padding-bottom: calc(env(safe-area-inset-bottom) + 132px);
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--glow-top-left), transparent 24%),
    radial-gradient(circle at bottom right, var(--glow-bottom-right), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--page-gradient-end));
  font-family: var(--sans);
}

body {
  line-height: 1.7;
}

body.is-comment-focus {
  overscroll-behavior-y: contain;
}

body.lock-scroll {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(18, 16, 15, 0.38);
  opacity: 0;
  transition: opacity 220ms ease;
}

.page-overlay.is-visible {
  opacity: 1;
}

.reader-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: min(380px, calc(100vw - 28px));
  padding: 18px 14px 18px 18px;
  transform: translateX(calc(-100% - 24px));
  transition: transform 240ms ease;
}

.reader-drawer-right {
  left: auto;
  right: 0;
  padding: 18px 18px 18px 14px;
  transform: translateX(calc(100% + 24px));
}

.reader-drawer.is-open {
  transform: translateX(0);
}

.drawer-panel {
  height: 100%;
  overflow-y: auto;
  border: 1px solid var(--paper-line);
  border-radius: 28px;
  background: var(--panel-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  padding: 24px 20px 20px;
}

.drawer-panel-compact {
  padding-top: 22px;
}

.drawer-panel h1 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.08;
}

.tagline,
.drawer-footer p,
.hero-text,
.home-card p,
.section-copy,
.system-card p,
.comments-copy p,
.comments-placeholder,
.meta-row {
  color: var(--text-soft);
}

.search-box {
  display: block;
  margin-top: 18px;
  padding: 14px;
  border-radius: 20px;
  background: var(--bg-fade);
  border: 1px solid var(--paper-line);
}

.search-box span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.nav-sections {
  margin-top: 18px;
}

.nav-group {
  padding: 12px;
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.12)),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.nav-group + .nav-group {
  margin-top: 14px;
}

.nav-group-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  transform: translateX(2px);
  border-color: rgba(139, 63, 52, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

.nav-item strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-hint {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-footer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--paper-line);
}

.ghost-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.reader-shell {
  position: relative;
  min-height: 100vh;
}

.reader-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: var(--header-height);
  padding: 12px 18px;
  background: rgba(255, 250, 243, 0.64);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--paper-line);
}

.header-actions #graph-button,
.header-actions #lab-button,
.header-actions #home-button {
  display: none;
}

.header-start,
.header-actions,
.font-controls,
.hero-actions,
.doc-pagination,
.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-copy h2 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  font-family: var(--serif);
  line-height: 1.2;
}

.reader-button,
.pill-button,
.mobile-tool,
.toc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--paper-line);
  background: var(--button);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.reader-button:hover,
.pill-button:hover,
.mobile-tool:hover,
.toc-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border);
}

.reader-button-strong,
.pill-button {
  background: var(--accent);
  color: var(--button-strong-text);
  border-color: transparent;
}

.font-size-indicator {
  min-width: 4.5rem;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.44);
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.font-size-indicator-strong {
  font-weight: 700;
  color: var(--text);
}

.pill-button-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-border);
}

.reader-progress {
  position: sticky;
  top: var(--header-height);
  z-index: 28;
  height: 3px;
  background: transparent;
}

.reader-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), #d88d62);
  transition: transform 120ms linear;
}

.reader-main {
  padding: 26px 18px 124px;
}

.home-view,
.doc-view,
.deck-view {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.app-home-view > :not(.app-shelf-home-card) {
  display: none;
}

.hero-card,
.home-card,
.reader-paper,
.comments-shell {
  border: 1px solid var(--paper-line);
  border-radius: var(--reader-radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(139, 63, 52, 0.06), transparent 40%),
    var(--panel-strong);
}

.hero-card-featured {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(216, 141, 98, 0.2), transparent 32%),
    radial-gradient(circle at bottom left, rgba(139, 63, 52, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(139, 63, 52, 0.08), rgba(255, 251, 245, 0.94) 52%),
    var(--panel-strong);
}

.app-shelf-home-card {
  min-height: calc(100vh - var(--header-height) - 170px);
  display: flex;
  align-items: stretch;
}

.hero-card-featured::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  pointer-events: none;
}

.hero-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.94fr);
  gap: 24px;
  align-items: stretch;
}

.app-home-view .hero-layout {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 28px;
}

.hero-copy-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-home-view .hero-copy-block {
  padding: 10px 4px 0 2px;
}

.hero-card h2,
.home-card h3,
.doc-meta h2,
.comments-copy h3,
.section-heading h3,
.book-card h4 {
  margin: 8px 0 0;
  font-family: var(--serif);
}

.hero-card h2 {
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1.02;
  max-width: 14ch;
}

.app-home-view .hero-card h2 {
  max-width: 10ch;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 60ch;
  font-size: 1.05rem;
}

.hero-card-featured .hero-text {
  max-width: 58ch;
  line-height: 1.92;
}

.hero-actions {
  margin-top: 22px;
}

.hero-card-featured .hero-actions {
  gap: 12px;
}

.app-home-view .hero-actions {
  margin-top: 28px;
}

.app-home-view .hero-actions .pill-button {
  min-width: 148px;
}

#start-reading-button {
  box-shadow: 0 18px 36px rgba(139, 63, 52, 0.18);
}

#open-catalog-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  border-color: rgba(139, 63, 52, 0.18);
}

#open-catalog-button:hover {
  background: rgba(255, 255, 255, 0.92);
}

.hero-spotlight {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px;
  border-radius: 26px;
  border: 1px solid rgba(139, 63, 52, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 241, 0.94)),
    var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.app-shelf-spotlight {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(107, 63, 42, 0.94), rgba(74, 45, 31, 0.96)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 32%);
  color: #f8eee5;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 28px 56px rgba(74, 48, 34, 0.22);
}

.app-shelf-spotlight::before {
  content: "";
  position: absolute;
  inset: auto 18px 18px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 240, 222, 0.2), rgba(255, 240, 222, 0));
  pointer-events: none;
}

.hero-spotlight h3 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.7vw, 2rem);
  line-height: 1.18;
}

.app-shelf-spotlight h3,
.app-shelf-spotlight .hero-spotlight-copy,
.app-shelf-spotlight .spotlight-link-copy em {
  color: inherit;
}

.hero-spotlight-copy {
  margin: 12px 0 0;
  line-height: 1.78;
  color: var(--text-soft);
}

.spotlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.spotlight-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.app-shelf-spotlight .spotlight-chip {
  background: rgba(255, 245, 233, 0.14);
  color: #f6dfc8;
}

.spotlight-links {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.spotlight-link {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px 13px;
  border-radius: 18px;
  border: 1px solid rgba(139, 63, 52, 0.14);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.app-shelf-spotlight .spotlight-link {
  border-color: rgba(255, 245, 233, 0.12);
  background: rgba(255, 248, 241, 0.08);
  color: #fff6ef;
}

.spotlight-link:hover {
  transform: translateX(4px);
  border-color: rgba(139, 63, 52, 0.24);
  background: rgba(255, 255, 255, 0.9);
}

.app-shelf-spotlight .spotlight-link:hover {
  border-color: rgba(255, 245, 233, 0.24);
  background: rgba(255, 248, 241, 0.14);
}

.spotlight-link-index {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(139, 63, 52, 0.16), rgba(139, 63, 52, 0.04));
  color: var(--accent);
  font-weight: 700;
}

.app-shelf-spotlight .spotlight-link-index {
  background: linear-gradient(180deg, rgba(255, 244, 230, 0.2), rgba(255, 244, 230, 0.08));
  color: #ffdec1;
}

.spotlight-link-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.spotlight-link-copy strong {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.34;
}

.spotlight-link-copy em {
  font-style: normal;
  color: var(--text-soft);
  font-size: 0.87rem;
  line-height: 1.55;
}

.home-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.live-book-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
}

.live-book-card,
.live-book-step,
.live-book-home-card,
.comment-template-card,
.live-book-comment-panel {
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.live-book-card,
.live-book-home-card,
.live-book-comment-panel {
  padding: 22px 20px;
}

.live-book-card-strong {
  background:
    radial-gradient(circle at top right, rgba(216, 141, 98, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 68%),
    var(--panel-strong);
}

.live-book-card h4,
.live-book-home-card h4,
.live-book-step h4,
.comment-template-card h4,
.live-book-comment-panel h4 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 1.14rem;
}

.live-book-meta,
.live-book-status,
.live-book-step p,
.live-book-home-card p,
.comment-template-card p,
.live-book-comment-panel p {
  color: var(--text-soft);
}

.live-book-meta,
.live-book-status {
  margin: 14px 0 0;
  line-height: 1.8;
}

.live-book-actions {
  margin-top: 18px;
}

.live-book-workflow,
.live-book-home-cards,
.comment-template-grid {
  display: grid;
  gap: 14px;
}

.live-book-workflow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.live-book-step {
  position: relative;
  padding: 18px 18px 18px 62px;
  overflow: hidden;
}

.live-book-step-index {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 63, 52, 0.1);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.live-book-step p {
  margin: 10px 0 0;
  line-height: 1.8;
}

.live-book-home-cards {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-book-home-card {
  position: relative;
  overflow: hidden;
}

.live-book-home-card::before {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(216, 141, 98, 0.38));
}

.live-book-home-card p {
  margin: 12px 0 0;
  line-height: 1.82;
}

.live-book-comment-panel {
  margin-top: 18px;
  padding: 14px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 72%),
    var(--panel-strong);
  border-color: rgba(139, 63, 52, 0.12);
  box-shadow: none;
}

.live-book-comment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.live-book-comment-head p {
  margin: 10px 0 0;
  max-width: 58ch;
  line-height: 1.82;
}

.live-book-thread {
  margin-top: 0;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px dashed rgba(139, 63, 52, 0.24);
  background: rgba(255, 255, 255, 0.45);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.9rem;
  word-break: break-all;
}

.live-book-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.live-book-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.live-book-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.08);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.comment-template-grid {
  display: grid;
  gap: 14px;
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.comment-template-card {
  padding: 18px;
  border: 1px solid rgba(139, 63, 52, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.46);
}

.comment-template-card p {
  margin: 10px 0 0;
  line-height: 1.76;
}

.comment-template-preview {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(139, 63, 52, 0.14);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.68;
  white-space: pre-wrap;
}

.comment-template-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.comment-copy-status {
  min-height: 1.4em;
  margin: 10px 2px 0;
  color: var(--accent);
  font-size: 0.92rem;
}

.quick-use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.quick-use-card {
  min-height: 100%;
}

.quick-use-list {
  margin: 4px 0 0;
  padding-left: 1.2em;
  color: var(--text-soft);
}

.quick-use-list li + li {
  margin-top: 6px;
}

.positioning-band {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
  gap: 18px;
  margin-top: 18px;
}

.positioning-card {
  border: 1px solid var(--paper-line);
  border-radius: 26px;
  padding: 24px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 60%),
    var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.positioning-card h3,
.starter-copy strong {
  margin: 8px 0 0;
  font-family: var(--serif);
}

.positioning-card p {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.82;
}

.positioning-card-strong {
  background:
    radial-gradient(circle at top right, rgba(216, 141, 98, 0.18), transparent 32%),
    linear-gradient(135deg, rgba(139, 63, 52, 0.08), rgba(255, 251, 245, 0.96) 56%),
    var(--panel-strong);
}

.positioning-statement {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  line-height: 1.34;
  color: var(--text);
}

.positioning-support {
  max-width: 48ch;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.starter-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 16px;
  border-radius: 24px;
  border: 1px solid var(--paper-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 62%),
    var(--panel-strong);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.starter-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 63, 52, 0.22);
  box-shadow: 0 24px 52px rgba(74, 48, 34, 0.16);
}

.starter-index {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(139, 63, 52, 0.16), rgba(210, 142, 80, 0.08));
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

.starter-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.starter-eyebrow,
.starter-copy em {
  font-style: normal;
  color: var(--accent);
}

.starter-eyebrow {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.starter-copy strong {
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--text);
}

.starter-copy p,
.starter-copy em {
  margin: 0;
  line-height: 1.72;
}

.starter-copy p {
  color: var(--text-soft);
}

.starter-copy em {
  font-size: 0.86rem;
}

.home-card {
  position: relative;
  overflow: hidden;
  padding: 24px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 62%),
    var(--panel-strong);
}

.home-card::before {
  content: "";
  display: block;
  width: 58px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(216, 141, 98, 0.4));
}

.home-card h3 {
  font-size: 1.18rem;
  line-height: 1.28;
}

.home-card p {
  margin: 12px 0 0;
  line-height: 1.8;
}

.bookshelf-section {
  margin-top: 30px;
}

.systems-section {
  margin-top: 30px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-copy {
  margin: 8px 0 0;
  max-width: 60ch;
}

.book-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.light-card {
  min-height: 100%;
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.graph-view {
  width: 100%;
}

.graph-shell {
  width: var(--reader-width);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.graph-launch-shell,
.graph-layout {
  display: grid;
  gap: 18px;
}

.graph-launch-shell {
  grid-template-columns: minmax(280px, 0.94fr) minmax(0, 1.06fr);
  align-items: stretch;
}

.graph-layout {
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  align-items: start;
}

.graph-hero-card,
.graph-note-card,
.graph-board-card,
.graph-detail-card,
.graph-launch-card {
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.graph-hero-card,
.graph-note-card,
.graph-board-card,
.graph-detail-card,
.graph-launch-card {
  padding: 22px 20px;
}

.graph-hero-card {
  background:
    radial-gradient(circle at top right, rgba(39, 96, 125, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(172, 91, 46, 0.1), transparent 28%),
    linear-gradient(135deg, rgba(255, 251, 246, 0.92), rgba(245, 249, 252, 0.96)),
    var(--panel-strong);
}

.graph-launch-card {
  display: grid;
  gap: 12px;
  align-content: start;
  background:
    radial-gradient(circle at top left, rgba(172, 91, 46, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 251, 246, 0.96), rgba(255, 255, 255, 0.88));
}

.graph-launch-card h4,
.graph-detail-head h3,
.graph-detail-section h4 {
  margin: 0;
  font-family: var(--serif);
}

.graph-launch-card p,
.graph-detail-copy,
.graph-preview-card p,
.graph-legend-card p,
.graph-chapter-card p,
.graph-detail-section-head p {
  margin: 0;
  line-height: 1.78;
  color: var(--text-soft);
}

.graph-launch-actions {
  margin-top: 4px;
}

.graph-preview-grid,
.graph-legend,
.graph-clusters,
.graph-candidate-list {
  display: grid;
  gap: 12px;
}

.graph-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.graph-legend {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.graph-clusters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.graph-board-card {
  display: grid;
  gap: 12px;
}

.graph-map-shell {
  display: grid;
  gap: 12px;
}

.graph-map-hint {
  display: grid;
  gap: 6px;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid rgba(139, 63, 52, 0.12);
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.9), rgba(246, 250, 252, 0.92));
}

.graph-map-hint span {
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.graph-map-hint p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.74;
}

.graph-map-scroll {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(139, 63, 52, 0.12);
  background:
    radial-gradient(circle at top left, rgba(172, 91, 46, 0.08), transparent 26%),
    radial-gradient(circle at bottom right, rgba(46, 108, 137, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 252, 248, 0.94), rgba(247, 249, 251, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.graph-map-svg {
  display: block;
  width: 100%;
  min-width: 1700px;
  height: auto;
}

.graph-map-edge {
  transition: stroke-opacity 160ms ease, stroke-width 160ms ease;
}

.graph-map-edge.is-highlight {
  filter: drop-shadow(0 0 10px rgba(74, 48, 34, 0.08));
}

.graph-map-node {
  outline: none;
}

.graph-map-node:focus rect,
.graph-map-node:hover rect {
  transform: translateY(-1px);
}

.graph-map-node rect {
  transition: transform 160ms ease, opacity 160ms ease, stroke-width 160ms ease;
  transform-origin: center;
}

.graph-map-node:hover rect {
  transform: translateY(-2px);
}

.graph-map-node.is-selected rect {
  transform: translateY(-2px);
}

.graph-map-family-label,
.graph-map-node-code,
.graph-map-node-label,
.graph-map-node-meta {
  pointer-events: none;
  user-select: none;
}

.graph-map-node-label {
  font-family: var(--serif);
}

.graph-note-card {
  display: grid;
  gap: 14px;
}

.graph-heading-inline {
  margin-bottom: 0;
}

.graph-stats,
.graph-chip-row,
.graph-cluster-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.graph-stat-chip,
.graph-chip,
.graph-cluster-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-soft);
  font-size: 0.82rem;
}

.graph-stat-chip strong {
  color: var(--text);
  font-size: 1rem;
}

.graph-stat-chip em {
  font-style: normal;
  color: var(--text-soft);
}

.graph-chip {
  color: var(--text);
}

.graph-chip.is-lit {
  border-color: rgba(172, 91, 46, 0.28);
  background: rgba(172, 91, 46, 0.12);
  color: var(--accent);
}

.graph-chip.is-mapped {
  border-color: rgba(39, 96, 125, 0.22);
  background: rgba(39, 96, 125, 0.1);
}

.graph-chip.is-candidate {
  border-style: dashed;
  background: rgba(120, 126, 145, 0.08);
}

.graph-legend-card,
.graph-preview-card,
.graph-chapter-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.graph-legend-card,
.graph-chapter-card {
  padding: 14px;
}

.graph-preview-card {
  display: grid;
  gap: 8px;
  padding: 16px 15px 14px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.graph-preview-card:hover,
.graph-chapter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 63, 52, 0.24);
}

.graph-preview-card.is-candidate {
  border-style: dashed;
  opacity: 0.88;
}

.graph-preview-card.is-mapped {
  background: rgba(248, 251, 252, 0.82);
}

.graph-preview-card strong {
  font-family: var(--serif);
  font-size: 1.08rem;
}

.graph-preview-card em {
  font-style: normal;
  color: var(--accent);
  font-size: 0.82rem;
}

.graph-preview-meta,
.graph-node-code {
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}

.graph-legend-card {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.graph-legend-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.graph-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 5px;
  background: rgba(139, 63, 52, 0.2);
  box-shadow: 0 0 0 8px rgba(139, 63, 52, 0.08);
}

.graph-legend-card.is-lit .graph-legend-dot {
  background: rgba(172, 91, 46, 0.94);
  box-shadow: 0 0 0 8px rgba(172, 91, 46, 0.16);
}

.graph-legend-card.is-mapped .graph-legend-dot {
  background: rgba(39, 96, 125, 0.9);
  box-shadow: 0 0 0 8px rgba(39, 96, 125, 0.14);
}

.graph-legend-card.is-candidate .graph-legend-dot {
  background: rgba(116, 122, 142, 0.72);
  box-shadow: 0 0 0 8px rgba(116, 122, 142, 0.12);
}

.graph-cluster,
.graph-detail-head {
  --graph-accent: #8b3f34;
  --graph-accent-rgb: 139, 63, 52;
}

.graph-cluster,
.graph-preview-card,
.graph-node,
.graph-detail-head {
  --graph-accent: #8b3f34;
  --graph-accent-rgb: 139, 63, 52;
}

.graph-cluster[data-family="mother-1"],
.graph-preview-card[data-family="mother-1"],
.graph-node[data-family="mother-1"],
.graph-detail-head[data-family="mother-1"] {
  --graph-accent: #a65d31;
  --graph-accent-rgb: 166, 93, 49;
}

.graph-cluster[data-family="mother-2"],
.graph-preview-card[data-family="mother-2"],
.graph-node[data-family="mother-2"],
.graph-detail-head[data-family="mother-2"] {
  --graph-accent: #b34b3a;
  --graph-accent-rgb: 179, 75, 58;
}

.graph-cluster[data-family="mother-3"],
.graph-preview-card[data-family="mother-3"],
.graph-node[data-family="mother-3"],
.graph-detail-head[data-family="mother-3"] {
  --graph-accent: #8c6a24;
  --graph-accent-rgb: 140, 106, 36;
}

.graph-cluster[data-family="mother-4"],
.graph-preview-card[data-family="mother-4"],
.graph-node[data-family="mother-4"],
.graph-detail-head[data-family="mother-4"] {
  --graph-accent: #2e6c89;
  --graph-accent-rgb: 46, 108, 137;
}

.graph-cluster[data-family="mother-5"],
.graph-preview-card[data-family="mother-5"],
.graph-node[data-family="mother-5"],
.graph-detail-head[data-family="mother-5"] {
  --graph-accent: #2d7a70;
  --graph-accent-rgb: 45, 122, 112;
}

.graph-cluster[data-family="mother-6"],
.graph-preview-card[data-family="mother-6"],
.graph-node[data-family="mother-6"],
.graph-detail-head[data-family="mother-6"] {
  --graph-accent: #8e4664;
  --graph-accent-rgb: 142, 70, 100;
}

.graph-cluster[data-family="bridge"],
.graph-preview-card[data-family="bridge"],
.graph-node[data-family="bridge"],
.graph-detail-head[data-family="bridge"] {
  --graph-accent: #5c6578;
  --graph-accent-rgb: 92, 101, 120;
}

.graph-cluster {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(var(--graph-accent-rgb), 0.2);
  background:
    radial-gradient(circle at top right, rgba(var(--graph-accent-rgb), 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 248, 244, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.graph-cluster.is-focus {
  border-color: rgba(var(--graph-accent-rgb), 0.34);
  box-shadow:
    0 24px 56px rgba(74, 48, 34, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.graph-cluster-head {
  display: grid;
  gap: 12px;
}

.graph-core-grid,
.graph-chapter-list {
  display: grid;
  gap: 10px;
}

.graph-core-grid {
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.graph-core-grid::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: -10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--graph-accent-rgb), 0.24), transparent);
}

.graph-node {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(var(--graph-accent-rgb), 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.graph-node::after,
.graph-preview-card::after,
.graph-detail-head::after {
  content: "";
  position: absolute;
  inset: auto -12% -28% -12%;
  height: 64%;
  background: radial-gradient(
    circle,
    rgba(var(--graph-accent-rgb), calc(0.08 + var(--graph-signal, 0.16) * 0.24)),
    transparent 68%
  );
  pointer-events: none;
}

.graph-node:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--graph-accent-rgb), 0.28);
}

.graph-node.is-selected {
  transform: translateY(-2px);
  border-color: rgba(var(--graph-accent-rgb), 0.4);
  box-shadow: 0 18px 40px rgba(var(--graph-accent-rgb), 0.16);
}

.graph-node.is-related {
  border-color: rgba(var(--graph-accent-rgb), 0.3);
}

.graph-node.is-lit {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(var(--graph-accent-rgb), 0.07)),
    rgba(255, 255, 255, 0.82);
}

.graph-node.is-mapped {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(var(--graph-accent-rgb), 0.04)),
    rgba(255, 255, 255, 0.76);
}

.graph-node.is-candidate {
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(var(--graph-accent-rgb), 0.02)),
    rgba(252, 252, 253, 0.74);
  opacity: 0.88;
}

.graph-node strong {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  line-height: 1.28;
}

.graph-node-meta {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.graph-node-mother {
  padding: 18px 18px 16px;
}

.graph-node-mother strong {
  font-size: 1.16rem;
}

.graph-node-candidate strong {
  font-size: 0.98rem;
}

.graph-detail-card {
  position: sticky;
  top: calc(var(--header-height) + 22px);
  display: grid;
  gap: 16px;
}

.graph-detail-head {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(var(--graph-accent-rgb), 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(var(--graph-accent-rgb), 0.08)),
    rgba(255, 255, 255, 0.88);
}

.graph-detail-section {
  display: grid;
  gap: 12px;
}

.graph-detail-section-head {
  display: grid;
  gap: 6px;
}

.graph-chapter-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.graph-chapter-card small {
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-chapter-card strong {
  font-family: var(--serif);
  font-size: 1rem;
}

.graph-candidate-list .graph-node {
  min-height: 0;
}

.system-card {
  display: grid;
  grid-template-rows: minmax(152px, auto) 1fr;
  padding: 0;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--paper-line);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.system-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 63, 52, 0.22);
  box-shadow: 0 24px 52px rgba(74, 48, 34, 0.16);
}

.system-card.is-featured {
  border-color: rgba(139, 63, 52, 0.2);
  box-shadow: 0 20px 48px rgba(139, 63, 52, 0.14);
}

.system-card-cover {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 158px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(139, 63, 52, 0.12), rgba(139, 63, 52, 0.03));
  border-bottom: 1px solid var(--paper-line);
}

.system-card.is-featured .system-card-cover {
  background: linear-gradient(180deg, rgba(139, 63, 52, 0.22), rgba(210, 142, 80, 0.12));
}

.system-card-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-label {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.system-card h4 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 1.24rem;
  line-height: 1.16;
}

.system-card-hook {
  margin: 10px 0 0;
  max-width: 22ch;
  line-height: 1.62;
}

.system-card-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.system-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.system-card-meta p {
  margin: 0;
}

.system-count {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.1);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.system-entry {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.42;
}

.system-card p:last-child {
  margin: 0;
  line-height: 1.72;
}

.book-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--paper-line);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.book-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 63, 52, 0.2);
  background: rgba(255, 255, 255, 0.92);
}

.book-card-index {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(139, 63, 52, 0.14), rgba(139, 63, 52, 0.03));
  color: var(--accent);
  font-weight: 700;
}

.book-card-copy {
  min-width: 0;
}

.book-card-meta {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.book-card h4 {
  margin-top: 10px;
  font-size: 1.1rem;
  line-height: 1.24;
}

.book-card p {
  margin: 8px 0 0;
  line-height: 1.68;
  color: var(--text-soft);
}

.reader-paper {
  width: var(--reader-width);
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(139, 63, 52, 0.03), transparent 12%),
    var(--paper);
  box-shadow: var(--shadow-paper);
}

.reader-paper-inner {
  padding: 34px clamp(20px, 4vw, 54px) 30px;
}

.doc-meta {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--paper-line);
}

.doc-meta h2 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.08;
}

.meta-row {
  margin-top: 12px;
  font-size: 0.92rem;
}

.doc-content {
  margin-top: 24px;
  font-family: var(--serif);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: var(--text);
  word-break: break-word;
}

.doc-content > *:first-child {
  margin-top: 0;
}

.doc-content p {
  margin: 0.92em 0 0;
  text-align: justify;
}

.doc-content p + p {
  text-indent: 2em;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
  margin: 1.9em 0 0.7em;
  font-family: var(--serif);
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-height) + 28px);
}

.doc-content h1 + p,
.doc-content h2 + p,
.doc-content h3 + p,
.doc-content h4 + p,
.doc-content h5 + p,
.doc-content h6 + p,
.doc-content blockquote p,
.doc-content li p,
.doc-content td p,
.doc-content th p {
  text-indent: 0;
}

.doc-content ul,
.doc-content ol,
.doc-content blockquote,
.doc-content pre,
.doc-content table,
.doc-content hr {
  margin: 1.25em 0 0;
}

.doc-content li + li {
  margin-top: 0.3em;
}

.doc-content blockquote {
  padding: 10px 0 10px 18px;
  border-left: 4px solid rgba(139, 63, 52, 0.24);
  color: var(--text-soft);
}

.doc-content pre {
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(20, 22, 25, 0.92);
  color: #f4efe8;
  font-size: 0.84em;
}

.doc-content code {
  font-family: var(--mono);
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.doc-content th,
.doc-content td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--paper-line);
  text-align: left;
}

.doc-content .doc-focus-match {
  padding: 0 0.18em;
  border-radius: 0.32em;
  background: rgba(216, 141, 98, 0.2);
  box-shadow: inset 0 0 0 1px rgba(139, 63, 52, 0.14);
  color: inherit;
}

.doc-content .doc-focus-match.is-flashing {
  animation: doc-focus-match-flash 720ms ease-in-out 2;
}

.doc-content .is-doc-focus-target {
  animation: doc-focus-target-flash 720ms ease-in-out 2;
  border-radius: 0.4em;
}

@keyframes doc-focus-match-flash {
  0%,
  100% {
    background: rgba(216, 141, 98, 0.2);
    box-shadow: inset 0 0 0 1px rgba(139, 63, 52, 0.14);
  }

  40% {
    background: rgba(216, 141, 98, 0.56);
    box-shadow:
      inset 0 0 0 1px rgba(139, 63, 52, 0.26),
      0 0 0 6px rgba(216, 141, 98, 0.16);
  }
}

@keyframes doc-focus-target-flash {
  0%,
  100% {
    background: transparent;
    box-shadow: none;
  }

  40% {
    background: rgba(216, 141, 98, 0.12);
    box-shadow: 0 0 0 8px rgba(216, 141, 98, 0.12);
  }
}

.comments-shell {
  margin-top: 28px;
  padding: 22px 22px 20px;
  background: var(--panel);
  overflow-anchor: none;
}

.comments-copy {
  display: grid;
  gap: 6px;
}

.comments-copy .eyebrow,
.comments-copy h3,
.comments-copy p {
  margin: 0;
}

.comments-copy h3 {
  font-size: 1.5rem;
  margin-top: 4px;
}

.comments-tip {
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.comment-compact-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.comment-mini-button {
  padding: 8px 14px;
  font-size: 0.9rem;
  line-height: 1.3;
  box-shadow: none;
}

.comment-mini-button-strong {
  background: var(--accent);
  color: var(--button-strong-text);
  border-color: transparent;
}

.comment-mini-button-ghost {
  background: rgba(255, 255, 255, 0.76);
}

.comments-more-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(139, 63, 52, 0.14);
}

.comments-more-panel[hidden] {
  display: none;
}

.feedback-guide-inline {
  margin-top: 0;
}

.comment-ai-provider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-ai-provider-label {
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.comments-mount {
  margin-top: 18px;
  overflow-anchor: none;
}

.comments-mount,
.comments-mount .twikoo,
.comments-mount .tk-input,
.comments-mount .tk-meta-input,
.comments-mount .el-form,
.comments-mount .el-form-item,
.comments-mount .el-textarea,
.comments-mount .el-textarea__inner {
  overflow-anchor: none;
}

.comments-mount .twikoo,
.comments-mount .tk-input,
.comments-mount .el-textarea,
.comments-mount .el-textarea__inner {
  overscroll-behavior: contain;
}

.comments-mount :is(input, textarea, select) {
  scroll-margin-top: 20px;
  scroll-margin-bottom: calc(env(safe-area-inset-bottom) + 136px);
}

.comments-mount .twikoo .el-textarea__inner {
  max-height: min(42vh, 360px);
  max-height: min(42dvh, 360px);
  overflow-y: auto !important;
  resize: none;
}

.feedback-guide {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.42);
}

.feedback-guide h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.02rem;
}

.feedback-list {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--text-soft);
}

.feedback-list li + li {
  margin-top: 0.45rem;
}

.comments-placeholder {
  padding: 18px;
  border: 1px dashed rgba(139, 63, 52, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.38);
}

.comments-placeholder-steps {
  margin: 12px 0 0;
  padding-left: 1.2rem;
}

.comments-placeholder-steps li + li {
  margin-top: 0.35rem;
}

.comments-placeholder-action {
  margin-top: 14px;
}

.comments-placeholder-action a {
  color: var(--accent);
  font-weight: 600;
}

.doc-pagination {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin-top: 24px;
}

.pager-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 16px 18px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--paper-line);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--text);
}

.pager-card small {
  display: block;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.pager-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.35;
}

.pager-card.is-variant {
  align-items: center;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(139, 63, 52, 0.1), rgba(255, 255, 255, 0.16)),
    var(--panel-strong);
  border-color: rgba(139, 63, 52, 0.22);
}

.pager-card.is-disabled {
  background: rgba(255, 255, 255, 0.34);
  box-shadow: none;
  color: var(--text-soft);
}

.doc-toc {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.toc-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--text);
}

.toc-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 16px;
}

.toc-link[data-level="3"] {
  margin-left: 12px;
}

.toc-link[data-level="4"],
.toc-link[data-level="5"],
.toc-link[data-level="6"] {
  margin-left: 20px;
}

.empty-state {
  padding: 14px 0;
  color: var(--text-soft);
}

.deck-home-grid,
.deck-structure-grid,
.deck-spread-grid,
.deck-guide-grid {
  display: grid;
  gap: 14px;
}

.deck-home-grid,
.deck-structure-grid,
.deck-browser-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deck-spread-grid,
.deck-guide-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.deck-shell {
  display: grid;
  gap: 18px;
}

.deck-home-card,
.deck-panel-card,
.deck-section-card,
.deck-card-detail-card {
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.deck-home-card,
.deck-panel-card,
.deck-section-card,
.deck-card-detail-card {
  padding: 22px 20px;
}

.deck-home-card h4,
.deck-panel-card h3,
.deck-section-card h3,
.deck-card-detail-card h3,
.deck-spread-card h4,
.deck-guide-card h4,
.deck-detail-section h4 {
  margin: 8px 0 0;
  font-family: var(--serif);
}

.deck-home-copy,
.deck-home-summary,
.deck-spectrum-item p,
.deck-spread-card p,
.deck-guide-card p,
.deck-card-tile-copy p,
.deck-detail-section p,
.deck-inline-note,
.deck-spread-rationale {
  color: var(--text-soft);
}

.deck-home-copy {
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.deck-home-summary {
  margin: 10px 0 0;
}

.deck-home-chip-row,
.deck-meta-row,
.deck-card-detail-meta,
.deck-related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.deck-meta-row {
  margin-top: 18px;
}

.deck-home-chip-row {
  margin-top: 16px;
}

.deck-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-soft);
  font-size: 0.85rem;
}

.deck-meta-chip-suit {
  border-color: var(--deck-accent, var(--accent));
  background: var(--deck-soft, rgba(139, 63, 52, 0.12));
  color: var(--deck-accent, var(--accent));
  font-weight: 700;
}

.deck-home-preview-list,
.deck-card-grid,
.deck-spectrum-list,
.deck-card-detail-body,
.deck-guide-steps {
  display: grid;
  gap: 10px;
}

.deck-home-preview-list,
.deck-spectrum-list,
.deck-card-grid {
  margin-top: 16px;
}

.deck-home-preview,
.deck-spread-node,
.deck-related-link {
  border: 1px solid var(--paper-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  cursor: pointer;
}

.deck-home-preview {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  text-align: left;
}

.deck-home-preview span,
.deck-card-tile-meta,
.deck-related-label,
.deck-detail-section h4 {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.deck-home-preview span,
.deck-card-tile-meta,
.deck-related-label {
  color: var(--accent);
}

.deck-home-preview strong,
.deck-spread-node strong,
.deck-related-link {
  font-family: var(--serif);
}

.deck-home-actions {
  margin-top: 18px;
}

.deck-hero-card {
  background:
    radial-gradient(circle at top right, rgba(53, 95, 122, 0.14), transparent 34%),
    radial-gradient(circle at bottom left, rgba(154, 107, 34, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(45, 90, 76, 0.08), rgba(255, 251, 245, 0.96) 56%),
    var(--panel-strong);
}

.deck-hero-subtitle {
  margin: 12px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.deck-panel-card,
.deck-section-card {
  overflow: hidden;
}

.deck-spectrum-item {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.42);
}

.deck-spectrum-item p {
  margin: 10px 0 0;
}

.deck-spread-card,
.deck-guide-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.42);
}

.deck-spread-sequence {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.deck-spread-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  text-align: left;
}

.deck-spread-node span {
  font-size: 1rem;
  color: var(--accent);
}

.deck-spread-rationale {
  margin: 14px 0 0;
}

.deck-guide-steps {
  margin: 14px 0 0;
  padding-left: 1.25rem;
}

.deck-guide-actions {
  margin-top: 16px;
}

.deck-browser-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.deck-card-tile {
  width: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.deck-card-tile:hover,
.deck-card-tile.is-active {
  transform: translateY(-1px);
  border-color: rgba(139, 63, 52, 0.24);
  background: rgba(255, 255, 255, 0.92);
}

.deck-card-tile-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border-radius: 18px;
  background: var(--bg-fade);
  border: 1px solid var(--paper-line);
  color: var(--accent);
  font-weight: 700;
}

.deck-card-tile-copy {
  min-width: 0;
}

.deck-card-tile-copy strong {
  display: block;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.35;
}

.deck-card-tile-copy p {
  margin: 8px 0 0;
}

.deck-card-detail-card {
  position: sticky;
  top: calc(var(--header-height) + 18px);
}

.deck-card-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.deck-card-detail-body {
  margin-top: 16px;
}

.deck-detail-section {
  padding: 14px;
  border-radius: 18px;
  background: var(--bg-fade);
  border: 1px solid var(--paper-line);
}

.deck-detail-section h4 {
  margin: 0;
  color: var(--accent);
}

.deck-detail-section p {
  margin: 8px 0 0;
}

.deck-inline-note {
  margin: 14px 0 0;
}

.deck-detail-actions {
  margin-top: 18px;
}

.deck-related-row {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.deck-related-link {
  padding: 10px 13px;
}

.reader-button.is-active,
.pill-button.is-active,
.lab-tab.is-active {
  border-color: var(--accent-border-strong);
  background: var(--guide-card-bg);
  color: var(--text);
  transform: translateY(-1px);
}

.lab-view {
  width: 100%;
}

.lab-shell {
  width: var(--reader-width);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.lab-hero-card,
.lab-note-card,
.lab-card,
.lab-entry-card {
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.lab-hero-card,
.lab-note-card,
.lab-card {
  padding: 22px 20px;
}

.lab-card-strong {
  background:
    radial-gradient(circle at top right, rgba(139, 63, 52, 0.1), transparent 34%),
    var(--panel-strong);
}

.lab-note-card p:last-child,
.lab-card p:last-child {
  margin-bottom: 0;
}

.lab-tabs,
.lab-inline-actions,
.lab-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lab-flow {
  margin: 14px 0 12px;
}

.lab-flow span {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--bg-fade);
  border: 1px solid var(--paper-line);
  font-size: 0.9rem;
  color: var(--text-soft);
}

.lab-stack-grid,
.lab-extension-grid,
.lab-preset-grid {
  display: grid;
  gap: 12px;
}

.lab-stack-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.lab-stack-card,
.lab-extension-card,
.lab-preset-button {
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.5);
}

.lab-stack-card,
.lab-extension-card {
  padding: 14px 14px 13px;
}

.lab-stack-card small,
.lab-stack-card strong,
.lab-extension-card strong,
.lab-preset-button strong,
.lab-preset-button span {
  display: block;
}

.lab-stack-card small {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-stack-card strong,
.lab-extension-card strong,
.lab-preset-button strong {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
}

.lab-stack-card p,
.lab-extension-card p,
.lab-preset-button span,
.lab-section-copy,
.lab-action-status {
  color: var(--text-soft);
}

.lab-stack-card p,
.lab-extension-card p {
  margin: 8px 0 0;
}

.lab-stack-card.is-active {
  border-color: rgba(139, 63, 52, 0.28);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.lab-section-lead,
.lab-section-copy {
  margin: 14px 0 0;
}

.lab-extension-grid,
.lab-preset-grid {
  margin-top: 16px;
}

.lab-preset-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lab-preset-button {
  width: 100%;
  padding: 15px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.lab-preset-button:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 63, 52, 0.24);
  background: rgba(255, 255, 255, 0.86);
}

.lab-preset-button span {
  margin-top: 8px;
  line-height: 1.65;
}

.lab-action-status {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.lab-action-status[data-tone="success"] {
  color: var(--accent);
  font-weight: 700;
}

.lab-action-status[data-tone="warning"] {
  color: #9d4f2f;
  font-weight: 700;
}

.lab-grid {
  display: grid;
  gap: 18px;
}

.lab-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lab-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lab-bullet-list,
.lab-number-list {
  margin: 12px 0 0;
  padding-left: 1.25em;
  color: var(--text-soft);
}

.lab-bullet-list li + li,
.lab-number-list li + li {
  margin-top: 8px;
}

.lab-mini-points {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.lab-mini-points span {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-fade);
  color: var(--text-soft);
  border: 1px solid var(--paper-line);
}

.lab-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.lab-entry-card {
  display: block;
  text-decoration: none;
  padding: 18px 16px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.lab-entry-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 63, 52, 0.22);
  background: rgba(255, 255, 255, 0.88);
}

.lab-entry-tag,
.simulation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lab-entry-card h4,
.lab-card h3 {
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.3;
}

.simulation-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.lab-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.lab-range,
.lab-select {
  display: block;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--paper-line);
  background: var(--bg-fade);
}

.lab-range span,
.lab-select span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.94rem;
}

.lab-range strong {
  color: var(--accent);
  font-weight: 700;
}

.lab-range input {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--accent);
}

.lab-select select {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.lab-text-field,
.lab-textarea {
  display: block;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--paper-line);
  background: var(--bg-fade);
}

.lab-text-field span,
.lab-textarea span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.94rem;
}

.lab-text-field input,
.lab-textarea textarea {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.lab-textarea textarea {
  resize: vertical;
  min-height: 120px;
}

.prompt-builder-grid {
  align-items: start;
}

.prompt-builder-full {
  grid-column: 1 / -1;
}

.prompt-method-flow {
  margin-top: 16px;
}

.prompt-preview-card {
  display: flex;
  flex-direction: column;
}

.prompt-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.prompt-preview-head h3 {
  margin-bottom: 0;
}

.lab-prompt-output {
  margin: 16px 0 0;
  padding: 16px;
  min-height: 300px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: var(--bg-fade);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
}

.lab-prompt-output.is-lite {
  min-height: 220px;
}

.assistant-launcher {
  position: fixed;
  right: 22px;
  bottom: 104px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 188px;
  padding: 13px 16px;
  border: 1px solid rgba(139, 63, 52, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 251, 246, 0.97), rgba(247, 251, 253, 0.94)),
    var(--panel-strong);
  box-shadow: 0 18px 38px rgba(74, 48, 34, 0.18);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.assistant-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(74, 48, 34, 0.22);
}

.assistant-launcher.is-active {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.assistant-launcher-pulse {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b3f34, #2e6c89);
  box-shadow: 0 0 0 6px rgba(139, 63, 52, 0.1);
}

.assistant-launcher-copy {
  display: grid;
  gap: 3px;
  text-align: left;
}

.assistant-launcher-copy strong {
  font-size: 0.95rem;
}

.assistant-launcher-copy small {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.assistant-panel {
  position: fixed;
  top: 10px;
  right: 0;
  bottom: 10px;
  z-index: 54;
  width: min(450px, calc(100vw - 18px));
  padding: 0 14px 0 0;
  transform: translateX(calc(100% + 26px));
  transition: transform 240ms ease;
  pointer-events: none;
}

.assistant-panel.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.assistant-panel-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--paper-line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(39, 96, 125, 0.12), transparent 26%),
    radial-gradient(circle at bottom left, rgba(172, 91, 46, 0.08), transparent 24%),
    var(--panel-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.assistant-panel-head-global {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 0;
}

.assistant-panel-title h3,
.assistant-context-head h4 {
  margin: 6px 0 0;
  font-family: var(--serif);
  line-height: 1.2;
}

.assistant-panel-description,
.assistant-context-copy {
  margin: 8px 0 0;
  color: var(--text-soft);
  line-height: 1.72;
}

.assistant-context-card {
  display: grid;
  gap: 12px;
  margin: 0 22px;
  padding: 16px;
  border: 1px solid var(--paper-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
}

.assistant-context-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.assistant-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-quick-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assistant-quick-action {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--paper-line);
  background: var(--guide-card-soft-bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.assistant-quick-action:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border-strong);
  background: var(--guide-card-bg);
}

.assistant-chat-card,
.assistant-guide-card,
.assistant-prompt-entry-card {
  display: grid;
  gap: 16px;
}

.assistant-chat-card {
  background:
    radial-gradient(circle at top right, rgba(39, 96, 125, 0.12), transparent 34%),
    radial-gradient(circle at bottom left, rgba(172, 91, 46, 0.08), transparent 28%),
    var(--panel-strong);
}

.assistant-prompt-entry-card {
  background:
    radial-gradient(circle at top left, rgba(39, 96, 125, 0.1), transparent 32%),
    radial-gradient(circle at bottom right, rgba(172, 91, 46, 0.08), transparent 26%),
    var(--panel-strong);
}

.assistant-panel-head {
  display: grid;
  gap: 12px;
}

.assistant-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-conversation {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 6px 4px 10px 0;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.assistant-conversation-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  margin: 0 22px;
  padding: 2px 4px 2px 0;
  overflow: hidden;
}

.assistant-message {
  display: grid;
  gap: 12px;
  padding: 16px;
  width: fit-content;
  max-width: 92%;
  border-radius: 22px;
  border: 1px solid var(--paper-line);
  background: var(--guide-card-bg);
  box-shadow: var(--app-inset);
}

.assistant-message.is-user {
  align-self: flex-end;
  justify-self: end;
  background: var(--assistant-user-bubble-bg);
  border-color: var(--assistant-user-bubble-border);
  color: var(--assistant-user-bubble-text);
}

.assistant-message.is-assistant {
  align-self: flex-start;
  justify-self: start;
  background: var(--assistant-bubble-bg);
}

.assistant-message.is-pending {
  border-style: dashed;
}

.assistant-message-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.assistant-message-role {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.assistant-message-meta {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.assistant-message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.82;
  color: var(--text);
}

.assistant-source-grid,
.assistant-suggestion-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assistant-source-card {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: var(--guide-card-bg);
  text-decoration: none;
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease;
}

.assistant-source-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border);
}

.assistant-source-card small,
.assistant-section-label {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.assistant-source-card strong {
  font-family: var(--serif);
  line-height: 1.34;
}

.assistant-source-card p,
.assistant-setup-note p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.assistant-composer textarea {
  min-height: 132px;
}

.assistant-panel-dock {
  display: grid;
  gap: 12px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--paper-line);
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.34), rgba(255, 255, 255, 0.72));
}

.assistant-composer-panel {
  margin: 0;
}

.assistant-composer-panel textarea {
  min-height: 110px;
}

.assistant-actions {
  margin-top: -2px;
}

.assistant-actions-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assistant-suggestion {
  text-align: left;
}

.assistant-setup-note {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.8);
}

.assistant-setup-note strong {
  color: var(--text);
}

.assistant-setup-note.is-pending {
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.92), rgba(247, 249, 251, 0.9)),
    rgba(255, 255, 255, 0.82);
}

.assistant-status[data-tone="info"] {
  color: var(--text-soft);
}

body.is-comment-focus .assistant-launcher,
body.is-comment-focus .assistant-panel,
body.is-comment-focus .mobile-reader-bar {
  display: none;
}

.lab-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.lab-metric {
  padding: 14px 12px;
  border-radius: 16px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.52);
}

.lab-metric span,
.dist-group p {
  display: block;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.lab-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
  font-family: var(--serif);
}

.lab-meter {
  margin-top: 12px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.12);
  overflow: hidden;
}

.lab-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #d28e50, var(--accent));
  transition: width 180ms ease;
}

.lab-result-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: var(--bg-fade);
}

.lab-result-card h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.lab-result-card p + p {
  margin-top: 10px;
}

.result-note {
  color: var(--accent);
  font-weight: 700;
}

.dist-shell {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.dist-group {
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.5);
}

.dist-group p {
  margin: 0;
}

.dist-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 156px;
  margin-top: 12px;
}

.dist-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.dist-bar {
  display: block;
  width: 100%;
  min-height: 10px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, #d69d5b, var(--accent));
  transition: height 180ms ease;
}

.dist-bar-alt {
  background: linear-gradient(180deg, #8cb9d8, #6a7fa8);
}

.dist-bar-faint {
  background: linear-gradient(180deg, rgba(121, 104, 90, 0.75), rgba(121, 104, 90, 0.45));
}

.dist-bar-wrap small,
.dist-bar-wrap em {
  font-style: normal;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.stage-node {
  padding: 14px 10px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.48);
  color: var(--text-soft);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.stage-node strong,
.stage-node span {
  display: block;
}

.stage-node strong {
  color: var(--text);
  font-size: 0.95rem;
}

.stage-node span {
  margin-top: 6px;
  font-size: 0.8rem;
}

.stage-node.is-active {
  border-color: rgba(139, 63, 52, 0.2);
}

.stage-node.is-current {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.thought-radar-shell {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 16px;
}

.thought-radar-stage {
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.48);
}

.thought-radar {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.thought-radar-ring,
.thought-radar-axis {
  fill: none;
  stroke: rgba(139, 63, 52, 0.18);
  stroke-width: 1.4;
}

.thought-radar-axis {
  stroke: rgba(139, 63, 52, 0.22);
}

.thought-radar-label {
  font-size: 11px;
  fill: var(--text-soft);
  font-family: var(--sans);
}

.thought-radar-shape {
  fill: rgba(139, 63, 52, 0.18);
  stroke: var(--accent);
  stroke-width: 2.4;
}

.thought-radar-point {
  fill: #d28e50;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1.6;
}

.thought-verdict-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thought-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--paper-line);
  color: var(--text);
  font-size: 0.9rem;
}

.thought-chip.is-alert {
  background: rgba(139, 63, 52, 0.14);
  border-color: rgba(139, 63, 52, 0.24);
  color: var(--accent);
}

.thought-gate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.thought-gate {
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.48);
  color: var(--text-soft);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.thought-gate strong,
.thought-gate span {
  display: block;
}

.thought-gate strong {
  color: var(--text);
  font-size: 0.95rem;
}

.thought-gate span {
  margin-top: 8px;
  line-height: 1.6;
  font-size: 0.84rem;
}

.thought-gate[data-state="active"] {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(139, 63, 52, 0.22);
  box-shadow: var(--shadow-soft);
}

.layer-lift-shell {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.layer-lift-node {
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.48);
  display: grid;
  gap: 10px;
  align-content: start;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.layer-lift-node small,
.layer-lift-node strong,
.layer-lift-node p {
  margin: 0;
}

.layer-lift-node small {
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.layer-lift-value {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
}

.layer-lift-bar {
  position: relative;
  height: 120px;
  border-radius: 16px;
  background: rgba(139, 63, 52, 0.09);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.layer-lift-bar span {
  display: block;
  width: 100%;
  height: 0;
  min-height: 8px;
  background: linear-gradient(180deg, #d8a167, var(--accent));
  transition: height 180ms ease;
}

.layer-lift-node p {
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.6;
}

.layer-lift-node.is-reached {
  border-color: rgba(139, 63, 52, 0.18);
}

.layer-lift-node.is-current {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(139, 63, 52, 0.24);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.playground-shell {
  margin-top: 16px;
  padding: 12px;
  border-radius: 24px;
  border: 1px solid var(--paper-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.game-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-icon {
  display: inline-flex;
  width: 1.9rem;
  height: 1.9rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.1);
  color: var(--accent);
  flex-shrink: 0;
}

.game-icon svg {
  width: 18px;
  height: 18px;
}

.game-launch-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(84, 111, 140, 0.12), transparent 36%),
    var(--panel-strong);
}

.game-launch-card::after {
  content: "";
  position: absolute;
  inset: auto -18% -32% auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(139, 63, 52, 0.08), transparent 70%);
  pointer-events: none;
}

.play-scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.play-score-chip {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.play-score-chip span {
  display: block;
  color: var(--text-soft);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.play-score-chip strong {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.2;
}

.playground-shell-cool {
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.82), rgba(255, 255, 255, 0.54));
}

.playground-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(139, 63, 52, 0.1);
  background: rgba(255, 255, 255, 0.62);
}

.playground-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.playground-hint {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.7;
}

.brain-vat-shell {
  background: linear-gradient(180deg, rgba(242, 247, 253, 0.82), rgba(255, 255, 255, 0.58));
}

.brain-vat-canvas {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(240, 244, 249, 0.7));
}

.brain-vat-action-grid {
  margin-top: 16px;
}

.brain-vat-action[data-state="used"] {
  opacity: 0.68;
  border-color: rgba(84, 111, 140, 0.24);
  background: rgba(240, 244, 250, 0.86);
}

.brain-vat-guess-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.brain-vat-guess {
  justify-content: center;
}

.brain-vat-guess.is-selected {
  border-color: rgba(139, 63, 52, 0.24);
  background: rgba(255, 255, 255, 0.86);
}

.brain-vat-guess.is-correct {
  border-color: rgba(84, 111, 140, 0.32);
  background: rgba(235, 244, 252, 0.92);
  color: #45698a;
}

.brain-vat-guess.is-wrong {
  border-color: rgba(139, 63, 52, 0.26);
  background: rgba(255, 244, 239, 0.92);
}

.brain-vat-status {
  margin-top: 16px;
}

.brain-vat-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.brain-vat-log {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.brain-vat-log-item {
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.52);
}

.brain-vat-log-item small {
  display: block;
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brain-vat-log-item p {
  margin: 8px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.brain-vat-log-item[data-tone="glitch"] {
  border-color: rgba(84, 111, 140, 0.24);
  background: rgba(240, 245, 251, 0.86);
}

.brain-vat-log-item.is-empty {
  background: var(--bg-fade);
}

.lab-lead {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.95;
}

.mobile-reader-bar {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 32;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(620px, calc(100vw - 28px));
  padding: 8px;
  border-radius: 24px;
  background: var(--guide-card-bg);
  backdrop-filter: blur(18px);
  border: 1px solid var(--paper-line);
  box-shadow: var(--shadow-soft);
  transform: translateX(-50%);
}

.app-tab-button {
  flex-direction: column;
  gap: 5px;
  min-height: 64px;
  border-radius: 18px;
  padding: 10px 8px;
  background: transparent;
}

.app-tab-button span:last-child {
  font-size: 0.79rem;
  letter-spacing: 0.04em;
}

.app-tab-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
}

.app-tab-icon svg {
  width: 20px;
  height: 20px;
}

.mobile-font-panel {
  display: none;
}

.mobile-tool[disabled] {
  opacity: 0.45;
  cursor: default;
}

.mobile-tool.is-active {
  border-color: var(--accent-border-strong);
  background: var(--guide-card-soft-bg);
  box-shadow: var(--app-inset);
}

body.is-home-hub {
  background:
    radial-gradient(circle at top left, var(--glow-top-left), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--app-gradient-end));
  color: var(--text);
}

body.is-home-hub .reader-header,
body.is-home-hub .reader-progress,
body.is-home-hub .assistant-launcher {
  display: none;
}

body.is-home-hub .reader-main {
  padding: 12px 14px 126px;
}

body.is-home-hub .app-home-view {
  width: min(760px, 100%);
}

body.is-home-hub .hero-card.hero-card-featured.app-shelf-home-card {
  min-height: calc(100vh - 138px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-home-shell {
  display: grid;
  gap: 20px;
}

.app-home-shell > .hero-copy-block,
.app-home-shell > .hero-spotlight {
  display: none;
}

.app-home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 6px;
}

.app-home-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-home-tabs::-webkit-scrollbar {
  display: none;
}

.app-home-tab {
  position: relative;
  border: 0;
  padding: 0 0 10px;
  background: transparent;
  color: #98a2b3;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.app-home-tab.is-active {
  color: var(--text);
}

.app-home-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.app-home-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-home-top-button,
.app-home-feed-button {
  border: 1px solid var(--paper-line);
  background: var(--guide-card-soft-bg);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.app-home-top-button:hover,
.app-home-feed-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.app-home-top-button {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-home-top-button svg {
  width: 22px;
  height: 22px;
}

.app-home-feature-story,
.app-home-feed-section {
  border: 1px solid var(--paper-line);
  border-radius: 32px;
  background: var(--guide-card-bg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.app-home-feature-story {
  padding: 26px;
}

.app-home-ai-card {
  border: 1px solid var(--paper-line);
  border-radius: 32px;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
    var(--guide-card-bg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.app-home-ai-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.app-home-ai-head h3 {
  margin: 8px 0 0;
  font-family: var(--sans);
  font-size: 1.58rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

.app-home-ai-copy,
.app-home-ai-note,
.app-home-ai-step p,
.app-home-ai-link p {
  color: var(--text-soft);
  line-height: 1.76;
}

.app-home-ai-copy {
  margin: 14px 0 0;
  max-width: 40rem;
}

.app-home-ai-note {
  margin: 0;
  max-width: 24rem;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--guide-card-soft-bg);
  border: 1px solid var(--accent-border);
  font-size: 0.94rem;
}

.app-home-ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(280px, 1.06fr);
  gap: 18px;
  margin-top: 18px;
}

.app-home-ai-steps,
.app-home-ai-links {
  display: grid;
  gap: 12px;
}

.app-home-ai-step,
.app-home-ai-link {
  border: 1px solid var(--paper-line);
  border-radius: 22px;
  background: var(--guide-card-bg);
  box-shadow: var(--app-inset);
}

.app-home-ai-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
}

.app-home-ai-step-index {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.app-home-ai-step p,
.app-home-ai-link p {
  margin: 0;
}

.app-home-ai-link {
  display: grid;
  gap: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.app-home-ai-link:hover {
  transform: translateY(-1px);
  background: var(--guide-card-soft-bg);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.app-home-ai-link-meta {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-home-ai-link strong {
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.35;
}

.app-home-ai-link code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.app-home-ai-actions {
  margin-top: 18px;
}

.app-home-ai-copy-status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1.5;
}

.app-home-feature-head h2 {
  margin: 8px 0 0;
  max-width: 11ch;
  font-family: var(--sans);
  font-size: clamp(2.15rem, 4.2vw, 3.1rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.app-home-hero-text {
  margin: 16px 0 0;
  max-width: 36rem;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.76;
}

.app-home-feature-layout {
  display: grid;
  grid-template-columns: minmax(170px, 190px) minmax(0, 1fr);
  gap: 22px;
  margin-top: 24px;
}

.app-home-book-cover {
  position: relative;
  min-height: 248px;
  padding: 20px 18px;
  border-radius: 28px;
  border: 1px solid var(--paper-line);
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 34%),
    var(--guide-card-bg);
  box-shadow:
    var(--app-inset),
    0 18px 38px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.app-home-book-cover::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 22px;
  border: 1px solid var(--paper-line);
  pointer-events: none;
}

.app-home-book-cover-badge,
.app-home-book-cover strong {
  position: relative;
  z-index: 1;
}

.app-home-book-cover-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-home-book-cover strong {
  font-size: 1.5rem;
  line-height: 1.16;
  letter-spacing: -0.03em;
  color: var(--text);
}

.app-home-feature-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.app-home-feature-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.82;
}

.app-home-meta-row {
  gap: 10px;
}

.app-home-meta-row .spotlight-chip {
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.app-home-primary-actions {
  margin-top: 0;
}

#home-start-button,
body.is-home-hub #start-reading-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--button-strong-text);
  border-color: transparent;
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.24);
}

#home-catalog-button,
body.is-home-hub #open-catalog-button {
  background: var(--guide-card-soft-bg);
  color: var(--text);
  border-color: var(--paper-line);
}

.app-home-feed-section {
  overflow: hidden;
  padding: 22px 0 8px;
}

.app-home-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px 14px;
}

.app-home-feed-head h3 {
  margin: 8px 0 0;
  font-family: var(--sans);
  font-size: 1.42rem;
  letter-spacing: -0.03em;
}

.app-home-feed-button {
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  font-weight: 700;
}

.app-home-feed-list {
  display: grid;
  gap: 0;
}

.app-home-feed-list .spotlight-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 22px;
  border: 0;
  border-top: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-home-feed-list .spotlight-link:first-child {
  border-top: 0;
}

.app-home-feed-list .spotlight-link:hover {
  transform: none;
  background: rgba(248, 250, 252, 0.96);
}

.app-home-feed-list .spotlight-link-index {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 800;
  box-shadow: none;
}

.app-home-feed-list .spotlight-link-copy strong {
  color: #0f172a;
  font-family: var(--sans);
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.35;
}

.app-home-feed-list .spotlight-link-copy em {
  margin-top: 6px;
  color: #64748b;
  font-style: normal;
  line-height: 1.65;
}

body.is-home-hub .mobile-reader-bar {
  background: var(--guide-card-bg);
  border: 1px solid var(--paper-line);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

body.is-home-hub .mobile-tool {
  color: var(--text-faint);
  border-color: transparent;
}

body.is-home-hub .mobile-tool.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

@media (max-width: 760px) {
  body.is-home-hub .reader-main {
    padding: 8px 12px 118px;
  }

  .app-home-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-home-topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .app-home-feature-story {
    padding: 22px 18px;
    border-radius: 28px;
  }

  .app-home-ai-card {
    padding: 20px 18px;
    border-radius: 28px;
  }

  .app-home-ai-head {
    flex-direction: column;
  }

  .app-home-feature-head h2 {
    max-width: none;
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .app-home-ai-head h3 {
    font-size: 1.42rem;
  }

  .app-home-feature-layout {
    grid-template-columns: 1fr;
  }

  .app-home-ai-layout {
    grid-template-columns: 1fr;
  }

  .app-home-book-cover {
    min-height: 188px;
  }

  .app-home-feed-head {
    padding: 0 18px 12px;
    align-items: end;
  }

  .app-home-feed-list .spotlight-link {
    padding: 16px 18px;
  }
}

@media (max-width: 1024px) {
  :root {
    --reader-width: min(920px, calc(100vw - 28px));
  }

  .reader-header {
    padding-inline: 14px;
  }

  .header-actions {
    gap: 8px;
  }

  .hero-layout {
    grid-template-columns: 1fr;
  }

  .lab-stack-grid,
  .lab-preset-grid,
  .lab-grid-two,
  .lab-grid-three,
  .lab-entry-grid,
  .graph-layout,
  .graph-launch-shell,
  .graph-preview-grid,
  .graph-legend,
  .graph-clusters,
  .graph-core-grid,
  .lab-controls,
  .lab-metrics,
  .assistant-source-grid,
  .assistant-suggestion-grid,
  .assistant-quick-actions,
  .brain-vat-metrics,
  .dist-shell,
  .thought-gate-grid,
  .layer-lift-shell,
  .brain-vat-guess-grid {
    grid-template-columns: 1fr;
  }

  .stage-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thought-radar-shell {
    grid-template-columns: 1fr;
  }

  .playground-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .graph-detail-card {
    position: static;
  }

  .play-scoreboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --reader-width: calc(100vw - 16px);
    --header-height: 70px;
  }

  .reader-header {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .header-actions {
    display: none;
  }

  .hero-card {
    padding: 22px 18px;
  }

  .hero-layout {
    gap: 16px;
  }

  .app-home-view .hero-layout {
    grid-template-columns: 1fr;
  }

  .positioning-band,
  .starter-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .pill-button,
  .hero-actions a.pill-button {
    width: 100%;
  }

  .live-book-inline-actions .pill-button,
  .live-book-inline-actions a.pill-button,
  .comment-template-actions .pill-button {
    width: auto;
  }

  .hero-spotlight {
    padding: 18px 16px;
  }

  .app-shelf-home-card {
    min-height: calc(100vh - var(--header-height) - 164px);
  }

  .spotlight-link {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 11px 12px;
  }

  .lab-card,
  .lab-note-card,
  .lab-entry-card,
  .graph-hero-card,
  .graph-note-card,
  .graph-board-card,
  .graph-detail-card,
  .graph-launch-card {
    padding: 18px 16px;
  }

  .reader-main {
    padding: 16px 8px 112px;
  }

  .reader-paper-inner {
    padding: 22px 16px 18px;
  }

  .doc-meta h2 {
    font-size: 1.72rem;
  }

  .doc-content {
    font-size: var(--reader-font-size);
  }

  .doc-content p {
    text-align: left;
  }

  .doc-content p + p {
    text-indent: 1.8em;
  }

  .home-panels,
  .live-book-layout,
  .live-book-workflow,
  .live-book-home-cards,
  .quick-use-grid,
  .starter-grid,
  .book-shelf,
  .systems-grid {
    grid-template-columns: 1fr;
  }

  .live-book-comment-head {
    flex-direction: column;
  }

  .live-book-inline-actions,
  .comment-template-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .live-book-inline-actions .pill-button,
  .live-book-inline-actions a.pill-button,
  .comment-template-actions .pill-button {
    width: 100%;
  }

  .book-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .simulation-head {
    flex-direction: column;
  }

  .lab-tabs,
  .lab-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .prompt-preview-head {
    flex-direction: column;
    align-items: stretch;
  }

  .assistant-message-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistant-launcher {
    right: 10px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 84px);
    left: 10px;
    width: auto;
    min-width: 0;
  }

  .assistant-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 10px 10px 0;
    transform: translateY(calc(100% + 24px));
  }

  .assistant-panel.is-open {
    transform: translateY(0);
  }

  .assistant-panel-shell {
    height: min(82vh, 920px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .assistant-panel-head-global,
  .assistant-panel-dock {
    padding-left: 16px;
    padding-right: 16px;
  }

  .assistant-context-card,
  .assistant-conversation-panel {
    margin-left: 16px;
    margin-right: 16px;
  }

  .lab-preset-button {
    padding: 14px 13px;
  }

  .dist-bars {
    height: 128px;
  }

  .doc-pagination {
    grid-template-columns: 1fr;
  }

  .reader-drawer,
  .reader-drawer-right {
    width: 100vw;
    padding: 10px 10px 14px;
  }

  .nav-group {
    padding: 12px;
  }

  .nav-group-head {
    flex-direction: column;
  }

  .nav-group-count {
    align-self: flex-start;
  }

  .mobile-reader-bar {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
  }

  body.is-comment-focus .reader-header {
    position: static;
    background: var(--panel-strong);
    backdrop-filter: none;
  }

  body.is-comment-focus .reader-progress,
  body.is-comment-focus .mobile-reader-bar,
  body.is-comment-focus .mobile-font-panel {
    display: none;
  }

  .mobile-tool {
    padding: 11px 6px;
    border-radius: 16px;
    font-size: 0.82rem;
  }

  .mobile-font-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 84px);
    z-index: 46;
    display: block;
  }

  .mobile-font-panel-card {
    border: 1px solid var(--paper-line);
    border-radius: 22px;
    background: rgba(255, 248, 239, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    padding: 14px;
  }

  .mobile-font-title {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .mobile-font-actions,
  .mobile-font-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }

  .mobile-font-actions .reader-button,
  .mobile-font-meta .reader-button {
    flex: 1;
    justify-content: center;
  }

  .mobile-font-actions .font-size-indicator {
    flex: 1.15;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .comments-shell {
    padding: 18px 16px;
  }

  .comment-ai-provider-label {
    width: 100%;
  }

  .live-book-comment-head {
    flex-direction: column;
  }
}

@media (max-width: 960px) {
  .deck-home-grid,
  .deck-structure-grid,
  .deck-browser-grid {
    grid-template-columns: 1fr;
  }

  .deck-card-detail-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .deck-home-grid,
  .deck-spread-grid,
  .deck-guide-grid,
  .deck-browser-grid {
    grid-template-columns: 1fr;
  }

  .deck-home-card,
  .deck-panel-card,
  .deck-section-card,
  .deck-card-detail-card,
  .deck-spread-card,
  .deck-guide-card {
    padding: 18px 16px;
  }

  .deck-card-tile {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .deck-card-detail-head {
    flex-direction: column;
  }

  .deck-home-actions,
  .deck-guide-actions,
  .deck-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

body.is-app-ui:not(.is-home-hub) {
  background:
    radial-gradient(circle at top left, var(--glow-top-left), transparent 26%),
    radial-gradient(circle at bottom right, var(--glow-bottom-right), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--app-gradient-end));
}

body.is-app-ui:not(.is-home-hub) .reader-header {
  top: 12px;
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: 26px;
  border: 1px solid var(--paper-line);
  background: var(--app-surface);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(22px);
}

body.is-app-ui:not(.is-home-hub) .reader-progress {
  top: calc(12px + var(--header-height));
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 0 18px;
}

body.is-app-ui:not(.is-home-hub) .reader-progress span {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
}

body.is-app-ui:not(.is-home-hub) .reader-main {
  padding-top: 36px;
}

body.is-app-ui:not(.is-home-hub) .reader-button,
body.is-app-ui:not(.is-home-hub) .mobile-tool,
body.is-app-ui:not(.is-home-hub) .toc-link,
body.is-app-ui:not(.is-home-hub) .font-size-indicator {
  border-color: var(--paper-line);
  background: var(--app-surface);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .reader-button-strong,
body.is-app-ui:not(.is-home-hub) .pill-button {
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

body.is-app-ui:not(.is-home-hub) .drawer-panel,
body.is-app-ui:not(.is-home-hub) .reader-paper,
body.is-app-ui:not(.is-home-hub) .comments-shell,
body.is-app-ui:not(.is-home-hub) .graph-hero-card,
body.is-app-ui:not(.is-home-hub) .graph-note-card,
body.is-app-ui:not(.is-home-hub) .graph-board-card,
body.is-app-ui:not(.is-home-hub) .graph-detail-card,
body.is-app-ui:not(.is-home-hub) .graph-launch-card,
body.is-app-ui:not(.is-home-hub) .lab-card,
body.is-app-ui:not(.is-home-hub) .lab-entry-card,
body.is-app-ui:not(.is-home-hub) .deck-home-card,
body.is-app-ui:not(.is-home-hub) .deck-panel-card,
body.is-app-ui:not(.is-home-hub) .deck-section-card,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card,
body.is-app-ui:not(.is-home-hub) .deck-spread-card,
body.is-app-ui:not(.is-home-hub) .deck-guide-card,
body.is-app-ui:not(.is-home-hub) .assistant-panel-shell {
  border-color: rgba(148, 163, 184, 0.18);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 28%),
    var(--panel-strong);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(20px);
}

body.is-app-ui:not(.is-home-hub) .graph-hero-card,
body.is-app-ui:not(.is-home-hub) .deck-hero-card,
body.is-app-ui:not(.is-home-hub) .lab-card-strong {
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.14), transparent 34%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 28%),
    var(--panel-strong);
}

body.is-app-ui:not(.is-home-hub) .reader-paper {
  border-radius: 34px;
}

body.is-app-ui:not(.is-home-hub) .graph-shell,
body.is-app-ui:not(.is-home-hub) .lab-shell {
  width: min(1180px, calc(100vw - 28px));
}

body.is-app-ui:not(.is-home-hub) .doc-meta,
body.is-app-ui:not(.is-home-hub) .assistant-panel-dock {
  border-color: rgba(148, 163, 184, 0.16);
}

body.is-app-ui:not(.is-home-hub) .doc-meta h2,
body.is-app-ui:not(.is-home-hub) .lab-card h3,
body.is-app-ui:not(.is-home-hub) .deck-home-card h4,
body.is-app-ui:not(.is-home-hub) .deck-panel-card h3,
body.is-app-ui:not(.is-home-hub) .deck-section-card h3,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card h3,
body.is-app-ui:not(.is-home-hub) .assistant-panel-title h3 {
  font-family: var(--sans);
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .graph-detail-card {
  top: calc(var(--header-height) + 34px);
}

body.is-app-ui:not(.is-home-hub) .deck-card-detail-card {
  top: calc(var(--header-height) + 30px);
}

body.is-app-ui .assistant-launcher {
  right: 18px;
  left: auto;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 86px);
  width: 52px;
  min-width: 52px;
  height: 52px;
  padding: 0;
  gap: 0;
  border-radius: 999px;
  justify-content: center;
  background: var(--panel-strong);
  background: color-mix(in srgb, var(--panel-strong) 92%, white 8%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

body.is-app-ui .assistant-launcher::before {
  content: "AI";
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent);
}

body.is-app-ui .assistant-launcher-pulse,
body.is-app-ui .assistant-launcher-copy {
  display: none;
}

body.is-app-ui .assistant-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.18);
}

body.is-app-ui .assistant-panel {
  width: min(430px, calc(100vw - 18px));
  padding-right: 10px;
}

@media (max-width: 1024px) {
  body.is-app-ui:not(.is-home-hub) .reader-header,
  body.is-app-ui:not(.is-home-hub) .reader-progress {
    width: calc(100vw - 24px);
  }
}

@media (max-width: 760px) {
  body.is-app-ui:not(.is-home-hub) .reader-header {
    top: 8px;
    width: calc(100vw - 20px);
    padding: 12px 14px;
    border-radius: 22px;
  }

  body.is-app-ui:not(.is-home-hub) .reader-progress {
    top: calc(8px + var(--header-height));
    width: calc(100vw - 20px);
    padding: 0 14px;
  }

  body.is-app-ui:not(.is-home-hub) .reader-main {
    padding-top: 24px;
  }

  body.is-app-ui .assistant-launcher {
    right: 12px;
    width: 46px;
    min-width: 46px;
    height: 46px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 78px);
  }

  body.is-app-ui .assistant-panel {
    padding: 8px 8px 0;
  }
}

/* Inner-page app refinements */
body.is-app-ui:not(.is-home-hub) {
  --app-border: var(--paper-line);
  --app-border-strong: var(--accent-border-strong);
  --app-divider: color-mix(in srgb, var(--paper-line) 70%, transparent);
  --app-shadow: 0 24px 56px rgba(15, 23, 42, 0.1);
  --app-shadow-soft: 0 18px 38px rgba(15, 23, 42, 0.08);
}

body.is-app-ui:not(.is-home-hub) .graph-shell,
body.is-app-ui:not(.is-home-hub) .lab-shell,
body.is-app-ui:not(.is-home-hub) .deck-shell {
  gap: 22px;
}

body.is-app-ui:not(.is-home-hub) .deck-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
}

body.is-app-ui:not(.is-home-hub) .graph-layout,
body.is-app-ui:not(.is-home-hub) .graph-launch-shell,
body.is-app-ui:not(.is-home-hub) .deck-home-grid,
body.is-app-ui:not(.is-home-hub) .deck-structure-grid,
body.is-app-ui:not(.is-home-hub) .deck-spread-grid,
body.is-app-ui:not(.is-home-hub) .deck-guide-grid,
body.is-app-ui:not(.is-home-hub) .deck-browser-grid,
body.is-app-ui:not(.is-home-hub) .lab-grid {
  gap: 18px;
}

body.is-app-ui:not(.is-home-hub) .graph-note-card,
body.is-app-ui:not(.is-home-hub) .graph-board-card,
body.is-app-ui:not(.is-home-hub) .deck-home-card,
body.is-app-ui:not(.is-home-hub) .deck-panel-card,
body.is-app-ui:not(.is-home-hub) .deck-section-card,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card,
body.is-app-ui:not(.is-home-hub) .lab-note-card,
body.is-app-ui:not(.is-home-hub) .lab-card,
body.is-app-ui:not(.is-home-hub) .assistant-context-card,
body.is-app-ui:not(.is-home-hub) .assistant-conversation-panel {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

body.is-app-ui:not(.is-home-hub) .graph-note-card::before,
body.is-app-ui:not(.is-home-hub) .graph-board-card::before,
body.is-app-ui:not(.is-home-hub) .deck-home-card::before,
body.is-app-ui:not(.is-home-hub) .deck-panel-card::before,
body.is-app-ui:not(.is-home-hub) .deck-section-card::before,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card::before,
body.is-app-ui:not(.is-home-hub) .lab-note-card::before,
body.is-app-ui:not(.is-home-hub) .lab-card::before,
body.is-app-ui:not(.is-home-hub) .assistant-context-card::before,
body.is-app-ui:not(.is-home-hub) .assistant-conversation-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.24), rgba(255, 255, 255, 0));
  pointer-events: none;
}

body.is-app-ui:not(.is-home-hub) .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--app-divider);
}

body.is-app-ui:not(.is-home-hub) .section-heading h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.16rem;
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .section-copy,
body.is-app-ui:not(.is-home-hub) .graph-detail-copy,
body.is-app-ui:not(.is-home-hub) .assistant-panel-description,
body.is-app-ui:not(.is-home-hub) .assistant-context-copy,
body.is-app-ui:not(.is-home-hub) .lab-section-copy,
body.is-app-ui:not(.is-home-hub) .lab-section-lead {
  max-width: 64ch;
}

body.is-app-ui:not(.is-home-hub) #doc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

body.is-app-ui:not(.is-home-hub) .meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-soft);
  color: var(--text-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .reader-paper {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 18%),
    var(--paper);
  box-shadow: 0 30px 72px rgba(15, 23, 42, 0.1);
}

body.is-app-ui:not(.is-home-hub) .reader-paper::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.26), rgba(255, 255, 255, 0));
  pointer-events: none;
}

body.is-app-ui:not(.is-home-hub) .doc-meta {
  position: relative;
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
  border-color: var(--app-divider);
}

body.is-app-ui:not(.is-home-hub) .doc-meta h2 {
  max-width: 14ch;
}

body.is-app-ui:not(.is-home-hub) .doc-content {
  margin-top: 30px;
}

body.is-app-ui:not(.is-home-hub) .doc-content h2,
body.is-app-ui:not(.is-home-hub) .doc-content h3 {
  font-family: var(--sans);
  letter-spacing: -0.04em;
}

body.is-app-ui:not(.is-home-hub) .doc-content blockquote {
  padding: 16px 18px;
  border: 1px solid var(--app-border);
  border-radius: 22px;
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .doc-content pre {
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.is-app-ui:not(.is-home-hub) .doc-content table {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-muted);
}

body.is-app-ui:not(.is-home-hub) .comments-shell {
  margin-top: 32px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 28%),
    var(--app-surface);
}

body.is-app-ui:not(.is-home-hub) .feedback-guide,
body.is-app-ui:not(.is-home-hub) .comments-placeholder,
body.is-app-ui:not(.is-home-hub) .comment-template-card {
  border-color: var(--app-border);
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .doc-pagination {
  margin-top: 28px;
  gap: 14px;
}

body.is-app-ui:not(.is-home-hub) .pager-card {
  min-height: 112px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 28%),
    var(--app-surface);
  box-shadow: var(--app-shadow-soft);
}

body.is-app-ui:not(.is-home-hub) .pager-card strong {
  font-family: var(--sans);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

body.is-app-ui:not(.is-home-hub) .toc-title {
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .toc-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: 18px;
}

body.is-app-ui:not(.is-home-hub) .toc-link::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.12);
}

body.is-app-ui:not(.is-home-hub) .graph-stats,
body.is-app-ui:not(.is-home-hub) .graph-chip-row,
body.is-app-ui:not(.is-home-hub) .graph-cluster-summary {
  gap: 10px;
}

body.is-app-ui:not(.is-home-hub) .graph-stat-chip,
body.is-app-ui:not(.is-home-hub) .graph-chip,
body.is-app-ui:not(.is-home-hub) .graph-cluster-summary span {
  padding: 9px 12px;
  border-color: var(--app-border);
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-note-card,
body.is-app-ui:not(.is-home-hub) .graph-board-card {
  padding: 24px;
  gap: 16px;
}

body.is-app-ui:not(.is-home-hub) .graph-map-hint {
  padding: 16px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(241, 245, 249, 0.78));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-map-scroll {
  padding: 10px;
  border-radius: 30px;
  border-color: var(--app-border);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-legend-card,
body.is-app-ui:not(.is-home-hub) .graph-preview-card,
body.is-app-ui:not(.is-home-hub) .graph-chapter-card {
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(241, 245, 249, 0.72));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-preview-card:hover,
body.is-app-ui:not(.is-home-hub) .graph-chapter-card:hover {
  border-color: rgba(96, 165, 250, 0.24);
  box-shadow: var(--app-shadow-soft), var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-preview-card strong,
body.is-app-ui:not(.is-home-hub) .graph-chapter-card strong,
body.is-app-ui:not(.is-home-hub) .graph-legend-card strong {
  font-family: var(--sans);
  letter-spacing: -0.02em;
}

body.is-app-ui:not(.is-home-hub) .graph-cluster {
  padding: 18px;
  border-radius: 28px;
  border-color: rgba(var(--graph-accent-rgb), 0.22);
  background:
    radial-gradient(circle at top right, rgba(var(--graph-accent-rgb), 0.14), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 245, 249, 0.8));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-cluster.is-focus {
  transform: translateY(-1px);
}

body.is-app-ui:not(.is-home-hub) .graph-node {
  min-height: 104px;
  padding: 16px 16px 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(var(--graph-accent-rgb), 0.05)),
    rgba(255, 255, 255, 0.82);
}

body.is-app-ui:not(.is-home-hub) .graph-node strong {
  font-family: var(--sans);
  letter-spacing: -0.02em;
}

body.is-app-ui:not(.is-home-hub) .graph-node-meta {
  line-height: 1.58;
}

body.is-app-ui:not(.is-home-hub) .graph-detail-card {
  gap: 18px;
}

body.is-app-ui:not(.is-home-hub) .graph-detail-head {
  padding: 20px;
  border-radius: 26px;
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-detail-section {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .graph-detail-section h4 {
  font-family: var(--sans);
  letter-spacing: -0.02em;
}

body.is-app-ui:not(.is-home-hub) .graph-candidate-list {
  gap: 10px;
}

body.is-app-ui:not(.is-home-hub) .deck-home-card,
body.is-app-ui:not(.is-home-hub) .deck-panel-card,
body.is-app-ui:not(.is-home-hub) .deck-section-card,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card {
  padding: 24px;
}

body.is-app-ui:not(.is-home-hub) .deck-home-card h4,
body.is-app-ui:not(.is-home-hub) .deck-panel-card h3,
body.is-app-ui:not(.is-home-hub) .deck-section-card h3,
body.is-app-ui:not(.is-home-hub) .deck-card-detail-card h3,
body.is-app-ui:not(.is-home-hub) .deck-spread-card h4,
body.is-app-ui:not(.is-home-hub) .deck-guide-card h4 {
  font-family: var(--sans);
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .deck-home-preview,
body.is-app-ui:not(.is-home-hub) .deck-spectrum-item,
body.is-app-ui:not(.is-home-hub) .deck-spread-card,
body.is-app-ui:not(.is-home-hub) .deck-guide-card,
body.is-app-ui:not(.is-home-hub) .deck-detail-section,
body.is-app-ui:not(.is-home-hub) .deck-related-link {
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(241, 245, 249, 0.72));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .deck-card-grid {
  gap: 12px;
}

body.is-app-ui:not(.is-home-hub) .deck-card-tile {
  padding: 16px;
  border-radius: 24px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(241, 245, 249, 0.72));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .deck-card-tile:hover,
body.is-app-ui:not(.is-home-hub) .deck-card-tile.is-active {
  border-color: var(--app-border-strong);
  box-shadow: var(--app-shadow-soft), var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .deck-card-tile-index {
  min-height: 60px;
  border-color: rgba(96, 165, 250, 0.18);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.12), rgba(255, 255, 255, 0.76));
}

body.is-app-ui:not(.is-home-hub) .deck-card-tile-copy strong {
  font-family: var(--sans);
  font-size: 1.06rem;
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .deck-card-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--app-divider);
}

body.is-app-ui:not(.is-home-hub) .deck-card-detail-meta {
  justify-content: flex-end;
}

body.is-app-ui:not(.is-home-hub) .deck-detail-section {
  padding: 16px;
}

body.is-app-ui:not(.is-home-hub) .deck-detail-section h4 {
  font-family: var(--sans);
}

body.is-app-ui:not(.is-home-hub) .deck-related-link {
  padding: 12px 14px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

body.is-app-ui:not(.is-home-hub) .deck-related-link:hover {
  transform: translateY(-1px);
  border-color: var(--app-border-strong);
}

body.is-app-ui:not(.is-home-hub) .lab-hero-card,
body.is-app-ui:not(.is-home-hub) .lab-note-card,
body.is-app-ui:not(.is-home-hub) .lab-card {
  padding: 24px;
}

body.is-app-ui:not(.is-home-hub) .lab-note-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 28%),
    var(--app-surface);
}

body.is-app-ui:not(.is-home-hub) .lab-tabs {
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--app-border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .lab-tab {
  flex: 1 1 auto;
  min-height: 44px;
  border-radius: 18px;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}

body.is-app-ui:not(.is-home-hub) .lab-tab.is-active {
  border-color: rgba(96, 165, 250, 0.18);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(255, 255, 255, 0.88));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.is-app-ui:not(.is-home-hub) .lab-card h3,
body.is-app-ui:not(.is-home-hub) .lab-entry-card h4 {
  font-family: var(--sans);
  letter-spacing: -0.03em;
}

body.is-app-ui:not(.is-home-hub) .lab-flow {
  gap: 12px;
  margin-top: 16px;
}

body.is-app-ui:not(.is-home-hub) .lab-flow span {
  padding: 10px 14px;
  border-color: var(--app-border);
  background: var(--app-surface-soft);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .lab-stack-card,
body.is-app-ui:not(.is-home-hub) .lab-extension-card,
body.is-app-ui:not(.is-home-hub) .lab-preset-button,
body.is-app-ui:not(.is-home-hub) .lab-range,
body.is-app-ui:not(.is-home-hub) .lab-select,
body.is-app-ui:not(.is-home-hub) .lab-text-field,
body.is-app-ui:not(.is-home-hub) .lab-textarea {
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(241, 245, 249, 0.72));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .lab-preset-button {
  min-height: 132px;
  padding: 16px;
  align-content: flex-start;
}

body.is-app-ui:not(.is-home-hub) .lab-preset-button strong {
  font-family: var(--sans);
  letter-spacing: -0.02em;
}

body.is-app-ui:not(.is-home-hub) .lab-entry-card {
  padding: 20px 18px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(241, 245, 249, 0.72));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .lab-entry-card:hover {
  box-shadow: var(--app-shadow-soft), var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .lab-range input {
  margin-top: 14px;
}

body.is-app-ui:not(.is-home-hub) .lab-select select,
body.is-app-ui:not(.is-home-hub) .lab-text-field input,
body.is-app-ui:not(.is-home-hub) .lab-textarea textarea {
  border-color: var(--app-border);
  background: rgba(255, 255, 255, 0.86);
}

body.is-app-ui:not(.is-home-hub) .lab-prompt-output {
  border-radius: 22px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.82));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .assistant-panel-shell {
  gap: 16px;
}

body.is-app-ui:not(.is-home-hub) .assistant-panel-title h3 {
  font-size: 1.18rem;
}

body.is-app-ui:not(.is-home-hub) .assistant-context-card {
  margin: 0 20px;
  padding: 18px;
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.76));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .assistant-context-head {
  align-items: center;
}

body.is-app-ui:not(.is-home-hub) .assistant-quick-actions {
  gap: 10px;
}

body.is-app-ui:not(.is-home-hub) .assistant-quick-action {
  padding: 12px 14px;
  border-radius: 16px;
  border-color: var(--app-border);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .assistant-conversation-panel {
  margin: 0 20px;
  padding: 2px 2px 2px 0;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(241, 245, 249, 0.12));
  overflow: hidden;
}

body.is-app-ui:not(.is-home-hub) .assistant-conversation {
  gap: 14px;
  padding-bottom: 12px;
}

body.is-app-ui:not(.is-home-hub) .assistant-message {
  max-width: 94%;
  padding: 16px 16px 14px;
  border-radius: 24px;
  border-color: var(--app-border);
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .assistant-message.is-user {
  background:
    linear-gradient(135deg, rgba(255, 248, 242, 0.96), rgba(255, 255, 255, 0.82));
}

body.is-app-ui:not(.is-home-hub) .assistant-message.is-assistant {
  background:
    linear-gradient(135deg, rgba(245, 249, 255, 0.96), rgba(255, 255, 255, 0.84));
}

body.is-app-ui:not(.is-home-hub) .assistant-source-card {
  border-color: var(--app-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.74));
  box-shadow: var(--app-inset);
}

body.is-app-ui:not(.is-home-hub) .assistant-panel-dock {
  padding: 16px 20px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.78));
}

body.is-app-ui:not(.is-home-hub) .assistant-composer-panel textarea {
  min-height: 96px;
  border-radius: 20px;
}

@media (max-width: 760px) {
  body.is-app-ui:not(.is-home-hub) .graph-shell,
  body.is-app-ui:not(.is-home-hub) .lab-shell,
  body.is-app-ui:not(.is-home-hub) .deck-shell {
    width: calc(100vw - 20px);
    gap: 16px;
  }

  body.is-app-ui:not(.is-home-hub) .reader-paper {
    border-radius: 28px;
  }

  body.is-app-ui:not(.is-home-hub) .reader-paper-inner {
    padding: 24px 16px 20px;
  }

  body.is-app-ui:not(.is-home-hub) .graph-note-card,
  body.is-app-ui:not(.is-home-hub) .graph-board-card,
  body.is-app-ui:not(.is-home-hub) .graph-detail-card,
  body.is-app-ui:not(.is-home-hub) .graph-launch-card,
  body.is-app-ui:not(.is-home-hub) .lab-note-card,
  body.is-app-ui:not(.is-home-hub) .lab-card,
  body.is-app-ui:not(.is-home-hub) .deck-home-card,
  body.is-app-ui:not(.is-home-hub) .deck-panel-card,
  body.is-app-ui:not(.is-home-hub) .deck-section-card,
  body.is-app-ui:not(.is-home-hub) .deck-card-detail-card {
    padding: 20px 16px;
    border-radius: 24px;
  }

  body.is-app-ui:not(.is-home-hub) .comments-shell {
    padding: 20px 16px;
  }

  body.is-app-ui:not(.is-home-hub) .doc-meta h2 {
    max-width: none;
  }

  body.is-app-ui:not(.is-home-hub) .assistant-context-card,
  body.is-app-ui:not(.is-home-hub) .assistant-conversation-panel {
    margin-left: 14px;
    margin-right: 14px;
  }

  body.is-app-ui:not(.is-home-hub) .assistant-panel-dock {
    padding-left: 14px;
    padding-right: 14px;
  }

  body.is-app-ui:not(.is-home-hub) .lab-tabs {
    padding: 4px;
    border-radius: 20px;
  }

  body.is-app-ui:not(.is-home-hub) .lab-tab {
    width: 100%;
  }
}

body.is-home-hub .app-home-shell {
  gap: 16px;
}

body.is-home-hub .app-home-search-strip {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--paper-line);
  border-radius: 26px;
  background: var(--guide-card-bg);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

body.is-home-hub .app-home-search-strip:hover {
  transform: translateY(-1px);
  background: var(--assistant-source-bg);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
}

body.is-home-hub .app-home-search-strip-icon {
  width: 46px;
  height: 46px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: var(--app-inset);
}

body.is-home-hub .app-home-search-strip-icon svg {
  width: 22px;
  height: 22px;
}

body.is-home-hub .app-home-search-strip-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body.is-home-hub .app-home-search-strip-copy strong {
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

body.is-home-hub .app-home-search-strip-copy small {
  color: var(--text-soft);
  line-height: 1.55;
}

body.is-home-hub .app-home-feed-section {
  padding-top: 18px;
}

body.is-home-hub .app-home-feed-head {
  padding: 0 18px 12px;
}

body.is-home-hub .app-home-feed-list .spotlight-link {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 96px;
  padding: 16px 18px;
}

body.is-home-hub .app-home-feed-list .spotlight-link:hover {
  background: var(--guide-card-soft-bg);
}

body.is-home-hub .app-home-feed-list .spotlight-link-index {
  width: 54px;
  height: 54px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow:
    var(--app-inset),
    0 10px 22px rgba(37, 99, 235, 0.08);
}

body.is-home-hub .app-home-feed-list .spotlight-link-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

body.is-home-hub .app-home-feed-list .spotlight-link-meta {
  color: var(--text-faint);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.is-home-hub .app-home-feed-list .spotlight-link-copy em {
  max-width: 42ch;
}

body.is-home-hub .app-home-feed-list .spotlight-link-arrow {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--guide-card-soft-bg);
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease;
}

body.is-home-hub .app-home-feed-list .spotlight-link:hover .spotlight-link-arrow {
  transform: translateX(2px);
  background: var(--accent-soft);
}

@media (max-width: 760px) {
  body.is-home-hub .app-home-search-strip {
    padding: 14px 16px;
    border-radius: 22px;
  }

  body.is-home-hub .app-home-search-strip-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
  }

  body.is-home-hub .app-home-search-strip-copy strong {
    font-size: 0.98rem;
  }

  body.is-home-hub .app-home-feed-list .spotlight-link {
    grid-template-columns: 48px minmax(0, 1fr) 28px;
    min-height: 88px;
    padding: 15px 16px;
  }

  body.is-home-hub .app-home-feed-list .spotlight-link-index {
    width: 48px;
    height: 48px;
    border-radius: 18px;
  }
}

body.is-reading .reader-header,
body.is-app-ui.is-reading:not(.is-home-hub) .reader-header {
  position: fixed;
  display: inline-flex;
  top: 40px;
  left: 18px;
  right: auto;
  z-index: 52;
  width: fit-content;
  max-width: none;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 0;
  justify-content: flex-start;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.is-reading .header-copy,
body.is-reading .header-actions,
body.is-reading .reader-progress {
  display: none;
}

body.is-reading .header-start {
  gap: 0;
}

body.is-reading .reader-header,
body.is-app-ui.is-reading:not(.is-home-hub) .reader-header {
  background-color: transparent !important;
  background-image: none !important;
  -webkit-backdrop-filter: none !important;
}

body.is-reading #catalog-button {
  padding: 9px 15px;
  min-width: 7.8rem;
  border-color: rgba(148, 163, 184, 0.24);
  background: color-mix(in srgb, var(--panel-strong) 90%, white 10%);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

body.is-reading #catalog-button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--button-strong-text);
  box-shadow: 0 16px 34px rgba(139, 63, 52, 0.28);
}

body.is-reading .reader-main,
body.is-app-ui.is-reading:not(.is-home-hub) .reader-main {
  padding-top: 8px;
}

@media (max-width: 760px) {
  body.is-reading .reader-header,
  body.is-app-ui.is-reading:not(.is-home-hub) .reader-header {
    top: 24px;
    left: 12px;
  }

  body.is-reading #catalog-button {
    padding: 7px 12px;
  }

  body.is-reading .reader-main,
  body.is-app-ui.is-reading:not(.is-home-hub) .reader-main {
    padding-top: 0;
  }

  body.is-reading .reader-paper-inner,
  body.is-app-ui.is-reading:not(.is-home-hub) .reader-paper-inner {
    padding-top: 14px;
  }

  body.is-reading .doc-meta,
  body.is-app-ui.is-reading:not(.is-home-hub) .doc-meta {
    display: none;
  }

  body.is-reading .doc-content,
  body.is-app-ui.is-reading:not(.is-home-hub) .doc-content {
    margin-top: 0;
  }

  body.is-reading .doc-content > :first-child,
  body.is-app-ui.is-reading:not(.is-home-hub) .doc-content > :first-child {
    margin-top: 0 !important;
  }
}

body.is-guide-screen .reader-header,
body.is-guide-screen .reader-progress,
body.is-guide-screen .mobile-reader-bar {
  display: none;
}

body.is-guide-screen .reader-main {
  padding: 14px 12px 18px;
  min-height: 100vh;
}

.guide-view {
  width: 100%;
}

.guide-shell {
  width: min(980px, calc(100vw - 24px));
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.guide-topbar {
  position: sticky;
  top: 12px;
  z-index: 24;
  display: flex;
  justify-content: flex-start;
}

.guide-back-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  background: var(--guide-back-bg);
  color: var(--text);
  box-shadow: 0 18px 36px rgba(74, 48, 34, 0.14);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.guide-back-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border-strong);
  box-shadow: 0 20px 42px rgba(74, 48, 34, 0.18);
}

.guide-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(139, 63, 52, 0.1);
  color: var(--accent);
  font-size: 0.96rem;
}

.guide-stage {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--paper-line);
  border-radius: 34px;
  background:
    radial-gradient(circle at top right, rgba(39, 96, 125, 0.14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(172, 91, 46, 0.1), transparent 28%),
    var(--guide-stage-bg);
  box-shadow: 0 28px 70px rgba(74, 48, 34, 0.14);
  backdrop-filter: blur(20px);
}

.guide-hero {
  display: grid;
  gap: 10px;
}

.guide-hero-copy h2 {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.05rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

body.is-guide-screen .assistant-panel-description {
  margin: 10px 0 0;
  max-width: 58ch;
  font-size: 0.98rem;
  line-height: 1.7;
}

body.is-guide-screen.is-app-ui:not(.is-home-hub) .assistant-context-card,
body.is-guide-screen .assistant-context-card {
  margin: 0;
  padding: 18px 18px 16px;
  border-color: var(--paper-line);
  border-radius: 26px;
  background: var(--guide-card-bg);
  box-shadow: var(--app-inset);
}

body.is-guide-screen .assistant-context-head {
  align-items: center;
}

.guide-quick-asks {
  display: grid;
  gap: 10px;
}

.guide-quick-asks-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

body.is-guide-screen .assistant-quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

body.is-guide-screen.is-app-ui:not(.is-home-hub) .assistant-quick-action,
body.is-guide-screen .assistant-quick-action {
  min-height: 0;
  padding: 9px 12px;
  border-radius: 16px;
  border-color: var(--paper-line);
  background: var(--guide-card-soft-bg);
  box-shadow: var(--app-inset);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-soft);
}

body.is-guide-screen .assistant-quick-action:hover {
  color: var(--text);
}

body.is-guide-screen.is-app-ui:not(.is-home-hub) .assistant-conversation-panel,
body.is-guide-screen .assistant-conversation-panel {
  margin: 0;
  padding: 10px;
  flex: 1 1 auto;
  min-height: 360px;
  border-radius: 30px;
  border: 1px solid var(--paper-line);
  background: var(--guide-card-ghost-bg);
  overflow: hidden;
}

body.is-guide-screen .assistant-conversation {
  gap: 16px;
  height: 100%;
  padding: 8px 2px 10px;
}

.assistant-message-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 12px;
}

.assistant-message-row.is-user {
  grid-template-columns: minmax(0, 1fr) auto;
}

.assistant-message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: var(--guide-card-bg);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.assistant-message-row.is-assistant .assistant-message-avatar {
  background: var(--assistant-ai-avatar-bg);
  color: var(--accent);
}

.assistant-message-row.is-user .assistant-message-avatar {
  order: 2;
  background: var(--assistant-user-avatar-bg);
  color: var(--assistant-user-bubble-text);
}

.assistant-message-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.assistant-message-row.is-user .assistant-message-stack {
  order: 1;
  justify-items: end;
}

body.is-guide-screen .assistant-message-head {
  padding-inline: 4px;
}

body.is-guide-screen .assistant-message-row.is-user .assistant-message-head {
  justify-content: flex-end;
}

.assistant-message-role {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}

.assistant-message-bubble {
  width: fit-content;
  max-width: min(100%, 680px);
  padding: 14px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 24px;
  background: var(--assistant-bubble-bg);
  box-shadow: var(--assistant-bubble-shadow);
}

.assistant-message-row.is-assistant .assistant-message-bubble {
  border-bottom-left-radius: 10px;
}

.assistant-message-row.is-user .assistant-message-bubble {
  border-bottom-right-radius: 10px;
  background: var(--assistant-user-bubble-bg);
  border-color: var(--assistant-user-bubble-border);
  color: var(--assistant-user-bubble-text);
}

.assistant-message-row.is-pending .assistant-message-bubble {
  border-style: dashed;
}

body.is-guide-screen .assistant-source-grid {
  width: min(100%, 680px);
}

.assistant-source-disclosure {
  width: min(100%, 680px);
  border: 1px solid var(--paper-line);
  border-radius: 18px;
  background: var(--assistant-source-bg);
  overflow: hidden;
}

.assistant-source-summary {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.assistant-source-summary::-webkit-details-marker {
  display: none;
}

.assistant-source-summary-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.assistant-source-summary-meta {
  font-size: 0.78rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-source-disclosure[open] .assistant-source-summary {
  border-bottom: 1px solid var(--paper-line);
  background: var(--guide-card-soft-bg);
}

.assistant-source-disclosure .assistant-source-grid {
  padding: 12px;
}

body.is-guide-screen.is-app-ui:not(.is-home-hub) .assistant-source-card,
body.is-guide-screen .assistant-source-card {
  border-color: var(--paper-line);
  background: var(--guide-card-bg);
  box-shadow: var(--app-inset);
}

body.is-guide-screen .assistant-panel-dock {
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: transparent;
}

.guide-actions [hidden] {
  display: none !important;
}

.guide-composer {
  border-radius: 22px;
}

.guide-composer textarea {
  min-height: 84px;
  max-height: 30vh;
  resize: none;
}

.guide-actions {
  align-items: center;
}

body.is-guide-screen #assistant-submit-button,
body.is-guide-screen #assistant-submit-button[disabled] {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  font-weight: 700;
  opacity: 1;
}

body.is-guide-screen .assistant-status {
  min-height: 0;
  margin: 2px 4px 0;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

body.is-guide-screen .assistant-status:empty {
  display: none;
}

@media (max-width: 760px) {
  body.is-guide-screen .reader-main {
    padding: 8px 6px 10px;
  }

  .guide-shell {
    width: calc(100vw - 12px);
    gap: 10px;
  }

  .guide-topbar {
    top: 8px;
  }

  .guide-back-button {
    padding: 10px 14px;
  }

  .guide-stage {
    min-height: calc(100vh - 26px);
    padding: 16px 14px 14px;
    border-radius: 24px;
    gap: 14px;
  }

  body.is-guide-screen .assistant-context-card {
    padding: 16px 14px 14px;
    border-radius: 22px;
  }

  body.is-guide-screen .assistant-quick-actions {
    grid-template-columns: 1fr;
  }

  body.is-guide-screen .assistant-conversation-panel {
    min-height: 300px;
    border-radius: 24px;
    padding: 8px;
  }

  .assistant-message-row {
    gap: 10px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .assistant-message-row.is-user {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .assistant-message-row.is-user .assistant-message-stack {
    justify-items: end;
  }

  body.is-guide-screen .assistant-message-row.is-user .assistant-message-head {
    justify-content: flex-end;
  }

  .assistant-message-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
  }

  .assistant-message-bubble,
  body.is-guide-screen .assistant-source-grid {
    max-width: 100%;
    width: 100%;
  }

  .assistant-source-summary-meta {
    white-space: normal;
  }

  .guide-composer textarea {
    min-height: 74px;
  }

  .guide-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .guide-actions .reader-button {
    flex: 1 1 140px;
  }
}
