/* LUMINARA — design tokens & global styles */

:root {
  /* base palette — dark indigo / violet, low saturation */
  --bg:           oklch(11% 0.026 285);
  --bg-surface:  oklch(14.5% 0.032 285);
  --bg-elev:     oklch(18% 0.041 285);
  --bg-card:     oklch(16% 0.036 285);
  --bg-tint:     oklch(22% 0.051 285);

  --line:        oklch(28% 0.036 285);
  --line-soft:   oklch(22% 0.032 285);
  --line-strong: oklch(40% 0.058 285);

  --text:        oklch(96% 0.007 285);
  --text-mid:    oklch(80% 0.014 285);
  --text-muted:  oklch(62% 0.029 285);
  --text-dim:    oklch(46% 0.043 285);

  --accent:      oklch(72% 0.261 295);   /* violet */
  --accent-soft: oklch(40% 0.174 295);
  --accent-2:    oklch(82% 0.174 205);   /* cyan */
  --accent-3:    oklch(80% 0.189 85);    /* amber */
  --accent-4:    oklch(78% 0.203 155);   /* mint */

  /* ecosystem chroma */
  --c-foundations: oklch(75% 0.145 280);
  --c-eth:         oklch(74% 0.232 290);
  --c-ton:         oklch(78% 0.203 220);
  --c-btc:         oklch(80% 0.232 60);
  /* Base brand blue #0052FF, lifted to the dark-theme lightness band (ticket 62). */
  --c-base:        oklch(70% 0.240 264);
  --c-rwa:         oklch(78% 0.189 155);
  --c-game:        oklch(80% 0.203 10);
  /* topic palette (Ruslan content) */
  --c-community:   oklch(78% 0.170 40);
  --c-payments:    oklch(78% 0.180 165);
  --c-miniapps:    oklch(78% 0.165 200);
  --c-telegram:    oklch(76% 0.160 240);
  --c-token:       oklch(82% 0.170 90);
  --c-gamefi:      oklch(80% 0.203 10);
  --c-wallet:      oklch(76% 0.185 320);
  --c-compare:     oklch(74% 0.170 265);

  --scrim:         oklch(0% 0.000 0 / 0.6);
  --glass:         oklch(11% 0.026 285 / 0.7);

  /* type */
  --f-display: "Exo 2", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --f-sans:    "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-display-weight: 600;
  --f-display-spacing: -0.01em;

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  --shadow-soft: 0 1px 0 oklch(100% 0.000 0 / 0.04) inset, 0 30px 60px -20px oklch(0% 0.000 0 / 0.6);

  --node-from:          oklch(35% 0.087 285);
  --node-to:            oklch(18% 0.043 285);
  --grid-line:          oklch(20% 0.029 285 / 0.55);
  --chapter-watermark:  oklch(28% 0.058 285);
  --chapter-watermark-hover: oklch(45% 0.203 295);
  --hero-glow:          oklch(28% 0.116 295 / 0.18);
  --hero-radial-1:      oklch(40% 0.217 295 / 0.18);
  --hero-radial-2:      oklch(40% 0.174 220 / 0.12);
  --primary-text:       oklch(15% 0.029 285);
  --primary-from:       oklch(78% 0.290 295);
  --primary-to:         oklch(60% 0.319 295);
  --avatar-text:        oklch(15% 0.029 285);
  --progress-glow:      oklch(35% 0.203 295 / 0.18);
  --scene-bg:           oklch(28% 0.116 295 / 0.4);
}

[data-theme="light"] {
  --bg:           oklch(98% 0.006 285);
  --bg-surface:  oklch(96% 0.009 285);
  --bg-elev:     oklch(93.5% 0.012 285);
  --bg-card:     oklch(97% 0.007 285);
  --bg-tint:     oklch(91% 0.014 285);

  --line:        oklch(82% 0.017 285);
  --line-soft:   oklch(88% 0.014 285);
  --line-strong: oklch(70% 0.026 285);

  --text:        oklch(22% 0.043 285);
  --text-mid:    oklch(40% 0.036 285);
  --text-muted:  oklch(55% 0.041 285);
  --text-dim:    oklch(68% 0.032 285);

  --accent:      oklch(55% 0.319 295);
  --accent-soft: oklch(80% 0.145 295);
  --accent-2:    oklch(55% 0.232 205);
  --accent-3:    oklch(62% 0.232 60);
  --accent-4:    oklch(55% 0.232 155);

  --c-foundations: oklch(45% 0.174 280);
  --c-eth:         oklch(48% 0.290 290);
  --c-ton:         oklch(52% 0.232 220);
  --c-btc:         oklch(58% 0.261 60);
  /* Base brand blue #0052FF (ticket 62). */
  --c-base:        oklch(52% 0.278 264);
  --c-rwa:         oklch(52% 0.232 155);
  --c-game:        oklch(58% 0.261 10);
  /* topic palette (Ruslan content) */
  --c-community:   oklch(56% 0.190 40);
  --c-payments:    oklch(52% 0.210 165);
  --c-miniapps:    oklch(54% 0.190 200);
  --c-telegram:    oklch(52% 0.190 240);
  --c-token:       oklch(58% 0.200 90);
  --c-gamefi:      oklch(58% 0.261 10);
  --c-wallet:      oklch(54% 0.220 320);
  --c-compare:     oklch(52% 0.200 265);

  --scrim:         oklch(100% 0.000 0 / 0.6);
  --glass:         oklch(98% 0.006 285 / 0.85);

  --shadow-soft: 0 1px 0 oklch(100% 0.000 0 / 0.5) inset, 0 20px 50px -25px oklch(40% 0.145 285 / 0.25);
}

[data-theme="light"] {
  --node-from:          oklch(96% 0.017 285);
  --node-to:            oklch(86% 0.026 285);
  --grid-line:          oklch(76% 0.017 285 / 0.5);
  --chapter-watermark:  oklch(90% 0.026 285);
  --chapter-watermark-hover: oklch(70% 0.261 295);
  --hero-glow:          oklch(78% 0.145 295 / 0.35);
  --hero-radial-1:      oklch(80% 0.203 295 / 0.18);
  --hero-radial-2:      oklch(82% 0.145 220 / 0.14);
  --primary-text:       oklch(98% 0.007 285);
  --primary-from:       oklch(52% 0.319 295);
  --primary-to:         oklch(45% 0.348 295);
  --avatar-text:        oklch(98% 0.007 285);
  --progress-glow:      oklch(75% 0.174 295 / 0.25);
  --scene-bg:           oklch(78% 0.116 295 / 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); }
body {
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* app shell */
  letter-spacing: -0.005em;
}

/* RESP-1: pin the app to the REAL visible width (--app-w, set from
   window.visualViewport in v62.html). Defeats webviews that report a layout
   viewport wider than the visible screen, which was clipping content. */
#root { height: 100vh; overflow: hidden; width: var(--app-w, 100%); max-width: 100%; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: var(--f-mono); letter-spacing: 0; text-transform: uppercase; font-size: 11px; }
.serif { font-family: var(--f-display); font-weight: 400; letter-spacing: -0.01em; }

/* ── App shell ── */
.app {
  display: grid;
  grid-template-columns: 248px 1fr 320px;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  height: 100dvh;      /* dynamic viewport height — reliable in mobile webviews (Telegram); falls back to 100vh */
  overflow-x: hidden;  /* M1: hard guard against horizontal overflow */
  background:
    radial-gradient(ellipse 80% 60% at 30% -10%, var(--hero-radial-1), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, var(--hero-radial-2), transparent 60%),
    var(--bg);
}

/* top bar */
.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 248px 1fr 320px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  z-index: 100;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--line-soft);
  min-width: 0;
  cursor: pointer; transition: opacity .16s;
  outline: none;
}
.brand:hover { opacity: .82; }
.brand:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 6px; }
.brand .word { white-space: nowrap; }
.brand .ver { white-space: nowrap; }
.brand .mark {
  width: 28px; height: 28px;
  position: relative;
}
.brand .mark svg { display: block; }
.brand .word {
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.brand .word b {
  font-weight: 400;
  background: linear-gradient(180deg, var(--text) 0%, var(--accent) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand .ver {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.topbar .center {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  min-width: 0;
  overflow-x: clip;            /* #4/#5: clip horizontal spill onto right column... */
  overflow-y: visible;         /* ...but let the research dropdown tree escape downward (NAV v2) */
}
.topbar .search > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar nav {
  display: flex; gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  padding: 4px;
}
.topbar nav button {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 7px;
  transition: 0.15s;
  white-space: nowrap;
}
.topbar nav button:hover { color: var(--text); }
.topbar nav button.active {
  color: var(--text);
  font-weight: 700;
}
.topbar nav button .dot {
  width: 5px; height: 5px; border-radius: 99px;
  background: var(--accent);
  display: inline-block;
}
.topbar nav button:not(.active) .dot { background: var(--text-dim); }

.topbar .search {
  flex: 1; max-width: 380px; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  height: 34px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  color: var(--text-muted);
  font-size: 13px;
}
.topbar .search svg { color: var(--text-dim); }
.topbar .search kbd {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar .right {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 0 20px;
  border-left: 1px solid var(--line-soft);
  /* SEARCH-Z-UNDER-PALETTE: the search box is position:relative (for its dropdown), so it
     paints above STATIC siblings regardless of DOM order. Put the palette column into the
     positioned layer ABOVE the search box. The search dropdown (z-index:200) still wins. */
  position: relative;
  z-index: 2;
}

/* language switcher */
.lang {
  position: relative;
}
.lang .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 12px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--text-mid);
  font-family: var(--f-mono);
  letter-spacing: 0.06em;
}
.lang .pill:hover { color: var(--text); border-color: var(--line); }
.lang .menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px;
  min-width: 200px;
  box-shadow: var(--shadow-soft);
  z-index: 50;
}
.lang .menu button {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-mid);
  text-align: left;
}
.lang .menu button:hover { background: var(--bg-tint); color: var(--text); }
.lang .menu button .code {
  font-family: var(--f-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.06em;
}
.lang .menu button.current .code { color: var(--accent); }

.palette-switch {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 9px; border-radius: 99px;
  background: var(--bg-surface); border: 1px solid var(--line-soft);
  margin-right: 4px;
}
.palette-switch .sw {
  width: 17px; height: 17px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid transparent; transition: transform .14s, border-color .14s;
}
.palette-switch .sw:hover { transform: scale(1.15); }
.palette-switch .sw.active { border-color: var(--text); }
.palette-switch .sw[data-p="violet"]  { background: oklch(72% 0.26 295); }
.palette-switch .sw[data-p="cobalt"]  { background: oklch(72% 0.26 250); }
.palette-switch .sw[data-p="ember"]   { background: oklch(78% 0.23 60); }
.palette-switch .sw[data-p="forest"]  { background: oklch(76% 0.23 165); }
.palette-switch .sw[data-p="crimson"] { background: oklch(68% 0.27 15); }
/* M: keep the colour palette reachable on mobile. Instead of hiding the swatches,
   let the right-hand control cluster wrap so they drop to a tidy second line. */
@media (max-width: 900px) {
  .topbar .right { flex-wrap: wrap; row-gap: 8px; }
  .palette-switch { gap: 6px; }
}

.icon-btn {
  width: 34px; height: 34px; flex: none;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-mid);
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.avatar {
  width: 34px; height: 34px; border-radius: 99px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--primary-text);
  font-weight: 700;
}
.avatar:hover { filter: brightness(1.08); cursor: pointer; }
.avatar.active { box-shadow: 0 0 0 2px var(--accent); }

/* ── Account / Кабинет ── */
.acc-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.acc-card {
  background: var(--bg-surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); padding: 20px;
}
.acc-wide { grid-column: 1 / -1; }
.acc-h {
  font-family: var(--f-display); font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.acc-soon { font-family: var(--f-mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); padding: 2px 7px; border-radius: 99px; background: var(--bg-tint); }
.acc-id { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.acc-id > div { min-width: 0; }
.acc-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--primary-text);
}
.acc-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-family: var(--f-mono); font-size: 13px; overflow-wrap: anywhere; }
.acc-wallet-ic { color: var(--text-muted); display: flex; }
.acc-badge-live { max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-family: var(--f-mono); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: linear-gradient(135deg, var(--primary-from), var(--primary-to)); color: var(--primary-text); font-weight: 600; }
.acc-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.acc-label { display: block; font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin: 12px 0 6px; }
.acc-input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); color: var(--text); font-family: var(--f-sans); font-size: 13.5px;
  padding: 9px 12px; outline: none; transition: .14s;
}
.acc-input:focus { border-color: var(--accent); }
.acc-input::placeholder { color: var(--text-dim); }
.acc-row { display: flex; gap: 8px; }
.acc-flex { flex: 1; min-width: 0; }
.acc-btn {
  flex: none; padding: 9px 16px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  font-family: var(--f-sans); font-size: 13px; font-weight: 500; transition: .14s;
}
.acc-btn:hover { border-color: var(--line-strong); }
.acc-btn.primary { border: none; background: linear-gradient(135deg, var(--primary-from), var(--primary-to)); color: var(--primary-text); font-weight: 600; }
.acc-btn.primary:disabled { opacity: .4; cursor: default; }
/* B1: top-of-profile logout + switch account */
.acc-auth-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
/* The actions are a toolbar, not a dashboard card.  Without spanning the
   two-column grid they consume the first cell and push Profile to the right. */
.acc-grid > .acc-auth-actions { grid-column: 1 / -1; }
.acc-auth-actions .acc-btn { font-size: 13px; }
.acc-btn-switch { color: var(--accent); border-color: var(--accent); }
.acc-switch-note { width: 100%; font-size: 12px; color: var(--text-muted); line-height: 1.45; margin: 4px 0 0; }
.acc-ref-stats { display: flex; gap: 22px; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.acc-ref-stats { flex-wrap: wrap; }
.acc-ref-stats b { font-family: var(--f-display); font-size: 18px; color: var(--accent); margin-right: 4px; }
.acc-ref-message { margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line-soft); border-radius: 8px; font-size: 12.5px; line-height: 1.4; }
.acc-ref-message.ok { color: var(--ok, #39d98a); border-color: color-mix(in oklab, var(--ok, #39d98a) 55%, var(--line-soft)); }
.acc-ref-message.err { color: var(--err, #e0526a); border-color: color-mix(in oklab, var(--err, #e0526a) 55%, var(--line-soft)); }
.acc-status {
  display: inline-block; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 13px; border-radius: 99px; color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 32%, transparent);
}
.acc-lp { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; }
.acc-lp-v { font-family: var(--f-display); font-weight: 700; font-size: 40px; line-height: 1; color: var(--text); }
.acc-lp-k { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.acc-lp-bar { height: 6px; background: var(--bg-elev); border-radius: 99px; overflow: hidden; margin-top: 12px; position: relative; }
.acc-lp-bar > i { position: absolute; inset: 0; right: auto; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; }
.acc-plans { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.acc-plan {
  position: relative; padding: 14px 10px; border-radius: var(--r-md); cursor: pointer; text-align: center;
  border: 1px solid var(--line-soft); background: var(--bg-card); transition: .15s;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.acc-plan:hover { border-color: var(--line); transform: translateY(-2px); }
.acc-plan.active { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, var(--bg-card)); }
.acc-plan.best { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }
.acc-plan-best { position: absolute; top: -8px; font-size: 12px; color: var(--accent); }
.acc-plan-label { font-size: 12px; color: var(--text-mid); }
.acc-plan-price { font-family: var(--f-display); font-weight: 700; font-size: 19px; color: var(--text); }
.acc-plan.active .acc-plan-price { color: var(--accent); }
.acc-quests { display: grid; gap: 8px; }
.acc-quest {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--bg-card);
}
.acc-quest.done { border-color: oklch(55% 0.14 155 / 0.5); background: oklch(40% 0.08 155 / 0.12); }
.acc-quest-check {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  border: 1.5px solid var(--line); color: var(--primary-text);
}
.acc-quest.done .acc-quest-check { background: oklch(72% 0.17 155); border-color: oklch(72% 0.17 155); }
.acc-quest-label { flex: 1; font-size: 13.5px; color: var(--text); }
.acc-quest.done .acc-quest-label { color: var(--text-muted); }
.acc-quest-lp { font-family: var(--f-mono); font-size: 11px; color: var(--accent); }
.acc-h-row { justify-content: space-between; }
.acc-missions-all {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .03em;
  color: var(--accent); background: transparent;
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 4px 12px; cursor: pointer; transition: border-color .16s;
}
.acc-missions-all:hover { border-color: var(--accent); }

/* Missions page (TICKET-012/013) */
.missions-summary {
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 14px 22px; margin-bottom: 22px;
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--bg-card), color-mix(in oklab, var(--accent) 8%, var(--bg-surface)));
}
.missions-summary .ms-v { font-family: var(--f-display); font-size: 30px; font-weight: 700; color: var(--text); }
.missions-summary .ms-u { font-size: 14px; color: var(--accent); }
.missions-summary .ms-k { font-size: 11px; color: var(--text-muted); letter-spacing: .06em; text-transform: uppercase; }
.missions-list { display: grid; gap: 10px; max-width: 720px; }
.mission {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg-card); transition: border-color .16s, background .16s;
}
.mission.done { border-color: oklch(55% 0.14 155 / 0.5); background: oklch(40% 0.08 155 / 0.12); }
.mission-check {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  border: 1.5px solid var(--line); background: transparent;
  color: #fff; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .16s, border-color .16s;
}
.mission.done .mission-check { background: oklch(72% 0.17 155); border-color: oklch(72% 0.17 155); }
.mission-body { flex: 1; min-width: 0; }
.mission-label { font-size: 14px; color: var(--text); }
.mission.done .mission-label { color: var(--text-muted); }
.mission-praise {
  margin-top: 4px; font-size: 12px; color: oklch(78% 0.15 155);
  font-family: var(--f-mono); letter-spacing: .02em;
  animation: praise-in .3s ease;
}
@keyframes praise-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.mission-lp { font-family: var(--f-mono); font-size: 12px; color: var(--accent); flex: none; }
@media (max-width: 760px) {
  .acc-grid { grid-template-columns: 1fr; }
  .acc-plans { grid-template-columns: repeat(2, 1fr); }
}

/* ── Left sidebar ── */
.sidebar {
  border-right: 1px solid var(--line-soft);
  padding: 18px 14px 14px;
  overflow-y: auto;
  background: var(--glass);
}
.sidebar .sec {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  padding: 14px 10px 8px;
}
.side-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.15s;
}
.side-item:hover { color: var(--text); background: var(--bg-surface); }
.side-item.active {
  background: var(--bg-surface);
  border-color: var(--line-soft);
  color: var(--text);
  font-weight: 600;
}
.side-item .glyph {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.side-item.active .glyph { color: var(--accent); }
.side-item .badge {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-elev);
  border-radius: 99px;
  padding: 2px 8px;
}

