/* ArtCrew Guide. Studio colour (dashboard guide v2): warm neutrals carry text and structure, an ink
   primary action, wash for grouped areas, and the seven studio colours only to say which part of
   ArtCrew a topic belongs to. Tokens only below :root. */
:root {
  --page: #ffffff;
  --surface: #ffffff;
  --wash: #f4f5ef;
  --warm: #fffbf4;
  --line: #e4e6de;
  --line-strong: #d2d5ca;
  --ink: #23251f;
  --muted: #6b6d64;
  --action: #24261f;
  --action-hover: #3e4435;
  --on-action: #ffffff;
  --shadow-sm: 0 1px 2px rgba(35, 37, 31, 0.06), 0 4px 14px rgba(35, 37, 31, 0.05);
  --shadow: 0 24px 70px rgba(35, 37, 31, 0.1);
  --scrim: rgba(28, 29, 25, 0.42);
  --spot: rgba(28, 29, 25, 0.34);
  --brush: #f6d27a;
  --brush-stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40' preserveAspectRatio='none'%3E%3Cpath fill='%23f6d27a' d='M7 13c38-6 92-8 148-7 52 1 98 2 139 5 5 4 5 12 1 17-44 6-104 8-160 8-48 0-92-1-128-4-6-4-7-14 0-19z'/%3E%3Cpath fill='%23f6d27a' opacity='.55' d='M18 34c62 3 152 3 232-1l-3 3c-80 3-160 3-226 0z'/%3E%3C/svg%3E");

  --c-cobalt: #2c5f9e;    --c-cobalt-soft: #e2ebf7;
  --c-teal: #16707a;      --c-teal-soft: #dbefef;
  --c-coral: #a44d5d;     --c-coral-soft: #fce5ea;
  --c-mustard: #876718;   --c-mustard-soft: #fdf1d3;
  --c-tangerine: #9d5626; --c-tangerine-soft: #fde9da;
  --c-leaf: #487433;      --c-leaf-soft: #e4f0db;
  --c-navy: #253f63;      --c-navy-soft: #e1e7f0;
  --c-neutral: #23251f;   --c-neutral-soft: #f4f5ef;
  --ring: #e8742a;

  --radius: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #141512;
  --surface: #1b1c18;
  --wash: #22241f;
  --warm: #1e1c17;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #f2f2ec;
  --muted: #a9aba0;
  --action: #f2f2ec;
  --action-hover: #ffffff;
  --on-action: #141512;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --scrim: rgba(0, 0, 0, 0.6);
  --spot: rgba(0, 0, 0, 0.42);
  --c-cobalt: #b5c7dd;    --c-cobalt-soft: #1f2d3b;
  --c-teal: #adcdd0;      --c-teal-soft: #1a3231;
  --c-coral: #f4c7d0;     --c-coral-soft: #4e2e31;
  --c-mustard: #f3ddac;   --c-mustard-soft: #4d3e16;
  --c-tangerine: #f7ceb4; --c-tangerine-soft: #50331d;
  --c-leaf: #c0d2b8;      --c-leaf-soft: #283520;
  --c-navy: #b3bcc8;      --c-navy-soft: #1e252c;
  --c-neutral: #f2f2ec;   --c-neutral-soft: #22241f;
  --ring: #f7a56b;
  color-scheme: dark;
}
:root[data-size="lg"] { font-size: 112.5%; }
:root[data-size="xl"] { font-size: 125%; }

[data-tone="cobalt"] { --t: var(--c-cobalt); --t-soft: var(--c-cobalt-soft); }
[data-tone="teal"] { --t: var(--c-teal); --t-soft: var(--c-teal-soft); }
[data-tone="coral"] { --t: var(--c-coral); --t-soft: var(--c-coral-soft); }
[data-tone="mustard"] { --t: var(--c-mustard); --t-soft: var(--c-mustard-soft); }
[data-tone="tangerine"] { --t: var(--c-tangerine); --t-soft: var(--c-tangerine-soft); }
[data-tone="leaf"] { --t: var(--c-leaf); --t-soft: var(--c-leaf-soft); }
[data-tone="navy"] { --t: var(--c-navy); --t-soft: var(--c-navy-soft); }
[data-tone="neutral"] { --t: var(--c-neutral); --t-soft: var(--c-neutral-soft); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--page); color: var(--ink); font-family: var(--font);
  font-size: 1.0625rem; line-height: 1.6; -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
