/* ==========================================================================
   Knowledge Source — reader theme
   Dark-first, editorial serif headings, three-pane reading layout.
   ========================================================================== */

:root {
  --font-sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Charter", "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --topbar-h: 58px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --hl-text: #c9d1d9;
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-number: #79c0ff;
  --hl-title: #d2a8ff;
  --hl-built: #ffa657;
  --hl-comment: #8b949e;
  --hl-attr: #79c0ff;
  --hl-meta: #8b949e;
}

:root[data-theme="dark"] {
  --bg: #0b0d11;
  --bg-grad:
    radial-gradient(1100px 620px at 82% -12%, rgba(167, 139, 250, 0.11), transparent 62%),
    radial-gradient(900px 520px at -8% 104%, rgba(103, 232, 249, 0.055), transparent 60%);
  --panel: #11141a;
  --panel-2: #171b23;
  --panel-3: #1d222c;
  --border: #242a36;
  --border-soft: #1b212b;
  --text: #e7eaf0;
  --text-dim: #a4adbc;
  --text-faint: #707b8d;
  --accent: #a78bfa;
  --accent-2: #67e8f9;
  --accent-soft: rgba(167, 139, 250, 0.13);
  --accent-ink: #120e1f;
  --link: #9db9ff;
  --mark: rgba(250, 204, 21, 0.26);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.85);
  --shadow-soft: 0 10px 26px -14px rgba(0, 0, 0, 0.7);
  --scrim: rgba(5, 8, 12, 0.62);
  --code-bg: #141821;
  --source: #f2a868;
  --source-soft: rgba(242, 168, 104, 0.13);
  --summary: #6dc4f4;
  --summary-soft: rgba(109, 196, 244, 0.13);
  --topic: #8ddc7c;
  --topic-soft: rgba(141, 220, 124, 0.13);
  --concept: #c4a4ff;
  --concept-soft: rgba(196, 164, 255, 0.13);
  --hub: #ff8fb1;
  --hub-soft: rgba(255, 143, 177, 0.13);
  --ok: #5ee0a0;
}

:root[data-theme="light"] {
  --bg: #f7f6f3;
  --bg-grad:
    radial-gradient(1000px 560px at 84% -10%, rgba(91, 67, 201, 0.06), transparent 62%),
    radial-gradient(760px 460px at -6% 104%, rgba(8, 145, 178, 0.045), transparent 60%);
  --panel: #ffffff;
  --panel-2: #f1f0ec;
  --panel-3: #e7e5df;
  --border: #ddd9d1;
  --border-soft: #e9e6df;
  --text: #1b1f24;
  --text-dim: #4d5563;
  --text-faint: #5f6775;
  --accent: #5b43c9;
  --accent-2: #0e7490;
  --accent-soft: rgba(91, 67, 201, 0.1);
  --accent-ink: #ffffff;
  --link: #2f5fd0;
  --mark: rgba(250, 204, 21, 0.45);
  --shadow: 0 26px 60px -28px rgba(48, 42, 30, 0.35);
  --shadow-soft: 0 10px 24px -16px rgba(48, 42, 30, 0.3);
  --scrim: rgba(28, 32, 46, 0.42);
  --code-bg: #f6f3ec;
  --source: #8a4a0c;
  --source-soft: rgba(138, 74, 12, 0.1);
  --summary: #165f86;
  --summary-soft: rgba(22, 95, 134, 0.1);
  --topic: #2d6b1f;
  --topic-soft: rgba(45, 107, 31, 0.1);
  --concept: #5b32a8;
  --concept-soft: rgba(91, 50, 168, 0.1);
  --hub: #99204d;
  --hub-soft: rgba(153, 32, 77, 0.1);
  --ok: #0f7a4c;
  --hl-text: #24292f;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-number: #0550ae;
  --hl-title: #8250df;
  --hl-built: #953800;
  --hl-comment: #6e7781;
  --hl-attr: #0550ae;
  --hl-meta: #6e7781;
}

:root[data-theme="terracotta"] {
  --bg: #1c1514;
  --bg-grad:
    radial-gradient(1100px 620px at 82% -12%, rgba(224, 122, 95, 0.18), transparent 62%),
    radial-gradient(900px 520px at -8% 104%, rgba(244, 162, 97, 0.12), transparent 60%);
  --panel: #261d1b;
  --panel-2: #2f2422;
  --panel-3: #392c2a;
  --border: #473734;
  --border-soft: #382b29;
  --text: #f5eae6;
  --text-dim: #cbb8b3;
  --text-faint: #9c8782;
  --accent: #e07a5f;
  --accent-2: #f4a261;
  --accent-soft: rgba(224, 122, 95, 0.18);
  --accent-ink: #1c1514;
  --link: #f4a261;
  --mark: rgba(244, 162, 97, 0.3);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.9);
  --shadow-soft: 0 10px 26px -14px rgba(0, 0, 0, 0.7);
  --scrim: rgba(15, 10, 9, 0.7);
  --code-bg: #221a18;
  --source: #e07a5f;
  --source-soft: rgba(224, 122, 95, 0.15);
  --summary: #f4a261;
  --summary-soft: rgba(244, 162, 97, 0.15);
  --topic: #81b29a;
  --topic-soft: rgba(129, 178, 154, 0.15);
  --concept: #e76f51;
  --concept-soft: rgba(231, 111, 81, 0.15);
  --hub: #d4a373;
  --hub-soft: rgba(212, 163, 115, 0.15);
  --ok: #81b29a;
}

:root[data-theme="obsidian"] {
  --bg: #000000;
  --bg-grad: none;
  --panel: #0d0d0d;
  --panel-2: #141414;
  --panel-3: #1c1c1c;
  --border: #262626;
  --border-soft: #1a1a1a;
  --text: #e6e6e6;
  --text-dim: #999999;
  --text-faint: #666666;
  --accent: #7c3aed;
  --accent-2: #a855f7;
  --accent-soft: rgba(124, 58, 237, 0.18);
  --accent-ink: #ffffff;
  --link: #c084fc;
  --mark: rgba(168, 85, 247, 0.28);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 1);
  --shadow-soft: 0 10px 26px -14px rgba(0, 0, 0, 0.9);
  --scrim: rgba(0, 0, 0, 0.85);
  --code-bg: #0a0a0a;
  --source: #f97316;
  --source-soft: rgba(249, 115, 22, 0.15);
  --summary: #38bdf8;
  --summary-soft: rgba(56, 189, 248, 0.15);
  --topic: #4ade80;
  --topic-soft: rgba(74, 222, 128, 0.15);
  --concept: #c084fc;
  --concept-soft: rgba(192, 132, 252, 0.15);
  --hub: #f43f5e;
  --hub-soft: rgba(244, 63, 94, 0.15);
  --ok: #22c55e;
}

:root[data-theme="github-dark"] {
  --bg: #0d1117;
  --bg-grad: none;
  --panel: #161b22;
  --panel-2: #21262d;
  --panel-3: #30363d;
  --border: #30363d;
  --border-soft: #21262d;
  --text: #f0f6fc;
  --text-dim: #8b949e;
  --text-faint: #6e7681;
  --accent: #2f81f7;
  --accent-2: #58a6ff;
  --accent-soft: rgba(56, 139, 253, 0.15);
  --accent-ink: #ffffff;
  --link: #58a6ff;
  --mark: rgba(210, 153, 34, 0.3);
  --shadow: 0 24px 60px -26px rgba(1, 4, 9, 0.85);
  --shadow-soft: 0 10px 26px -14px rgba(1, 4, 9, 0.7);
  --scrim: rgba(1, 4, 9, 0.75);
  --code-bg: #10141b;
  --source: #f0883e;
  --source-soft: rgba(240, 136, 62, 0.15);
  --summary: #58a6ff;
  --summary-soft: rgba(88, 166, 255, 0.15);
  --topic: #3fb950;
  --topic-soft: rgba(63, 185, 80, 0.15);
  --concept: #bc8cff;
  --concept-soft: rgba(188, 140, 255, 0.15);
  --hub: #f778ba;
  --hub-soft: rgba(247, 120, 186, 0.15);
  --ok: #238636;
}

/* ---------------------------------------------------------------- base */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-faint) 45%, var(--panel-3));
  background-clip: padding-box;
  border: 3px solid transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.i {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
  vertical-align: -3px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-faint);
  font: 600 10.5px/1 var(--font-sans);
  letter-spacing: 0.02em;
}

.type-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--tc, var(--text-faint));
}

.t-source {
  --tc: var(--source);
  --tc-soft: var(--source-soft);
}

.t-summary {
  --tc: var(--summary);
  --tc-soft: var(--summary-soft);
}

.t-topic {
  --tc: var(--topic);
  --tc-soft: var(--topic-soft);
}

.t-concept {
  --tc: var(--concept);
  --tc-soft: var(--concept-soft);
}

.t-hub,
.t-report {
  --tc: var(--hub);
  --tc-soft: var(--hub-soft);
}

.t-doc,
.t-transcript,
.t-word_index {
  --tc: var(--text-faint);
  --tc-soft: var(--panel-2);
}

/* -------------------------------------------------------------- layout */

#shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 312px;
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#shell.no-inspector {
  grid-template-columns: 280px minmax(0, 1fr);
}

#shell.no-inspector #inspector {
  display: none;
}

#shell.full-width-mode {
  grid-template-columns: minmax(0, 1fr);
}

#shell.full-width-mode #sidebar,
#shell.full-width-mode #inspector {
  display: none;
}

#shell.full-width-mode .note-wrap,
#shell.full-width-mode .prose,
#shell.full-width-mode .page {
  max-width: 100% !important;
  width: 100%;
}

#progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 80;
  pointer-events: none;
}

#progress-fill {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: transform 0.08s linear;
}

/* ------------------------------------------------------------- sidebar */

#sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 14px;
  color: inherit;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #7c6cf7 46%, var(--accent-2));
  box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--accent) 75%, transparent);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-text strong {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.brand-text span {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
}

.side-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% - 28px);
  margin: 2px 14px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 12.8px;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}

.side-search:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text-dim);
}

.side-search .i {
  width: 15px;
  height: 15px;
}

.side-search .side-kbd {
  margin-left: auto;
}

#nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 33px;
  padding: 6.5px 9px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 13.4px;
  line-height: 1.4;
  transition: background 0.13s, color 0.13s, transform 0.1s var(--ease);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item .i {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  transition: color 0.13s;
}

.nav-item:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.nav-item:hover .i {
  color: var(--text-dim);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active .i {
  color: var(--accent);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 2px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
}

.nav-item:focus-visible,
.nav-group-toggle:focus-visible,
.side-list a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

.nav-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.side-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 2px 10px 18px;
}

.side-scroll.scrolled-top {
  box-shadow: inset 0 12px 12px -14px rgba(0, 0, 0, 0.55);
}

.side-scroll.scrolled-end {
  box-shadow: inset 0 -14px 14px -16px rgba(0, 0, 0, 0.55);
}

.side-scroll.scrolled-top.scrolled-end {
  box-shadow: inset 0 12px 12px -14px rgba(0, 0, 0, 0.55),
    inset 0 -14px 14px -16px rgba(0, 0, 0, 0.55);
}

.side-group h3 {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 14px -4px 4px;
  padding: 10px 8px 5px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-list li {
  margin: 0;
}

.side-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5.5px 8px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 12.8px;
  line-height: 1.45;
  transition: background 0.13s, color 0.13s;
}

.side-list a:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.side-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-count {
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.side-sub {
  display: block;
  margin-top: -2px;
  padding: 0 8px 4px;
  color: var(--text-faint);
  font-size: 10.8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--accent);
  opacity: 0.55;
}

#sync-info {
  padding: 11px 16px 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 10.8px;
  line-height: 1.7;
}

#sync-info code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}

.sync-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

/* -------------------------------------------------------------- topbar */

#main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

#topbar {
  position: relative;
  z-index: 20;
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.icon-btn .i {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--panel-2);
  color: var(--text);
}

#menu-toggle {
  display: grid;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 900px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 38px;
  padding: 0 46px 0 37px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.4px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

#search-input::placeholder {
  color: var(--text-faint);
}

#search-input:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#search-input::-webkit-search-cancel-button {
  display: none;
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.suggest-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  max-height: min(68vh, 520px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.suggest-panel.open {
  display: block;
  animation: pop 0.13s var(--ease);
}

.sug-group {
  padding: 10px 13px 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sug-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  color: var(--text);
  font-size: 13.4px;
  cursor: pointer;
}

.sug-item.active,
.sug-item:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.sug-main {
  flex: 1;
  min-width: 0;
}

.sug-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-meta {
  display: block;
  color: var(--text-faint);
  font-size: 11.4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sug-kind {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sug-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.8px;
}

.sug-empty {
  padding: 20px 14px;
  color: var(--text-faint);
  font-size: 12.8px;
  text-align: center;
}

#content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

.loading,
.empty {
  padding: 60px 20px;
  color: var(--text-faint);
  font-size: 13.5px;
  text-align: center;
}

.loading::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --------------------------------------------------------------- note */

.note-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 44px 90px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--text-faint);
  font-size: 12px;
}

.crumbs a {
  color: var(--text-faint);
}

.crumbs a:hover {
  color: var(--accent);
  text-decoration: none;
}

.crumbs .sep {
  opacity: 0.45;
}