.progress-card {
  margin: 16px 6px 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background:
    radial-gradient(ellipse 100% 60% at 0% 0%, var(--progress-glow), transparent 70%),
    var(--bg-surface);
}
.progress-card .h {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--text-muted);
}
.progress-card .v {
  font-family: var(--f-display); font-size: 34px; font-weight: 700; color: var(--text); margin-top: 4px;
}
.progress-card .bar {
  margin-top: 12px;
  height: 6px; background: var(--bg-elev);
  border-radius: 99px; overflow: hidden;
  position: relative;
}
.progress-card .bar > i {
  position: absolute; inset: 0; right: auto;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 99px;
}
.progress-card .note { font-size: 12.5px; color: var(--text-mid); margin-top: 8px; line-height: 1.45; }

.mini-map {
  margin: 14px 6px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 12px;
}
.mini-map .h {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim);
}
.mini-map .canvas {
  margin-top: 8px;
  height: 88px;
  border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(0deg, transparent 0 11px, var(--line-soft) 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, var(--line-soft) 11px 12px),
    var(--bg);
  position: relative;
  overflow: hidden;
}

/* ── Main canvas ── */
.canvas-area {
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
}
.view-scroll { height: 100%; overflow-y: auto; }

/* ── Right rail ── */
.rail {
  border-left: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--glass);
}
.rail-header { flex: none; padding: 18px 18px 0; position: relative; z-index: 6; background: var(--bg); }
.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px 14px; overscroll-behavior: contain; }

/* ── M1: mobile shell collapse (≤860px) — single column + topbar reflow ──
   Sidebar & rail are hidden here; M2 reintroduces the sidebar as a drawer,
   M3 handles the node-detail rail. All 5 sections stay reachable via the
   topbar nav strip below. */
@media (max-width: 860px) {
  /* shell → single column; topbar row auto-sizes (it wraps to two rows) */
  .app {
    /* minmax(0,1fr), NOT 1fr: a bare 1fr is minmax(auto,1fr) and grows to the
       column content's min-content — the topbar's nav strip forced it to ~474px
       at a 390 viewport, clipping everything. min(0) pins the column to the real
       width; over-wide children (the tab strip) scroll instead of pushing width. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  /* topbar stops mirroring the 3-col grid → wrapping flex bar */
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    grid-template-columns: none;
  }
  .brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    border-right: 0;
    padding: 10px 12px;
  }
  .brand .word { font-size: 18px; }
  .brand .ver { display: none; }          /* drop the BETA · V1.2 tag on mobile */

  .topbar .right {
    order: 2;
    flex: 0 0 auto;
    gap: 6px;
    padding: 10px 12px;
    border-left: 0;
  }

  /* nav drops to its own full-width row, horizontally scrollable */
  .topbar .center {
    order: 3;
    flex: 1 0 100%;
    padding: 0 12px 10px;
    gap: 0;
  }
  .topbar .center .search { display: none; }     /* ⌘K box is desktop-only */
  .topbar nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;                        /* Firefox */
  }
  .topbar nav::-webkit-scrollbar { display: none; }  /* WebKit */

  /* rail → M3 bottom-sheet below (mobile); sidebar → M2 drawer */

  /* main content spans the single column */
  .canvas-area { border-right: 0; }
}

/* ── M-CONTENT: responsive page layouts ──
   M1 fixed the shell; these collapse the per-view grids that were forcing a
   min-content width wider than the viewport (chapter cards, lesson reader,
   hero KPI stats) and trim oversized side-padding / display titles. */
@media (max-width: 860px) {
  .section-pad {
    /* Keep a visible, touch-safe gutter on every route rather than relying on
       a header-only offset.  This is shared by Quizzes and all peer pages. */
    padding: 24px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  }
  .hero .preamble { padding: 24px 16px 20px; }

  /* RESP-2: tile cards into neat rectangles on mobile (auto-fit fills the
     real container width pinned by RESP-1) instead of long single columns. */
  .chapter-rail  { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } /* Foundations → tiles */
  .eco-grid      { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } /* Ecosystems → tiles */
  .tool-showcase { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } /* Tools → tiles */
  .hero .stats   { grid-template-columns: repeat(2, 1fr); padding: 0 16px; } /* Atlas KPIs 4→2 */
  .scene-view > .scene-stage { float: none; width: 100%; max-width: none; margin: 0 0 24px 0; }  /* lesson reader 2-col→stacked */
  .hero h1, .section-head h2 { font-size: clamp(26px, 6.2vw, 42px); }  /* shrink display heads so a stuck/tablet viewport can't clip them */

  /* RESP-2b: the real anti-clip lever. Grid/flex tracks are minmax(auto,1fr)
     by default and refuse to shrink below their children's min-content, so a
     4-up rail computes ~600px and overflows a 390px screen. Letting the centre
     column and the cards shrink (min-width:0) forces every grid to fit the
     pinned app width; text wraps inside the card instead of pushing it wider. */
  .canvas-area { min-width: 0; }
  .chapter-rail > *, .eco-grid > *, .tool-showcase > *,
  .hero .stats > * { min-width: 0; }
  .ch-top, .ch-id { min-width: 0; }   /* let the chapter title wrap inside a narrow tile */
  .chapter-rail, .eco-grid, .tool-showcase { max-width: 100%; }
}

@media (max-width: 560px) {
  /* RESP-2: keep Foundations cards as tiles (no forced single column). */

  /* keep big display headings inside the viewport */
  .hero h1,
  .section-head h2 {
    font-size: clamp(26px, 8vw, 40px);
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* ── M2: mobile sidebar drawer ── */
.nav-burger  { display: none; }   /* desktop: hidden (shown ≤860) */
.nav-backdrop { display: none; }  /* desktop: no backdrop */

@media (max-width: 860px) {
  .nav-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line-soft);
    background: var(--bg-surface);
    color: var(--text-mid);
    cursor: pointer;
    flex: 0 0 auto;
    order: 0;                       /* leftmost in the mobile flex topbar */
    margin-left: 12px;
  }
  .nav-burger:hover { color: var(--text); border-color: var(--line); }
  .brand { padding-left: 6px; }     /* tighten gap next to the burger */

  /* sidebar → off-canvas drawer */
  .sidebar {
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(82vw, 300px);
    z-index: 60;
    background: var(--bg);
    border-right: 1px solid var(--line-soft);
    transform: translateX(-100%);
    transition: transform .24s ease;
    -webkit-overflow-scrolling: touch;
  }
  .app.nav-open .sidebar { transform: translateX(0); }

  /* dim backdrop behind the open drawer */
  .nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity .24s ease;
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  /* MOBILE-NAV-TREE: the topbar nav is overflow-x:auto (horizontal scroll) on mobile, which
     clipped the absolutely-positioned "Мои исследования" dropdown → it opened but was invisible
     and untappable. Pin it to the viewport (fixed) so it escapes the scroll container's clip.
     SPECIFICITY: `.topbar .nav-tree` (two classes) beats the base `.nav-tree` rule defined later
     in the file — without this the base position:absolute wins by source order and re-clips it. */
  .topbar .nav-tree {
    position: fixed;
    top: var(--nav-tree-top, 100px);
    left: 8px; right: 8px;
    min-width: 0; width: auto;
    max-height: 72dvh;
    z-index: 210;
  }
}

/* ── M3: mobile node-detail bottom sheet ── */
.rail-grab    { display: none; }  /* desktop: hidden */
.rail-close   { display: none; }
.rail-backdrop { display: none; }

@media (max-width: 860px) {
  /* rail → bottom sheet */
  .rail {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-height: 85dvh;
    z-index: 60;
    background: var(--bg);
    border-top: 1px solid var(--line-soft);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .4);
    padding: 0;
    transform: translateY(100%);
    transition: transform .26s ease;
    -webkit-overflow-scrolling: touch;
  }
  .app.rail-open .rail { transform: translateY(0); }

  .rail-grab {
    display: block;
    width: 36px; height: 4px;
    border-radius: 99px;
    background: var(--line);
    margin: 8px auto 6px;
  }
  .rail-header { padding: 6px 18px 0; }
  .rail-scroll { padding: 0 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .rail-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; top: 10px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line-soft);
    background: var(--bg-surface);
    color: var(--text-mid);
    font-size: 15px; cursor: pointer;
  }
  .rail-close:hover { color: var(--text); border-color: var(--line); }

  .rail-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity .26s ease;
  }
  .app.rail-open .rail-backdrop { opacity: 1; pointer-events: auto; }
}

/* ── Hero / Atlas ── */
.hero {
  position: relative;
  /* ATLAS-FOOTER: min-height (not fixed height:max(...,100%)) so the hero reserves room
     for the 3D atlas but doesn't stretch to fill the scroll container — otherwise the
     shared SiteFooter, which follows every view inside .view-scroll, gets pushed past the
     bottom edge and the atlas looks footerless. */
  min-height: max(1180px, 100%);
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.hero .preamble {
  padding: 28px 36px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 36px;
  align-items: start;
}
.hero .preamble .lhs { max-width: 620px; }
.hero .preamble .rhs {
  border-left: 1px solid var(--line-soft);
  padding-left: 24px;
}
@media (max-width: 1340px) {
  .hero .preamble {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .hero .preamble .rhs {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    padding: 16px 0 0;
    max-width: 560px;
  }
}
.hero .atlas-host {
  position: relative;
  overflow: hidden;
  min-height: 760px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, var(--hero-glow), transparent 70%),
    var(--bg);
}
.hero .atlas-host .atlas-wrap { flex: 1; min-height: 0; }

/* ── 3D atlas (TICKET-008) ── */
.atlas3d { position: relative; }
.atlas3d-mount { position: absolute; inset: 0; }
.atlas3d-label {
  position: absolute; left: 0; top: 0;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.01em; font-weight: 500;
  color: var(--text); white-space: nowrap;
  text-shadow: 0 1px 2px var(--bg), 0 0 4px var(--bg), 0 0 8px var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision;
  pointer-events: none; transition: opacity 0.2s; will-change: transform;
}
.atlas3d-label.on { color: var(--accent); text-shadow: 0 1px 2px var(--bg), 0 0 6px var(--bg); }
.atlas-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--text-dim);
  background: var(--glass); backdrop-filter: blur(8px);
  border: 1px solid var(--line-soft); border-radius: 99px; padding: 6px 14px;
  pointer-events: none; z-index: 5; white-space: nowrap;
}
.hero .stats {
  border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 0 36px;
  background: var(--bg);
  position: relative;
  z-index: 2;
}
.hero .stats .stat {
  /* Keep every metric clear of its divider.  The previous zero left padding
     placed each column's label and number directly against the preceding
     vertical rule (most visibly TOPICS / INSIGHTS / TOOLS). */
  box-sizing: border-box;
  padding: 16px 24px 18px;
  border-right: 1px solid var(--line-soft);
}
.hero .stats .stat:first-child { padding-left: 0; }
.hero .stats .stat:last-child { border-right: 0; }
.hero .stats .stat .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim); }
.hero .stats .stat .v { font-family: var(--f-display); font-size: 26px; margin-top: 2px; color: var(--text); }
.hero .stats .stat .t { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.hero .kicker {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.16em;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 10px;
}
.hero .kicker::before {
  content: ""; display: inline-block; width: 24px; height: 1px; background: var(--accent);
}
.hero h1 {
  font-family: var(--f-display);
  font-size: clamp(34px, 3.8vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  margin: 12px 0 0;
  font-weight: 400;
  max-width: 26ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero h1 .acc {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
}
.hero .lede {
  max-width: 56ch;
  margin-top: 18px;
  color: var(--text-mid);
  font-size: 15px;
  line-height: 1.55;
}
.hero .actions {
  display: flex; gap: 10px;
  margin-top: 22px;
}
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: 99px;
  font-size: 13.5px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--bg-surface);
  transition: 0.15s;
}
.btn:hover { background: var(--bg-elev); }
.btn.primary {
  background: linear-gradient(180deg, var(--primary-from), var(--primary-to));
  color: var(--primary-text);
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn .arr { transition: transform 0.15s; }
.btn:hover .arr { transform: translateX(3px); }

/* ── Atlas map ── */
.atlas-wrap {
  position: relative;
  overflow: hidden;
}
.atlas-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask: radial-gradient(ellipse at center, black 30%, transparent 90%);
  -webkit-mask: radial-gradient(ellipse at center, black 30%, transparent 90%);
  pointer-events: none;
}

.atlas-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.atlas-svg .edge {
  stroke: var(--line);
  stroke-width: 0.4;
  fill: none;
  opacity: 0.5;
  transition: opacity 0.2s, stroke 0.2s;
}
.atlas-svg .edge.hot {
  stroke: var(--accent);
  opacity: 0.9;
  stroke-width: 0.6;
}
.atlas-svg .edge.linked {
  stroke: var(--accent);
  opacity: 0.7;
  stroke-width: 0.5;
}
.atlas-svg .edge.linked.hot { opacity: 1; stroke-width: 0.7; }

.node {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: grid;
  place-items: center;
  text-align: center;
}
.node .blob {
  width: 100%; height: 100%;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, var(--node-from), var(--node-to) 70%);
  border: 1px solid var(--line);
  position: relative;
  display: grid; place-items: center;
  transition: 0.2s;
  box-shadow: 0 8px 30px -10px oklch(0% 0.000 0 / 0.6);
}
.node .blob::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 999px;
  border: 1px dashed var(--line-soft);
  opacity: 0;
  transition: 0.2s;
}
.node:hover .blob, .node.active .blob {
  border-color: currentColor;
  box-shadow: 0 0 0 4px oklch(70% 0.261 295 / 0.08), 0 8px 40px -10px currentColor;
}
.node:hover .blob::after, .node.active .blob::after { opacity: 1; }
.node.done .blob {
  border-color: currentColor;
  background: radial-gradient(circle at 35% 30%, currentColor, var(--node-to) 75%);
  box-shadow: 0 0 0 3px color-mix(in oklab, currentColor 14%, transparent), 0 0 22px -4px currentColor;
}
.node.done .core { color: #fff; font-weight: 700; opacity: 0.95; }
.node .label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-mid);
  background: var(--glass);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid var(--line-soft);
}
.node.active .label { color: var(--text); border-color: currentColor; }
.node .core {
  font-family: var(--f-display);
  font-size: 13px;
  color: var(--text);
  z-index: 1;
}

/* glow color per group */
.node[data-group="foundations"] { color: var(--c-foundations); }
.node[data-group="ethereum"]    { color: var(--c-eth); }
.node[data-group="ton"]         { color: var(--c-ton); }
.node[data-group="bitcoin"]     { color: var(--c-btc); }
.node[data-group="rwa"]         { color: var(--c-rwa); }
.node[data-group="gamefi"]      { color: var(--c-game); }

.atlas-progress {
  position: absolute; right: 20px; top: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  background: var(--glass); backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft); border-radius: 99px;
  padding: 8px 15px; color: var(--text-mid); z-index: 5;
}
.atlas-progress .ap-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.atlas-progress .ap-v { font-family: var(--f-display); font-weight: 700; font-size: 15px; color: var(--text); }
.atlas-progress .ap-k { color: var(--text-dim); text-transform: none; letter-spacing: 0; }