a { color: inherit; }
button { font: inherit; color: inherit; }
kbd {
  font: 600 0.72rem/1 var(--font); padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
}
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.brush { position: relative; white-space: nowrap; z-index: 0; }
.brush::before {
  content: ""; position: absolute; inset: 55% -0.12em -0.04em; z-index: -1;
  background: var(--brush-stroke) center / 100% 100% no-repeat;
  transform-origin: left; animation: brush-in 0.9s 0.25s var(--ease) both;
}
@keyframes brush-in { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* ── Top bar ─────────────────────────────── */
.read-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; background: var(--t, var(--ink)); transform: scaleX(0); transform-origin: left; transition: transform 0.12s linear; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-tile { width: 36px; height: 36px; border-radius: 11px; background: var(--action); color: var(--on-action); display: grid; place-items: center; }
.brand-tile svg { width: 22px; height: 22px; }
.brand-words { display: flex; flex-direction: column; line-height: 1.1; }
.brand-words strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-words span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.search-trigger {
  flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); cursor: pointer; text-align: left;
  transition: border-color 0.2s, box-shadow 0.25s var(--ease);
}
.search-trigger:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.search-trigger-words { flex: 1; font-weight: 500; }
.topbar-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: background 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--wash); }
.icon-btn:active { transform: scale(0.94); }
.size-switch { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.size-switch button { border: 0; background: none; width: 36px; height: 40px; cursor: pointer; font-weight: 700; color: var(--muted); }
.size-switch button:nth-child(1) { font-size: 0.8rem; }
.size-switch button:nth-child(2) { font-size: 0.98rem; }
.size-switch button:nth-child(3) { font-size: 1.18rem; }
.size-switch button[aria-pressed="true"] { background: var(--wash); color: var(--ink); }
.only-narrow { display: none; }
.tool-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--wash); flex: none; }
.tool-tabs[hidden] { display: none; }
.tool-tabs a { padding: 7px 12px; border-radius: 9px; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.tool-tabs a:hover { color: var(--ink); }
.tool-tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
@media (max-width: 1100px) { .tool-tabs { display: none; } }

/* ── Computer / phone switch ─────────────── */
.device-switch { position: relative; flex: none; display: flex; padding: 4px; border-radius: 16px; background: var(--wash); border: 1px solid var(--line); isolation: isolate; }
.device-switch button {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 10px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); cursor: pointer; text-align: left; transition: color 0.35s var(--ease);
}
.device-switch button:hover { color: var(--ink); }
.device-switch button[aria-checked="true"] { color: var(--on-action); }
.device-switch .i { width: 20px; height: 20px; transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.device-switch button[aria-checked="true"] .i { transform: rotate(-10deg) scale(1.18); }
.ds-words { display: grid; line-height: 1.1; }
.ds-words b { font-size: 0.88rem; }
.ds-words small { font-size: 0.7rem; font-weight: 600; opacity: 0.72; }
.ds-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 12px; background: var(--action);
  box-shadow: 0 6px 16px rgba(35, 37, 31, 0.18); transition: transform 0.6s cubic-bezier(0.34, 1.4, 0.64, 1), width 0.6s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.side-product { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: var(--wash); font-weight: 700; font-size: 0.92rem; }
.side-product .i { grid-row: span 2; width: 26px; height: 26px; }
.side-product small { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
@media (max-width: 1240px) { .ds-words small { display: none; } }
@media (max-width: 760px) { .ds-words { display: none; } .device-switch button { padding: 8px 12px; } }

/* ── Layout ──────────────────────────────── */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.layout.no-sidebar .sidebar { display: none; }
main { min-height: 70vh; padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 56px) 80px; outline: none; }
.sidebar {
  position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 72px); overflow: auto;
  padding: 28px 12px 40px 24px; border-right: 1px solid var(--line);
}
.side-group { margin-bottom: 6px; }
.side-topic {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px;
  background: none; cursor: pointer; text-align: left; font-weight: 600; font-size: 0.95rem; text-decoration: none;
}
.side-topic:hover { background: var(--wash); }
.side-topic .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--t-soft); color: var(--t); display: grid; place-items: center; flex: none; }
.side-topic .dot svg { width: 15px; height: 15px; }
.side-topic .chev { margin-left: auto; color: var(--muted); transition: transform 0.25s var(--ease); }
.side-group.open .chev { transform: rotate(90deg); }
.side-list { list-style: none; margin: 2px 0 8px; padding: 0 0 0 22px; display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.side-group.open .side-list { grid-template-rows: 1fr; }
.side-list > div { overflow: hidden; }
.side-list a {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 10px 6px 16px; border-left: 2px solid var(--line);
  text-decoration: none; color: var(--muted); font-size: 0.9rem; line-height: 1.35; transition: color 0.15s, border-color 0.15s;
}
.side-list a:hover { color: var(--ink); }
.side-list a[aria-current="page"] { color: var(--ink); font-weight: 600; border-color: var(--t); }
.side-list a .tick { color: var(--c-leaf); margin-left: auto; }
.side-extra { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 44; }

/* ── Page transitions ────────────────────── */
.view { animation: view-in 0.5s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); transition-delay: var(--d, 0s); }
.rise.in { opacity: 1; transform: none; }