.note-hero {
  position: relative;
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow .type-dot {
  width: 6px;
  height: 6px;
}

.note-hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.1vw, 38px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.note-lede {
  max-width: 66ch;
  margin: -2px 0 16px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.62;
  text-wrap: pretty;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 15px;
  color: var(--text-dim);
  font-size: 12.8px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.meta-item .i {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.meta-item a {
  color: inherit;
}

.meta-item a:hover {
  color: var(--accent);
  text-decoration: none;
}

.meta-item b {
  font-weight: 600;
  color: var(--text);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 9px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

a.badge:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
  text-decoration: none;
}

.badge.type-source,
.badge.type-summary,
.badge.type-topic,
.badge.type-concept,
.badge.type-hub,
.badge.type-report {
  color: var(--tc);
  border-color: color-mix(in srgb, var(--tc) 34%, transparent);
  background: var(--tc-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12.8px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, filter 0.15s;
}

.btn:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--panel-3);
  color: var(--text);
  text-decoration: none;
}

.btn .i {
  width: 15px;
  height: 15px;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #8b6cf6);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn.primary:hover {
  color: var(--accent-ink);
  filter: brightness(1.07);
}

.btn.ghost {
  background: transparent;
}

.btn kbd {
  height: 18px;
  min-width: 18px;
  border-color: color-mix(in srgb, currentColor 22%, transparent);
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: inherit;
  font-size: 9.5px;
  opacity: 0.85;
}

.btn.primary kbd {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
}

/* --------------------------------------------------------------- prose */

.note-body {
  min-width: 0;
}

.prose {
  width: 100%;
  max-width: 120ch;
  color: var(--text);
  font-size: 16.4px;
  line-height: 1.78;
}

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

.prose > p:first-of-type {
  font-size: 17.4px;
  color: var(--text);
}

.prose h1,
.prose h2 {
  position: relative;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.prose h1 {
  margin: 2.2em 0 0.7em;
  font-size: 28px;
  line-height: 1.25;
}

.prose h2 {
  margin: 2.1em 0 0.7em;
  padding-bottom: 0.36em;
  font-size: 23px;
  line-height: 1.3;
}

.prose h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.prose h3 {
  position: relative;
  margin: 1.7em 0 0.45em;
  font-size: 17.5px;
  font-weight: 650;
  line-height: 1.4;
}

.prose h4 {
  margin: 1.6em 0 0.4em;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose p {
  margin: 0 0 1.05em;
}

.prose ul,
.prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.35em;
}

.prose li {
  margin: 0.28em 0;
}

.prose li::marker {
  color: var(--accent);
}

.prose strong {
  font-weight: 650;
  color: var(--text);
}

.prose a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 38%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.prose a:hover {
  text-decoration-color: var(--link);
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 0.8em 1.2em;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 72%);
  color: var(--text-dim);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.12em 0.38em;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.prose pre {
  margin: 0;
  padding: 15px 17px;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--code-bg);
}

.prose pre code {
  padding: 0;
  border: none;
  background: none;
  font-size: 12.8px;
  line-height: 1.7;
}

.code-wrap {
  position: relative;
  margin: 1.3em 0;
}

.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.code-copy .i {
  width: 14px;
  height: 14px;
}

.code-wrap:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.table-scroll {
  margin: 1.4em 0;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.prose table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 13.8px;
}

.prose th,
.prose td {
  padding: 9px 13px;
  border-top: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.prose thead th {
  position: sticky;
  top: 0;
  border-top: none;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.prose tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--panel-2) 45%, transparent);
}

.prose hr {
  margin: 2.2em 0;
  border: none;
  border-top: 1px solid var(--border-soft);
}

.prose img {
  max-width: 100%;
  border-radius: 12px;
}

.heading-anchor {
  position: absolute;
  left: -1.3em;
  top: 0.15em;
  display: inline-flex;
  width: 1em;
  height: 1em;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.heading-anchor .i {
  width: 0.72em;
  height: 0.72em;
}

.heading-anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 0.8;
}

/* wikilinks */

a.wl {
  padding: 0 2px;
  border-bottom: 1px solid color-mix(in srgb, var(--tc, var(--accent)) 45%, transparent);
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--tc, var(--accent)) 9%, transparent);
  color: var(--text);
  text-decoration: none;
  transition: background 0.13s, border-color 0.13s;
}

a.wl::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--tc, var(--accent));
  vertical-align: 2px;
  opacity: 0.9;
}

a.wl:hover {
  border-bottom-color: var(--tc, var(--accent));
  background: color-mix(in srgb, var(--tc, var(--accent)) 16%, transparent);
  text-decoration: none;
}

.wl-dead {
  color: var(--text-faint);
  border-bottom: 1px dashed var(--text-faint);
}

.auto-marker {
  display: none;
}

/* ---------------------------------------------------------- transcript */

.transcript-head {
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
}

.transcript-title {
  margin: 4px 0 6px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.transcript-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.6px;
}

.transcript-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.transcript-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}

.tb-label {
  margin-right: 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11.8px;
  font-weight: 500;
}

.tb-btn:hover,
.tb-btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--accent);
}

.tb-spacer {
  margin-left: auto;
}

.raw-text {
  margin: 0;
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: var(--tsize, 14px);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.raw-text.no-wrap {
  white-space: pre;
  overflow-x: auto;
  overflow-wrap: normal;
}

/* ----------------------------------------------------- inline toc (mobile) */

.toc-inline {
  display: none;
  margin: 0 0 26px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
}

.toc-inline summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
}

.toc-inline summary::-webkit-details-marker {
  display: none;
}

.toc-inline summary::after {
  content: "+";
  margin-left: auto;
  font-size: 13px;
}

.toc-inline[open] summary::after {
  content: "−";
}

.toc-inline nav {
  display: flex;
  flex-direction: column;
  padding: 0 8px 10px;
}

.toc-inline .toc {
  border-left: none;
  margin-left: 0;
}

/* ----------------------------------------------------------- inspector */

#inspector {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 18px 70px;
  border-left: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel) 46%, transparent);
  font-size: 13px;
}

.insp-section + .insp-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.insp-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.insp-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
}

.toc a {
  position: relative;
  display: block;
  margin-left: -2px;
  padding: 5px 10px;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12.6px;
  line-height: 1.42;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.toc a.lvl-3 {
  padding-left: 21px;
  color: var(--text-faint);
  font-size: 12px;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc a.active {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  color: var(--accent);
}

.insp-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.insp-list a {
  display: block;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 12.4px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insp-list a:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.kind {
  margin-right: 6px;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.details-box {
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.2px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.details-box code {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10.8px;
}

.details-box a {
  color: var(--text-dim);
}

.insp-empty {
  color: var(--text-faint);
  font-size: 11.8px;
  font-style: italic;
}

/* --------------------------------------------------------------- pages */

.page {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 34px 44px 100px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 64ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 13.6px;
  line-height: 1.65;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 26px;
  padding: 36px 38px 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background:
    radial-gradient(760px 250px at 0% 0%, var(--accent-soft), transparent 62%),
    var(--panel);
}

.hero::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -150px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 15%, transparent), transparent 68%);
  pointer-events: none;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-eyebrow .type-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.hero h1 {
  max-width: 18ch;
  margin: 10px 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero p {
  max-width: 58ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 14.2px;
  line-height: 1.7;
}

.hero p code {
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
}

.stat-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-icon .i {
  width: 17px;
  height: 17px;
}

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 36px 0 14px;
  color: var(--text-faint);
  font-size: 10.8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.section-title .section-count {
  order: 3;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(182px, 1fr));
  gap: 12px;
}

.start-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.start-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--panel-2);
  text-decoration: none;
}

.start-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.start-icon .i {
  width: 17px;
  height: 17px;
}

.start-card strong {
  font-size: 13.8px;
  font-weight: 600;
}

.start-card span {
  color: var(--text-faint);
  font-size: 11.8px;
  line-height: 1.5;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 12px;
}

.card {
  --tc: var(--text-faint);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  padding: 15px 17px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  transition: transform 0.16s var(--ease), border-color 0.16s, box-shadow 0.16s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tc);
  opacity: 0.85;
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tc) 42%, var(--border));
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--tc);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-go {
  display: inline-flex;
  margin-left: auto;
  color: var(--text-faint);
  transition: transform 0.16s, color 0.16s;
}

.card-go .i {
  width: 14px;
  height: 14px;
}

.card:hover .card-go {
  transform: translateX(2px);
  color: var(--tc);
}

.card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14.6px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.005em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: var(--text-faint);
  font-size: 11.6px;
}

.card-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card .thumb {
  width: calc(100% + 34px);
  max-width: none;
  margin: -15px -17px 8px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--panel-3);
  border-radius: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12.6px;
}

.chip:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.chip .count {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 10px;
}

.topic-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 13.4px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.topic-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--accent-soft);
  text-decoration: none;
}

.tt-count {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.4px;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}

.filter-wrap .i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.filter-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 33px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}

.filter-input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar-note {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.az-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 18px;
}

.az-grid a,
.az-grid button {
  padding: 3px 8px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
}

.az-grid a:hover,
.az-grid button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-card {
  --tc: var(--text-faint);
  display: block;
  padding: 15px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.result-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--panel-2);
  text-decoration: none;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.result-head strong {
  font-size: 14.4px;
  font-weight: 600;
}

.result-kind {
  color: var(--tc);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.result-sub {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.result-snippet {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.result-snippet mark {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--mark);
  color: inherit;
}

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
}

.prevnext a {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  max-width: 48%;
  padding: 11px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text-dim);
}

.prevnext a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text);
  text-decoration: none;
}

.prevnext .next {
  align-items: flex-end;
  text-align: right;
}

.pn-label {
  color: var(--text-faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pn-count {
  align-self: center;
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- videos */

.video-hero {
  margin-bottom: 26px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
}

.video-embed {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: none;
  background: var(--panel-3);
  cursor: pointer;
}

.video-embed img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-embed .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(9, 11, 16, 0.7);
  color: #fff;
  backdrop-filter: blur(5px);
  transition: transform 0.18s, background 0.18s;
}

.video-embed .play .i {
  width: 26px;
  height: 26px;
  margin-left: 3px;
}

.video-embed:hover .play {
  transform: scale(1.06);
  background: rgba(9, 11, 16, 0.82);
}

.video-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-body {
  padding: 20px 22px 22px;
}

.video-body h1 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(23px, 2.6vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.nowrap {
  white-space: nowrap;
}

/* --------------------------------------------------------------- graph */

#graph-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  min-height: 480px;
  overflow: hidden;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 7%, transparent) 0%, transparent 75%),
    linear-gradient(to right, color-mix(in srgb, var(--border-soft) 30%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border-soft) 30%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 36px 36px, 36px 36px;
}

#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#graph-canvas.dragging {
  cursor: grabbing;
}

.graph-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.graph-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.graph-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 6px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gfilter {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 550;
  text-align: left;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.gfilter:hover {
  background: var(--panel-2);
  color: var(--text);
}

.gfilter[aria-pressed="false"] {
  opacity: 0.35;
}

.gcount {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--border-soft) 60%, transparent);
  color: var(--text-faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.gzoom {
  display: flex;
  gap: 6px;
}

.gzoom button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

.gzoom button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel-3);
  transform: translateY(-1px);
}

.gzoom .i {
  width: 15px;
  height: 15px;
}

#graph-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: var(--r-sm, 8px);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#graph-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.graph-hint {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--text-dim);
  font-size: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

#graph-tip {
  position: absolute;
  min-width: 180px;
  max-width: 320px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s cubic-bezier(0.16, 1, 0.3, 1), transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(4px);
  z-index: 25;
}

#graph-tip.active {
  opacity: 1;
  transform: translateY(0);
}

.graph-tip-title {
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.35;
}

.graph-tip-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px;
}

.graph-tip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--tc, var(--text-dim));
  background: color-mix(in srgb, var(--tc, var(--text-dim)) 15%, transparent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.graph-tip-degree {
  color: var(--text-faint);
}

.graph-tip-words {
  color: var(--text-faint);
}

.graph-tip-degree::before,
.graph-tip-words::before {
  content: "· ";
  opacity: 0.6;
}

.graph-tip-summary {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

#shell.graph-full {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 961px) {
  #shell.graph-full #sidebar,
  #shell.graph-full #inspector {
    display: none;
  }
}

.graph-panel.graph-spread {
  width: 180px;
  padding: 10px 14px 13px;
}

.graph-spread .graph-title {
  padding: 0 0 8px;
}

#graph-spread {
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 85%, transparent);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#graph-spread::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgba(0, 0, 0, 0.4);
  -webkit-appearance: none;
  appearance: none;
}

#graph-spread::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
}

#graph-spread::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 85%, transparent);
}

.gzoom button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-soft));
  color: var(--accent);
}

/* Enhanced Markdown & Callouts */
.callout {
  margin: 1.5em 0;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 6px;
  text-transform: capitalize;
}

.callout-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-dim);
}