.atlas-legend {
  position: absolute; left: 20px; top: 20px;
  display: flex; gap: 14px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--text-mid);
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  padding: 8px 15px;
  z-index: 5;
}
.qod {
  background: linear-gradient(160deg, color-mix(in oklab, var(--accent) 10%, var(--bg-card)) 0%, var(--bg-surface) 100%);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, var(--line-soft));
  border-radius: var(--r-md);
  padding: 15px 16px 13px;
  position: relative;
  overflow: hidden;
}
.qod::before {
  content: ""; position: absolute; top: -30px; right: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-radial-1), transparent 70%);
  pointer-events: none;
}
.qod-head { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.qod-tag { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.qod-date { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.06em; color: var(--text-dim); }
.qod-q {
  font-family: var(--f-display); font-size: 16px; font-weight: 600; line-height: 1.3;
  margin: 9px 0 12px; position: relative; z-index: 1; color: var(--text);
}
.qod-q-link { cursor: pointer; transition: color .16s; }
.qod-q-link:hover { color: var(--accent); }
.qod-q-arrow { color: var(--accent); font-weight: 700; opacity: 0; transition: opacity .16s; }
.qod-q-link:hover .qod-q-arrow { opacity: 1; }
.qod-answer { display: flex; gap: 6px; position: relative; z-index: 1; }
.qod-input {
  flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); color: var(--text); font-family: var(--f-sans); font-size: 12.5px;
  padding: 8px 11px; outline: none; transition: .14s;
}
.qod-input:focus { border-color: var(--accent); }
.qod-input::placeholder { color: var(--text-dim); }
.qod-mic, .qod-send {
  flex: none; width: 34px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line-soft); background: var(--bg-card); color: var(--text-mid);
  display: flex; align-items: center; justify-content: center; transition: .14s; font-size: 15px;
}
.qod-mic:hover { color: var(--accent); border-color: var(--accent); }
.qod-send { border: none; background: linear-gradient(135deg, var(--primary-from), var(--primary-to)); color: var(--primary-text); font-weight: 700; }
.qod-send:disabled { opacity: .4; cursor: default; }
.qod-send:not(:disabled):hover { filter: brightness(1.08); }
.qod-done { font-size: 12.5px; color: oklch(78% 0.15 155); position: relative; z-index: 1; padding: 4px 0; }

/* ── Crypto calendar (под Вопросом дня) ── */
.cryptocal {
  margin-top: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 14px 15px 12px;
}
.cc-head { margin-bottom: 10px; }
.cc-tag { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.cc-list { display: grid; gap: 2px; }
.cc-scroll { max-height: 224px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.cc-scroll::-webkit-scrollbar { width: 6px; }
.cc-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.cc-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm);
  transition: .14s; cursor: default;
}
.cc-item:hover { background: var(--bg-card); }
.cc-item.cc-today {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.cc-date { font-family: var(--f-mono); font-size: 10px; color: var(--accent); flex: none; width: 48px; }
.cc-icon { font-size: 13px; flex: none; width: 18px; text-align: center; }
.cc-label { flex: 1; font-size: 12.5px; color: var(--text-mid); line-height: 1.25; }
.cc-when { font-family: var(--f-mono); font-size: 9.5px; color: var(--text-dim); flex: none; white-space: nowrap; }
.cc-today .cc-when { color: var(--accent); }

/* ── Atlas titlebar (над ментальной картой) ── */
.atlas-titlebar {
  position: relative;
  z-index: 4;
  padding: 20px 24px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.atlas-titlebar .atlas-name { margin-bottom: 5px; font-size: 22px; }
.atlas-titlebar-lede { color: var(--text-mid); font-size: 13px; line-height: 1.5; max-width: 72ch; }

.atlas-name {
  font-family: var(--f-display); font-weight: 700; font-size: 18px;
  letter-spacing: -0.01em; margin-bottom: 7px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 90%, var(--accent-2) 120%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.atlas-legend .item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.atlas-legend .dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; }

.atlas-zoom {
  position: absolute; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 4px;
}
.atlas-zoom button {
  width: 30px; height: 28px;
  border-radius: 8px;
  color: var(--text-mid);
}
.atlas-zoom button:hover { background: var(--bg-surface); color: var(--text); }

/* ── Right rail: insight ── */
.rail-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  overflow: hidden;
}
.rail-card .head {
  padding: 16px 16px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.rail-card .kicker {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim);
  white-space: nowrap;
}
.rail-card .dot {
  width: 10px; height: 10px; border-radius: 99px;
  background: currentColor;
}
.rail-card h3 {
  font-family: var(--f-display);
  font-size: 28px;
  margin: 6px 16px 12px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.rail-card .lede {
  margin: 0 16px 16px;
  color: var(--text-mid);
  font-size: 13.5px;
  line-height: 1.55;
}
.rail-card .meta {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  padding: 10px 16px;
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.08em;
  color: var(--text-dim);
}
.rail-card .meta b { color: var(--text-mid); font-weight: 500; }

.rail-section {
  margin-top: 20px;
}
.rail-section .h {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--text-dim); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}

.qa-list { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.qa {
  background: var(--bg-surface);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 18px 1fr 14px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-mid);
}
.qa .n { font-family: var(--f-mono); font-size: 10px; color: var(--text-dim); }
.qa:hover { color: var(--text); background: var(--bg-card); }

/* connections list */
.conn-list { display: grid; gap: 6px; }
.conn {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-mid);
  cursor: pointer;
}
.conn:hover { color: var(--text); background: var(--bg-surface); }
.conn .swatch { width: 8px; height: 8px; border-radius: 99px; background: currentColor; }
.conn .arr { color: var(--text-dim); }

/* ── Foundations view ── */
.section-pad {
  /* Every full-page view, including Quizzes, owns a real content gutter.
     `env()` keeps that gutter outside a device notch / rounded safe-area. */
  min-width: 0;
  padding: 32px max(36px, env(safe-area-inset-right)) 60px max(36px, env(safe-area-inset-left));
}
.section-head {
  display: grid; gap: 8px;
  margin-bottom: 28px;
  max-width: 760px;
}
.section-head .kicker {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; color: var(--accent);
}
.section-head h2 {
  font-family: var(--f-display);
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 400;
  margin: 4px 0 0;
  letter-spacing: -0.015em;
  line-height: 1.04;
}
.section-head p { color: var(--text-mid); font-size: 14.5px; margin: 8px 0 0; max-width: 60ch; }

.chapter-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.chapter {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 18px 18px 16px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 230px;
  display: flex;
  flex-direction: column;
}
.chapter:hover { transform: translateY(-2px); border-color: var(--line); background: var(--bg-card); }
.chapter .ch-top { display: flex; align-items: flex-start; gap: 12px; position: relative; z-index: 1; }
.chapter .n {
  font-family: var(--f-display);
  font-size: 28px; font-weight: 700;
  line-height: 1; flex: none;
  width: 44px; height: 44px; border-radius: 12px;
  box-sizing: border-box;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  letter-spacing: -0.02em;
  margin-top: 0;
  align-self: flex-start;
}
.chapter .ch-id { flex: 1; min-width: 0; padding-top: 1px; }
.chapter .kicker { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--text-dim); }
.chapter .title {
  font-family: var(--f-display);
  font-size: 18px; font-weight: 600;
  margin: 2px 0 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.chapter .sub { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 10px; position: relative; z-index: 1; }
.chapter .ch-points {
  list-style: none; padding: 0; margin: 12px 0 0; position: relative; z-index: 1;
  display: grid; gap: 7px; flex: 1;
}
.chapter .ch-points li {
  font-size: 12px; color: var(--text-mid); line-height: 1.35;
  padding-left: 15px; position: relative;
}
.chapter .ch-points li::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.7;
}
.chapter .meta {
  display: flex; gap: 12px; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--text-dim);
  position: relative; z-index: 1;
  white-space: nowrap;
}
.chapter .meta .ring {
  display: inline-flex; gap: 2px;
}
.chapter .meta .ring i {
  width: 4px; height: 4px; border-radius: 99px; background: var(--line);
}
.chapter .meta .ring i.f { background: var(--accent); }
/* A2: completed chapter dots → solid accent; partial → lighter accent for opened-but-not-completed */
.chapter .meta .ring.ring--done i.f { background: var(--accent); opacity: 1; }
.chapter .meta .ring.ring--partial i.f { background: var(--accent); opacity: 0.7; }

/* ── Ecosystems ── */
.eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.eco-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 22px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
}
.eco-card:hover { background: var(--bg-card); transform: translateY(-2px); }
.eco-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 100% 0%, currentColor, transparent 60%);
  opacity: 0.10;
  pointer-events: none;
}
.eco-card > * { position: relative; z-index: 1; }
.eco-card .head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.eco-card .head .mono { white-space: nowrap; opacity: 0.55; }
.eco-card .title {
  font-family: var(--f-display);
  font-size: 26px;
  letter-spacing: -0.01em;
}
.eco-card .blurb { font-size: 13px; color: var(--text-mid); line-height: 1.5; }
.eco-card .stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.eco-card .stat { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.eco-card .stat .k { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--text-dim); }
.eco-card .stat .v { font-family: var(--f-display); font-size: 22px; color: var(--text); margin-top: 1px; }
.eco-card .stat .t { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.eco-card .protos {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.eco-card .proto {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid var(--line-soft);
  color: var(--text-mid);
}
.eco-card .open {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  color: currentColor;
}
.eco-card[data-c="ethereum"] { color: var(--c-eth); }
.eco-card[data-c="ton"]      { color: var(--c-ton); }
.eco-card[data-c="bitcoin"]  { color: var(--c-btc); }
.eco-card[data-c="rwa"]      { color: var(--c-rwa); }
.eco-card[data-c="gamefi"]   { color: var(--c-game); }
.eco-card[data-c="communities"]      { color: var(--c-community); }
.eco-card[data-c="miniapps"]         { color: var(--c-miniapps); }
.eco-card[data-c="payments"]         { color: var(--c-payments); }
.eco-card[data-c="social_graph"]     { color: var(--c-telegram); }
.eco-card[data-c="tokens"]           { color: var(--c-token); }
.eco-card[data-c="ton_new_internet"] { color: var(--c-ton); }
.eco-card[data-c="ton_vs_eth"]       { color: var(--c-compare); }
.eco-card[data-c="wallet"]           { color: var(--c-wallet); }

/* ── Ecosystem detail page (TICKET-003/007) ── */
.eco-page { --eco: var(--accent); }
.eco-page[data-c="ethereum"] { --eco: var(--c-eth); }
.eco-page[data-c="ton"]      { --eco: var(--c-ton); }
.eco-page[data-c="bitcoin"]  { --eco: var(--c-btc); }
.eco-page[data-c="rwa"]      { --eco: var(--c-rwa); }
.eco-page[data-c="gamefi"]   { --eco: var(--c-game); }
.eco-page[data-c="foundations"] { --eco: var(--c-foundations); }
.eco-page[data-c="communities"]      { --eco: var(--c-community); }
.eco-page[data-c="miniapps"]         { --eco: var(--c-miniapps); }
.eco-page[data-c="payments"]         { --eco: var(--c-payments); }
.eco-page[data-c="social_graph"]     { --eco: var(--c-telegram); }
.eco-page[data-c="tokens"]           { --eco: var(--c-token); }
.eco-page[data-c="ton_new_internet"] { --eco: var(--c-ton); }
.eco-page[data-c="ton_vs_eth"]       { --eco: var(--c-compare); }
.eco-page[data-c="wallet"]           { --eco: var(--c-wallet); }
.eco-back {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 18px; transition: .14s;
}
.eco-back:hover { color: var(--text); }
.eco-hero {
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start;
  padding: 24px; border-radius: var(--r-lg); margin-bottom: 28px;
  background: linear-gradient(150deg, color-mix(in oklab, var(--eco) 14%, var(--bg-card)) 0%, var(--bg-surface) 100%);
  border: 1px solid color-mix(in oklab, var(--eco) 30%, var(--line-soft));
}
.eco-hero-main .kicker { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--eco); }
.eco-hero-title {
  font-family: var(--f-display); font-weight: 700; font-size: 34px; line-height: 1.05; margin: 8px 0 0;
  background: linear-gradient(135deg, var(--text), var(--eco) 110%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.eco-hero-blurb { font-size: 15px; color: var(--text-mid); line-height: 1.5; margin: 12px 0 18px; max-width: 50ch; }
.eco-atlas-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 18px; border-radius: 99px; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--eco), color-mix(in oklab, var(--eco) 60%, #000));
  color: #fff; transition: .15s;
}
.eco-atlas-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.eco-hero-stats { display: flex; flex-direction: column; gap: 14px; min-width: 150px; }
.eco-hs { text-align: right; }
.eco-hs .v { font-family: var(--f-display); font-weight: 700; font-size: 24px; color: var(--eco); line-height: 1; }
.eco-hs .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }
.eco-hs .t { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.eco-section-h {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); margin: 24px 0 12px;
}
.eco-topics { display: grid; gap: 7px; }
.eco-topic {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--bg-surface); transition: .14s;
}
.eco-topic:hover { border-color: color-mix(in oklab, var(--eco) 45%, var(--line)); background: var(--bg-card); transform: translateX(3px); }
.eco-topic-n { font-family: var(--f-mono); font-size: 12px; color: var(--eco); flex: none; }
.eco-topic-label { flex: 1; font-size: 14px; color: var(--text); }
.eco-topic-go { color: var(--text-dim); transition: .14s; }
.eco-topic:hover .eco-topic-go { color: var(--eco); transform: translateX(2px); }
.eco-protos { display: flex; flex-wrap: wrap; gap: 8px; }
.eco-proto {
  font-family: var(--f-mono); font-size: 12px; padding: 7px 14px; border-radius: 99px;
  color: var(--eco); background: color-mix(in oklab, var(--eco) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--eco) 30%, transparent);
}
@media (max-width: 680px) {
  .eco-hero { grid-template-columns: 1fr; }
  .eco-hero-stats { flex-direction: row; flex-wrap: wrap; }
  .eco-hs { text-align: left; }
}
.eco-card .blurb, .eco-card .title, .eco-card .stat .v { color: var(--text); }

/* ── Tools ── */
.tool-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.tool-tabs button {
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-mid);
}
.tool-tabs button.active { background: var(--bg-elev); color: var(--text); border-color: var(--line); }
.tool-tabs button:hover { color: var(--text); }

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* ── Tools showcase (brand-coloured витрина) ── */
.tool-showcase {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.tool-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--bg-card) 0%, color-mix(in oklab, var(--brand) 11%, var(--bg-surface)) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  cursor: pointer;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--brand) 55%, var(--line));
  box-shadow: 0 18px 40px -20px var(--brand);
}
.tool-card .bar {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 40%, transparent));
}
.tool-reorder-hint {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 2px 0 14px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--text-muted);
}
.tool-reset {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--accent);
  background: transparent; border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  transition: border-color .16s, color .16s;
}
.tool-reset:hover { border-color: var(--accent); }
.tool-card { cursor: default; }
.tool-card .tc-head, .tool-card .tc-tag { cursor: pointer; }
.tool-card .tc-grip {
  position: absolute; top: 12px; right: 14px;
  font-size: 13px; line-height: 1; color: var(--text-muted);
  opacity: .45; cursor: grab; user-select: none;
  transition: opacity .16s, color .16s;
}
.tool-card:hover .tc-grip { opacity: .9; color: var(--brand); }
.tool-card.dragging { opacity: .5; transform: scale(.98); }
.tool-card.drag-over {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--brand) 60%, transparent);
}
.tool-card .tc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tool-card .tc-mark {
  width: 50px; height: 50px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700; font-size: 22px;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), color-mix(in oklab, var(--brand) 60%, #000));
  box-shadow: 0 6px 18px -5px var(--brand);
}
.tool-card .tc-id { flex: 1; min-width: 0; }
.tool-card .tc-name {
  font-family: var(--f-display); font-size: 20px; font-weight: 600; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-card .tc-url {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--text-dim); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-card .tc-go { color: var(--text-dim); font-size: 18px; transition: .15s; }
.tool-card:hover .tc-go { color: var(--brand); transform: translate(2px,-2px); }
.tool-card .tc-cat {
  display: inline-block; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 99px; margin-bottom: 10px;
  color: var(--brand); background: color-mix(in oklab, var(--brand) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--brand) 35%, transparent);
}
.tool-card .tc-tag { font-size: 13.5px; color: var(--text-mid); line-height: 1.5; min-height: 40px; }
.tool-card .tc-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.tool-card .tc-stat-item { text-align: center; }
.tool-card .tc-sv { font-family: var(--f-display); font-size: 17px; font-weight: 700; color: var(--brand); line-height: 1; }
.tool-card .tc-sk { font-family: var(--f-mono); font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-top: 5px; }

.tool {
  background: var(--bg-surface);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: 0.15s;
}
.tool:hover { background: var(--bg-card); }
.tool .top { display: flex; align-items: center; justify-content: space-between; }
.tool .name { font-family: var(--f-display); font-size: 19px; line-height: 1.05; }
.tool .url { font-family: var(--f-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.06em; }
.tool .tag {
  font-size: 12.5px; color: var(--text-muted);
  font-family: var(--f-sans);
  letter-spacing: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  text-transform: none;
}

/* ── Chapter scene view ── */
.scene-view {
  display: block;
}
.scene-view::after { content: ""; display: block; clear: both; }
/* visual floated left so prose flows beside AND under it (SCENE-TEXT-UNDER-ASIDE) */
.scene-view > .scene-stage { float: left; width: 44%; max-width: 420px; margin: 0 36px 24px 0; }
.scene-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 14px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 24px;
  white-space: nowrap;
}
.scene-back:hover { color: var(--text); }