/* ── Home ────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: clamp(32px, 6vw, 72px) clamp(20px, 5vw, 64px);
  background:
    radial-gradient(60% 80% at 0% 0%, var(--c-tangerine-soft), transparent 70%),
    radial-gradient(50% 70% at 100% 10%, var(--c-teal-soft), transparent 70%),
    radial-gradient(60% 80% at 80% 120%, var(--c-mustard-soft), transparent 70%),
    var(--warm);
  border: 1px solid var(--line);
}
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(20px, 4vw, 48px); align-items: center; transition: background 0.6s var(--ease); }
.hero[data-product="phone"] {
  background:
    radial-gradient(60% 80% at 0% 0%, var(--c-teal-soft), transparent 70%),
    radial-gradient(50% 70% at 100% 10%, var(--c-cobalt-soft), transparent 70%),
    radial-gradient(60% 80% at 80% 120%, var(--c-coral-soft), transparent 70%),
    var(--warm);
}
.hero-words { min-width: 0; }
.hero-stage { display: grid; justify-items: center; gap: 14px; min-width: 0; }
.hero-stage .scene { width: 100%; margin: 0; padding: 18px 8px 22px; background: none; border: 0; view-transition-name: hero-device; }
.hero-stage .scene.phone { padding-top: 22px; }
.hero-stage .sc-tools { display: none; }
.hero-swap {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 85%, transparent); cursor: pointer; font-size: 0.88rem; text-align: left;
  transition: transform 0.3s var(--ease), box-shadow 0.3s, background 0.2s;
}
.hero-swap:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); background: var(--surface); }
.hero-swap b { font-weight: 700; }
::view-transition-group(hero-device) { animation-duration: 0.7s; animation-timing-function: cubic-bezier(0.34, 1.2, 0.64, 1); }
.hero-kicker { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.hero-kicker .i { width: 18px; height: 18px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.035em; margin: 0 0 14px; font-weight: 800; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 40rem; margin: 0 0 28px; }
.hero-search { position: relative; max-width: 640px; }
.hero-search input {
  width: 100%; font: 500 1.15rem var(--font); color: var(--ink); padding: 20px 140px 20px 58px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); outline: none;
  transition: box-shadow 0.3s var(--ease), border-color 0.2s;
}
.hero-search input:focus { border-color: var(--ink); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ring) 22%, transparent), var(--shadow); }
.hero-search > .i { position: absolute; left: 22px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; color: var(--muted); }
.hero-search .go {
  position: absolute; right: 8px; top: 8px; bottom: 8px; padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--action); color: var(--on-action); font-weight: 700; cursor: pointer; transition: background 0.2s, transform 0.2s var(--ease);
}
.hero-search .go:hover { background: var(--action-hover); }
.hero-search .go:active { transform: scale(0.97); }
.hero-typing { color: var(--muted); font-size: 0.95rem; margin: 14px 0 0 24px; min-height: 1.6em; }
.hero-typing b { color: var(--ink); font-weight: 600; }
.hero-typing .caret { display: inline-block; width: 2px; height: 1em; background: var(--ink); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; font-weight: 600; font-size: 0.92rem; transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.2s;
}
.chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t); }

.block { margin-top: clamp(40px, 6vw, 72px); }
.block-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.block-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.025em; margin: 0; line-height: 1.15; }
.block-head p { margin: 6px 0 0; color: var(--muted); }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t, var(--muted)); margin: 0 0 8px; }

.path { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; counter-reset: path; }
.path li { counter-increment: path; }
.path a {
  position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.2s;
}
.path a:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.path a::before {
  content: counter(path); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--t-soft); color: var(--t);
}
.path a.done::before { content: "✓"; background: var(--c-leaf); color: var(--page); }
.path strong { font-size: 1.02rem; line-height: 1.3; }
.path span { color: var(--muted); font-size: 0.88rem; }
.path-progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.meter { width: 160px; height: 8px; border-radius: 99px; background: var(--wash); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--c-leaf); border-radius: inherit; transition: width 0.8s var(--ease); }

.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.topic-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.topic-card::after {
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 220px; height: 220px; border-radius: 50%;
  background: var(--t-soft); opacity: 0; transform: scale(0.6); transition: opacity 0.4s, transform 0.6s var(--ease); z-index: 0;
}
.topic-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.topic-card:hover::after { opacity: 1; transform: scale(1); }
.topic-card > * { position: relative; z-index: 1; }
.tile { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--t-soft); color: var(--t); transition: transform 0.4s var(--ease); }
.tile svg { width: 24px; height: 24px; }
.topic-card:hover .tile { transform: rotate(-6deg) scale(1.06); }
.topic-card h3 { margin: 0; font-size: 1.2rem; letter-spacing: -0.015em; }
.topic-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.topic-card .count { margin-top: auto; font-weight: 600; font-size: 0.88rem; display: flex; align-items: center; gap: 6px; }
.topic-card .count svg { transition: transform 0.3s var(--ease); }
.topic-card:hover .count svg { transform: translateX(4px); }

.asks-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.ask-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 14px; background: var(--wash);
  text-decoration: none; font-weight: 500; transition: background 0.2s, transform 0.25s var(--ease);
}
.ask-link::before { content: "?"; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; background: var(--t-soft); color: var(--t); }
.ask-link:hover { background: var(--surface); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.help-band {
  display: flex; align-items: center; gap: 20px; justify-content: space-between; flex-wrap: wrap; padding: 28px 32px; border-radius: var(--radius);
  background: var(--wash); border: 1px solid var(--line);
}
.help-band h2 { margin: 0 0 4px; font-size: 1.35rem; }
.help-band p { margin: 0; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; transition: background 0.2s, transform 0.2s var(--ease), box-shadow 0.25s;
}
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: var(--action-hover); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--wash); }
.btn:active { transform: scale(0.97); }

/* ── Topic page ──────────────────────────── */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 22px; }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.topic-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 32px; }
.topic-head .tile { width: 64px; height: 64px; border-radius: 18px; }
.topic-head .tile svg { width: 30px; height: 30px; }
.topic-head h1, .article-head h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 8px; font-weight: 800; }
.topic-head p { margin: 0; color: var(--muted); font-size: 1.1rem; max-width: 40rem; }
.article-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.article-row {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.2s;
}
.article-row:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.article-row .n { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; background: var(--t-soft); color: var(--t); }
.article-row.done .n { background: var(--c-leaf); color: var(--page); }
.article-row .words { flex: 1; min-width: 0; }
.article-row strong { display: block; font-size: 1.05rem; }
.article-row span.sum { color: var(--muted); font-size: 0.92rem; }
.article-row .time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; display: flex; align-items: center; gap: 6px; }