.callout-note { border-left-color: #60a5fa; background: color-mix(in srgb, #60a5fa 6%, var(--panel)); }
.callout-note .callout-title { color: #60a5fa; }
.callout-tip { border-left-color: #34d399; background: color-mix(in srgb, #34d399 6%, var(--panel)); }
.callout-tip .callout-title { color: #34d399; }
.callout-important { border-left-color: #a78bfa; background: color-mix(in srgb, #a78bfa 6%, var(--panel)); }
.callout-important .callout-title { color: #a78bfa; }
.callout-warning { border-left-color: #fbbf24; background: color-mix(in srgb, #fbbf24 6%, var(--panel)); }
.callout-warning .callout-title { color: #fbbf24; }
.callout-caution { border-left-color: #f87171; background: color-mix(in srgb, #f87171 6%, var(--panel)); }
.callout-caution .callout-title { color: #f87171; }

/* -------------------------------------------------------------- palette */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: var(--scrim);
  backdrop-filter: blur(7px);
}

.overlay.open {
  display: flex;
}

.palette {
  width: min(660px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8);
  animation: pop 0.14s var(--ease);
}

.palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.palette-input .i {
  width: 17px;
  height: 17px;
  color: var(--text-faint);
}

.palette-input input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 15px;
}

.palette-input input::placeholder {
  color: var(--text-faint);
}

.palette-results {
  max-height: min(54vh, 430px);
  overflow-y: auto;
  padding: 6px;
}

.palette-group-title {
  padding: 9px 10px 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  cursor: pointer;
}

.palette-item.active {
  background: var(--accent-soft);
}

.pi-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-dim);
}

.pi-icon-wrap {
  display: flex;
  flex: none;
}

.pi-icon .i {
  width: 15px;
  height: 15px;
}

.palette-item.active .pi-icon {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.pi-main {
  flex: 1;
  min-width: 0;
}

.pi-title {
  display: block;
  overflow: hidden;
  font-size: 13.4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pi-meta {
  display: block;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pi-key {
  color: var(--text-faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.palette-foot {
  display: flex;
  gap: 16px;
  padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.3px;
}

.palette-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.palette-empty {
  padding: 24px 14px;
  color: var(--text-faint);
  font-size: 12.8px;
  text-align: center;
}

/* ---------------------------------------------------------------- modal */

.modal {
  width: min(780px, calc(100vw - 32px));
  max-height: 82vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  resize: both;
  overflow: hidden;
  min-width: 320px;
  min-height: 250px;
}

.modal.sheet-modal {
  width: min(1040px, calc(100vw - 32px));
  max-width: 96vw;
  height: 85vh;
  max-height: 94vh;
}

.modal::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
}

.modal-head h2 {
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-body {
  height: calc(100% - 55px);
  max-height: calc(88vh - 55px);
  overflow: auto;
  padding: 16px;
  box-sizing: border-box;
}

.modal-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 6px);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-tab-btn.active {
  background: var(--accent);
  color: #120e1f;
  font-weight: 600;
  border-color: var(--accent);
}

.markdown-preview-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.markdown-sheet-preview {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
}

.markdown-sheet-preview .prose {
  max-width: 100%;
}

.raw-md {
  margin: 0;
  color: var(--text-dim);
  font: 12.5px/1.7 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
}

.shortcut-row:hover {
  background: var(--panel-2);
}

.shortcut-row span {
  color: var(--text-dim);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

.shortcut-note {
  margin: 14px 0 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.65;
}

/* ------------------------------------------------------- back to top, toast */

#to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-dim);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s, color 0.18s, border-color 0.18s;
}

#to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-3);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12.8px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.18s, transform 0.18s;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  padding: 40px;
  color: var(--text);
  text-align: center;
}

#scrim {
  display: none;
}

/* ----------------------------------------------------------- animations */

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 1360px) {
  #shell {
    grid-template-columns: 264px minmax(0, 1fr) 292px;
  }

  #shell.no-inspector {
    grid-template-columns: 264px minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  #shell,
  #shell.no-inspector {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  #inspector {
    display: none;
  }

  .toc-inline {
    display: block;
  }

  .note-wrap {
    max-width: 800px;
  }
}

@media (max-width: 960px) {
  #shell,
  #shell.no-inspector {
    grid-template-columns: minmax(0, 1fr);
  }

  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(320px, 88vw);
    height: 100vh;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border-right: 1px solid var(--border);
    background: var(--panel);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    overscroll-behavior: contain;
    transform: translateX(-102%);
    transition: transform 0.24s var(--ease);
  }

  body.sidebar-open #sidebar {
    transform: none;
  }

  #scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(4, 6, 10, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  body.sidebar-open #scrim {
    opacity: 1;
    pointer-events: auto;
  }

  #menu-toggle {
    display: grid;
  }

  .note-wrap {
    padding: 26px 30px 100px;
  }

  .page {
    padding: 30px 28px 90px;
  }

  .hero {
    padding: 30px 28px;
  }
}

@media (max-width: 640px) {
  #topbar {
    gap: 8px;
    padding: 0 12px;
  }

  .search-kbd {
    display: none;
  }

  #search-input {
    padding-right: 14px;
    font-size: 13.8px;
  }

  #shortcuts-btn {
    display: none;
  }

  .note-wrap,
  .page {
    padding: 22px 17px 84px;
  }

  .note-hero h1 {
    font-size: 26px;
  }

  .hero {
    padding: 26px 22px;
    border-radius: 18px;
  }

  .hero h1 {
    font-size: 32px;
  }

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

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .prevnext {
    flex-direction: column;
  }

  .prevnext a {
    max-width: none;
  }

  .pn-count {
    align-self: flex-start;
    order: 3;
  }

  .prose {
    font-size: 16px;
  }

  .transcript-toolbar {
    gap: 5px;
  }

  .tb-spacer {
    margin-left: 0;
  }

  .raw-text {
    padding: 16px;
  }

  #to-top {
    right: 16px;
    bottom: 16px;
  }

  .overlay {
    padding: 7vh 10px 10px;
  }

  .palette-foot span:last-child {
    display: none;
  }

  .graph-toolbar {
    top: 10px;
    right: 10px;
  }

  .graph-hint {
    display: none;
  }
}

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

@media print {
  body {
    overflow: visible;
    background: #fff;
    color: #111;
  }

  #sidebar,
  #topbar,
  #inspector,
  #progress,
  #to-top,
  #toast,
  .graph-toolbar,
  .toc-inline,
  .actions,
  .prevnext,
  .read-bar,
  .sel-toolbar,
  .sel-translate,
  .translate-panel,
  .media-grid,
  .cams-grid,
  .tv-results,
  .lb-stage,
  .lb-audio-art {
    display: none !important;
  }

  #shell,
  #shell.no-inspector {
    display: block;
    height: auto;
  }

  #content {
    overflow: visible;
    height: auto;
  }

  .note-wrap {
    max-width: none;
    padding: 0;
  }

  .prose {
    max-width: none;
  }
}

/* ==========================================================================
   Chatbot Floating Widget
   ========================================================================== */

#chatbot-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#chatbot-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #a78bfa), var(--accent-2, #67e8f9));
  color: #0b0d11;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(167, 139, 250, 0.45);
}

#chatbot-toggle svg {
  width: 20px;
  height: 20px;
}

.chatbot-drawer {
  position: absolute;
  bottom: 54px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 120px);
  background: var(--panel, #11141a);
  border: 1px solid var(--border, #242a36);
  border-radius: var(--r-md, 12px);
  box-shadow: var(--shadow, 0 24px 60px rgba(0, 0, 0, 0.85));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot-drawer[hidden],
.chatbot-drawer.is-closed {
  display: none !important;
}

.chatbot-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft, #1b212b);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-2, #171b23);
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #e7eaf0);
}

.chatbot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.chatbot-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--accent-soft, rgba(167, 139, 250, 0.15));
  color: var(--accent, #a78bfa);
}

#chatbot-close {
  background: none;
  border: none;
  color: var(--text-dim, #a4adbc);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm, 6px);
  position: relative;
  z-index: 10;
}

#chatbot-close svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

#chatbot-close:hover {
  background: var(--panel-3, #1d222c);
  color: var(--text, #e7eaf0);
}

/* ==========================================================================
   User Interactions: Likes, Comments, Notes & Word Corner
   ========================================================================== */

.interactions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 0 16px;
  margin-top: 14px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.like-btn.liked {
  background: var(--hub-soft, rgba(255, 143, 177, 0.2));
  color: var(--hub, #ff8fb1);
  border-color: var(--hub, #ff8fb1);
  font-weight: 600;
}

.notes-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: calc(100vh - var(--topbar-h));
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.22s var(--ease);
}

.notes-drawer[hidden],
.notes-drawer.is-closed {
  display: none !important;
}

.notes-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
}

.notes-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.user-section {
  padding: 0;
  border: none;
  background: transparent;
}

.user-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.user-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  resize: vertical;
  min-height: 64px;
}

.user-textarea:focus {
  border-color: var(--accent);
}

.user-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-item-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm, 8px);
  background: var(--panel-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.user-item-content {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

.user-item-date {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.user-item-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.user-item-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Word Corner Tagging */
.word-corner-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--accent-2);
}

.word-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  padding: 0;
  display: flex;
  align-items: center;
}

.word-tag button:hover {
  color: #ef4444;
}

.theme-dropdown {
  position: relative;
}

.theme-picker-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}

.theme-picker-menu.open {
  display: flex;
}

.theme-picker-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--r-sm, 6px);
  background: none;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.theme-picker-opt:hover,
.theme-picker-opt.active {
  background: var(--panel-2);
  color: var(--text);
}

.chatbot-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-msg {
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 88%;
  word-break: break-word;
}