.scene-stage {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background:
    radial-gradient(ellipse at 30% 30%, var(--scene-bg), transparent 60%),
    var(--bg-surface);
  position: relative;
  overflow: hidden;
}
.scene-stage .corner {
  position: absolute;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.scene-stage .corner.tl { top: 14px; left: 14px; }
.scene-stage .corner.tr { top: 14px; right: 14px; }
.scene-stage .corner.bl { bottom: 14px; left: 14px; }
.scene-stage .corner.br { bottom: 14px; right: 14px; }

.scene-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
  font-family: var(--f-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.scene-body h3 {
  font-family: var(--f-display);
  font-size: 44px;
  font-weight: 400;
  margin: 6px 0 18px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.scene-body .insight {
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 16px;
  margin: 18px 0;
  font-family: var(--f-display);
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.scene-body p { color: var(--text-mid); font-size: 16px; }
/* Longread prose (SceneProse) */
.scene-prose p { color: var(--text-mid); font-size: 16.5px; line-height: 1.75; margin: 0 0 17px; }
.scene-prose p:last-child { margin-bottom: 0; }
.scene-prose .sp-h {
  font-family: var(--font-display, inherit); font-weight: 700; font-size: 17px;
  color: var(--text); margin: 26px 0 10px; letter-spacing: -0.01em;
}
.scene-prose .sp-h:first-child { margin-top: 0; }
.scene-prose .sp-quote {
  margin: 18px 0; padding: 14px 18px; border-left: 3px solid var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  border-radius: 0 10px 10px 0; color: var(--text); font-size: 15px; line-height: 1.6;
}
.scene-prose .sp-list { margin: 14px 0; padding-left: 22px; }
.scene-prose .sp-list li { color: var(--text-mid); font-size: 16px; line-height: 1.68; margin-bottom: 8px; }
.scene-prose .sp-h1 { font-size: 20px; margin-top: 28px; }
.scene-prose .sp-h3 { font-size: 15px; opacity: 0.92; margin-top: 20px; }
.scene-prose .sp-ol { list-style: decimal; }
.scene-prose .sp-code { font-family: var(--font-mono, monospace); font-size: 0.9em;
  background: color-mix(in oklch, var(--accent) 12%, transparent); padding: 1px 6px; border-radius: 5px; }
.scene-prose strong { color: var(--text); font-weight: 700; }
.scene-prose em { font-style: italic; }
.scene-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.scene-pager {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px;
}
.scene-pager .dots {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-right: 8px;
}
.scene-pager .dots i {
  width: 6px; height: 6px; border-radius: 99px; background: var(--line);
}
.scene-pager .dots i.f { background: var(--accent); }

/* journal */
.journal-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.saved-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: 16px;
  display: grid; gap: 8px;
  min-height: 140px;
}
.saved-card .kicker { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim); }
.saved-card .title { font-family: var(--f-display); font-size: 22px; line-height: 1.1; }
.saved-card .note { color: var(--text-mid); font-size: 12.5px; }

/* ── Journal metrics (saved / days / active hours) ── */
.journal-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 8px;
}
.jm {
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: radial-gradient(ellipse 120% 80% at 0% 0%, var(--progress-glow), transparent 70%), var(--bg-surface);
  padding: 18px 20px;
}
.jm-accent { border-color: color-mix(in oklab, var(--accent) 35%, var(--line-soft)); }
.jm-k { font-size: 10px; letter-spacing: 0.12em; color: var(--text-dim); text-transform: uppercase; }
.jm-v { font-family: var(--f-display); font-weight: 700; font-size: 46px; line-height: 1; margin-top: 8px; color: var(--text); }
.jm-u { font-size: 18px; font-weight: 500; color: var(--text-muted); }
.jm-accent .jm-v { color: var(--accent); }
.jm-t { font-size: 11px; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 8px; }
.journal-moved {
  max-width: 720px; padding: 18px 20px; border: 1px solid var(--line-soft);
  border-radius: var(--r-md); background: var(--bg-surface);
}
.journal-moved p { margin: 8px 0 14px; color: var(--text-muted); line-height: 1.55; }
.account-journal-metrics { margin-bottom: 16px; }
.account-insights-empty { margin: 4px 0 2px; }
.account-insights-list { display: grid; gap: 10px; }
.account-insight {
  padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--bg-card);
}
.account-insight-meta {
  display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px;
  color: var(--text-dim); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
}
.account-insight-meta span:last-child { white-space: nowrap; }
.account-insight p { margin: 0; color: var(--text); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .journal-moved { padding: 16px; }
  .account-insight { padding: 13px; }
  .account-insight-meta { flex-direction: column; gap: 3px; }
}

/* ── Проверь себя ── */
.check-block { margin-top: 34px; }
.check-head { margin-bottom: 16px; }
.check-head p { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; margin-top: 4px; max-width: 640px; }
.self-check {
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg-surface); padding: 18px 18px 16px; margin-bottom: 14px;
}
.sc-q { font-family: var(--f-display); font-size: 16.5px; font-weight: 600; line-height: 1.3; display: flex; gap: 10px; }
.sc-q-link { cursor: pointer; transition: color .16s; }
.sc-q-link:hover { color: var(--accent); }
.sc-q-arrow { color: var(--accent); font-weight: 700; opacity: 0; transition: opacity .16s; margin-left: auto; }
.sc-q-link:hover .sc-q-arrow { opacity: 1; }
.sc-n { font-family: var(--f-mono); font-size: 12px; color: var(--accent); padding-top: 3px; flex: none; }
.sc-opts { display: grid; gap: 7px; margin: 13px 0 4px; }
.sc-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-soft); background: var(--bg-card);
  color: var(--text-mid); font-size: 13.5px; font-family: var(--f-sans);
  cursor: pointer; transition: .14s;
}
.sc-opt:hover { color: var(--text); border-color: var(--line); }
.sc-opt .sc-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text-dim); flex: none; transition: .14s; }
.sc-opt.ok { border-color: oklch(72% 0.17 155); background: oklch(40% 0.10 155 / 0.18); color: var(--text); }
.sc-opt.ok .sc-dot { border-color: oklch(72% 0.17 155); background: oklch(72% 0.17 155); }
.sc-opt.no { border-color: oklch(65% 0.20 25); background: oklch(40% 0.12 25 / 0.16); color: var(--text); }
.sc-opt.no .sc-dot { border-color: oklch(65% 0.20 25); }
.sc-verdict { font-size: 12px; margin: 8px 0 2px; padding-left: 2px; }
.sc-verdict.ok { color: oklch(78% 0.15 155); }
.sc-verdict.no { color: oklch(74% 0.16 30); }
.sc-free { margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--line-soft); position: relative; }
.sc-label { display: block; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.sc-textarea {
  width: 100%; resize: vertical; min-height: 52px;
  background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--f-sans); font-size: 13.5px; line-height: 1.5;
  padding: 10px 12px; outline: none; transition: .14s;
}
.sc-textarea:focus { border-color: var(--accent); }
.sc-textarea::placeholder { color: var(--text-dim); }
.sc-send {
  margin-top: 9px; padding: 8px 18px; border-radius: 99px; border: none;
  background: linear-gradient(135deg, var(--primary-from), var(--primary-to));
  color: var(--primary-text); font-family: var(--f-sans); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .14s;
}
.sc-send:disabled { opacity: .4; cursor: default; }
.sc-send:not(:disabled):hover { filter: brightness(1.07); }

/* ── POINTS-VERIFY: per-topic quiz at the end of a lesson ── */
.theme-quiz { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.chapter-quiz-note {
  margin-top: 24px; padding: 9px 0 9px 12px;
  border-left: 2px solid var(--accent); color: var(--text-muted);
  font-family: var(--f-mono); font-size: 11px; line-height: 1.5;
}
.tq-head {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.sc-why { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-mid); }
/* QUIZ-COMPLETION (ticket 64) — progress, restored answers and the result panel. */
.tq-progress { margin-left: 10px; font-family: var(--f-mono); font-size: 11.5px; opacity: 0.7; }
.sc-restored { font-family: var(--f-mono); font-size: 11.5px; opacity: 0.7; }
.sc-opt[disabled] { opacity: 0.6; cursor: progress; }
.tq-done {
  margin-top: 18px; padding: 20px;
  border: 1px solid var(--border, rgba(255,255,255,0.14));
  background: var(--bg-subtle, rgba(255,255,255,0.04));
  border-radius: 16px; max-width: 100%;
}
.tq-done-h { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.tq-done-score { margin-top: 8px; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.tq-done-fb { margin-top: 6px; font-size: 13.5px; color: var(--text-mid); }
.tq-done-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.tq-done-actions .btn { min-width: 150px; }
.tq-act-ghost { opacity: 0.85; }
@media (max-width: 520px) {
  .tq-done-actions { flex-direction: column; }
  .tq-done-actions .btn { width: 100%; min-width: 0; }
}

/* ── Insight feedback: launcher + slider + floating + mic ── */
.fb-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(140deg, var(--primary-from), var(--primary-to));
  color: var(--primary-text);
  box-shadow: 0 10px 30px -8px var(--accent-soft), 0 0 0 1px var(--line-soft) inset;
  display: flex; align-items: center; justify-content: center;
  transition: transform .16s, filter .16s;
}
.fb-launcher:hover { transform: translateY(-3px) scale(1.05); filter: brightness(1.08); }

.fb-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: oklch(0% 0 0 / 0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fb-fade .22s ease;
}
@keyframes fb-fade { from { opacity: 0; } to { opacity: 1; } }
.fb-floating { width: 100%; max-width: 440px; animation: fb-pop .26s cubic-bezier(.2,.9,.3,1.2); }
@keyframes fb-pop { from { transform: translateY(16px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.fb-slider {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 120;
  width: 400px; max-width: 92vw;
  background: var(--bg-elev); border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px -30px oklch(0% 0 0 / 0.6);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto;
}
.fb-slider.open { transform: translateX(0); }
/* scrim behind the slide-over: click to close; sits above topbar (100) but below panel (120) */
.fb-slider-scrim {
  position: fixed; inset: 0; z-index: 110;
  background: oklch(0% 0 0 / 0.4); backdrop-filter: blur(2px);
  animation: fb-fade .2s ease;
}

.fb-panel { position: relative; padding: 26px 24px 24px; }
.fb-floating .fb-panel {
  background: linear-gradient(165deg, var(--bg-elev) 0%, color-mix(in oklab, var(--accent) 8%, var(--bg-card)) 100%);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft); overflow: hidden;
}
.fb-glow {
  position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-radial-1), transparent 70%); pointer-events: none;
}
.fb-x {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--line-soft);
  color: var(--text-muted); cursor: pointer; font-size: 12px;
}
.fb-x:hover { color: var(--text); }
.fb-title {
  font-family: var(--f-display); font-size: 19px; font-weight: 700; line-height: 1.2;
  position: relative; z-index: 1; padding-right: 28px;
  background: linear-gradient(135deg, var(--text), var(--accent) 95%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.fb-sub { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 8px; position: relative; z-index: 1; }
.fb-textarea {
  width: 100%; resize: vertical; min-height: 78px; margin-top: 16px;
  background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  color: var(--text); font-family: var(--f-sans); font-size: 14px; line-height: 1.5;
  padding: 12px 14px; outline: none; transition: .14s; position: relative; z-index: 1;
}
.fb-textarea:focus { border-color: var(--accent); }
.fb-textarea::placeholder { color: var(--text-dim); }
.fb-or {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  color: var(--text-dim); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
}
.fb-or::before, .fb-or::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.fb-mic {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 15px; border-radius: var(--r-md);
  border: 1px solid var(--line-soft); background: var(--bg-card);
  color: var(--text-mid); cursor: pointer; transition: .14s; position: relative; z-index: 1;
}
.fb-mic:hover { border-color: var(--line); color: var(--text); }
.fb-mic.rec { border-color: oklch(65% 0.22 25); color: oklch(78% 0.18 25); background: oklch(40% 0.12 25 / 0.14); }
.fb-mic-ic { display: flex; flex: none; }
.fb-mic-lbl { flex: 1; text-align: left; font-size: 13.5px; }
.fb-mic-time { font-family: var(--f-mono); font-size: 13px; }
.fb-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 24px; }
.fb-wave i {
  flex: 1; max-width: 4px; background: oklch(72% 0.20 25); border-radius: 2px; height: 30%;
  animation: fb-bar .9s ease-in-out infinite;
}
@keyframes fb-bar { 0%,100% { height: 25%; } 50% { height: 95%; } }
.fb-rec-hint { font-size: 11px; color: oklch(72% 0.16 25); margin-top: 7px; text-align: center; position: relative; z-index: 1; }
.fb-playback { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.fb-del { background: none; border: 1px solid var(--line-soft); border-radius: var(--r-sm); color: var(--text-muted); font-size: 12px; padding: 6px 12px; cursor: pointer; align-self: flex-start; transition: color .16s, border-color .16s; }
.fb-del:hover { color: var(--accent); border-color: var(--accent); }
.fb-beta-note { position: relative; z-index: 1; font-size: 10.5px; color: var(--text-dim); text-align: center; margin-top: 8px; font-family: var(--f-mono); letter-spacing: .02em; }
/* VOICE-TO-TEXT: small-print disclaimer that Web Speech may send audio to Google. */
.fb-voice-note { position: relative; z-index: 1; font-size: 9.5px; line-height: 1.45; color: var(--text-dim); opacity: .8; text-align: left; margin: 8px 2px 0; }
.fb-send {
  margin-top: 16px; width: 100%; padding: 12px; border-radius: var(--r-md); border: none;
  background: linear-gradient(135deg, var(--primary-from), var(--primary-to));
  color: var(--primary-text); font-family: var(--f-sans); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .14s; position: relative; z-index: 1;
}
.fb-send:disabled { opacity: .4; cursor: default; }
.fb-send:not(:disabled):hover { filter: brightness(1.07); }
.fb-thanks { text-align: center; padding: 18px 4px 6px; position: relative; z-index: 1; }
.fb-check {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, var(--primary-from), var(--primary-to)); color: var(--primary-text);
}
.fb-thanks-tx { font-size: 14.5px; color: var(--text-mid); line-height: 1.55; max-width: 300px; margin: 0 auto; }
@media (max-width: 520px) { .fb-slider { width: 100%; } }

/* ── Misc ── */
.spacer { height: 14px; }
.divider { height: 1px; background: var(--line-soft); }

.fade-in { animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pulse {
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 oklch(70% 0.261 295 / 0.4), 0 8px 30px -10px oklch(0% 0.000 0 / 0.6); }
  50% { box-shadow: 0 0 0 8px oklch(70% 0.261 295 / 0), 0 8px 30px -10px oklch(0% 0.000 0 / 0.6); }
}

/* mini-map dots (interactive — TICKET-002) */
.mini-map .canvas .dot {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 99px;
  background: currentColor;
  transform: translate(-50%, -50%);
  padding: 0; border: 0; cursor: pointer;
  transition: transform .14s, box-shadow .14s, opacity .14s;
  opacity: 0.78;
}
.mini-map .canvas .dot:hover {
  transform: translate(-50%, -50%) scale(2.1);
  opacity: 1;
  box-shadow: 0 0 8px currentColor;
  z-index: 2;
}
.mini-map .canvas .dot.sel {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.9);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3.5px currentColor, 0 0 10px currentColor;
  z-index: 3;
}

.tag-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tag {
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 99px;
  border: 1px solid var(--line-soft);
  color: var(--text-muted);
}

/* ── Font presets (Cyrillic-ready: EN / RU / UK / KK) ── */
[data-font="editorial"] {
  --f-display: "Lora", "Times New Roman", serif;
  --f-sans:    "Manrope", ui-sans-serif, system-ui, sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, monospace;
  --f-display-weight: 500;
  --f-display-spacing: -0.012em;
}
[data-font="modern"] {
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-sans:    "Onest", ui-sans-serif, system-ui, sans-serif;
  --f-mono:    "Geist Mono", ui-monospace, monospace;
  --f-display-weight: 500;
  --f-display-spacing: -0.025em;
}
[data-font="bold"] {
  --f-display: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  --f-sans:    "Geist", ui-sans-serif, system-ui, sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, monospace;
  --f-display-weight: 500;
  --f-display-spacing: -0.03em;
}

/* Apply display weight + spacing through global typographic anchors */
.hero h1, .section-head h2, .scene-body h3, .rail-card h3,
.chapter .title, .eco-card .title, .saved-card .title, .tool .name,
.progress-card .v, .hero .stats .stat .v, .eco-card .stat .v, .chapter .n,
.brand .word, .scene-body .insight {
  font-weight: var(--f-display-weight, 400);
  letter-spacing: var(--f-display-spacing, -0.01em);
}

/* The Instrument Serif italic em+acc gradient only reads as italic for that font.
   For other presets, the em still italicises (real italic via font-style). */
.hero h1 em.acc { font-style: italic; font-weight: var(--f-display-weight, 400); }

/* ── Color palettes (dark theme variants) ── */
[data-palette="violet"] {
  --accent:        oklch(72% 0.261 295);
  --accent-soft:   oklch(40% 0.174 295);
  --accent-2:      oklch(82% 0.174 205);
  --hero-radial-1: oklch(40% 0.217 295 / 0.18);
  --hero-radial-2: oklch(40% 0.174 220 / 0.12);
  --c-eth:         oklch(74% 0.232 290);
  --hero-glow:     oklch(28% 0.116 295 / 0.18);
  --progress-glow: oklch(35% 0.203 295 / 0.18);
  --scene-bg:      oklch(28% 0.116 295 / 0.40);
  --primary-from:  oklch(78% 0.290 295);
  --primary-to:    oklch(60% 0.319 295);
  --chapter-watermark-hover: oklch(45% 0.203 295);
}
[data-palette="cobalt"] {
  --accent:        oklch(72% 0.261 250);
  --accent-soft:   oklch(40% 0.174 250);
  --accent-2:      oklch(82% 0.174 200);
  --hero-radial-1: oklch(40% 0.232 250 / 0.20);
  --hero-radial-2: oklch(40% 0.174 200 / 0.14);
  --c-eth:         oklch(74% 0.232 250);
  --hero-glow:     oklch(28% 0.145 250 / 0.20);
  --progress-glow: oklch(35% 0.203 250 / 0.18);
  --scene-bg:      oklch(28% 0.145 250 / 0.40);
  --primary-from:  oklch(78% 0.261 250);
  --primary-to:    oklch(60% 0.290 250);
  --chapter-watermark-hover: oklch(45% 0.203 250);
}
[data-palette="ember"] {
  --bg:            oklch(11% 0.026 40);
  --bg-surface:   oklch(14.5% 0.029 40);
  --bg-elev:      oklch(18% 0.036 40);
  --bg-card:      oklch(16% 0.032 40);
  --line:         oklch(28% 0.036 40);
  --line-soft:    oklch(22% 0.029 40);
  --accent:        oklch(78% 0.232 60);
  --accent-soft:   oklch(45% 0.174 60);
  --accent-2:      oklch(80% 0.189 20);
  --glass:         oklch(11% 0.026 40 / 0.72);
  --hero-radial-1: oklch(45% 0.261 60 / 0.18);
  --hero-radial-2: oklch(45% 0.217 30 / 0.14);
  --c-eth:         oklch(78% 0.232 60);
  --hero-glow:     oklch(30% 0.145 60 / 0.22);
  --progress-glow: oklch(38% 0.203 60 / 0.20);
  --scene-bg:      oklch(30% 0.145 60 / 0.40);
  --primary-from:  oklch(80% 0.261 60);
  --primary-to:    oklch(64% 0.290 50);
  --chapter-watermark-hover: oklch(50% 0.232 60);
  --node-from:     oklch(36% 0.102 60);
  --node-to:       oklch(18% 0.043 40);
}
[data-palette="forest"] {
  --bg:            oklch(11% 0.020 175);
  --bg-surface:   oklch(14% 0.026 175);
  --bg-elev:      oklch(18% 0.032 175);
  --bg-card:      oklch(16% 0.029 175);
  --line:         oklch(28% 0.032 175);
  --line-soft:    oklch(22% 0.026 175);
  --accent:        oklch(76% 0.232 165);
  --accent-soft:   oklch(40% 0.174 165);
  --accent-2:      oklch(82% 0.174 195);
  --glass:         oklch(11% 0.020 175 / 0.72);
  --hero-radial-1: oklch(40% 0.232 165 / 0.18);
  --hero-radial-2: oklch(40% 0.174 195 / 0.14);
  --c-eth:         oklch(76% 0.232 165);
  --hero-glow:     oklch(28% 0.145 165 / 0.22);
  --progress-glow: oklch(35% 0.203 165 / 0.20);
  --scene-bg:      oklch(28% 0.145 165 / 0.40);
  --primary-from:  oklch(78% 0.261 165);
  --primary-to:    oklch(58% 0.290 160);
  --chapter-watermark-hover: oklch(45% 0.203 165);
  --node-from:     oklch(34% 0.087 175);
  --node-to:       oklch(18% 0.036 175);
}

/* Light-theme palette overlays (subtle, mostly accent shifts) */
[data-theme="light"][data-palette="violet"] { --accent: oklch(55% 0.319 295); --primary-from: oklch(52% 0.319 295); --primary-to: oklch(45% 0.348 295); --c-eth: oklch(48% 0.290 290); }
[data-theme="light"][data-palette="cobalt"] { --accent: oklch(52% 0.319 250); --primary-from: oklch(50% 0.319 250); --primary-to: oklch(42% 0.348 250); --c-eth: oklch(45% 0.290 250); }
[data-theme="light"][data-palette="ember"]  { --bg: oklch(98% 0.006 60); --bg-surface: oklch(96% 0.009 60); --bg-card: oklch(97% 0.007 60); --bg-elev: oklch(93% 0.012 60); --accent: oklch(54% 0.290 50); --primary-from: oklch(58% 0.319 55); --primary-to: oklch(48% 0.319 45); --c-eth: oklch(54% 0.290 50); --line: oklch(82% 0.017 50); --line-soft: oklch(88% 0.014 50); --glass: oklch(98% 0.006 60 / 0.85); }
[data-theme="light"][data-palette="forest"] { --bg: oklch(98% 0.006 170); --bg-surface: oklch(96% 0.009 170); --bg-card: oklch(97% 0.007 170); --bg-elev: oklch(93% 0.012 170); --accent: oklch(46% 0.261 165); --primary-from: oklch(48% 0.261 165); --primary-to: oklch(40% 0.290 160); --c-eth: oklch(46% 0.261 165); --line: oklch(82% 0.017 170); --line-soft: oklch(88% 0.014 170); --glass: oklch(98% 0.006 170 / 0.85); }

[data-palette="crimson"] {
  --accent: oklch(68% 0.27 15); --accent-soft: oklch(40% 0.18 15); --accent-2: oklch(80% 0.18 350);
  --hero-radial-1: oklch(44% 0.24 15 / 0.32); --hero-radial-2: oklch(44% 0.18 350 / 0.22);
  --c-eth: oklch(72% 0.22 15); --hero-glow: oklch(30% 0.12 15 / 0.22);
  --progress-glow: oklch(38% 0.18 15 / 0.20); --scene-bg: oklch(30% 0.12 15 / 0.40);
  --primary-from: oklch(74% 0.27 15); --primary-to: oklch(56% 0.29 10);
  --chapter-watermark-hover: oklch(48% 0.18 15);
}
[data-theme="light"][data-palette="crimson"] { --accent: oklch(52% 0.27 15); --primary-from: oklch(54% 0.27 15); --primary-to: oklch(46% 0.29 10); --c-eth: oklch(50% 0.24 15); }

/* === LUMINARA ENHANCED GRADIENTS === */
html[data-theme="dark"] body {
  background: var(--bg);
  background-image: 
    radial-gradient(ellipse 120% 60% at 10% 20%, var(--hero-radial-1) 0%, transparent 70%),
    radial-gradient(ellipse 80% 50% at 90% 80%, var(--hero-radial-2) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 50%, oklch(20% 0.04 var(--accent-hue, 295) / 0.08) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, oklch(14% 0.035 var(--accent-hue, 295)) 50%, var(--bg) 100%);
}
html[data-palette="violet"] { --accent-hue: 295; }
html[data-palette="cobalt"] { --accent-hue: 250; }
html[data-palette="ember"]  { --accent-hue: 50; }
html[data-palette="forest"] { --accent-hue: 170; }
html[data-palette="crimson"] { --accent-hue: 15; }

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 70% 50% at 30% 40%, var(--hero-radial-1) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 70% 60%, var(--hero-radial-2) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.sidebar, .left-bar {
  background: linear-gradient(180deg, var(--bg-surface) 0%, oklch(12% 0.028 var(--accent-hue, 295)) 100%) !important;
}

.progress-bar, .progress {
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--primary-from)) !important;
}