/* ── Article ─────────────────────────────── */
.article { max-width: 860px; }
.article-head { margin-bottom: 28px; }
.article-head .summary { font-size: 1.2rem; color: var(--muted); margin: 0 0 18px; max-width: 42rem; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--wash); font-size: 0.85rem; font-weight: 600; }
.pill.tone { background: var(--t-soft); color: var(--t); }
.pill.draft { background: var(--c-mustard-soft); color: var(--c-mustard); display: none; }
body.writer .pill.draft { display: inline-flex; }
.step-meter { display: flex; align-items: center; gap: 12px; margin: 22px 0 8px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--wash); font-weight: 600; font-size: 0.92rem; }
.step-meter .meter { flex: 1; width: auto; }
.step-meter .meter span { background: var(--t); }

.steps { list-style: none; margin: 18px 0 0; padding: 0; position: relative; }
.steps::before { content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: var(--line); }
.step { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 18px; padding: 0 0 34px; }
.step-num {
  position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--page);
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; cursor: pointer; transition: background 0.3s, border-color 0.3s, color 0.3s, transform 0.3s var(--ease);
}
.step-num:hover { border-color: var(--t); transform: scale(1.06); }
.step-num .check { display: none; }
.step.done .step-num { background: var(--c-leaf); border-color: var(--c-leaf); color: var(--page); animation: pop 0.45s var(--ease); }
.step.done .step-num .n { display: none; }
.step.done .step-num .check { display: block; }
@keyframes pop { 40% { transform: scale(1.18); } }
.step-body { padding-top: 9px; min-width: 0; }
.step-text { font-size: 1.12rem; margin: 0; }
.step-text b { font-weight: 700; padding: 1px 8px; border-radius: 8px; background: var(--wash); border: 1px solid var(--line); white-space: nowrap; font-size: 0.95em; }
.step-text a, .good a { font-weight: 600; text-decoration-color: var(--t); text-underline-offset: 3px; }
.step-done-hint { display: inline-flex; margin-top: 10px; font-size: 0.85rem; color: var(--muted); border: 0; background: none; padding: 0; cursor: pointer; gap: 6px; align-items: center; }
.step-done-hint:hover { color: var(--ink); }
.step.done .step-text { color: var(--muted); }
.step-see { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; color: var(--muted); font-size: 0.98rem; }
.step-see .i { margin-top: 4px; color: var(--t); }
.before { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 0; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--t-soft); font-size: 0.98rem; }
.before .i { margin-top: 3px; color: var(--t); }
.twin {
  display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 16px 20px; border-radius: var(--radius); text-decoration: none;
  border: 1px dashed var(--line-strong); background: var(--surface); transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.2s;
}
.twin:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-style: solid; }
.twin > span:nth-child(2) { flex: 1; display: grid; }
.twin small { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.twin-device { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--action); color: var(--on-action); flex: none; }
.twin-device .i { width: 22px; height: 22px; }
.tile { position: relative; }
.tile-device { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.result .tile .tile-device svg { width: 12px; height: 12px; }
.gl-device { float: right; color: var(--muted); }
.gl-device .i { width: 16px; height: 16px; }

.shot {
  position: relative; margin: 16px 0 0; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--wash);
  box-shadow: var(--shadow-sm); cursor: zoom-in; isolation: isolate;
}
.shot-zoom { position: relative; transition: transform 1.4s var(--ease); will-change: transform; }
.shot img { display: block; width: 100%; height: auto; }
.shot.focus .shot-zoom { transform: scale(var(--z, 1)); }
.mark {
  position: absolute; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 0 var(--spot); border: 3px solid transparent; transition: box-shadow 0.9s var(--ease) 0.5s, border-color 0.4s 0.7s;
}
.shot.focus .mark { box-shadow: 0 0 0 200vmax var(--spot); border-color: var(--ring); }
.mark::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 3px solid var(--ring); opacity: 0;
}
.shot.focus .mark::after { animation: ring 1.8s 1.4s ease-out infinite; }
@keyframes ring { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35, 1.6); } }
.shot-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; z-index: 2; opacity: 0; transition: opacity 0.25s; }
.shot:hover .shot-tools, .shot:focus-within .shot-tools { opacity: 1; }
.shot-tools button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(20, 21, 18, 0.78); color: #fff; font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(6px);
}
.shot-missing { margin: 14px 0 0; padding: 14px 16px; border-radius: 14px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 0.88rem; display: none; }
body.writer .shot-missing { display: block; }