.chat-msg.chat-user {
  align-self: flex-end;
  background: var(--accent, #a78bfa);
  color: #120e1f;
  font-weight: 500;
  border-bottom-right-radius: 2px;
}

.chat-msg.chat-assistant {
  align-self: flex-start;
  background: var(--panel-2, #171b23);
  color: var(--text, #e7eaf0);
  border: 1px solid var(--border-soft, #1b212b);
  border-bottom-left-radius: 2px;
}

.chat-msg.chat-error {
  align-self: flex-start;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.chatbot-form {
  display: flex;
  padding: 8px 10px;
  border-top: 1px solid var(--border-soft, #1b212b);
  background: var(--panel-2, #171b23);
  gap: 8px;
}

#chatbot-input {
  flex: 1;
  background: var(--panel, #11141a);
  border: 1px solid var(--border, #242a36);
  border-radius: var(--r-sm, 8px);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text, #e7eaf0);
  outline: none;
}

#chatbot-input:focus {
  border-color: var(--accent, #a78bfa);
}

#chatbot-send {
  background: var(--accent, #a78bfa);
  color: #120e1f;
  border: none;
  border-radius: var(--r-sm, 8px);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

#chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#chatbot-send svg {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------- accounts */

.account-menu {
  position: relative;
  flex: none;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.account-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--panel-2);
  color: var(--text);
}

.account-btn .i {
  width: 16px;
  height: 16px;
}

.account-btn.signed-in {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: var(--accent-soft);
  color: var(--text);
}

.account-avatar {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.account-avatar.large {
  width: 34px;
  height: 34px;
  font-size: 12.5px;
}

.account-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 258px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.account-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px 11px;
  border-bottom: 1px solid var(--border-soft);
}

.account-panel-head div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-panel-head strong {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel-head span:not(.account-avatar) {
  color: var(--text-faint);
  font-size: 11.5px;
}

.account-panel-links,
.account-panel-actions {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.account-panel-actions {
  border-top: 1px solid var(--border-soft);
}

.account-panel-links a,
.account-panel-actions button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.8px;
  text-align: left;
}

.account-panel-links a:hover,
.account-panel-actions button:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.account-panel-links .i,
.account-panel-actions .i {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
}

.account-panel-actions button.danger {
  color: #f08a97;
}

.auth-modal {
  width: min(430px, calc(100vw - 28px));
  min-height: 0;
  resize: none;
}

.auth-card {
  padding: 20px;
}

.auth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-brand {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-head h2 {
  margin: 0;
  font: 600 21px/1.25 var(--font-serif);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.auth-tab {
  flex: 1;
  height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.auth-form,
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .field[hidden] {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12.2px;
  font-weight: 500;
}

.field input {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
}

.field input:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-error {
  min-height: 17px;
  color: #f08a97;
  font-size: 12px;
}

.auth-submit {
  width: 100%;
  height: 38px;
  justify-content: center;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .account-name {
    display: none;
  }

  .account-btn {
    padding: 0 9px;
  }

  .account-panel {
    position: fixed;
    right: 12px;
    top: calc(var(--topbar-h) + 6px);
  }
}

/* ------------------------------------------------- personal notes & attachments */

.btn.small {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.8px;
}

.btn.small .i {
  width: 13px;
  height: 13px;
}

.btn.danger {
  color: #f08a97;
}

.btn.danger:hover {
  border-color: color-mix(in srgb, #f08a97 55%, var(--border));
  color: #ffb3bc;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.personal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.personal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 17px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 14px);
  background: var(--panel);
  transition: border-color 0.15s, transform 0.15s;
}

.personal-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}

.personal-card-title {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.personal-card-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.personal-card-excerpt {
  flex: 1;
  margin: 0;
  color: var(--text-dim);
  font-size: 12.6px;
  line-height: 1.6;
}

.personal-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.personal-card-date {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.personal-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  color: var(--accent);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.personal-link.muted,
.personal-link.missing {
  color: var(--text-faint);
}

.personal-link.missing {
  color: #f08a97;
}

.personal-link .i {
  width: 12px;
  height: 12px;
  flex: none;
}

.personal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 54px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg, 14px);
  color: var(--text-dim);
  text-align: center;
}

.personal-empty p {
  margin: 0;
  font-size: 13.5px;
}

.personal-page {
  max-width: 980px;
}

.personal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.personal-bar .pe-status {
  flex: 1;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pe-title {
  width: 100%;
  padding: 10px 2px;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.pe-title:focus {
  border-bottom-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}

.pe-title::placeholder {
  color: var(--text-faint);
}

.pe-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
}

.pe-link-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.5px;
}

.pe-link-field span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pe-link-field .i {
  width: 13px;
  height: 13px;
}

.pe-link-field input {
  width: min(340px, 62vw);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.pe-link-state {
  display: flex;
  align-items: center;
  min-height: 22px;
}

.pe-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.pe-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pe-count.over {
  color: #f0b26b;
}

.pe-body {
  width: 100%;
  min-height: 340px;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 14px);
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: 14.5px/1.7 var(--font-mono);
  resize: vertical;
  tab-size: 2;
}

.pe-body:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pe-preview {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 14px);
  background: var(--panel);
  max-width: 100%;
}

.pe-attach {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.pe-attach h3 {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.pe-hint {
  margin: 18px 0 0;
  color: var(--text-faint);
  font-size: 11.5px;
}

.pe-hint code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-2);
  font-size: 11px;
}

.attach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.attach-upload {
  cursor: pointer;
}

.attach-link-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.attach-link-form input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
}

.attach-link-form input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.attach-link-actions {
  display: flex;
  gap: 7px;
}

.attach-status {
  min-height: 15px;
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.attach-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.attach-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.attach-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: zoom-in;
}

.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-faint);
}

.attach-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.attach-meta strong {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12.2px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-meta span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-item-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.attach-action {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.attach-action:hover {
  background: var(--panel-3);
  color: var(--text);
}

.attach-action.danger:hover {
  color: #f08a97;
}

.attach-action .i {
  width: 14px;
  height: 14px;
}

.linked-note-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.linked-note-list li {
  display: flex;
  flex-direction: column;
  padding: 5px 8px;
  border-radius: 7px;
}

.linked-note-list li:hover {
  background: var(--panel-2);
}

.linked-note-list a {
  color: var(--text-dim);
  font-size: 12.4px;
  line-height: 1.45;
  text-decoration: none;
}

.linked-note-list a:hover {
  color: var(--text);
}

.linked-note-list span {
  color: var(--text-faint);
  font-size: 10.5px;
}

.insp-attachments .attach-item {
  padding: 5px;
}

.insp-linked-notes .btn.small {
  margin-top: 4px;
}

.lightbox {
  max-width: 92vw;
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
}

.lightbox img {
  display: block;
  max-width: 88vw;
  max-height: 84vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--text);
  cursor: pointer;
}

.lightbox-close .i {
  width: 15px;
  height: 15px;
}

/* ------------------------------------------------ friends, DMs and groups */

.nav-badge {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.nav-badge[hidden],
.create-group[hidden] {
  display: none;
}

/* ------------------------------------------- markdown extras and highlighting */

.prose figure,
.markdown-sheet-preview figure {
  margin: 1.5em 0;
}

.prose .prose-figure img {
  width: auto;
  max-height: 78vh;
  margin: 0 auto;
}

.prose figcaption {
  margin-top: 0.55em;
  color: var(--text-faint);
  font-size: 12.8px;
  text-align: center;
}

.prose img[data-zoom] {
  cursor: zoom-in;
}

.prose .img-broken {
  min-width: 140px;
  min-height: 70px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.prose ul.contains-task-list {
  padding-left: 0.3em;
  list-style: none;
}

.prose li.task-list-item {
  list-style: none;
}

.prose li.task-list-item input[type="checkbox"] {
  margin: 0 0.5em 0 0;
  accent-color: var(--accent);
  vertical-align: -1px;
}

.prose details {
  margin: 1.2em 0;
  padding: 0.7em 1em;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
}

.prose summary {
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 600;
}

.prose details[open] summary {
  margin-bottom: 0.6em;
}

.prose svg {
  max-width: 100%;
  height: auto;
}

/* footnotes */

.prose .footnotes {
  margin-top: 2.6em;
  padding-top: 1.1em;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 14px;
}

.prose .footnotes-title {
  margin-bottom: 0.5em;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose .footnotes ol {
  padding-left: 1.4em;
}

.prose .footnote-item {
  margin: 0.45em 0;
}

.prose .footnote-item p {
  margin: 0 0 0.25em;
}

.prose .footnote-backrefs {
  display: inline-flex;
  gap: 0.4em;
}

.prose .footnote-backref {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85em;
}

.prose .fn-ref {
  font-size: 0.72em;
  line-height: 0;
}

.prose .fn-ref a {
  padding: 0 0.1em;
  text-decoration: none;
}

.prose .fn-ref a::before,
.prose .fn-ref a::after {
  color: var(--text-faint);
}

.prose .fn-ref a::before {
  content: "[";
}

.prose .fn-ref a::after {
  content: "]";
}

/* obsidian image embeds */

.prose .obs-embed {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.08em 0.5em;
  border: 1px dashed var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 0.9em;
}

.prose .obs-embed::before {
  content: "▧";
}

.prose .obs-embed.obs-missing {
  border-style: dotted;
  opacity: 0.75;
}

.prose .obs-image {
  cursor: zoom-in;
}

/* embeds */

.embed {
  margin: 1.5em 0;
}

.embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.embed-spotify iframe {
  aspect-ratio: auto;
  height: 152px;
}

.embed-spotify.tall iframe {
  height: 352px;
}

.embed-media video,
.embed-media audio {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.embed-media audio {
  height: 44px;
}

/* mermaid */

.mermaid-block {
  margin: 1.5em 0;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 40%, transparent);
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.mermaid-block[data-state="ready"] {
  padding: 10px;
}

.mermaid-block svg {
  max-width: 100%;
  height: auto;
}

.mermaid-error {
  display: inline-block;
  margin-bottom: 0.6em;
  padding: 0.35em 0.7em;
  border-radius: 999px;
  background: color-mix(in srgb, #f87171 14%, transparent);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
}

.mermaid-source {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--code-bg);
  text-align: left;
}

/* syntax highlighting tokens */

.prose pre code.hljs {
  padding: 0;
  background: transparent;
  color: var(--hl-text);
}

.hljs-comment,
.hljs-quote {
  color: var(--hl-comment);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag {
  color: var(--hl-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute {
  color: var(--hl-string);
}

.hljs-number,
.hljs-symbol,
.hljs-bullet,
.hljs-link {
  color: var(--hl-number);
}

.hljs-title,
.hljs-section,
.hljs-name {
  color: var(--hl-title);
}

.hljs-built_in,
.hljs-type {
  color: var(--hl-built);
}

.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-params {
  color: var(--hl-attr);
}

.hljs-meta {
  color: var(--hl-meta);
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.hljs-deletion {
  color: #f87171;
}

.social-page {
  max-width: 1040px;
}

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

.friends-grid .span {
  grid-column: 1 / -1;
}

.social-panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.social-panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.social-panel h2 .i {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.inline-form input:focus,
.inline-form select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.social-list,
.friend-grid,
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.social-list li:last-child {
  border-bottom: none;
}

.social-list-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.social-list-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-list-main span {
  color: var(--text-faint);
  font-size: 11.5px;
}

.social-subhead {
  margin: 14px 0 2px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.social-empty {
  margin: 8px 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.social-avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--accent-soft),
    color-mix(in srgb, var(--accent-2) 16%, transparent)
  );
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.social-avatar.small {
  width: 28px;
  height: 28px;
  font-size: 10.5px;
}

.social-avatar.tiny {
  width: 22px;
  height: 22px;
  font-size: 9px;
}

.friend-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.friend-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 10px;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.friend-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.friend-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-main span {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* chat */

.chat-page {
  display: flex;
  flex-direction: column;
  max-width: 900px;
  height: calc(100vh - var(--topbar-h));
  padding-bottom: 22px;
}

.chat-page.group-chat-page {
  max-width: 1180px;
}

.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-peer {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.chat-peer strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-peer span {
  color: var(--text-faint);
  font-size: 11.5px;
}

.chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 14px;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  padding: 6px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  overflow-y: auto;
}

.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin: 12px 0;
}

.chat-row.mine {
  flex-direction: row-reverse;
}

.chat-main {
  display: flex;
  max-width: min(78%, 640px);
  flex-direction: column;
  gap: 3px;
}

.chat-row.mine .chat-main {
  align-items: flex-end;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-faint);
  font-size: 10.5px;
}

.chat-meta strong {
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
}

.chat-bubble {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.4px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-row.mine .chat-bubble {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 12px 12px 3px 12px;
  background: var(--accent-soft);
}

.chat-row.pending .chat-bubble {
  opacity: 0.6;
}

.chat-row.failed .chat-bubble {
  border-color: color-mix(in srgb, #f08a97 60%, var(--border));
}

.chat-retry {
  padding: 0;
  border: none;
  background: none;
  color: #f08a97;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.chat-empty {
  padding: 30px 10px;
  color: var(--text-faint);
  font-size: 12.8px;
  text-align: center;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin-top: 10px;
}

.chat-page .chat-composer {
  padding-right: 58px;
}

.chat-composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13.4px;
  line-height: 1.45;
  resize: none;
}

.chat-composer textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.group-members {
  flex: none;
  width: 270px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow-y: auto;
}

.group-members[hidden] {
  display: none;
}

.member-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}

.member-list li:last-child {
  border-bottom: none;
}

.member-list .attach-action {
  flex: none;
}

.group-members .inline-form {
  margin-top: 10px;
}

.group-members [data-leave-group] {
  width: 100%;
  margin-top: 12px;
  justify-content: center;
}

/* groups list */

.create-group {
  margin: 6px 0 18px;
}

.member-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.member-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12.3px;
  cursor: pointer;
}

.member-choice:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--accent-soft);
  color: var(--text);
}

.member-choice input {
  accent-color: var(--accent);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.group-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.group-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--panel-2);
  text-decoration: none;
}

.group-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group-card-head strong {
  font-size: 14px;
}

.group-card-last {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.3px;
  line-height: 1.45;
}

.group-card-meta {
  color: var(--text-faint);
  font-size: 11px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .social-avatar {
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--panel);
}

.avatar-stack .social-avatar:first-child {
  margin-left: 0;
}

.avatar-more {
  margin-left: 6px;
  color: var(--text-faint);
  font-size: 10.5px;
}

.unread-dot {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 900px) {
  .friends-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .friends-grid .span {
    grid-column: auto;
  }

  .chat-page {
    height: auto;
    min-height: calc(100vh - var(--topbar-h));
  }

  .chat-body {
    flex-direction: column;
  }

  .chat-scroll {
    max-height: 60vh;
  }

  .group-members {
    width: auto;
    max-height: 260px;
  }
}

/* ------------------------------------------------------- sidebar collapse */

@media (min-width: 961px) {
  #shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 312px;
  }

  #shell.sidebar-collapsed.no-inspector {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  #shell.sidebar-collapsed #sidebar {
    min-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

@media (min-width: 961px) and (max-width: 1360px) {
  #shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 292px;
  }

  #shell.sidebar-collapsed.no-inspector {
    grid-template-columns: 0 minmax(0, 1fr);
  }
}

@media (min-width: 961px) and (max-width: 1180px) {
  #shell.sidebar-collapsed,
  #shell.sidebar-collapsed.no-inspector {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  #shell.sidebar-collapsed #inspector {
    display: none;
  }
}

#sidebar {
  transition: transform 0.24s var(--ease), opacity 0.18s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  #shell,
  #sidebar,
  .theme-picker-menu,
  .font-menu {
    transition: none;
  }
}

/* -------------------------------------------------------------- font menu */

.font-dropdown {
  position: relative;
}

.font-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  display: flex;
  width: 252px;
  margin-top: 6px;
  padding: 12px;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.font-menu[hidden] {
  display: none;
}

.font-menu-head {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.font-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12.4px;
}

.font-row select {
  width: 140px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12.2px;
}

.font-row select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.font-menu [data-font-reset] {
  align-self: flex-start;
}

/* Live news */

.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.news-item:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--panel-2);
  transform: translateY(-1px);
  text-decoration: none;
}

.news-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
}

.news-source {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-time {
  color: var(--text-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.news-title {
  font-size: 14.5px;
  line-height: 1.42;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-summary {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
  color: var(--text-faint);
}

.news-foot .i {
  width: 14px;
  height: 14px;
}

.news-domain {
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  font-size: 11px;
  color: var(--text-dim);
}

.chips button.chip {
  font: inherit;
  font-size: 12.6px;
}

.chip.is-active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

/* ------------------------------------------------------------ file preview */

.preview-page .page-head {
  align-items: flex-start;
}

.preview-privacy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
}

.preview-privacy svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.preview-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 44px 24px;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}

.preview-drop:hover,
.preview-drop:focus-visible,
.preview-drop.is-dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel));
  outline: none;
}

.preview-drop.is-dragging {
  transform: scale(1.004);
}

.preview-drop-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.preview-drop-icon svg {
  width: 22px;
  height: 22px;
}

.preview-drop strong {
  font-size: 16px;
}

.preview-drop-sub {
  max-width: 54ch;
  color: var(--text-faint);
  font-size: 12.4px;
  line-height: 1.6;
}

.preview-drop .btn {
  margin-top: 6px;
}

.preview-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(10px);
  font-size: 12.5px;
}

.preview-kind {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.2px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-bar-name {
  max-width: 44ch;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-bar-size {
  color: var(--text-faint);
}

.preview-bar-grow {
  flex: 1;
}

.preview-body {
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 20px;
  color: var(--text-faint);
  font-size: 13px;
}

.preview-loading svg {
  animation: spin 1.4s linear infinite;
}

.preview-media {
  display: flex;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--code-bg);
}

.preview-media img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.preview-video video {
  display: block;
  width: 100%;
  max-height: 78vh;
  border-radius: var(--r-md);
  background: #000;
}

.preview-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 44px 20px;
  text-align: center;
}

.preview-audio-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.preview-audio-icon svg {
  width: 26px;
  height: 26px;
}

.preview-audio audio {
  width: min(560px, 100%);
}

.pdf-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel-2);
}

.pdf-zoom-label {
  min-width: 46px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.pdf-count {
  color: var(--text-faint);
  font-size: 12px;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-height: 80vh;
  padding: 8px;
  overflow: auto;
  border-radius: var(--r-md);
  background: var(--panel-2);
}

.pdf-page {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 240px;
}

.pdf-page canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.pdf-placeholder {
  padding: 24px;
  color: var(--text-faint);
  font-size: 12px;
}

.preview-doc {
  max-width: 76ch;
  margin: 0 auto;
  color: var(--text);
}

.epub-body .epub-section + .epub-section {
  margin-top: 2.2em;
  padding-top: 1.4em;
  border-top: 1px solid var(--border-soft);
}

.epub-body img {
  max-width: 100%;
  height: auto;
}

.preview-pre {
  max-height: 76vh;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border-radius: var(--r-md);
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 12.6px;
  line-height: 1.65;
  tab-size: 2;
}

.preview-note {
  margin: 12px 0;
  padding: 9px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--accent-soft);
  color: var(--text-dim);
  font-size: 12.3px;
}

.preview-error,
.preview-unknown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 46px 20px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.preview-error svg,
.preview-unknown svg {
  width: 26px;
  height: 26px;
  color: var(--text-faint);
}

.preview-error p,
.preview-unknown p {
  max-width: 54ch;
  margin: 0;
}

.preview-table-wrap {
  max-height: 74vh;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.4px;
}

.preview-table th,
.preview-table td {
  max-width: 320px;
  padding: 7px 10px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  font-weight: 600;
}

.preview-table tbody tr:hover {
  background: var(--panel-2);
}

.pptx-slides {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.pptx-slide {
  position: relative;
  min-height: 150px;
  padding: 26px 18px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel-2);
}

.pptx-num {
  position: absolute;
  top: 8px;
  left: 12px;
  color: var(--text-faint);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pptx-slide h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
}

.pptx-slide p {
  margin: 4px 0;
  color: var(--text-dim);
  font-size: 12.6px;
  line-height: 1.55;
}

.zip-list {
  margin: 0 0 12px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  list-style: none;
}

.zip-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 12.2px;
}

.zip-list li:last-child {
  border-bottom: 0;
}

.zip-list li span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-list li span:last-child {
  flex: none;
  color: var(--text-faint);
}

.preview-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.preview-recent-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

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

.preview-recent-card strong {
  overflow: hidden;
  font-size: 13.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-recent-card > span:last-child {
  color: var(--text-faint);
  font-size: 11.5px;
}

.pr-kind {
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------- reading music */

.music-page {
  max-width: 1180px;
}

.music-focus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background:
    radial-gradient(700px 200px at 0% 0%, var(--accent-soft), transparent 70%),
    var(--panel);
}

.music-focus-art {
  display: grid;
  flex: none;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
}

.music-focus-art svg {
  width: 28px;
  height: 28px;
}

.music-focus-copy {
  flex: 1 1 320px;
}

.music-focus-copy h2 {
  margin: 2px 0 6px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
}

.music-focus-copy p {
  max-width: 62ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.music-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--panel);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.music-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.music-card.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.music-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.music-num {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.music-play {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.music-play:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.music-play svg {
  width: 16px;
  height: 16px;
}

.music-card strong {
  font-size: 15px;
  font-weight: 600;
}

.music-composer {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.4px;
}

.music-mood {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 12px;
}

.music-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.3px;
}

.music-card-foot a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-faint);
  text-decoration: none;
}

.music-card-foot a:hover {
  color: var(--accent);
}

.music-card-foot svg {
  width: 11px;
  height: 11px;
}

.music-credit {
  margin: 22px 0 0;
  color: var(--text-faint);
  font-size: 11.8px;
  line-height: 1.6;
}

.music-dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  z-index: 70;
  width: min(980px, calc(100% - 28px));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}