.chapter:hover {
  background: linear-gradient(135deg, var(--bg-card) 0%, oklch(20% 0.04 var(--accent-hue, 295)) 100%) !important;
}

.btn-primary, .btn.primary {
  background: linear-gradient(135deg, var(--primary-from) 0%, var(--accent) 50%, var(--primary-to) 100%) !important;
}

/* Enhanced node glow on mind map */
.node circle, .node .dot {
  filter: drop-shadow(0 0 8px currentColor);
}

/* Gradient text for headings */
.hero h1, .hero .title, .section-title {
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 80%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Viral onboarding (TICKET-016) ── */
.vo-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  animation: vo-fade .25s ease;
}
@keyframes vo-fade { from { opacity: 0; } to { opacity: 1; } }
.vo-card {
  position: relative; width: 100%; max-width: 520px;
  background: linear-gradient(165deg, var(--bg-surface), color-mix(in oklab, var(--accent) 9%, var(--bg-surface)));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 30px 26px;
  box-shadow: 0 40px 120px -40px var(--accent), 0 10px 40px -20px rgba(0,0,0,.5);
  animation: vo-rise .3s ease;
}
@keyframes vo-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.vo-skip {
  position: absolute; top: 16px; right: 18px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--text-muted); background: transparent; border: 0; cursor: pointer;
  transition: color .16s;
}
.vo-skip:hover { color: var(--text); }
.vo-progress { display: flex; gap: 6px; margin-bottom: 18px; }
.vo-pip { width: 22px; height: 3px; border-radius: 99px; background: var(--line); transition: background .2s; }
.vo-pip.on { background: var(--accent); }
.vo-pip.past { background: color-mix(in oklab, var(--accent) 55%, var(--line)); }
.vo-tag {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.vo-title {
  font-family: var(--f-display); font-size: 25px; font-weight: 700; line-height: 1.22;
  color: var(--text); margin: 0 0 14px;
}
.vo-body { font-size: 14.5px; line-height: 1.5; color: var(--text-mid); margin: 0 0 22px; }
.vo-map {
  margin: 4px 0 18px; padding: 14px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in oklab, var(--accent) 8%, var(--bg)) 0%, var(--bg) 75%);
}
.vo-map svg { display: block; width: 100%; height: auto; }
.vo-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.vo-actions .btn { flex: 1; min-width: 140px; justify-content: center; }
@media (max-width: 560px) {
  .vo-card { padding: 24px 20px 20px; }
  .vo-title { font-size: 21px; }
  .vo-actions .btn { min-width: 100%; }
}

/* ── June 5 features: rating, insights, footer ── */
.acc-level { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 10px; }
.acc-level-name { font-family: var(--f-display); font-size: 22px; font-weight: 700; color: var(--text); }
.acc-level-sub { font-family: var(--f-mono); font-size: 14px; color: var(--accent); letter-spacing: 1px; }
.acc-level-cycle { font-family: var(--f-mono); font-size: 11px; color: var(--accent); margin-left: 2px; }
.acc-insight-preview { display: grid; gap: 8px; }
.acc-insight-chip {
  font-size: 13px; line-height: 1.45; color: var(--text-mid);
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--bg-card); font-style: italic;
}
.acc-soon { font-family: var(--f-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); padding: 2px 8px; border-radius: 99px; background: var(--bg-tint); }
.acc-sbt-row { display: flex; gap: 10px; margin-top: 12px; }
.acc-sbt-badge {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border: 1px dashed var(--line); color: var(--text-dim);
}
.acc-sbt-badge.locked { opacity: .5; }
.acc-lock-note {
  margin: 0 0 12px;
  padding: 9px 10px;
  border-left: 3px solid var(--c-crimson, #e5484d);
  background: color-mix(in srgb, var(--c-crimson, #e5484d) 8%, transparent);
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.45;
}
.acc-activation {
  margin: 0 0 16px;
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.acc-activation-head {
  margin-bottom: 9px;
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-mid);
}
.acc-activation-list { display: grid; gap: 8px; }
.acc-activation-step {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto;
  min-height: 30px; align-items: center; gap: 8px;
  font-size: 12.5px; line-height: 1.35; color: var(--text-mid);
}
.acc-activation-step.done { color: var(--text-muted); }
.acc-activation-step input {
  width: 16px; height: 16px; margin: 0; accent-color: var(--accent); pointer-events: none;
}
.acc-step-action {
  border: 0; padding: 5px 8px; background: transparent; color: var(--accent);
  font-family: var(--f-sans); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.acc-step-action:hover { text-decoration: underline; }
.acc-activation-hint { margin: 8px 0 0 26px; font-size: 11.5px; line-height: 1.4; color: var(--text-muted); }
.acc-ton-guide { margin: 10px 0 0 26px; display: grid; gap: 8px; }
.acc-ton-guide .acc-activation-hint { margin: 0; color: var(--text-mid); }
.acc-ton-next { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.acc-ton-connect { justify-self: start; min-height: 42px; white-space: normal; text-align: center; }
.acc-ton-safety { font: 10px/1.4 var(--f-mono); color: var(--text-dim); }
.acc-ton-row-action { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; flex-wrap: wrap; }
.acc-ton-row-action .acc-sub { margin: 0; text-align: right; overflow-wrap: anywhere; }
.quiz-hub { min-width: 0; max-width: 820px; }
.quiz-catalog-view { min-width: 0; }
.quiz-catalog-state { min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; color: var(--text-2); }
.quiz-catalog-section { margin-top: 34px; min-width: 0; }
.quiz-catalog-section > h3 { margin: 0 0 14px; font: 600 13px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.quiz-catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; min-width: 0; }
.quiz-catalog-card { display: flex; flex-direction: column; min-width: 0; min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-card); overflow-wrap: anywhere; }
.quiz-catalog-card.locked { background: color-mix(in oklch, var(--bg-card) 92%, var(--bg-2)); }
.quiz-catalog-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 12px; }
.quiz-access-badge { display: inline-flex; padding: 5px 9px; border: 1px solid currentColor; border-radius: 999px; color: var(--green); font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.quiz-catalog-card.locked .quiz-access-badge { color: var(--text-2); }
.quiz-catalog-card h4 { margin: 20px 0 8px; font-size: clamp(18px, 2vw, 23px); line-height: 1.2; }
.quiz-title-warning { color: var(--text-2); font-size: 12px; }
.quiz-card-progress { margin: auto 0 15px; padding-top: 22px; color: var(--text-2); font: 500 12px/1.4 var(--mono); }
.quiz-card-action { width: 100%; white-space: normal; }
@media (max-width: 640px) {
  .quiz-catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .quiz-catalog-card { min-height: 0; padding: 16px; }
  .quiz-catalog-card-top { align-items: flex-start; }
}
@media (max-width: 620px) {
  .acc-activation-step { grid-template-columns: 18px minmax(0, 1fr); }
  .acc-step-action { grid-column: 2; justify-self: start; padding-left: 0; }
  .acc-ton-guide { margin-left: 0; }
  .acc-ton-connect { width: 100%; }
  .acc-ton-row-action { width: min(100%, 220px); }
  .acc-ton-row-action .acc-btn { width: 100%; white-space: normal; }
}
.ins-capture {
  max-width: 720px; margin-bottom: 26px; padding: 20px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--bg-card), color-mix(in oklab, var(--accent) 7%, var(--bg-surface)));
}
.ins-cap-h { font-family: var(--f-display); font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ins-q { font-size: 13.5px; color: var(--text-mid); margin-bottom: 12px; }
.ins-textarea, .ins-capture .acc-input {
  width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); color: var(--text); font-family: var(--f-sans); font-size: 14px;
  padding: 12px; resize: vertical; margin-bottom: 14px;
}
.ins-textarea:focus, .ins-capture .acc-input:focus { outline: none; border-color: var(--accent); }
.ins-socials { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ins-social {
  font-family: var(--f-mono); font-size: 12px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text-mid); cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.ins-social.on { border-color: var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.ins-social:disabled { opacity: .4; cursor: not-allowed; }
.ins-share-row { margin-bottom: 12px; }
.ins-or { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.ins-done { font-family: var(--f-mono); font-size: 14px; color: oklch(78% 0.15 155); padding: 8px 0; animation: praise-in .3s ease; }
.ins-mine { max-width: 720px; margin-bottom: 26px; }
.ins-section-h { font-family: var(--f-display); font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.ins-h-row { display: flex; align-items: center; justify-content: space-between; }
.ins-mine-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; margin-bottom: 8px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--bg-card);
}
.ins-mine-text { flex: 1; font-size: 13.5px; color: var(--text-mid); font-style: italic; }
.ins-shared-badge { color: oklch(72% 0.17 155); font-weight: 700; }
.ins-stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ins-stream-card {
  padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg-card);
  display: flex; flex-direction: column; gap: 8px;
}
.ins-topic, .li-anon { font-family: var(--f-mono); font-size: 10.5px; color: var(--accent); letter-spacing: .04em; }
.ins-stream-text { font-size: 13.5px; line-height: 1.5; color: var(--text-mid); font-style: italic; }
.lesson-insights { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.li-h { font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.li-list { display: grid; gap: 8px; }
.li-item {
  display: flex; align-items: baseline; gap: 10px; text-align: left; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--bg-card); cursor: pointer; transition: border-color .16s;
}
.li-item:hover { border-color: var(--accent); }
.li-anon { flex: none; }
.li-text { font-size: 13px; color: var(--text-mid); font-style: italic; line-height: 1.4; }
.site-footer {
  margin-top: 56px; border-top: 1px solid var(--line);
  padding: 40px calc(clamp(16px, 3vw, 36px) + env(safe-area-inset-right, 0px))
           calc(24px + env(safe-area-inset-bottom, 0px))
           calc(clamp(16px, 3vw, 36px) + env(safe-area-inset-left, 0px));
}
.sf-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; max-width: 1180px; margin-inline: auto; }
.sf-logo { font-family: var(--f-display); font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.sf-tag { font-size: 13px; color: var(--text-muted); max-width: 280px; line-height: 1.5; }
.sf-h { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; }
.sf-link { display: block; background: none; border: 0; padding: 5px 0; color: var(--text-mid); font-size: 13.5px; cursor: pointer; text-align: left; transition: color .16s; }
.sf-link:hover { color: var(--accent); }
.sf-bottom { display: flex; justify-content: space-between; max-width: 1180px; margin: 32px auto 0; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--text-dim); }
@media (max-width: 760px) {
  .sf-inner { grid-template-columns: 1fr; gap: 24px; }
  .sf-bottom { flex-direction: column; gap: 6px; }
}

/* ── RESP-2 FIX (source-order/specificity) ─────────────────────────────────
   The base .chapter-rail / .eco-grid / .tool-showcase rules are declared LATER
   in this file than the earlier ≤860 overrides, so at mobile widths the base
   (repeat(4,1fr) / auto-fit-280 / auto-fit-300) won on source order and the
   cards stayed 4-up / single-column-long. Re-assert the tiling here, last in
   the file AND with higher specificity (.app …), so it wins unconditionally. */
@media (max-width: 860px) {
  .app .chapter-rail,
  .app .eco-grid,
  .app .tool-showcase {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-width: 100%;
  }
  .app .chapter-rail > *,
  .app .eco-grid > *,
  .app .tool-showcase > * { min-width: 0; }

  /* The base KPI rules are declared above the earlier responsive section, so
     re-assert the 2 × 2 layout here, after the base styles.  Odd cells retain
     the outer gutter; even cells get an interior gap from the divider. */
  .app .hero .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 16px;
  }
  .app .hero .stats .stat { min-width: 0; }
  .app .hero .stats .stat:nth-child(odd) { padding-left: 0; }
  .app .hero .stats .stat:nth-child(even) { border-right: 0; }
  .app .hero .stats .stat:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
}

/* ── Feedback pass: first-run locale, honest learning and mobile overlays ── */
.sidebar-close { display: none; }
.locale-prompt {
  position: fixed; z-index: 205; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); width: min(680px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev);
  box-shadow: var(--shadow-soft); color: var(--text); font-size: 13px;
}
.locale-prompt > span { flex: none; font-weight: 650; }
.locale-prompt-options { display: flex; gap: 5px; overflow-x: auto; min-width: 0; scrollbar-width: thin; }
.locale-prompt-options button {
  flex: none; padding: 6px 9px; border: 1px solid var(--line-soft); border-radius: 99px;
  background: var(--bg-surface); color: var(--text-mid); font-size: 12px;
}
.locale-prompt-options button:hover { color: var(--text); border-color: var(--accent); }
.acc-learning-quiz {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft);
  color: var(--text-mid); font-size: 13px;
}
.acc-learning-quiz b { color: var(--text); font-family: var(--f-display); font-size: 22px; }
.scene-read-sentinel { display: block; width: 100%; height: 2px; }
.scene-body[tabindex="-1"]:focus { outline: none; }
.atlas3d-label.status-not_started { color: var(--text-dim); filter: grayscale(1); }
.atlas3d-label.status-in_progress { color: var(--text-mid); }
.atlas3d-label.status-completed { color: var(--text); font-weight: 650; }
.uni-status-legend {
  position: absolute; z-index: 8; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line-soft); border-radius: 99px;
  background: var(--glass); backdrop-filter: blur(10px); font: 10px var(--f-mono); pointer-events: none;
}
.uni-status-legend .done { color: var(--accent); }
.uni-status-legend .doing { color: var(--text-mid); }
.uni-status-legend .next { color: var(--text-dim); }