.good { margin: 8px 0 0; padding: 22px 24px; border-radius: var(--radius); background: var(--t-soft); }
.good h2 { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; font-size: 1.05rem; color: var(--t); }
.good ul { margin: 0; padding-left: 1.2em; }
.good li + li { margin-top: 6px; }
.note {
  display: none; margin: 22px 0 0; padding: 16px 20px; border-radius: var(--radius-sm); background: var(--c-mustard-soft); color: var(--ink);
  border-left: 4px solid var(--c-mustard); font-size: 0.92rem;
}
body.writer .note { display: block; }
.note strong { color: var(--c-mustard); }

.answers { margin-top: 34px; }
.answers h2, .related h2, .feedback h2 { font-size: 1.05rem; margin: 0 0 12px; }
.answers ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.answers li { padding: 8px 14px; border-radius: 12px; background: var(--wash); font-size: 0.92rem; }
.answers li::before { content: "“"; color: var(--muted); }
.answers li::after { content: "”"; color: var(--muted); }

.finish {
  margin-top: 30px; padding: 26px 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: space-between;
}
.finish p { margin: 0; font-weight: 600; font-size: 1.05rem; }
.feedback-buttons { display: flex; gap: 8px; }
.feedback-thanks { color: var(--c-leaf); font-weight: 600; }
.related { margin-top: 34px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.related-grid a {
  padding: 16px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); text-decoration: none; display: flex; flex-direction: column; gap: 4px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.related-grid a:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.related-grid small { color: var(--t); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px; }
.pager a { padding: 18px 20px; border-radius: var(--radius-sm); border: 1px solid var(--line); text-decoration: none; display: flex; flex-direction: column; gap: 2px; transition: border-color 0.2s, background 0.2s; }
.pager a:hover { border-color: var(--line-strong); background: var(--wash); }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { color: var(--muted); font-weight: 600; }

/* ── Search ──────────────────────────────── */
.palette { position: fixed; inset: 0; z-index: 80; display: grid; justify-items: center; align-items: start; padding: 10vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(4px); animation: fade 0.25s both; }
.palette-box {
  position: relative; width: min(680px, 100%); max-height: 76vh; display: flex; flex-direction: column; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; animation: drop 0.35s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(0.98); } }