.music-dock[hidden] {
  display: none;
}

.md-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.md-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.md-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.md-btn svg {
  width: 15px;
  height: 15px;
}

.md-play {
  width: 40px;
  height: 40px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.md-play:hover {
  background: var(--accent);
  color: var(--accent-ink);
  filter: brightness(1.08);
}

.md-play svg {
  width: 17px;
  height: 17px;
}

.md-loop.is-active {
  color: var(--accent);
}

.md-now {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.md-title {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-title:hover {
  color: var(--accent);
}

.md-sub {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-timeline {
  display: flex;
  flex: 1 1 220px;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.md-time {
  min-width: 34px;
  color: var(--text-faint);
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.md-volume {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
}

.md-volume svg {
  width: 14px;
  height: 14px;
}

input.md-seek,
input.md-vol {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

input.md-seek {
  flex: 1;
}

input.md-vol {
  width: 74px;
}

input.md-seek::-webkit-slider-thumb,
input.md-vol::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  -webkit-appearance: none;
}

input.md-seek::-moz-range-thumb,
input.md-vol::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

input.md-seek:disabled {
  opacity: 0.4;
  cursor: default;
}

body.music-dock-open .page {
  padding-bottom: 190px;
}

/* ---------------------------------------------------------- youtube explorer */

.yt-searchbar,
.yt-linkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.yt-searchbar svg,
.yt-linkbar svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.yt-searchbar input,
.yt-linkbar input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.yt-searchbar input::placeholder,
.yt-linkbar input::placeholder {
  color: var(--text-faint);
}

.yt-linkbar {
  padding: 6px 12px;
  border-radius: var(--r-md);
}

.yt-linkbar input {
  font-size: 13px;
}

.yt-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.yt-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.yt-filter-label {
  margin: 0 2px 0 10px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yt-filter-label:first-child {
  margin-left: 0;
}

.yt-engine {
  margin: -6px 0 14px;
  color: var(--text-faint);
  font-size: 12px;
}

.yt-watch {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 18px;
  margin: 8px 0 28px;
}

.yt-watch[hidden] {
  display: none;
}

.yt-player-col {
  min-width: 0;
}

.yt-player-slot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: #08090b;
}

.yt-slot-note {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.yt-slot-note svg {
  width: 26px;
  height: 26px;
}

.yt-player-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px 0;
}

.yt-player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
}

.yt-player-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.yt-player-copy strong {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}

.yt-player-copy span {
  color: var(--text-faint);
  font-size: 12px;
}

/* floating player */

.yt-float {
  position: fixed;
  z-index: 65;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #000;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.yt-float[hidden] {
  display: none !important;
}

.yt-float.is-inline {
  z-index: 10;
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: none;
}

.yt-float.is-inline .yt-float-bar {
  display: none;
}

.yt-float-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 5px 0 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.yt-float-bar:active {
  cursor: grabbing;
}

.yt-float-title {
  flex: 1;
  min-width: 0;
  padding-right: 6px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ytfb {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.ytfb:hover {
  background: var(--panel);
  color: var(--text);
}

.ytfb svg {
  width: 13px;
  height: 13px;
}

.yt-float-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

.yt-float-frame iframe,
.yt-float-frame > div {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* rich video details */

.yt-details {
  margin-top: 14px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.yt-details[hidden] {
  display: none;
}

.yt-details-loading {
  color: var(--text-faint);
  font-size: 12.5px;
}

.yt-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.yt-stats span {
  display: flex;
  flex-direction: column;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.yt-stats strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.yt-stats .yt-live {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(220, 60, 60, 0.14);
  color: #e25555;
  font-size: 11px;
  font-weight: 700;
}

.yt-desc-wrap {
  margin: 12px 0 4px;
}

.yt-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.yt-desc.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
}

.yt-desc-more {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.yt-desc-more:hover {
  text-decoration: underline;
}

.yt-channel {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel-2);
  color: inherit;
  text-decoration: none;
}

.yt-channel:hover {
  border-color: var(--border);
  background: var(--panel);
}

.yt-channel img,
.yt-channel-fallback {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel);
  object-fit: cover;
}

.yt-channel-fallback svg {
  width: 18px;
  height: 18px;
  color: var(--text-faint);
}

.yt-channel-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.yt-channel-copy strong {
  font-size: 13.5px;
  font-weight: 600;
}

.yt-channel-copy span {
  color: var(--text-faint);
  font-size: 11.5px;
}

.yt-channel > svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.yt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.yt-tags .chip {
  font-size: 11px;
}

.yt-comments {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.yt-comments h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.yt-comment {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border-soft);
}

.yt-comment:first-of-type {
  border-top: 0;
}

.yt-comment img {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.yt-comment > div {
  min-width: 0;
}

.yt-comment header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.yt-comment header strong {
  font-size: 12px;
  font-weight: 600;
}

.yt-comment header span {
  color: var(--text-faint);
  font-size: 11px;
}

.yt-comment p {
  margin: 3px 0 0;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.yt-rail {
  display: flex;
  gap: 12px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.yt-rail .yt-card {
  flex: none;
  width: 214px;
}

.yt-trending {
  margin-bottom: 8px;
}

.yt-transcript {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.yt-tr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
}

.yt-tr-head > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.yt-tr-head strong {
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.yt-tr-head span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-follow {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
}

.yt-follow input {
  accent-color: var(--accent);
}

.yt-lines {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.yt-loading {
  padding: 30px 16px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
}

.yt-line {
  display: flex;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.8px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.yt-line:hover {
  background: var(--panel-2);
  color: var(--text);
}

.yt-line.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.yt-line.is-active .yt-time {
  color: var(--accent);
}

.yt-time {
  flex: none;
  min-width: 42px;
  padding-top: 1px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.8px;
}

.yt-text {
  flex: 1;
}

.yt-empty {
  padding: 18px 14px;
}

.yt-empty > svg {
  width: 22px;
  height: 22px;
  color: var(--text-faint);
}

.yt-empty strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 13.5px;
}

.yt-empty p {
  margin: 0 0 9px;
  color: var(--text-dim);
  font-size: 12.3px;
  line-height: 1.6;
}

.yt-empty textarea {
  width: 100%;
  margin: 4px 0 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.yt-empty-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.yt-empty-actions label.btn {
  cursor: pointer;
}

.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.yt-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

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

.yt-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--panel-2);
}

.yt-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.yt-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
}

.yt-card-body strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.yt-card-meta {
  color: var(--text-faint);
  font-size: 11.2px;
}

.yt-recent {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.yt-recent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.yt-recent-card:hover {
  border-color: var(--accent);
}

.yt-recent-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 78px;
  height: 44px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text-faint);
}

.yt-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-recent-thumb svg {
  width: 18px;
  height: 18px;
}

.yt-recent-card > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.yt-recent-card strong {
  overflow: hidden;
  font-size: 12.2px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-recent-card span span {
  color: var(--text-faint);
  font-size: 11px;
}

.yt-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.yt-error svg {
  width: 24px;
  height: 24px;
  color: var(--text-faint);
}

@media (max-width: 1080px) {
  .yt-watch {
    grid-template-columns: 1fr;
  }

  .yt-transcript {
    max-height: 380px;
  }
}

@media (max-width: 900px) {
  .md-volume {
    display: none;
  }

  .md-now {
    flex-basis: 120px;
  }
}

@media (max-width: 640px) {
  .preview-body {
    padding: 12px;
  }

  .preview-bar-name {
    max-width: 26ch;
  }

  .pdf-pages {
    max-height: 66vh;
  }

  .yt-player-meta {
    flex-wrap: wrap;
  }

  .yt-player-actions {
    width: 100%;
  }

  .yt-player-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .yt-details {
    padding: 12px;
  }

  .yt-stats {
    gap: 8px 14px;
  }

  .yt-rail .yt-card {
    width: 186px;
  }

  .yt-filters .chip {
    font-size: 11px;
    padding: 5px 9px;
  }

  .yt-filter-label {
    margin-left: 4px;
  }

  .yt-float.is-float {
    border-radius: 12px;
  }

  .yt-float.is-float .yt-float-title {
    max-width: 110px;
  }

  .md-inner {
    flex-wrap: wrap;
  }

  .md-now {
    order: -1;
    flex-basis: 100%;
  }

  .md-timeline {
    flex-basis: 100%;
    order: 2;
  }

  .music-dock {
    bottom: 8px;
    width: calc(100% - 16px);
  }

  body.music-dock-open .page {
    padding-bottom: 230px;
  }
}

/* ==========================================================================
   Reading aids — highlights, read aloud, translation

   Highlight colours are translucent so one tint works in every theme; the TTS
   band is a single fixed tint that never hides the text.
   ========================================================================== */

:root {
  --hl-yellow: rgba(250, 204, 21, 0.32);
  --hl-green: rgba(74, 222, 128, 0.28);
  --hl-blue: rgba(96, 165, 250, 0.3);
  --hl-pink: rgba(244, 114, 182, 0.28);
  --tts-bg: rgba(167, 139, 250, 0.3);
}

:root[data-theme="light"] {
  --hl-yellow: rgba(250, 204, 21, 0.45);
  --hl-green: rgba(74, 222, 128, 0.4);
  --hl-blue: rgba(96, 165, 250, 0.35);
  --hl-pink: rgba(244, 114, 182, 0.35);
  --tts-bg: rgba(139, 108, 246, 0.22);
}

::highlight(ks-hl-yellow) {
  background-color: var(--hl-yellow);
}

::highlight(ks-hl-green) {
  background-color: var(--hl-green);
}

::highlight(ks-hl-blue) {
  background-color: var(--hl-blue);
}

::highlight(ks-hl-pink) {
  background-color: var(--hl-pink);
}

::highlight(ks-tts) {
  background-color: var(--tts-bg);
}

mark.ks-hl {
  border-radius: 2px;
  background-color: var(--hl-yellow);
  color: inherit;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

mark.ks-hl-yellow {
  background-color: var(--hl-yellow);
}

mark.ks-hl-green {
  background-color: var(--hl-green);
}

mark.ks-hl-blue {
  background-color: var(--hl-blue);
}

mark.ks-hl-pink {
  background-color: var(--hl-pink);
}

.ks-tts-word {
  border-radius: 2px;
  background-color: var(--tts-bg);
}

/* ------------------------------------------------------------- read aloud */

.read-bar {
  position: sticky;
  top: 0;
  z-index: 14;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: -6px 0 20px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.has-readbar .transcript-toolbar {
  top: var(--readbar-h, 46px);
}

.rb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11.8px;
  font-weight: 500;
  cursor: pointer;
}

.rb-btn:hover,
.rb-btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--accent);
}

.rb-play {
  min-width: 66px;
  justify-content: center;
  font-weight: 600;
}

.rb-select {
  height: 28px;
  max-width: 250px;
  min-width: 0;
  padding: 0 6px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11.8px;
}

.rb-progress {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rb-settings {
  position: relative;
}

.rb-settings summary {
  padding: 4px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11.8px;
  cursor: pointer;
  list-style: none;
}

.rb-settings summary::-webkit-details-marker {
  display: none;
}

.rb-settings[open] {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--border-soft);
}

.rb-settings[open] summary {
  flex-basis: 100%;
  padding: 0;
  border: 0;
  background: none;
}

.rb-settings label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 11.5px;
}

.rb-settings input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
}

/* ------------------------------------------------------- selection toolbar */

.sel-toolbar {
  position: fixed;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.sel-toolbar[hidden] {
  display: none;
}

.sel-swatch {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 50%;
  cursor: pointer;
}

.sel-swatch.is-active {
  box-shadow: 0 0 0 2px var(--text);
}

.sw-yellow {
  background: #facc15;
}

.sw-green {
  background: #4ade80;
}

.sw-blue {
  background: #60a5fa;
}

.sw-pink {
  background: #f472b6;
}

.sel-sep {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--border);
}

.sel-btn {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}

.sel-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.sel-btn[hidden] {
  display: none;
}

.sel-danger:hover {
  border-color: rgba(255, 143, 177, 0.5);
  color: #ff8fb1;
}

.sel-comment {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  display: flex;
  gap: 4px;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
}

.sel-comment[hidden] {
  display: none;
}

.sel-comment input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}

/* --------------------------------------------------- selection translation */

.sel-translate {
  position: fixed;
  z-index: 110;
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12.6px;
}

.sel-translate[hidden],
.st-status[hidden],
.st-result[hidden],
.st-foot[hidden] {
  display: none;
}

.st-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.st-close,
.tp-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.st-close:hover,
.tp-close:hover {
  background: var(--panel-3);
  color: var(--text);
}

.st-source {
  margin: 0 0 9px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.45;
}

.st-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.st-label {
  color: var(--text-faint);
  font-size: 11px;
}

.lang-select {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}

.st-go,
.tp-run {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.st-go:disabled,
.tp-run:disabled {
  opacity: 0.55;
  cursor: progress;
}

.st-status,
.tp-status {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 12px;
}

.st-status.is-error,
.tp-status.is-error {
  color: #ff8fb1;
}

.st-result {
  max-height: 220px;
  margin: 6px 0;
  padding: 8px 10px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel-2);
  line-height: 1.55;
  white-space: pre-wrap;
}

.st-foot,
.tp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-faint);
  font-size: 10.5px;
}

.st-copy,
.tp-cancel {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}

.st-copy:hover,
.tp-cancel:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.tp-cancel[hidden],
.tp-status[hidden],
.tp-output[hidden],
.tp-foot[hidden],
.tp-toggle[hidden] {
  display: none;
}

/* ------------------------------------------------------ translation panel */

.translate-panel {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

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

.tp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tp-title {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tp-lang {
  max-width: 220px;
}

.tp-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
}

.tp-toggle button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
}

.tp-toggle button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.tp-close {
  margin-left: auto;
}

.tp-output {
  max-width: 72ch;
  margin-top: 10px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* --------------------------------------------------------- inspector list */

.insp-highlights {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insp-empty {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.hl-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hl-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-2);
}

.hl-orphan,
.hl-item.is-pending {
  opacity: 0.55;
}

.hl-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: #facc15;
}

.hl-jump {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.hl-jump:hover {
  color: var(--text);
}

.hl-quote {
  display: block;
  line-height: 1.45;
}

.hl-comment {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  font-style: italic;
}

.hl-del {
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.hl-del:hover {
  color: #ff8fb1;
}

@media (max-width: 640px) {
  .read-bar {
    gap: 6px;
    padding: 7px 8px;
  }

  .rb-select {
    flex-basis: 100%;
    max-width: 100%;
    order: 3;
  }

  .rb-progress {
    margin-left: 0;
  }

  .rb-settings label {
    flex: 1 1 46%;
  }

  .rb-settings input[type="range"] {
    flex: 1;
    width: 100%;
  }

  .sel-toolbar {
    left: 10px !important;
    right: 10px;
    top: auto !important;
    bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .sel-comment {
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 6px);
    min-width: 0;
  }

  .sel-translate {
    left: 10px !important;
    width: calc(100vw - 20px);
  }

  .translate-panel {
    padding: 10px;
  }

  .tp-lang {
    max-width: 150px;
  }

  .tp-title {
    flex-basis: 100%;
  }
}

/* --------------------------------------------------------------- discovery */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ks-spin 0.8s linear infinite;
  vertical-align: -2px;
}

@keyframes ks-spin {
  to {
    transform: rotate(360deg);
  }
}

.sentinel-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 22px 0;
  color: var(--text-faint);
  font-size: 13px;
}

.sentinel-loader[hidden] {
  display: none;
}

.sentinel-loader.is-loading {
  opacity: 0.75;
}

/* --- youtube suggestions and paging --- */

.yt-search-wrap {
  position: relative;
}

.suggest-panel {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% - 8px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  box-shadow: var(--shadow-soft);
}

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

.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 15px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.suggest-item:hover,
.suggest-item.is-active {
  background: var(--accent-soft);
}

.suggest-item svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.suggest-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: 20px 0 8px;
}

.yt-results-head .section-title {
  margin: 0;
}

.yt-loading {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* --- media library --- */

.media-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.media-search svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.media-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.media-search input::placeholder {
  color: var(--text-faint);
}

.media-tabs {
  margin-top: 12px;
}

.media-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin-top: 10px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.media-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

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

.media-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--panel-3), var(--panel-2));
}

.media-thumb[data-kind="audio"] {
  aspect-ratio: 4 / 2.4;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.3), rgba(103, 232, 249, 0.14));
}