@media (max-width: 860px) {
  .sidebar {
    z-index: 220;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  .sidebar-close {
    display: flex; position: sticky; top: 0; z-index: 4; margin-left: auto;
    width: 36px; height: 36px; align-items: center; justify-content: center;
    border: 1px solid var(--line-soft); border-radius: 9px; background: var(--bg-elev); color: var(--text-mid);
  }
  .rail {
    z-index: 220;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    overscroll-behavior: contain;
  }
  .rail-close {
    position: absolute; top: 10px; right: 14px;
    float: none; z-index: 5; margin: 0; background: var(--bg-elev);
  }
  .nav-backdrop, .rail-backdrop { z-index: 215; }
  .locale-prompt { align-items: flex-start; flex-direction: column; gap: 8px; }

  /* Portrait atlas: controls get their own rows and the camera canvas starts below them. */
  .hero { min-height: 980px; }
  .hero .atlas-host { min-height: max(580px, calc(100dvh - 160px)); }
  .atlas3d-mount { top: 92px; }
  .atlas-legend {
    left: 10px; right: 10px; top: 10px; max-width: none; overflow-x: auto;
    gap: 12px; border-radius: 12px; padding: 8px 10px; scrollbar-width: none;
  }
  .atlas-legend::-webkit-scrollbar { display: none; }
  .atlas-progress { left: 10px; right: auto; top: 52px; max-width: calc(100% - 20px); }
  .atlas-progress .ap-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .atlas-zoom { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .atlas-hint { display: none; }
  .atlas3d-label { font-size: 10px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .fb-launcher { right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 860px) and (orientation: landscape) {
  .hero { min-height: 760px; }
  .hero .atlas-host { min-height: max(350px, calc(100dvh - 96px)); }
  .atlas3d-mount { top: 54px; }
  .atlas-legend { right: 44%; white-space: nowrap; }
  .atlas-progress { left: auto; right: 10px; top: 10px; max-width: 40%; }
  .atlas-progress .ap-k { display: none; }
  .atlas-zoom { bottom: 12px; }
}

/* ════════════════════════════════════════════════════════════════════
   «Мои исследования» (Research page) — A3 · RESEARCH-PAGE
   Hierarchy: ecosystem → theme → subtopic (text left / media right / insight)
   ════════════════════════════════════════════════════════════════════ */

/* per-topic accent via data-c (mirror of .eco-page --eco) */
.research [data-c]            { --rc: var(--accent); }
.research[data-c]             { --rc: var(--accent); }
[data-c="ton"].research, .research [data-c="ton"],
[data-c="ton"] .research      { --rc: var(--c-ton); }
.research [data-c="telegram"], [data-c="telegram"].rs-eco       { --rc: var(--c-telegram); }
.research [data-c="ethereum"] { --rc: var(--c-eth); }
.research [data-c="bitcoin"]  { --rc: var(--c-btc); }
.research [data-c="rwa"]      { --rc: var(--c-rwa); }
.research [data-c="gamefi"]   { --rc: var(--c-game); }
.research [data-c="communities"]      { --rc: var(--c-community); }
.research [data-c="miniapps"]         { --rc: var(--c-miniapps); }
.research [data-c="payments"]         { --rc: var(--c-payments); }
.research [data-c="social_graph"]     { --rc: var(--c-telegram); }
.research [data-c="tokens"]           { --rc: var(--c-token); }
.research [data-c="ton_new_internet"] { --rc: var(--c-ton); }
.research [data-c="ton_vs_eth"]       { --rc: var(--c-compare); }
.research [data-c="wallet"]           { --rc: var(--c-wallet); }
.research.rs-subview[data-c],
.research[data-c="ton"]               { --rc: var(--c-ton); }
.rs-subview[data-c="wallet"]          { --rc: var(--c-wallet); }
.rs-subview[data-c="miniapps"]        { --rc: var(--c-miniapps); }
.rs-subview[data-c="payments"]        { --rc: var(--c-payments); }
.rs-subview[data-c="communities"]     { --rc: var(--c-community); }
.rs-subview[data-c="social_graph"]    { --rc: var(--c-telegram); }
.rs-subview[data-c="tokens"]          { --rc: var(--c-token); }
.rs-subview[data-c="gamefi"]          { --rc: var(--c-game); }
.rs-subview[data-c="ton_vs_eth"]      { --rc: var(--c-compare); }
.rs-subview[data-c="ton_new_internet"]{ --rc: var(--c-ton); }

.rs-section-h {
  font-family: var(--font-mono, monospace);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); margin: 26px 0 12px;
}

/* RESEARCH-HUB (#84): one full-width hierarchy shared with the top navigation. */
.research-hub-list, .research-catalog-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.research-hub-card, .research-catalog-card {
  width: 100%; min-width: 0; display: grid; align-items: center; gap: 18px;
  grid-template-columns: 46px minmax(0, 1fr) auto 28px;
  padding: clamp(22px, 3vw, 34px); text-align: left; color: var(--text);
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel, var(--bg-card));
  transition: transform .18s, border-color .18s, background .18s;
}
.research-hub-card:hover, .research-catalog-card:hover {
  transform: translateY(-2px); border-color: color-mix(in oklab, var(--accent) 50%, var(--line));
  background: color-mix(in oklab, var(--panel, var(--bg-card)) 92%, var(--accent));
}
.research-hub-n, .research-catalog-n, .research-hub-meta {
  font-family: var(--font-mono, monospace); color: var(--text-muted); letter-spacing: .08em;
}
.research-hub-main { display: grid; gap: 8px; min-width: 0; }
.research-hub-main strong, .research-catalog-title { font-size: clamp(23px, 3vw, 34px); line-height: 1.1; }
.research-hub-main small { color: var(--text-dim); font-size: 14px; line-height: 1.55; max-width: 76ch; }
.research-hub-go, .research-catalog-go { color: var(--accent); font-size: 24px; }
.research-catalog-card { grid-template-columns: 46px minmax(0, 1fr) 28px; }
@media (max-width: 720px) {
  .research-hub-card, .research-catalog-card { gap: 12px; padding: 18px 16px; grid-template-columns: 34px minmax(0, 1fr) 22px; }
  .research-hub-meta { display: none; }
  .research-hub-main strong, .research-catalog-title { font-size: 21px; }
  .research-hub-main small { font-size: 13px; }
}

/* ecosystem banner */
.rs-eco {
  --rc: var(--c-telegram);
  position: relative; border: 1px solid color-mix(in oklab, var(--rc) 32%, var(--line));
  border-radius: 16px; padding: clamp(20px, 3.5vw, 32px); overflow: hidden;
  background:
    radial-gradient(130% 150% at 100% 0%, color-mix(in oklab, var(--rc) 20%, transparent), transparent 58%),
    var(--panel, var(--bg-elev));
}
.rs-eco-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.rs-eco-badge {
  font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--rc);
  background: color-mix(in oklab, var(--rc) 15%, transparent);
  border: 1px solid color-mix(in oklab, var(--rc) 38%, transparent);
  padding: 5px 11px; border-radius: 99px;
}
.rs-eco h3 { font-size: clamp(24px, 4vw, 38px); margin: 0; letter-spacing: -.02em; }
.rs-eco-blurb { color: var(--text-dim); max-width: 74ch; margin: 6px 0 18px; }
.rs-eco-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.rs-eco-stat .v { font-size: 22px; font-weight: 700; }
.rs-eco-stat .k { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }

/* general theme hero */
.rs-parent {
  position: relative; border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(20px, 3.5vw, 28px); overflow: hidden; cursor: pointer;
  background: radial-gradient(120% 140% at 0 0, color-mix(in oklab, var(--rc) 14%, transparent), transparent 60%), var(--panel, var(--bg-card));
  transition: border-color .18s, transform .18s;
}
.rs-parent:hover { border-color: color-mix(in oklab, var(--rc) 50%, var(--line)); transform: translateY(-2px); }
.rs-parent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--rc); }
.rs-parent-ribbon { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rs-parent-ribbon .mono { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-muted); }
.rs-parent h3 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 8px; letter-spacing: -.01em; }
.rs-parent-blurb { color: var(--text-dim); max-width: 64ch; margin: 0 0 16px; }
.rs-parent-go { color: var(--rc); font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .06em; }
.rs-chip {
  font-family: var(--font-mono, monospace); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--rc);
  background: color-mix(in oklab, var(--rc) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--rc) 35%, transparent);
  padding: 4px 9px; border-radius: 99px;
}

/* themes grid */
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rs-card {
  position: relative; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel, var(--bg-card)); padding: 18px; cursor: pointer; overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.rs-card:hover { border-color: color-mix(in oklab, var(--rc) 55%, var(--line)); transform: translateY(-2px); }
.rs-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rc); opacity: .85; }
.rs-card-ttl { font-size: 16.5px; font-weight: 600; margin: 0 0 6px; padding-left: 4px; letter-spacing: -.005em; }
.rs-card-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; padding-left: 4px; min-height: 34px; }
.rs-card-foot { display: flex; align-items: center; gap: 10px; padding-left: 4px; }
.rs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px color-mix(in oklab, var(--rc) 70%, transparent); }
.rs-count { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); letter-spacing: .06em; }
.rs-bar { height: 4px; border-radius: 99px; background: var(--bg-tint, rgba(255,255,255,.06)); overflow: hidden; margin-top: 12px; }
.rs-bar > i { display: block; height: 100%; background: var(--rc); border-radius: 99px; }

/* theme head */
.rs-thead {
  position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  padding: clamp(20px, 3.5vw, 30px); margin-bottom: 22px;
  background: radial-gradient(140% 160% at 100% 0, color-mix(in oklab, var(--rc) 16%, transparent), transparent 55%), var(--panel, var(--bg-card));
}
.rs-thead-eco { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in oklab, var(--rc) 75%, var(--text-muted)); margin-bottom: 12px; }
.rs-thead .rs-chip { margin-bottom: 12px; display: inline-block; }
.rs-thead h2 { font-size: clamp(24px, 4vw, 38px); margin: 8px 0; letter-spacing: -.02em; }
.rs-thead p { color: var(--text-dim); max-width: 64ch; margin: 0; }

/* subtopic list */
.rs-sublist { display: flex; flex-direction: column; gap: 8px; }
.rs-sub {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel, var(--bg-card));
  padding: 14px 16px; cursor: pointer; transition: .15s; color: var(--text);
}
.rs-sub:hover { border-color: color-mix(in oklab, var(--rc) 50%, var(--line)); transform: translateX(2px); }
.rs-sub.read { border-color: color-mix(in oklab, var(--rc) 35%, var(--line)); }
.rs-sub-n { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--rc); flex: none; }
.rs-sub-n.big { font-size: 18px; }
.rs-sub-label { flex: 1; font-size: 15px; }
.rs-sub-go { color: var(--text-muted); }
.rs-sub-read { color: var(--rc); font-weight: 700; }

/* subtopic view: text left / media right */
.rs-subhead { margin-bottom: 18px; }
.rs-subhead-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rs-subhead-row h2 { font-size: clamp(22px, 3.6vw, 32px); margin: 0; letter-spacing: -.02em; }
.rs-read-badge { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--rc); border: 1px solid color-mix(in oklab, var(--rc) 45%, transparent); border-radius: 99px; padding: 4px 10px; }
.rs-locale-notice {
  margin: -6px 0 18px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px; line-height: 1.45;
  color: var(--text-mid, #555);
  background: color-mix(in oklab, var(--accent, #2563eb) 7%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent, #2563eb) 22%, transparent);
}

.rs-body-grid { display: block; }
.rs-body-grid::after { content: ""; display: block; clear: both; }
.rs-text { min-width: 0; }
.rs-text-body { font-size: 16px; line-height: 1.7; color: var(--text); margin: 0 0 18px; }
/* MARKDOWN-RENDER: when the body is rendered via SceneProse, the wrapper must not
   impose its own paragraph font-size/line-height — .scene-prose owns typography. */
.rs-text-body.rs-text-md { font-size: inherit; line-height: inherit; }
.rs-text-insight {
  border-left: 3px solid var(--rc); padding: 12px 16px; margin: 0 0 16px;
  background: color-mix(in oklab, var(--rc) 8%, transparent); border-radius: 0 8px 8px 0;
  color: var(--text-dim); font-size: 15px;
}
.rs-tagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.rs-tag { font-family: var(--font-mono, monospace); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); border: 1px solid var(--line); padding: 3px 7px; border-radius: 99px; }

.rs-pager { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.rs-pager-pos { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-muted); flex: 1; text-align: center; }
/* COURSE-NAV (#54): same route-aware pager is available before and after every
   Research/White Paper reader. The top copy needs external spacing, not a
   duplicate layout or separate navigation state. */
.rs-pager-top { margin: 4px 0 18px; }

/* media column — floated right so prose flows beside AND under it (SCENE-TEXT-UNDER-ASIDE) */
.rs-media { float: right; width: 300px; margin: 0 0 20px 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, var(--bg-card)); padding: 16px; }
.rs-media-h { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.rs-media-group { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; }
.rs-media-label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.rs-media-ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in oklab, var(--rc) 13%, transparent); color: var(--rc); font-size: 13px; }
.rs-media-soon { font-family: var(--font-mono, monospace); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--line); border-radius: 99px; padding: 3px 8px; }

/* insight field */
.rs-insight { border: 1px solid var(--line); border-radius: 12px; background: color-mix(in oklab, var(--rc) 5%, transparent); padding: 16px; margin-top: 8px; }
.rs-insight-h { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--rc); }
.rs-insight-ta { width: 100%; box-sizing: border-box; resize: vertical; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #0c0c10); color: var(--text); padding: 11px 13px; font: inherit; font-size: 14px; }
.rs-insight-ta:focus { outline: none; border-color: var(--rc); }
.rs-insight-foot { margin-top: 10px; display: flex; justify-content: flex-end; }
.rs-insight-saved { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--rc); letter-spacing: .05em; }

@media (max-width: 860px) {
  .rs-media { float: none; width: 100%; margin: 0 0 20px 0; }
}

/* nav divider (research ↔ technical) */
.topbar nav .nav-divider { display: inline-block; width: 1px; height: 18px; background: var(--line); margin: 0 6px; flex: none; }