.palette-field { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.palette-field .i { width: 22px; height: 22px; color: var(--muted); }
.palette-field input { flex: 1; border: 0; outline: none; background: none; font: 500 1.15rem var(--font); color: var(--ink); min-width: 0; }
.palette-field input::-webkit-search-cancel-button { display: none; }
.palette-results { overflow: auto; padding: 8px; }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
.palette-foot kbd { margin-right: 4px; }
.result {
  display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; text-decoration: none; cursor: pointer;
  animation: view-in 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms);
}
.result[aria-selected="true"], .result:hover { background: var(--wash); }
.result .tile { width: 38px; height: 38px; border-radius: 11px; flex: none; }
.result .tile svg { width: 19px; height: 19px; }
.result strong { display: block; font-size: 1rem; }
.result .snip { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.45; margin-top: 2px; }
.result .where { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t); margin-bottom: 2px; }
.result mark, .search-page mark { background: color-mix(in srgb, var(--brush) 60%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
.result-group { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 12px 14px 6px; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }
.empty .chips { justify-content: center; }
.search-page .result { border: 1px solid var(--line); margin-bottom: 10px; padding: 16px 18px; }

/* ── Glossary ────────────────────────────── */
.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.glossary a { padding: 20px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.glossary a:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.glossary dt { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.glossary dd { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ── Writer health ───────────────────────── */
.health { display: none; margin-top: 40px; padding: 24px; border-radius: var(--radius); border: 1px dashed var(--c-mustard); background: var(--c-mustard-soft); }
body.writer .health { display: block; }
.health h2 { margin: 0 0 12px; font-size: 1.15rem; }
.health-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.health-stats span { padding: 8px 14px; border-radius: 12px; background: var(--surface); font-weight: 600; font-size: 0.9rem; }
.health ul { margin: 0; padding-left: 1.2em; font-size: 0.9rem; }

/* ── Lightbox ────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(14, 15, 12, 0.9); display: grid; place-items: center; padding: 56px 20px 40px; animation: fade 0.25s both; }
.lightbox[hidden] { display: none; }
.lightbox-stage { width: 100%; height: 100%; display: grid; place-items: center; overflow: auto; }
.lightbox .shot { width: min(1500px, 100%); margin: 0; cursor: zoom-in; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5); border: 0; animation: drop 0.4s var(--ease) both; }
.lightbox .shot.zoomed { cursor: zoom-out; }
.lightbox .shot.zoomed .shot-zoom { transform: scale(2.2); }
.lightbox-close { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, 0.12); border-color: transparent; color: #fff; }
.lightbox-hint { position: absolute; bottom: 10px; color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; margin: 0; }

/* ── Confetti ────────────────────────────── */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti i { position: absolute; width: 10px; height: 14px; border-radius: 3px; animation: confetti 1.6s var(--ease) forwards; }
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

/* ── Footer ──────────────────────────────── */
.footer { border-top: 1px solid var(--line); padding: 28px clamp(16px, 4vw, 56px); color: var(--muted); font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer p { margin: 0; }
.footer a { font-weight: 600; color: var(--ink); }
.writer-switch { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }

/* ── Narrow screens ──────────────────────── */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .only-narrow { display: grid; }
  .sidebar {
    position: fixed; z-index: 45; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); max-height: none; background: var(--page);
    transform: translateX(-102%); transition: transform 0.4s var(--ease); box-shadow: var(--shadow); padding-top: 24px;
  }
  .sidebar.open { transform: none; }
  .layout.no-sidebar .sidebar { display: block; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-stage .scene.computer { max-width: 520px; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .brand-words, .size-switch, .search-trigger kbd, .search-trigger-words { display: none; }
  .search-trigger { flex: 0 0 auto; width: 42px; height: 42px; padding: 0; justify-content: center; margin: 0 0 0 auto; border-radius: 12px; }
  .hero-search input { padding: 16px 16px 16px 50px; font-size: 1.02rem; }
  .hero-search .go { display: none; }
  .hero-search > .i { left: 18px; }
  .step { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .step-num { width: 40px; height: 40px; }
  .steps::before { left: 19px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .article-row .time { display: none; }
  .topic-head { flex-direction: column; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .rise { opacity: 1; transform: none; }
}

@media print {
  .topbar, .sidebar, .footer, .shot-tools, .finish, .pager, .related, .read-progress, .step-done-hint { display: none !important; }
  .layout { display: block; }
  .shot .mark { box-shadow: none !important; border-color: var(--ring) !important; }
  .shot-zoom { transform: none !important; }
  .rise { opacity: 1 !important; transform: none !important; }
}

/* Real-screen animation: before picture, cursor presses the ringed button, real after picture fades in. */
.shot.play .after { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.shot.play .cursor { position: absolute; left: 86%; top: 90%; width: 28px; height: 28px; margin: -3px 0 0 -5px; opacity: 0; z-index: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); pointer-events: none; }
.shot.play .mark { opacity: 0; }
.shot.play .play-typed { position: absolute; opacity: 0; padding: 3px 8px; border-radius: 8px; background: var(--ring); color: #fff; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.shot.play.focus .cursor { animation: play-cursor 4.6s var(--ease) 0.2s both; }
.shot.play.focus .mark { animation: play-mark 4.6s ease 0.2s both; }
.shot.play.focus .after { animation: play-after 4.6s ease 0.2s both; }
.shot.play.focus .play-typed { animation: play-typed 4.6s ease 0.2s both; }
@keyframes play-cursor {
  0% { left: 86%; top: 90%; opacity: 0; transform: scale(1); }
  10% { opacity: 1; }
  38% { left: var(--cx); top: var(--cy); transform: scale(1); }
  44% { left: var(--cx); top: var(--cy); transform: scale(0.78); }
  50% { left: var(--cx); top: var(--cy); transform: scale(1); opacity: 1; }
  62%, 100% { left: var(--cx); top: var(--cy); opacity: 0; }
}
@keyframes play-mark { 0%, 12% { opacity: 0; } 22%, 52% { opacity: 1; } 60%, 100% { opacity: 0; } }
@keyframes play-after { 0%, 52% { opacity: 0; } 62%, 100% { opacity: 1; } }
@keyframes play-typed { 0%, 40% { opacity: 0; } 44%, 54% { opacity: 1; } 62%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .shot.play .mark { opacity: 1; }
  .shot.play .after, .shot.play .cursor { display: none; }
}
@media print { .shot.play .after, .shot.play .cursor { display: none; } .shot.play .mark { opacity: 1; } }