.media-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb svg {
  width: 28px;
  height: 28px;
  color: var(--text-faint);
}

.media-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
}

.media-badge svg {
  width: 13px;
  height: 13px;
  color: #fff;
}

.media-caption {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 9px 11px 11px;
}

.media-caption strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-credit {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-note {
  margin-top: 22px;
  color: var(--text-faint);
  font-size: 12px;
}

/* --- lightbox --- */

.lb {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-md);
  background: #000;
}

.lb-stage iframe,
.lb-stage video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.lb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  background: rgba(8, 10, 14, 0.84);
  color: #fff;
  text-align: center;
}

.lb-overlay[hidden] {
  display: none;
}

.lb-overlay p {
  margin: 0;
  color: #c9d1d9;
  font-size: 13px;
}

.lb-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.lb-overlay strong {
  font-size: 14.5px;
}

.lb-overlay .spinner {
  margin-bottom: 4px;
  border-color: rgba(255, 255, 255, 0.24);
  border-top-color: #fff;
}

.lb-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}

.lb-linkbtn:hover {
  text-decoration: underline;
}

.lb-note {
  min-height: 15px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.lb-relay-note {
  color: var(--accent);
}

.lb-photo .lb-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.lb-photo img {
  max-width: 100%;
  max-height: 66vh;
  border-radius: var(--r-md);
  background: #000;
  object-fit: contain;
}

.lb-photo figcaption {
  color: var(--text-dim);
  font-size: 12.5px;
}

.lb-missing {
  padding: 26px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.lb-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.lb-credit {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.lb-link {
  color: var(--link);
}

.lb-audio {
  align-items: center;
  text-align: center;
}

.lb-audio-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.3), rgba(103, 232, 249, 0.16));
}

.lb-audio-art svg {
  width: 44px;
  height: 44px;
  color: var(--accent);
}

.lb-audio-title {
  margin: 6px 0 2px;
  font-family: var(--font-serif);
  font-size: 19px;
}

.lb-audio-el {
  width: min(520px, 100%);
}

/* --- live cameras --- */

.cam-filters {
  margin-bottom: 8px;
}

.cams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.cam-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

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

.cam-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120% 120% at 15% 10%, rgba(167, 139, 250, 0.2), transparent 60%),
    linear-gradient(135deg, var(--panel-3), var(--panel-2));
  color: var(--text-faint);
}

.cam-tile svg {
  width: 30px;
  height: 30px;
}

.cam-live {
  position: absolute;
  left: 9px;
  top: 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.cam-live span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5d5d;
}

.cam-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
}

.cam-copy strong {
  font-size: 13.5px;
}

.cam-copy span {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

.cam-copy em {
  color: var(--text-faint);
  font-size: 11px;
  font-style: normal;
  text-transform: capitalize;
}

/* --- world tv --- */

.tv-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.tv-filter,
.tv-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tv-filter input,
.tv-select select {
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
}

.tv-filter input:focus,
.tv-select select:focus {
  border-color: var(--accent);
}

.tv-status {
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.tv-group {
  margin: 20px 0 4px;
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.tv-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}

.tv-card:hover {
  border-color: var(--accent);
}

.tv-logo {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-faint);
}

.tv-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tv-logo svg {
  width: 16px;
  height: 16px;
}

.tv-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 9px;
  }

  .cams-grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  }

  .tv-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .tv-filter,
  .tv-select {
    flex: 1 1 100%;
  }

  .tv-filter input,
  .tv-select select {
    min-width: 0;
    width: 100%;
  }

  .lb-photo img {
    max-height: 52vh;
  }

  .lb-audio-art {
    width: 104px;
    height: 104px;
  }
}



/* ------------------------------------------------------- UI polish pass */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 8px;
  z-index: 2000;
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(-180%);
  transition: transform 0.15s var(--ease);
}

.skip-link:focus {
  transform: none;
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 2px;
}

#content:focus-visible {
  outline: none;
}

/* Topbar overflow menu (mobile) */

.more-dropdown {
  position: relative;
  display: none;
}

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 254px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.more-menu[hidden],
.actions-menu[hidden] {
  display: none;
}

.more-menu-head {
  padding: 6px 8px 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.more-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 8px;
}

.more-swatch {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}

.more-swatch:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--text);
}

.more-swatch.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.more-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.8px;
  text-align: left;
  cursor: pointer;
}

.more-item:hover {
  background: var(--panel-2);
  color: var(--text);
}

.more-item .i {
  width: 16px;
  height: 16px;
}

/* Note action bar */

.actions-more {
  position: relative;
  margin-left: auto;
}

.actions-more > .btn .i:last-child {
  width: 12px;
  height: 12px;
  opacity: 0.65;
}

.actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 236px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.actions-menu .btn {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
}

.actions-menu .btn:hover {
  border-color: var(--border-soft);
  background: var(--panel-2);
}

/* Skeleton loading */

.skeleton-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 12px;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 118px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
}

.skeleton-bar {
  position: relative;
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--panel-2);
}

.skeleton-bar.tall {
  height: 34px;
  border-radius: 10px;
}

.skeleton-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    color-mix(in srgb, var(--text) 7%, transparent) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

.skeleton-bar.w-20 { width: 20%; }
.skeleton-bar.w-25 { width: 25%; }
.skeleton-bar.w-30 { width: 30%; }
.skeleton-bar.w-40 { width: 40%; }
.skeleton-bar.w-55 { width: 55%; }
.skeleton-bar.w-65 { width: 65%; }
.skeleton-bar.w-70 { width: 70%; }
.skeleton-bar.w-75 { width: 75%; }
.skeleton-bar.w-90 { width: 90%; }
.skeleton-bar.w-95 { width: 95%; }

@keyframes skeleton-sweep {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-bar::after {
    animation: none;
  }
}

/* World TV quick picks */

.tv-quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tv-quick strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.tv-quick span {
  color: var(--text-faint);
  font-size: 12.6px;
}

.tv-quick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 640px;
  margin-top: 8px;
}

.tv-quick .chip {
  cursor: pointer;
}

/* Chrome spacing and sidebar footer */

#to-top {
  right: 22px;
  bottom: 84px;
}

#sync-info {
  padding: 10px 16px 13px;
  line-height: 1.5;
}

.sync-line {
  font-size: 11.4px;
  color: var(--text-dim);
}

.sync-meta {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.start-card,
.topic-tile {
  transition: transform 0.16s var(--ease), border-color 0.16s, box-shadow 0.16s;
}

.start-card:hover,
.topic-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow-soft);
}

@media (max-width: 640px) {
  .theme-dropdown,
  .font-dropdown,
  #import-btn,
  #layout-toggle-btn,
  #shortcuts-btn {
    display: none;
  }

  .more-dropdown {
    display: block;
  }

  #topbar {
    gap: 6px;
  }

  .actions {
    gap: 6px;
  }

  .actions .btn {
    padding: 0 10px;
    font-size: 12.2px;
  }

  .actions-more {
    margin-left: 0;
  }

  .actions-menu {
    left: 0;
    right: auto;
    width: min(236px, calc(100vw - 40px));
  }

  #to-top {
    right: 16px;
    bottom: 78px;
  }
}

/* ==================================================================
   Studio — ask, web search, research, saved, code runner, 2048
   ================================================================== */

.nav-group-toggle {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 6px 0 1px;
  padding: 8px 9px 6px;
  border: 0;
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px);
  color: var(--text-faint);
  font: 700 10.6px/1.4 var(--font-sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
}

.nav-group-toggle:hover {
  background: var(--panel-2);
  color: var(--text-dim);
}

.nav-group-toggle .i {
  width: 15px;
  height: 15px;
}

.nav-group-toggle .nav-chev {
  margin-left: auto;
  transition: transform 0.16s var(--ease);
}

.nav-group-toggle[aria-expanded="false"] .nav-chev {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.2s var(--ease);
}

.nav-group-items.collapsed {
  grid-template-rows: 0fr;
}

.nav-group-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow: hidden;
}

.studio-page {
  max-width: 1160px;
}

.studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11.8px;
  font-weight: 600;
}

.studio-pill .i {
  width: 13px;
  height: 13px;
}

.studio-hint {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 12.2px;
  line-height: 1.6;
}

.studio-prose {
  max-width: none;
  font-size: 15.4px;
  line-height: 1.72;
}

.cite-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  margin: 0 2px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: 1px;
  text-decoration: none;
}

.cite-chip:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--text);
  text-decoration: none;
}