/* research beacon — soft pulse on the "My Research" nav item until visited */
.topbar nav button.beacon {
  color: var(--text);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 42%, transparent);
  border-radius: 99px; animation: rs-beacon 2.8s ease-in-out infinite;
}
@keyframes rs-beacon {
  0%, 100% { box-shadow: 0 0 0 0 transparent; border-color: color-mix(in oklab, var(--accent) 34%, transparent); }
  50%      { box-shadow: 0 0 14px 1px color-mix(in oklab, var(--accent) 36%, transparent); border-color: color-mix(in oklab, var(--accent) 70%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar nav button.beacon { animation: none; box-shadow: 0 0 12px 0 color-mix(in oklab, var(--accent) 26%, transparent); }
}

/* ════════════════════════════════════════════════════════════════════
   «Моя вселенная» (My Universe) — B2 personal concept map
   ════════════════════════════════════════════════════════════════════ */
.uni-stage { border: 1px solid var(--line); border-radius: 14px; background:
  radial-gradient(120% 130% at 50% 0%, color-mix(in oklab, var(--accent) 8%, transparent), transparent 60%), var(--panel, var(--bg-card));
  padding: 16px; margin: 12px 0; }
.uni-stage.compact { padding: 8px; }
.uni-stage-3d-card { height: clamp(440px, 46vw, 620px); margin-top: 14px; }
@media (max-width: 720px) {
  .uni-stage-3d-card { height: 420px; }
}
.uni-svg { display: block; }
.uni-stats { display: flex; gap: 22px; margin: 12px 0; font-size: 14px; color: var(--text-dim); }
.uni-stats.small { gap: 16px; font-size: 12px; margin: 8px 0 0; }
.uni-stats b { color: var(--text); font-size: 18px; }
.uni-stats.small b { font-size: 14px; }
.uni-empty { color: var(--text-muted); font-size: 13px; padding: 18px; text-align: center;
  border: 1px dashed var(--line); border-radius: 10px; }
.uni-concepts { display: flex; flex-wrap: wrap; gap: 7px; }
.uni-concept { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 10px; background: color-mix(in oklab, var(--accent) 5%, transparent); }

/* ════════════════════════════════════════════════════════════════════
   D · Cabinet polish — avatar upload, notifications bell
   ════════════════════════════════════════════════════════════════════ */
.acc-avatar-wrap { position: relative; display: inline-block; cursor: pointer; flex: none; }
.acc-avatar-img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: block;
  border: 1px solid var(--line); }
.acc-avatar-wrap .acc-avatar { margin: 0; }
.acc-avatar-edit { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px;
  border-radius: 50%; display: grid; place-items: center; background: var(--accent);
  color: var(--primary-text, #0c0c10); border: 2px solid var(--bg); }
.acc-avatar-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.notif-wrap { position: relative; display: inline-flex; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 300px;
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px); z-index: 60;
  background: var(--panel, var(--bg-card)); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4); overflow: hidden; }
/* Keep the panel anchored to the bell.  Centering against the viewport from a
   static wrapper made the popover escape past the left edge on some phones. */
@media (max-width: 420px) {
  .notif-panel {
    right: max(0px, env(safe-area-inset-right)); left: auto; transform: none;
    width: min(300px, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px));
    max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px);
  }
}
.notif-head { padding: 12px 14px; border-bottom: 1px solid var(--line-soft, var(--line));
  font-weight: 600; font-size: 14px; }
.notif-empty { padding: 26px 18px; text-align: center; color: var(--text-muted); }
.notif-empty-ic { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 12px;
  display: grid; place-items: center; background: var(--bg-tint, rgba(255,255,255,.05)); color: var(--text-muted); }
.notif-empty p { font-size: 12.5px; line-height: 1.5; margin: 0; }

/* ════════════════════════════════════════════════════════════════════
   E1 · Media — YouTube embeds + media links in the research subtopic
   ════════════════════════════════════════════════════════════════════ */
.rs-yt { display: block; width: 100%; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line); margin: 0 0 9px; position: relative; background: #000; }
.rs-yt-frame { width: 100%; height: 100%; border: 0; display: block; }
.rs-yt-poster { background-size: cover; background-position: center; cursor: pointer; padding: 0;
  display: grid; place-items: center; }
.rs-yt-poster::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.28); transition: background .15s; }
.rs-yt-poster:hover::after { background: rgba(0,0,0,.12); }
.rs-yt-play { position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--rc, var(--accent)); color: #fff; font-size: 16px;
  box-shadow: 0 4px 18px rgba(0,0,0,.4); padding-left: 3px; }
.rs-yt-title { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 8px 10px;
  font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7));
  text-align: left; }
.rs-media-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel, var(--bg-card));
  color: var(--text); font-size: 13.5px; transition: border-color .15s, background .15s; }
.rs-media-link:hover { border-color: color-mix(in oklab, var(--rc, var(--accent)) 45%, var(--line));
  background: var(--bg-elev); }
.rs-media-link > span:nth-child(2) { flex: 1; }
.rs-media-ic.small { width: 22px; height: 22px; font-size: 11px; }
.rs-media-ext { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted); }
.rs-media-ft { font-family: var(--font-mono, monospace); font-size: 9px; font-weight: 600; flex: none;
  width: 34px; height: 24px; display: grid; place-items: center; border-radius: 5px;
  color: var(--rc, var(--accent)); background: color-mix(in oklab, var(--rc, var(--accent)) 13%, transparent);
  border: 1px solid color-mix(in oklab, var(--rc, var(--accent)) 30%, transparent); }

/* ════════════════════════════════════════════════════════════════════
   F2 · White Paper course — special theme card + 6-section module reader
   ════════════════════════════════════════════════════════════════════ */
.rs-wp { --rc: var(--c-ton); position: relative; border: 1px solid color-mix(in oklab, var(--rc) 30%, var(--line));
  border-radius: 14px; padding: clamp(18px,3vw,26px); cursor: pointer; overflow: hidden;
  background: radial-gradient(130% 150% at 100% 0, color-mix(in oklab, var(--rc) 14%, transparent), transparent 56%), var(--panel, var(--bg-card));
  transition: border-color .18s, transform .18s; }
.rs-wp:hover { border-color: color-mix(in oklab, var(--rc) 55%, var(--line)); transform: translateY(-2px); }
.rs-wp::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--rc); }
.rs-wp-badge { display: inline-block; font-family: var(--font-mono, monospace); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--rc); margin-bottom: 8px;
  background: color-mix(in oklab, var(--rc) 14%, transparent); border: 1px solid color-mix(in oklab, var(--rc) 35%, transparent);
  padding: 4px 9px; border-radius: 99px; }
.rs-wp h3 { font-size: clamp(20px,3vw,27px); margin: 0 0 8px; letter-spacing: -.01em; }
.rs-wp-blurb { color: var(--text-dim); max-width: 66ch; margin: 0 0 14px; }
.rs-wp-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.rs-wp-go { color: var(--rc); font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .05em; }

.rs-sub-soon { opacity: .6; }
.rs-wp-sections { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.rs-wp-sec { --rc: var(--c-ton); border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel, var(--bg-card)); padding: 16px 18px; }
.rs-wp-sec-h { font-family: var(--font-mono, monospace); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: color-mix(in oklab, var(--rc) 70%, var(--text-muted)); margin-bottom: 8px; }
.rs-wp-sec-body { margin: 0; line-height: 1.65; color: var(--text); font-size: 15px; font-weight: 450; }
.rs-wp-sec.en { background: color-mix(in oklab, var(--rc) 5%, var(--panel, var(--bg-card))); }
.rs-wp-sec.en .rs-wp-sec-body { font-family: var(--font-mono, monospace); font-size: 14px; font-weight: 600; color: var(--text); }
.rs-wp-sec.q { border-color: color-mix(in oklab, var(--rc) 40%, var(--line));
  background: color-mix(in oklab, var(--rc) 8%, transparent); }
.rs-wp-sec.q .rs-wp-sec-body { font-style: italic; }
/* WP weekly (rich) blocks */
.rs-wp-section-ref { font-family: var(--font-mono, monospace); font-size: 11px; letter-spacing: .06em; color: var(--text-dim); margin-top: 4px; }
.rs-wp-part { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; border-top: 1px dashed var(--line); }
.rs-wp-part:first-child { border-top: 0; }
.rs-wp-part-h { font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 8px 0 2px; }
.rs-wp-sec.ctx { background: color-mix(in oklab, var(--c-ton) 6%, var(--panel, var(--bg-card))); }
.rs-wp-sec.src .rs-wp-sec-h, .rs-wp-sec.links .rs-wp-sec-h { margin-bottom: 6px; }
.rs-wp-srclist { margin: 0; padding-left: 18px; line-height: 1.7; font-size: 14px; }
.rs-wp-srclist a { color: var(--c-ton); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--c-ton) 40%, transparent); }
.rs-wp-srclist a:hover { border-bottom-color: var(--c-ton); }
.rs-wp-linklist { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.rs-wp-link { font-family: var(--font-mono, monospace); font-size: 12.5px; color: var(--c-ton); background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: left; letter-spacing: .02em; }
.rs-wp-link:hover { text-decoration: underline; }

/* CONTENT-ACCESS-FLAG (B3): per-scene free/paid badge next to the scene title */
.access-badge {
  display: inline-block; vertical-align: middle;
  margin-left: 10px; padding: 2px 9px;
  font-family: var(--f-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase;
  border-radius: 999px; border: 1px solid transparent; line-height: 1.6;
}
.access-badge.access-free { color: var(--c-foundations, #1d9e75); background: rgba(29,158,117,0.12); border-color: rgba(29,158,117,0.35); }
.access-badge.access-paid { color: #b8860b; background: rgba(184,134,11,0.12); border-color: rgba(184,134,11,0.38); }

/* B2 (CONTENT-GATE): paywall shown in place of a locked scene/week body */
.rs-paywall {
  border: 1px solid rgba(184,134,11,0.38);
  background: rgba(184,134,11,0.06);
  border-radius: 16px;
  padding: 34px 28px;
  text-align: center;
  max-width: 560px;
  margin: 8px 0;
}
.rs-paywall-lock { font-size: 34px; line-height: 1; margin-bottom: 12px; }
.rs-paywall-title { font-family: var(--f-mono); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #b8860b; margin-bottom: 10px; }
.rs-paywall-body { color: var(--text); font-size: 16px; line-height: 1.5; margin: 0 auto 20px; max-width: 42ch; }
.rs-paywall-cta { min-width: 200px; }
.rs-paywall-soon { margin-top: 14px; font-family: var(--f-mono); font-size: 13px; color: var(--text-muted); }
.rs-gate-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  max-width: 560px;
  margin: 8px 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text-muted);
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.rs-gate-error {
  border: 1px solid rgba(193, 67, 67, 0.42);
  background: rgba(193, 67, 67, 0.06);
  border-radius: 16px;
  padding: 30px 28px;
  max-width: 560px;
  margin: 8px 0;
  text-align: center;
}
.rs-gate-error-title { font-family: var(--f-mono); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #a43b3b; margin-bottom: 10px; }
.rs-gate-error-body { color: var(--text); font-size: 16px; line-height: 1.5; margin: 0 auto 20px; max-width: 42ch; }
.rs-text-loading { color: var(--text-muted); font-size: 24px; letter-spacing: 0.2em; }
.rs-sub-lock { margin-left: auto; font-size: 15px; opacity: 0.85; }

/* SHARE-BUTTON (C3): share row under a scene */
.rs-share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 22px 0 4px; }
.rs-share-lbl { font-family: var(--f-mono); font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.rs-share-btn {
  padding: 6px 12px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-surface); color: var(--text-mid); cursor: pointer;
  transition: 0.15s;
}
.rs-share-btn:hover { border-color: var(--accent); color: var(--text); }

/* NAV-RESTRUCTURE A4: expandable subtopic tree on ecosystem cards */
.eco-tree { margin: 4px 0 2px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.eco-tree-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  color: var(--text-mid); padding: 2px 0; letter-spacing: 0.02em;
}
.eco-tree-toggle:hover { color: var(--text); }
.eco-tree-toggle .chev { display: inline-block; transition: transform 0.15s; font-size: 11px; }
.eco-tree-toggle.open .chev { transform: rotate(90deg); }
.eco-tree-list { margin-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.eco-tree-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer;
  transition: background 0.12s;
}
.eco-tree-item:hover { background: var(--bg-surface); }
.eco-tree-n { font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); min-width: 20px; }
.eco-tree-label { font-size: 13.5px; color: var(--text-mid); }
.eco-tree-item:hover .eco-tree-label { color: var(--text); }

/* NAV-RESTRUCTURE v2: "Мои исследования" dropdown tree (Основания · Экосистемы → общие темы) */
.nav-tree-wrap { position: relative; display: inline-flex; }
.nav-has-tree .nav-caret { font-size: 9px; margin-left: 2px; opacity: 0.7; transition: transform 0.15s; display: inline-block; }
.nav-has-tree.tree-open .nav-caret { transform: rotate(180deg); }
.nav-tree {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 200;
  min-width: 280px; max-width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto;
  background: var(--bg-card, #fff); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.16);
}
.nav-tree-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: var(--r-sm); color: var(--text-mid);
  font-size: 13.5px; font-weight: 500; transition: background 0.12s, color 0.12s;
}
/* Long lesson titles must wrap inside the menu rather than widen it. */
.nav-tree-row, .nav-tree-label, .nav-tree-sub {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
.nav-tree-label, .nav-tree-sub { flex: 1 1 auto; min-width: 0; }
.nav-tree { overflow-x: hidden; }
.nav-tree-row:hover { background: var(--bg-surface); color: var(--text); }
.nav-tree-row.lvl1 { font-weight: 600; color: var(--text); }
.nav-tree-row.lvl2 { padding-left: 22px; }
/* leaf rows carry a .nav-chev-slot (30px) for alignment, so trim their own left padding */
.nav-tree-row.lvl1 { padding-left: 4px; }
.nav-tree-row.lvl3 { padding-left: 16px; font-weight: 400; font-size: 13px; color: var(--text-mid); }
.nav-chev { display: inline-block; font-size: 17px; transition: transform 0.15s; color: var(--text-dim); }
.nav-tree-row.open > .nav-chev { transform: rotate(90deg); }
.nav-tree-count { margin-left: auto; flex: 0 0 auto; white-space: nowrap; font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); }
.nav-tree-n { font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); min-width: 18px; }
.nav-tree-sub { flex: 1; }
.nav-tree-eco { display: flex; flex-direction: column; }

/* NAV v2: chevron-LEFT tree. [>] expands (own hit target); label navigates. Uniform. */
.nav-tree-row.hasrow { display: flex; align-items: stretch; gap: 0; padding: 0; }
.nav-chev-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; background: none; border: none; cursor: pointer;
  color: var(--text-dim); border-radius: var(--r-sm); transition: background 0.12s, color 0.12s;
}
.nav-chev-btn:hover { background: var(--bg-surface); color: var(--text); }
.nav-chev-btn .nav-chev { display: inline-block; font-size: 18px; transition: transform 0.15s; }
.nav-chev-btn.open .nav-chev { transform: rotate(90deg); }
/* empty chevron slot keeps leaf rows aligned with expandable ones */
.nav-chev-slot { flex: 0 0 auto; width: 30px; display: inline-block; }
.nav-tree-label {
  flex: 1; display: flex; align-items: center; gap: 9px;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 10px 9px 4px; border-radius: var(--r-sm);
  color: inherit; font: inherit; transition: background 0.12s, color 0.12s;
}
.nav-tree-row.lvl1.hasrow .nav-tree-label { font-weight: 600; color: var(--text); }
.nav-tree-row.lvl2.hasrow { padding-left: 16px; }
.nav-tree-label:hover { background: var(--bg-surface); color: var(--text); }
.nav-tree-label .nav-tree-count { margin-left: auto; }

/* SOURCES-BLOCK (30.06): expandable sources list under materials */
.rs-sources { margin: 18px 0 4px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.rs-sources-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  font-family: var(--f-mono); font-size: 12.5px; font-weight: 600;
  color: var(--text-mid); letter-spacing: 0.02em; text-transform: uppercase; padding: 2px 0;
}
.rs-sources-toggle:hover { color: var(--text); }
.rs-sources-chev { display: inline-block; font-size: 10px; transition: transform 0.15s; color: var(--text-dim); }
.rs-sources.open .rs-sources-chev { transform: rotate(90deg); }
/* SOURCES (ticket 63) — shared renderer used by every course template. Long URLs and titles must
   wrap instead of forcing horizontal scroll on mobile / Mini App. */
.rs-srclist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.rs-src-item { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; line-height: 1.5; min-width: 0; }
.rs-src-link { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--accent); text-decoration: none; }
.rs-src-link:hover .rs-src-title { text-decoration: underline; }
.rs-src-ic, .rs-src-bullet { flex: 0 0 auto; opacity: 0.8; }
.rs-src-title { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.rs-src-domain { flex: 0 0 auto; font-family: var(--f-mono); font-size: 11.5px; opacity: 0.65; }
/* Bibliography without a usable link must not look clickable. */
.rs-src-plain { color: var(--text-muted); cursor: default; }
.rs-src-plain .rs-src-title { text-decoration: none; }
.rs-srclist-wp .rs-src-link { color: var(--c-ton); }
.rs-srclist-media { margin-top: 6px; }
.rs-src-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.rs-sources-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.rs-sources-list li { font-size: 13.5px; line-height: 1.5; }
.rs-sources-list a { color: var(--accent); text-decoration: none; }
.rs-sources-list a:hover { text-decoration: underline; }
.rs-sources-ext { font-size: 11px; color: var(--text-dim); }

/* SOURCES as 4th media row: expandable chevron */
.rs-media-group.rs-media-clickable { user-select: none; }
.rs-media-group.rs-media-clickable:hover .rs-media-label { color: var(--text); }
.rs-media-chev { display: inline-block; margin-left: 8px; font-size: 10px; color: var(--text-dim); transition: transform 0.15s; }
.rs-media-chev.open { transform: rotate(90deg); }

/* SITE-SEARCH: functional search box + results dropdown */
.topbar .search.search-live { position: relative; } /* SEARCH-Z-UNDER-PALETTE: palette swatches render above the search box */
.search-input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  color: var(--text); font-size: 13px; font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }
.search-drop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 200;
  max-height: 60vh; overflow-y: auto;
  background: var(--bg-card, #fff); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,0.16);
}
.search-empty { padding: 14px; color: var(--text-muted); font-size: 13px; text-align: center; }
.search-res {
  display: block; width: 100%; text-align: left; background: none; border: none;
  cursor: pointer; padding: 9px 10px; border-radius: var(--r-sm); transition: background 0.12s;
}
.search-res:hover { background: var(--bg-surface); }
.search-res-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.search-res-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.search-res-crumb { font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.search-res-snip { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); line-height: 1.4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* FOUNDATIONS: Media block occupies the left column (replaces SceneArt) */
.scene-view > .scene-media-left {
  float: left; width: 44%; max-width: 420px; margin: 0 36px 24px 0;
  background: var(--bg-surface); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 18px;
}
@media (max-width: 860px) {
  .scene-view > .scene-media-left { float: none; width: 100%; max-width: none; margin: 0 0 24px 0; }
}

/* Крипто-Азбука — A–Z letter-card grid (ABC glossary), styled like .chapter cards */
.abc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 10px; }
.abc-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 18px; min-height: 128px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg-surface); cursor: pointer; text-align: left;
  transition: 0.2s; position: relative; overflow: hidden;
}
.abc-card:hover:not(.abc-empty) { transform: translateY(-2px); border-color: currentColor; }
.abc-letter { font-family: var(--f-display); font-size: 40px; font-weight: 700; line-height: 1; color: currentColor; }
.abc-terms-list { display: flex; flex-direction: column; gap: 3px; align-self: stretch; }
.abc-term { font-size: 13.5px; line-height: 1.3; color: var(--text); }
.abc-card.abc-empty { opacity: 0.4; cursor: default; }