/* ---------------------------------------------------------------- ask */

.ask-shell {
  max-width: 860px;
}

.ask-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ask-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 44px 22px 34px;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: center;
}

.ask-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 2px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.ask-empty-icon .i {
  width: 22px;
  height: 22px;
}

.ask-empty strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.ask-empty > span {
  max-width: 54ch;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.ask-msg {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
  font-size: 14.4px;
  line-height: 1.65;
}

.ask-user {
  align-self: flex-end;
  max-width: min(620px, 92%);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #8b6cf6);
  color: var(--accent-ink);
  font-weight: 500;
}

.ask-assistant {
  max-width: 100%;
}

.ask-assistant .prose {
  max-width: none;
  margin: 0;
  font-size: 14.9px;
  line-height: 1.72;
}

.ask-assistant .prose > *:last-child {
  margin-bottom: 0;
}

.ask-pending {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  font-size: 13px;
}

.ask-error {
  border-color: color-mix(in srgb, #e5484d 45%, var(--border));
  background: color-mix(in srgb, #e5484d 9%, var(--panel));
  color: color-mix(in srgb, #e5484d 72%, var(--text));
  font-size: 13.2px;
}

.ask-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ask-form:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ask-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 180px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 14px/1.55 var(--font-sans);
  resize: none;
  outline: none;
}

.ask-form .btn {
  flex: none;
  height: 40px;
}

/* -------------------------------------------------------------- sources */

.studio-sources {
  margin-top: 14px;
  padding: 12px 14px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.studio-sources-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.studio-sources-head .i {
  width: 13px;
  height: 13px;
}

.studio-source {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  color: var(--text);
}

.studio-source:hover {
  background: var(--panel-3);
  text-decoration: none;
}

.studio-source-n {
  flex: none;
  min-width: 26px;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.studio-source-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.studio-source-text strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.studio-source-text span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.6px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ----------------------------------------------------------- web search */

.studio-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 14px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.studio-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.studio-search > .i {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--text-faint);
}

.studio-search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
}

.studio-search .btn {
  flex: none;
  height: 38px;
}

.web-filters {
  margin-bottom: 4px;
}

.web-filters .chip.active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.web-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.web-result {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color 0.15s;
}

.web-result:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.web-result-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}

.web-badge {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text-faint);
  font-size: 9.8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.web-badge.web-wiki {
  background: var(--summary-soft);
  color: var(--summary);
}

.web-badge.web-hn {
  background: var(--source-soft);
  color: var(--source);
}

.web-badge.web-news {
  background: var(--topic-soft);
  color: var(--topic);
}

.web-host {
  color: var(--text-faint);
  font-size: 11.6px;
}

.web-result-title {
  color: var(--text);
  font-size: 15.4px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
}

.web-result-title:hover {
  color: var(--accent);
}

.web-result-snippet {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13.2px;
  line-height: 1.6;
}

.web-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 4px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ----------------------------------------------------------- research */

.research-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 4px 0 18px;
  padding: 0;
  list-style: none;
}

.research-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12.6px;
}

.research-steps li .i {
  width: 15px;
  height: 15px;
}

.research-steps li.active {
  color: var(--accent);
}

.research-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 4px;
  color: var(--text-dim);
  font-size: 13.2px;
}

.research-report {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.research-report-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.research-report-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.research-report-head .eyebrow {
  margin-bottom: 6px;
}

.research-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 26px;
}

.research-body {
  min-width: 0;
}

.research-body .prose {
  max-width: none;
  font-size: 15.2px;
}

.research-sources {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.research-sources .studio-sources {
  margin-top: 0;
}

/* -------------------------------------------------------------- saved */

.saved-section {
  margin-top: 26px;
}

.saved-section .section-title {
  margin-top: 0;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-row .saved-card {
  flex: 1;
  min-width: 0;
}

.saved-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.saved-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--panel-2);
  text-decoration: none;
}

.saved-card > .i {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.saved-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.saved-card-text strong {
  overflow: hidden;
  font-size: 13.6px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-card-text span {
  color: var(--text-faint);
  font-size: 11.6px;
}

.btn.is-saved {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}

/* ---------------------------------------------------------- code runner */

.code-page .page-head {
  align-items: center;
}

.code-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.code-template {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-faint);
  font-size: 12.4px;
  font-weight: 600;
}

.code-template select {
  height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: 500 12.8px/1 var(--font-sans);
  cursor: pointer;
}

.code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.code-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  height: min(62vh, 620px);
}

.code-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--code-bg);
}

.code-pane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 10.6px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.code-pane-head > span:first-child {
  margin-right: auto;
}

.code-pane-note {
  color: var(--text-faint);
  font-size: 10.4px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.code-kbd {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-faint);
  font: 600 9.4px/1.5 var(--font-sans);
}

#code-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 13px/1.6 var(--font-mono);
  tab-size: 2;
  resize: none;
  outline: none;
}

.code-frame-host {
  flex: 1;
  min-height: 0;
  background: #0f1117;
}

.code-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.code-console {
  max-height: 38%;
  overflow-y: auto;
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel);
  font: 400 12px/1.55 var(--font-mono);
}

.code-console:empty {
  display: none;
}

.code-line {
  padding: 1px 0;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.code-line.code-info {
  color: var(--text-faint);
}

.code-line.code-warn {
  color: #e3b341;
}

.code-line.code-error {
  color: #ff7b72;
}

/* ---------------------------------------------------------------- 2048 */

.game-score {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 66px;
  padding: 6px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
  text-align: center;
}

.game-score span {
  color: var(--text-faint);
  font-size: 9.4px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-score strong {
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.g2048-shell {
  position: relative;
  width: min(100%, 480px);
  margin: 22px auto 0;
}

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel-2);
  outline: none;
  touch-action: none;
}

.g2048-board:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 10px;
  color: var(--text);
  font-size: clamp(17px, 4.4vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.tile-empty {
  background: var(--panel-3);
}

.tile-2 {
  background: color-mix(in srgb, var(--text-faint) 14%, var(--panel-3));
}

.tile-4 {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-3));
}

.tile-8 {
  background: color-mix(in srgb, var(--accent) 30%, var(--panel-3));
}

.tile-16 {
  background: color-mix(in srgb, var(--accent) 42%, var(--panel-3));
}

.tile-32 {
  background: color-mix(in srgb, var(--accent) 54%, var(--panel-3));
}

.tile-64 {
  background: color-mix(in srgb, var(--accent) 66%, var(--panel-3));
}

.tile-128 {
  background: color-mix(in srgb, var(--accent) 78%, var(--panel-3));
  color: var(--accent-ink);
}

.tile-256 {
  background: color-mix(in srgb, var(--accent) 90%, var(--panel-3));
  color: var(--accent-ink);
}

.tile-512 {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 18px -8px var(--accent);
}

.tile-1024 {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  color: var(--accent-ink);
  font-size: clamp(14px, 3.8vw, 21px);
  box-shadow: 0 0 22px -7px var(--accent);
}

.tile-2048 {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-size: clamp(14px, 3.8vw, 21px);
  box-shadow: 0 0 28px -6px var(--accent);
}

.tile-super {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  font-size: clamp(12px, 3.2vw, 19px);
  box-shadow: 0 0 24px -8px var(--accent-2);
}

.g2048-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(3px);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.g2048-overlay[hidden] {
  display: none;
}

@media (max-width: 960px) {
  .research-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .research-sources {
    position: static;
  }

  .code-workbench {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .code-pane {
    height: min(46vh, 420px);
  }
}

@media (max-width: 640px) {
  .studio-page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ask-empty {
    padding: 32px 16px 26px;
  }

  .ask-form {
    flex-direction: column;
    align-items: stretch;
  }

  .ask-form textarea {
    min-height: 64px;
  }

  .ask-form .btn {
    width: 100%;
    justify-content: center;
  }

  .studio-search {
    padding-left: 12px;
  }

  .studio-search input {
    height: 44px;
    font-size: 14px;
  }

  .research-report {
    padding: 16px;
  }

  .research-report-head h2 {
    font-size: 19px;
  }

  .research-actions {
    width: 100%;
  }

  .research-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .code-toolbar {
    align-items: stretch;
  }

  .code-actions {
    width: 100%;
  }

  .code-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .g2048-board {
    gap: 7px;
    padding: 7px;
  }

  .tile {
    border-radius: 8px;
    font-size: 18px;
  }

  .game-score {
    min-width: 56px;
    padding: 5px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-group-toggle .nav-chev,
  .tile {
    transition: none;
  }
}

/* ==================================================================
   Shell polish — route motion, rail affordances, drawer, touch
   ================================================================== */

@keyframes ks-route-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#content.route-enter > :first-child {
  animation: ks-route-in 0.22s var(--ease) both;
}

#topbar {
  transition: box-shadow 0.18s var(--ease), border-color 0.18s;
}

#topbar.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 12px 24px -22px rgba(0, 0, 0, 0.8);
}

.card:active {
  transform: translateY(0) scale(0.995);
}

html.theme-fade body,
html.theme-fade #sidebar,
html.theme-fade #main,
html.theme-fade #topbar,
html.theme-fade #content,
html.theme-fade #inspector,
html.theme-fade .card,
html.theme-fade .panel,
html.theme-fade .nav-item,
html.theme-fade .side-search {
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease),
    border-color 0.22s var(--ease);
}

.side-end {
  height: 8px;
  margin: 0;
}

@media (pointer: coarse) {
  .nav-item {
    min-height: 40px;
  }

  .nav-group-toggle {
    min-height: 38px;
  }
}

@media (max-height: 520px) and (max-width: 960px) {
  .brand {
    padding: 10px 18px 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .side-search {
    margin-bottom: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #content.route-enter > :first-child {
    animation: none;
  }

  .nav-group-items,
  .card,
  html.theme-fade body,
  html.theme-fade #sidebar,
  html.theme-fade #main,
  html.theme-fade #topbar,
  html.theme-fade #content,
  html.theme-fade #inspector,
  html.theme-fade .card,
  html.theme-fade .panel,
  html.theme-fade .nav-item,
  html.theme-fade .side-search {
    transition: none;
  }
}

/* ==================================================================
   Studio code runner — highlighted editor, draggable split, animations
   ================================================================== */

.code-workbench {
  grid-template-columns: minmax(0, var(--code-split, 50%)) 14px minmax(0, 1fr);
  gap: 0;
}

.code-splitter {
  position: relative;
  cursor: col-resize;
  touch-action: none;
  border-radius: 6px;
}

.code-splitter::after {
  content: '';
  position: absolute;
  inset: 18% 6px;
  border-radius: 3px;
  background: var(--border-soft);
  transition: background 0.15s var(--ease);
}

.code-splitter:hover::after,
.code-splitter.is-dragging::after {
  background: var(--accent);
}

.code-editor-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--code-bg);
}

.code-gutter {
  flex: none;
  width: 46px;
  padding: 14px 9px 40px 0;
  overflow: hidden;
  border-right: 1px solid var(--border-soft);
  color: var(--text-faint);
  background: color-mix(in srgb, var(--panel-2) 55%, var(--code-bg));
  font: 400 13px/1.6 var(--font-mono);
  text-align: right;
  white-space: pre;
  user-select: none;
}

.code-editor-stack {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.code-highlight,
.code-editor-stack #code-editor {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 14px 16px 40px;
  border: 0;
  font: 400 13px/1.6 var(--font-mono);
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.code-highlight {
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

.code-highlight code {
  padding: 0;
  background: none;
  font: inherit;
  white-space: inherit;
}

.code-editor-stack #code-editor {
  z-index: 1;
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--text);
  resize: none;
  outline: none;
  overflow: auto;
}

.code-editor-stack #code-editor::selection {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  -webkit-text-fill-color: transparent;
}

.code-editor-stack #code-editor:focus-visible {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.code-output-full {
  margin-left: 8px;
  width: 26px;
  height: 26px;
}

.code-pane.is-full {
  position: fixed;
  inset: 0;
  z-index: 96;
  border-radius: 0;
  border: 0;
  background: var(--code-bg);
}

.code-json {
  margin: 0;
  padding: 16px;
  overflow: auto;
  height: 100%;
  color: var(--text);
  font: 400 13px/1.6 var(--font-mono);
  white-space: pre-wrap;
}

body.code-output-fullscreen {
  overflow: hidden;
}

/* --- 2048 polish --- */

.g2048-board {
  grid-template-columns: repeat(var(--board, 4), 1fr);
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.seg-btn {
  border: 0;
  border-radius: 7px;
  padding: 5px 11px;
  background: transparent;
  color: var(--text-faint);
  font: 600 11.6px/1 var(--font-sans);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.seg-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.game-stats {
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.game-hint {
  margin-left: auto;
}

.game-score {
  position: relative;
  overflow: visible;
}

#g2048-delta {
  position: absolute;
  right: 8px;
  top: 0;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}

#g2048-delta.is-visible {
  animation: ks-score-float 0.62s var(--ease) both;
}

.g2048-over-title {
  display: block;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.tile.is-spawned {
  animation: ks-tile-spawn 0.16s var(--ease) both;
}

.tile.is-merged {
  animation: ks-tile-pop 0.24s var(--ease) both;
}

@keyframes ks-tile-spawn {
  from {
    transform: scale(0.55);
    opacity: 0.35;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes ks-tile-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.13);
  }
  100% {
    transform: none;
  }
}

@keyframes ks-score-float {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}

@media (max-width: 960px) {
  .code-workbench {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    height: auto;
  }

  .code-splitter {
    display: none;
  }

  .code-editor-wrap {
    min-height: 320px;
  }

  .game-hint {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------- research options */

.research-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin: 16px 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}

.research-option {
  display: flex;
  align-items: center;
  gap: 9px;
}

.research-option-label {
  color: var(--text-faint);
  font-size: 10.4px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.research-option-hint {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11.6px;
}

.research-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.research-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.research-meta-chip .i {
  width: 13px;
  height: 13px;
}

.research-meta-chip.is-accent {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.research-continue {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 50%, transparent);
}

.research-continue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12.6px;
}

.research-continue-head .i {
  width: 15px;
  height: 15px;
  align-self: center;
  color: var(--accent);
}

.research-continue-head strong {
  color: var(--text);
  font-size: 13px;
}

.research-continue-row {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.research-continue-row input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: 400 13px/1 var(--font-sans);
  outline: none;
}

.research-continue-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.studio-sources-head .count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 10.5px;
}

@media (max-width: 640px) {
  .research-options {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .research-option {
    justify-content: space-between;
  }

  .research-option-hint {
    margin-left: 0;
  }

  .research-continue-row {
    flex-direction: column;
  }
}

/* --------------------------------------------------- web search · rich cards */

.web-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
}

.web-result:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: 0 8px 24px -18px rgba(0, 0, 0, 0.55);
}