/* Крипта-Ясли — lesson list (20 lessons → scenes) */
.lesson-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.lesson-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg-surface); cursor: pointer; text-align: left; transition: 0.2s;
}
.lesson-card:hover:not(.lesson-empty) { transform: translateX(2px); border-color: currentColor; }
.lesson-n { font-size: 15px; color: currentColor; min-width: 26px; }
.lesson-title { flex: 1; font-size: 16px; color: var(--text); }
.lesson-count { font-size: 13px; color: var(--text-muted); }
.lesson-card.lesson-empty { opacity: 0.4; cursor: default; }
.lesson-bonus { margin-top: 26px; }
.lesson-bonus-card { display: block; width: 100%; font: inherit; text-align: left; color: var(--text); }

/* Крипто-Азбука — scene view (letter + 3 terms) */
.abc-scene-h { margin-bottom: 6px; }
.abc-scene-letter { font-family: var(--f-display); font-size: 56px; font-weight: 700; line-height: 1; color: var(--accent); }
.abc-terms { display: flex; flex-direction: column; gap: 20px; margin-top: 10px; }
.abc-term-item { border-left: 3px solid currentColor; padding-left: 16px; }
.abc-term-name { font-family: var(--f-mono); font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.abc-term-desc { color: var(--text); line-height: 1.55; }

/* Крипто-Азбука — per-term sources (compact mini-block under each term, spec v3) */
.abc-term-src { margin-top: 8px; font-size: 13px; opacity: 0.9; }
.abc-term-src .rs-sources, .abc-term-src .sources { margin-top: 4px; }

/* FOUNDATIONS-BONUS-CARDS: Крипто-Ясли + Крипто-Азбука sit together on one row (span 2 each of
   the 4-col rail → two side by side fill the row), no number, height fits content (no empty volume) */
/* FOUNDATIONS-BONUS-CARDS: bonus chapters (Ясли/Азбука/Атлас ETH) live in their own row.
   Even columns so 3 line up flush; falls back to 2 then 1 on narrow widths.
   min-height:0 keeps them compact (no number → no empty volume). */
.chapter-rail--bonus {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}
.chapter-rail--bonus .chapter--bonus { grid-column: auto; }
.chapter--bonus { min-height: 0; }

/* DIFFICULTY-LEVELS: segmented control above a Foundations article body (simple/extended/deep/academic) */
.diff-levels { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 16px; }
.diff-level {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--bg-surface);
  color: var(--text-mid); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: 0.15s;
}
.diff-level:hover:not(:disabled) { color: var(--text); border-color: var(--line); }
.diff-level.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.diff-level.diff-empty, .diff-level:disabled { opacity: 0.5; cursor: not-allowed; }
.diff-soon {
  font-family: var(--f-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.04em; opacity: 0.85; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line-soft);
}

/* ADMIN-ROLE-MANAGEMENT: roles tab (RolesManager) — reuses .la-btn from the admin panel CSS */
.rm { display: flex; flex-direction: column; gap: 10px; }
.rm-note { font-size: 12px; color: var(--text-mid); background: var(--bg-surface); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; }
.rm-search { display: flex; gap: 8px; }
.rm-input { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-surface); color: var(--text); font-size: 14px; }
.rm-input:focus { outline: none; border-color: var(--accent); }
.rm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-card, var(--bg-surface)); }
.rm-name { font-weight: 600; color: var(--text); word-break: break-word; }
.rm-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rm-badge { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-soft); color: var(--text-mid); }
.rm-badge.rm-superadmin { color: var(--accent); border-color: var(--accent); }
.rm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-locked { font-size: 12px; color: var(--accent); font-weight: 600; }
.ref-admin { display: flex; flex-direction: column; gap: 10px; }
.ref-admin-filters, .ref-code-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: center; }
.ref-admin-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-mid); }
.ref-admin-row.suspicious { border-color: var(--err, #e0526a); }
.ref-admin-row.probabilistic { box-shadow: inset 3px 0 0 var(--warn, #e0a23a); }
.ref-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 14px; font-size: 12px; color: var(--text-mid); }
.ref-admin-grid span { min-width: 0; overflow-wrap: anywhere; }
.ref-admin-grid b { display: block; margin-bottom: 2px; color: var(--text-dim); font-family: var(--f-mono); font-size: 9px; text-transform: uppercase; }
.ref-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.audit-admin { display: flex; flex-direction: column; gap: 10px; }
.audit-toolbar { display: flex; justify-content: flex-end; }
.audit-preserved { color: var(--warn, #e0a23a); font-size: 10px; }
.audit-meta { margin: 10px 0 0; max-height: 180px; overflow: auto; padding: 9px; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--bg-surface); color: var(--text-mid); font: 10px/1.45 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.users-admin { display: flex; flex-direction: column; gap: 10px; }
.users-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, .4fr) auto; gap: 8px; }
.users-sort { width: 100%; }
.users-table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
.users-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 12px; }
.users-table th, .users-table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.users-table th { color: var(--text-dim); font: 10px var(--f-mono); text-transform: uppercase; background: var(--bg-surface); }
.users-table td small { display: block; margin-top: 3px; color: var(--text-dim); font: 9px/1.4 var(--f-mono); overflow-wrap: anywhere; }
.users-pages { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--text-mid); font: 10px var(--f-mono); }
.dossier-backdrop { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 18px; background: color-mix(in oklab, #000 72%, transparent); }
.dossier-panel { width: min(1050px, 100%); max-height: calc(100vh - 36px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-card); box-shadow: 0 24px 80px #0008; }
.dossier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.dossier-head h3 { margin: 0 0 4px; font-size: 20px; }
.dossier-head small { color: var(--text-dim); font: 9px var(--f-mono); overflow-wrap: anywhere; }
.dossier-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.dossier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.dossier-grid section { min-width: 0; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.dossier-grid h4 { margin: 0 0 10px; color: var(--accent-2); font: 11px var(--f-mono); text-transform: uppercase; }
.dossier-grid dl { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 12px; }
.dossier-grid dt { color: var(--text-dim); }
.dossier-grid dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.dossier-line { display: grid; grid-template-columns: minmax(74px, auto) minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.dossier-line span { overflow-wrap: anywhere; color: var(--text-mid); }
.dossier-line small { color: var(--text-dim); font: 9px var(--f-mono); }
[data-theme="light"] .dossier-grid h4 { color: oklch(42% 0.16 250); }
[data-theme="light"] .dossier-actions .la-btn.ok {
  color: oklch(38% 0.15 160);
  border-color: oklch(38% 0.15 160);
}
[data-theme="light"] .dossier-actions .la-btn.ok:hover:not([disabled]) {
  background: oklch(92% 0.05 160);
}
@media (max-width: 700px) {
  .users-toolbar { grid-template-columns: 1fr; }
  .dossier-backdrop { padding: 0; }
  .dossier-panel { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; padding: 15px; }
  .dossier-head, .dossier-grid { display: flex; flex-direction: column; }
  .dossier-actions { margin-top: 8px; }
}

/* EMBED-MAP: CTA button (replaces the "Материалы" media slot) + full-screen map overlay */
.chapter-map-cta{
  display:flex; align-items:center; gap:14px; width:100%; cursor:pointer;
  text-align:left; padding:16px 18px; margin:14px 0; font:inherit;
  border:1px solid var(--line); border-radius:14px;
  background:linear-gradient(135deg, color-mix(in oklch, var(--accent) 14%, var(--bg-card)), var(--bg-card));
  color:var(--text); transition:.15s;
}
.chapter-map-cta:hover{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent) inset; }
.chapter-map-cta:disabled{ cursor:wait; opacity:.72; }
.rs-media-error{ margin:8px 0 0; color:var(--danger, #b42318); font-size:12px; line-height:1.45; }
.cmc-icon{ font-size:26px; }
.cmc-text{ display:flex; flex-direction:column; gap:2px; }
.cmc-text b{ font-size:15px; }
.cmc-text small{ font-size:12px; color:var(--text-muted); }

/* Legacy full-screen overlay classes: no longer used by any active portal (Issue #19 replaced
   the research live-demo AND the foundations chapter-map portal with window.LuminaraModal /
   .lum-modal-* below), kept only so nothing breaks if an older cached bundle still references
   them momentarily during a rollout. */
.chapter-map-overlay{ position:fixed; inset:0; z-index:9999; background:var(--bg); display:block; }
.chapter-map-iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; display:block; }
.chapter-map-close{
  position:fixed; top:14px; right:16px; z-index:10000; cursor:pointer;
  width:40px; height:40px; border-radius:50%;
  border:1px solid var(--line); background:var(--bg-card); color:var(--text);
  font-size:22px; line-height:1;
}

/* Issue #19 — ONE shared accessible modal shell (window.LuminaraModal) for the research
   live-demo, the foundations chapter map, and the new #24 premium ARPANET interactives.
   Windowed on desktop; edge-to-edge with safe-area padding on mobile; close target ≥44×44,
   always in the outer document so it stays visible through the iframe's own internal scroll. */
.lum-modal-backdrop{
  position:fixed; inset:0; z-index:9999;
  background:color-mix(in oklch, black 55%, transparent);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  padding-top:max(24px, env(safe-area-inset-top));
  padding-bottom:max(24px, env(safe-area-inset-bottom));
  padding-left:max(24px, env(safe-area-inset-left));
  padding-right:max(24px, env(safe-area-inset-right));
}
.lum-modal-shell{
  position:relative; overflow:hidden;
  width:min(1100px, calc(100vw - 48px));
  height:calc(100dvh - 48px);
  max-height:calc(100dvh - 48px);
  background:var(--bg); border:1px solid var(--line); border-radius:16px;
  box-shadow:0 24px 60px -20px rgba(0,0,0,.55);
}
/* Chapter maps are authored as a full Atlas surface with their own side panels and canvas.
   They must not inherit the windowed live-demo frame: it clips the map and exposes its internal
   document below the canvas. */
.lum-modal-backdrop--fullscreen{ padding:0; background:var(--bg); }
.lum-modal-shell--fullscreen{
  width:100vw; height:100dvh; max-height:100dvh;
  border:0; border-radius:0; box-shadow:none;
}
.lum-modal-iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; display:block; }
.lum-modal-close{
  position:absolute; top:8px; right:8px; z-index:5; cursor:pointer;
  width:44px; height:44px; min-width:44px; min-height:44px;
  border-radius:50%; border:1px solid var(--line); background:var(--bg-card); color:var(--text);
  font-size:22px; line-height:1; display:flex; align-items:center; justify-content:center;
}
.lum-modal-close:hover{ border-color:var(--accent); color:var(--accent); }
@media (max-width: 640px){
  .lum-modal-backdrop{ padding:0; padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom);
    padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right); }
  .lum-modal-shell{ width:100%; height:100%; max-height:100%; border-radius:0; }
}

/* QUIZZES-ALPHA-HIDE: "Coming soon" pill next to a section title */
.soon-pill{
  display:inline-block; vertical-align:middle; margin-left:10px;
  font-size:11px; font-weight:600; letter-spacing:.04em; text-transform:uppercase;
  padding:3px 9px; border-radius:999px;
  border:1px solid var(--line); color:var(--text-muted); background:var(--bg-card);
}

/* LEVELS-PAID-GATING: paid-locked deep/academic level badge */
.diff-level.diff-locked{ opacity:.85; }
.diff-soon.diff-paid{ color:var(--accent); }

/* T-4.2: top scene pager — a compact copy of the bottom prev/next, shown above the content */
.scene-pager-top{
  display:flex; align-items:center; gap:14px; margin:4px 0 18px;
}
.scene-pager-top .scene-pager-pos{
  font-family:var(--f-mono); font-size:12px; color:var(--text-muted); letter-spacing:.06em;
}
.scene-pager-top .btn{ padding:6px 14px; font-size:13px; }

/* MOBILE-RESPONSIVE (#80) + MOBILE-SCENE-NAV (#81)
   One contract for all reader/card surfaces.  It is deliberately component-level
   rather than a collection of chapter-specific offsets: long localized labels may
   wrap, but must stay readable, reachable and inside the visible page. */
@media (max-width: 860px) {
  .section-pad,
  .scene-view,
  .scene-body,
  .scene-meta,
  .scene-pager,
  .rs-pager,
  .hero .actions,
  .chapter .ch-top,
  .eco-topic,
  .rs-media-group { min-width: 0; max-width: 100%; }

  .section-pad :is(
    .hero h1, .section-head h2, .scene-body h3, .rail-card h3,
    .chapter .title, .chapter .sub, .eco-card .title, .eco-card .blurb,
    .eco-topic-label, .tool-card .tc-name, .saved-card .title,
    .quiz-catalog-card h4, .research-hub-card, .research-catalog-card,
    .rs-card-ttl, .rs-card-sub, .rs-media-label, .rs-wp-link, .tag
  ) { overflow-wrap: anywhere; hyphens: auto; }

  .app :is(
    .chapter, .eco-card, .tool-card, .rail-card, .saved-card,
    .quiz-catalog-card, .research-hub-card, .research-catalog-card,
    .rs-card, .rs-media, .rs-media-group
  ) { min-width: 0; max-width: 100%; }

  .hero .actions,
  .chapter .meta,
  .rs-media-group { flex-wrap: wrap; }
  .rs-media-label { min-width: 0; }

  /* Controls remain legible in every locale and meet the 44px touch target. */
  .section-pad :is(.btn, .diff-level, .chapter-map-cta, .quiz-card-action) {
    min-width: 0;
    min-height: 44px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* A scene title and its count must never compete for the same narrow row. */
  .scene-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 5px;
    line-height: 1.4;
  }
  .scene-meta > span { min-width: 0; overflow-wrap: anywhere; }

  /* Both Foundations and Research use the same two-row mobile navigation:
     previous/next are independently tappable; the position/dots get a full row. */
  .scene-pager,
  .scene-pager-top,
  .rs-pager {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "previous next"
      "status status";
    align-items: stretch;
    gap: 8px;
  }
  .scene-pager > .btn:first-of-type,
  .scene-pager-top > .btn:first-of-type,
  .rs-pager > .btn:first-of-type { grid-area: previous; }
  .scene-pager > .btn:last-of-type,
  .scene-pager-top > .btn:last-of-type,
  .rs-pager > .btn:last-of-type { grid-area: next; }
  .scene-pager > .btn,
  .scene-pager-top > .btn,
  .rs-pager > .btn {
    justify-content: center;
    min-height: 44px;
    padding: 8px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .scene-pager .dots,
  .scene-pager-pos,
  .rs-pager-pos {
    grid-area: status;
    min-width: 0;
    margin: 0;
    justify-self: center;
    text-align: center;
    overflow-wrap: anywhere;
  }
  .scene-pager .dots { justify-content: center; }
}

/* T-3 (variant A): scene reader gives its width to the text — no right white strip.
   Inline max-width is removed (full width). Only on ultra-wide screens we re-cap for readability. */
@media (min-width: 1800px){ .scene-wide{ max-width: 1680px !important; } }

/* v102.1 (Issue 2): reading a scene, the 320px right rail is empty → drop it and give the width to
   the text. Desktop only (≥861px); on mobile the rail is a closed bottom-drawer, so no strip there. */
@media (min-width: 861px) {
  .app.app--reading { grid-template-columns: 248px 1fr; }
  .app.app--reading .rail { display: none; }
}

/* RAIL-COLLAPSE-RESEARCH (v102.2): reading a topic in research/TON — drop the empty 320px right rail
   and give the width to text, same as Foundations reading. Desktop only; body class set by research.jsx. */
@media (min-width: 861px) {
  body.research-reading .app { grid-template-columns: 248px 1fr; }
  body.research-reading .rail { display: none; }
}