.web-result-media {
  display: block;
  width: 104px;
  height: 78px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel-3);
}

.web-result-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.web-result:hover .web-result-media img {
  transform: scale(1.045);
}

.web-result-main {
  min-width: 0;
}

.web-when {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11.2px;
  white-space: nowrap;
}

.web-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.web-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: 600 11.6px/1.2 var(--font-sans);
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}

.web-action .i {
  width: 13px;
  height: 13px;
}

.web-action:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.web-vault {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}

.web-vault .studio-sources-head {
  margin-bottom: 10px;
}

.web-vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.web-foot {
  margin: 16px 0 0;
  color: var(--text-faint);
  font-size: 11.6px;
}

.web-empty {
  margin-top: 18px;
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 45%, transparent);
}

.web-empty-head {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.web-empty-head > .i {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  color: var(--accent);
}

.web-empty-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

.web-empty-head span {
  display: block;
  max-width: 56ch;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.web-empty-group {
  margin-top: 16px;
}

.web-empty-group .research-option-label {
  display: block;
  margin-bottom: 7px;
}

.web-empty-group .chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.web-empty-group .chips .chip .i {
  width: 13px;
  height: 13px;
}

@media (max-width: 640px) {
  .web-result {
    grid-template-columns: minmax(0, 1fr);
  }

  .web-result-media {
    width: 100%;
    height: 132px;
    order: -1;
  }

  .web-result-media img {
    object-position: center 35%;
  }

  .web-empty {
    padding: 16px;
  }
}

/* --------------------------------------------------------------- news · rich */

.news-page .news-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
  margin-top: 22px;
  align-items: start;
}

.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  box-shadow: 0 18px 40px -30px rgba(0, 0, 0, 0.75);
  text-decoration: none;
}

.news-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 18% 0%, hsl(var(--tone, 260) 62% 32% / 0.85), transparent 62%),
    linear-gradient(150deg, hsl(var(--tone, 260) 52% 24%), hsl(calc(var(--tone, 260) + 42) 58% 11%));
}

.news-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.news-card:hover .news-media img {
  transform: scale(1.045);
}

.news-media-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.32);
  font: 700 clamp(30px, 6vw, 46px) / 1 var(--font-sans);
  letter-spacing: 0.1em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.news-domain-pill {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.68);
  color: rgba(255, 255, 255, 0.86);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
}

.news-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 15px;
}

.news-page .news-title {
  margin: 0;
  font-size: 15.4px;
  font-weight: 650;
  line-height: 1.42;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-page .news-summary {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.8px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-page .news-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 9px;
  color: var(--text-faint);
}

.news-host {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.4px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.news-page .news-foot .i {
  flex: none;
  width: 14px;
  height: 14px;
  transition: color 0.15s;
}

.news-card:hover .news-foot .i {
  color: var(--accent);
}

.news-card.is-lead {
  grid-column: span 2;
}

.news-card.is-lead .news-media {
  aspect-ratio: 21 / 9;
}

.news-card.is-lead .news-title {
  font-size: 20px;
  line-height: 1.36;
  -webkit-line-clamp: 2;
}

.news-card.is-lead .news-summary {
  font-size: 13.6px;
  -webkit-line-clamp: 2;
}

.news-videos {
  margin-top: 22px;
  padding: 18px 18px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--panel) 82%, transparent), color-mix(in srgb, var(--panel-2) 88%, transparent));
}

.news-rail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.news-rail-head .eyebrow {
  margin: 0 0 3px;
}

.news-rail-head h2 {
  margin: 0 0 3px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.news-rail-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.8px;
}

.news-rail-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 11.6px;
  font-weight: 600;
  white-space: nowrap;
}

.news-rail-badge .i {
  width: 14px;
  height: 14px;
  color: var(--topic, var(--accent));
}

.news-rail-right {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.rail-arrows {
  display: flex;
  gap: 6px;
}

.rail-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.rail-arrow .i {
  width: 14px;
  height: 14px;
}

.rail-arrow:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.rail-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.rail-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.news-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(238px, 268px);
  gap: 13px;
  overflow-x: auto;
  margin: 0 -4px;
  padding: 2px 4px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.news-video {
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  color: inherit;
  text-decoration: none;
}

.news-video:hover {
  text-decoration: none;
}

.news-video-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 11px;
  background:
    radial-gradient(120% 90% at 18% 0%, hsl(var(--tone, 260) 62% 32% / 0.85), transparent 62%),
    linear-gradient(150deg, hsl(var(--tone, 260) 52% 24%), hsl(calc(var(--tone, 260) + 42) 58% 11%));
}

.news-video-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.news-video:hover .news-video-media img {
  transform: scale(1.06);
}

.news-video-media .news-media-fallback {
  font-size: 26px;
}

.news-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.news-play::before {
  content: '';
  position: absolute;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(9, 11, 17, 0.66);
  backdrop-filter: blur(5px);
  transition: transform 0.2s ease, background 0.2s ease;
}

.news-video:hover .news-play::before {
  transform: scale(1.08);
  background: color-mix(in srgb, var(--accent) 78%, #000);
}

.news-play .i {
  position: relative;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  color: #fff;
}

.news-video-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 2px 0;
}

.news-video-body strong {
  color: var(--text);
  font-size: 13.2px;
  font-weight: 600;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}

.news-video:hover .news-video-body strong {
  color: var(--accent);
}

.news-video-meta {
  color: var(--text-faint);
  font-size: 11.2px;
}

@media (max-width: 760px) {
  .news-card.is-lead {
    grid-column: auto;
  }

  .news-card.is-lead .news-media {
    aspect-ratio: 16 / 9;
  }

  .news-card.is-lead .news-title {
    font-size: 16.4px;
  }

  .news-rail-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .news-rail-right {
    width: 100%;
    justify-content: space-between;
  }

  .news-videos {
    padding: 15px 14px 8px;
  }
}

/* --------------------------------------------------------------- home · shell */

.home-page {
  max-width: 1180px;
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 22px;
  overflow: hidden;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(90% 130% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    radial-gradient(70% 100% at 0% 100%, color-mix(in srgb, var(--summary) 8%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--panel) 92%, transparent), var(--panel-2));
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -55%;
  right: -12%;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 20%, transparent), transparent 66%);
  filter: blur(14px);
  pointer-events: none;
}

.home-hero-main {
  position: relative;
  min-width: 0;
}

.home-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 10.8px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 15px 0 12px;
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.home-hero h1 span {
  display: block;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.home-lede {
  max-width: 60ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 14.4px;
  line-height: 1.65;
}

.home-lede code {
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.6px;
}

.home-command {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 560px);
  height: 52px;
  margin-top: 20px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  color: var(--text-faint);
  font: inherit;
  font-size: 13.8px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, color 0.16s, transform 0.16s;
}

.home-command:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-soft);
  color: var(--text-dim);
  transform: translateY(-1px);
}

.home-command .i {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.home-command span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-command kbd {
  flex: none;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-faint);
  font: 600 10.6px/1.3 var(--font-sans);
}

.home-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.resume-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 16px;
  padding: 9px 14px 9px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel));
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.resume-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 8px 22px -18px color-mix(in srgb, var(--accent) 60%, transparent);
  transform: translateY(-1px);
  text-decoration: none;
}

.resume-card .i {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.resume-label {
  flex: none;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.resume-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.resume-card em {
  flex: none;
  color: var(--text-faint);
  font-size: 11px;
  font-style: normal;
}

@media (max-width: 520px) {
  .resume-card strong {
    max-width: 38vw;
  }
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12.2px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}

.quick-chip .i {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.quick-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.home-pulse {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  backdrop-filter: blur(12px);
}

.pulse-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 10.8px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #47d68a;
  box-shadow: 0 0 0 3px rgba(71, 214, 138, 0.16);
  animation: homePulse 2.6s ease-in-out infinite;
}

@keyframes homePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(71, 214, 138, 0.16); }
  50% { box-shadow: 0 0 0 6px rgba(71, 214, 138, 0.05); }
}

.pulse-live {
  margin-left: auto;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.pulse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.pulse-stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-2);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), transform 0.16s var(--ease);
}

a.pulse-stat:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
  transform: translateY(-1px);
}

a.pulse-stat:hover b {
  color: var(--accent);
}

.pulse-stat b {
  transition: color 0.16s var(--ease);
}

.pulse-stat span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-faint);
  font-size: 10.6px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pulse-stat .i {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.pulse-stat b {
  color: var(--text);
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.pulse-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 11.4px;
}

.pulse-foot a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.pulse-foot a:hover {
  text-decoration: underline;
}

.pulse-foot .i {
  width: 13px;
  height: 13px;
}

.home-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.home-tool {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  padding: 15px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.home-tool::after {
  content: '';
  position: absolute;
  right: -34px;
  bottom: -44px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--accent-soft);
  filter: blur(9px);
  opacity: 0.5;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.home-tool:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
  box-shadow: 0 14px 30px -26px rgba(0, 0, 0, 0.7);
  text-decoration: none;
}

.home-tool:hover::after {
  opacity: 0.95;
}

.home-tool-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.home-tool-icon .i {
  width: 17px;
  height: 17px;
}

.home-tool strong {
  font-size: 13.6px;
  font-weight: 650;
}

.home-tool-blurb {
  color: var(--text-faint);
  font-size: 11.6px;
  line-height: 1.45;
}

.home-tool-go {
  position: absolute;
  top: 15px;
  right: 14px;
  color: var(--text-faint);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.home-tool:hover .home-tool-go {
  color: var(--accent);
  opacity: 1;
  transform: none;
}

.home-tool-go .i {
  width: 15px;
  height: 15px;
}

.home-news {
  margin-top: 30px;
}

.home-news-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.home-news-head .section-title {
  margin: 0 0 6px;
}

.home-news-note {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.4px;
}

.home-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.home-news-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.home-news-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
  text-decoration: none;
}

.home-news-media {
  display: grid;
  flex: none;
  place-items: center;
  width: 98px;
  height: 78px;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(120% 90% at 20% 0%, hsl(var(--tone, 260) 60% 30% / 0.9), transparent 60%),
    linear-gradient(150deg, hsl(var(--tone, 260) 50% 22%), hsl(calc(var(--tone, 260) + 40) 56% 11%));
  color: rgba(255, 255, 255, 0.4);
  font-size: 20px;
  font-weight: 700;
}

.home-news-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.home-news-card:hover .home-news-media img {
  transform: scale(1.05);
}

.home-news-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.home-news-meta {
  color: var(--text-faint);
  font-size: 10.4px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.home-news-body strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-news-skeleton {
  height: 100px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: homeShimmer 1.4s ease infinite;
}

@keyframes homeShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 1040px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-pulse {
    padding: 16px;
  }

  .pulse-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 12px 0;
  }
}

@media (max-width: 760px) {
  .home-hero {
    padding: 22px;
    border-radius: 20px;
  }

  .home-hero h1 {
    font-size: clamp(28px, 8vw, 36px);
  }

  .home-command {
    height: 48px;
  }

  .home-command kbd {
    display: none;
  }

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

  .home-news-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-news-card {
    align-items: flex-start;
  }

  .home-news-media {
    width: 84px;
    height: 70px;
  }
}

/* ==================================================================
   Accessibility polish — focus rings, empty chips, reduced motion
   ================================================================== */

.home-tool:focus-visible,
.home-news-card:focus-visible,
.quick-chip:focus-visible,
.resume-card:focus-visible,
.pulse-stat:focus-visible,
.start-card:focus-visible,
.topic-tile:focus-visible,
.news-card:focus-visible,
.news-video:focus-visible,
.web-result-title:focus-visible,
.saved-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.news-page .chips .chip.is-empty {
  opacity: 0.42;
}

.news-page .chips .chip.is-empty:not(.is-active):hover {
  opacity: 0.75;
}

.news-page .chips .chip.is-empty .count {
  color: var(--text-faint);
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot,
  .home-news-skeleton {
    animation: none;
  }

  .news-card,
  .news-card:hover,
  .news-video,
  .home-tool,
  .home-tool:hover,
  .home-news-card,
  .home-news-card:hover,
  .quick-chip,
  .quick-chip:hover,
  .resume-card,
  .resume-card:hover,
  a.pulse-stat,
  a.pulse-stat:hover,
  .rail-arrow,
  .rail-arrow:hover:not(:disabled) {
    transition: none;
    transform: none;
  }

  .news-card:hover .news-media img,
  .news-video:hover .news-video-media img,
  .home-news-card:hover .home-news-media img {
    transform: none;
    transition: none;
  }

  .news-play::before,
  .news-video:hover .news-play::before {
    transition: none;
    transform: none;
  }
}


/* --------------------------------------------------------------- news video inline player & modal */
.news-player-modal {
  margin: 18px 0;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.2s ease-out;
}

.news-player-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.news-player-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-player-embed {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.news-video {
  cursor: pointer;
}
