/* ---------------------------------------------------------------
   The English Study Map — stylesheet
   Themes only ever redefine custom properties, never painted
   properties, so a theme rule can never outrank a component rule.
   --------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg:            #f7f6f3;
  --surface-1:     #fcfcfb;
  --surface-2:     #f1efea;
  --surface-3:     #e7e4dd;
  --border:        #e0ddd5;
  --border-strong: #c8c4b9;

  --ink:           #16150f;
  --ink-2:         #55534a;
  --ink-3:         #86837a;

  --accent:        #2a78d6;
  --accent-soft:   #e8f0fc;
  --accent-ink:    #ffffff;

  --series-1:      #2a78d6;
  --series-2:      #eb6834;
  --grid:          #e3e0d8;

  /* Stage ordinal ramp: one blue hue, light → dark as the stages advance. */
  --stage-1: #86b6ef;
  --stage-2: #6da7ec;
  --stage-3: #3987e5;
  --stage-4: #256abf;
  --stage-5: #184f95;
  --stage-6: #0d366b;
  --stage-ink-1: #0d366b;
  --stage-ink-2: #0d366b;
  --stage-ink-3: #ffffff;
  --stage-ink-4: #ffffff;
  --stage-ink-5: #ffffff;
  --stage-ink-6: #ffffff;

  /* Strand accents are generated from a per-row hue. */
  --strand-s: 58%;
  --strand-l: 38%;
  --strand-tint-s: 62%;
  --strand-tint-l: 94%;

  --ok:            #1baf7a;
  --ring-track:    #e3e0d8;

  --shadow-1: 0 1px 2px rgb(22 21 15 / .05), 0 2px 8px rgb(22 21 15 / .04);
  --shadow-2: 0 8px 30px rgb(22 21 15 / .12), 0 2px 8px rgb(22 21 15 / .06);

  --radius:   14px;
  --radius-s: 9px;
  --topbar-h: 106px;
  --maxw: 1240px;
  --serif: ui-serif, "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            #141412;
    --surface-1:     #1a1a19;
    --surface-2:     #222220;
    --surface-3:     #2c2c29;
    --border:        #34342f;
    --border-strong: #4a4a43;

    --ink:           #f5f4ef;
    --ink-2:         #bcbab0;
    --ink-3:         #8d8b82;

    --accent:        #3987e5;
    --accent-soft:   #182a44;
    --accent-ink:    #0b1524;

    --series-1:      #3987e5;
    --series-2:      #d95926;
    --grid:          #2f2f2b;

    --stage-1: #184f95;
    --stage-2: #256abf;
    --stage-3: #2a78d6;
    --stage-4: #5598e7;
    --stage-5: #86b6ef;
    --stage-6: #b7d3f6;
    --stage-ink-1: #ffffff;
    --stage-ink-2: #ffffff;
    --stage-ink-3: #ffffff;
    --stage-ink-4: #0b1524;
    --stage-ink-5: #0b1524;
    --stage-ink-6: #0b1524;

    --strand-s: 62%;
    --strand-l: 66%;
    --strand-tint-s: 30%;
    --strand-tint-l: 17%;

    --ok:            #199e70;
    --ring-track:    #32322d;

    --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 2px 8px rgb(0 0 0 / .3);
    --shadow-2: 0 10px 40px rgb(0 0 0 / .55), 0 2px 10px rgb(0 0 0 / .4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #141412;
  --surface-1:     #1a1a19;
  --surface-2:     #222220;
  --surface-3:     #2c2c29;
  --border:        #34342f;
  --border-strong: #4a4a43;

  --ink:           #f5f4ef;
  --ink-2:         #bcbab0;
  --ink-3:         #8d8b82;

  --accent:        #3987e5;
  --accent-soft:   #182a44;
  --accent-ink:    #0b1524;

  --series-1:      #3987e5;
  --series-2:      #d95926;
  --grid:          #2f2f2b;

  --stage-1: #184f95;
  --stage-2: #256abf;
  --stage-3: #2a78d6;
  --stage-4: #5598e7;
  --stage-5: #86b6ef;
  --stage-6: #b7d3f6;
  --stage-ink-1: #ffffff;
  --stage-ink-2: #ffffff;
  --stage-ink-3: #ffffff;
  --stage-ink-4: #0b1524;
  --stage-ink-5: #0b1524;
  --stage-ink-6: #0b1524;

  --strand-s: 62%;
  --strand-l: 66%;
  --strand-tint-s: 30%;
  --strand-tint-l: 17%;

  --ok:            #199e70;
  --ring-track:    #32322d;

  --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 2px 8px rgb(0 0 0 / .3);
  --shadow-2: 0 10px 40px rgb(0 0 0 / .55), 0 2px 10px rgb(0 0 0 / .4);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.18; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 8px 0; text-decoration: none;
}
.skip-link:focus { left: 0; }
.muted { color: var(--ink-3); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 12px 16px 10px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); flex: none; }
.brand-text { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -.015em; white-space: nowrap; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 1 1 260px; justify-content: flex-end; }

.search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 0; }
.search-icon { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 34px 8px 34px;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd {
  position: absolute; right: 10px; font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); border: 1px solid var(--border); border-radius: 5px;
  padding: 0 5px; line-height: 16px; background: var(--surface-2);
}
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun, .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }

.tabs {
  max-width: var(--maxw); margin: 0 auto; padding: 0 16px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 14px 11px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
  border-bottom: 2.5px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 80px; }
.view { padding-top: 26px; }
.section-head { margin: 46px 0 18px; }
.section-head h2 { font-size: clamp(22px, 3vw, 27px); }
.section-head p { color: var(--ink-2); font-size: 15px; margin-top: 5px; max-width: 62ch; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 34px;
  align-items: center; padding: 22px 0 10px;
}
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.hero h1 { font-size: clamp(31px, 5.6vw, 52px); letter-spacing: -.025em; }
.lede { margin-top: 14px; font-size: clamp(16px, 1.9vw, 18.5px); color: var(--ink-2); max-width: 60ch; line-height: 1.6; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 20px; font-size: 14px; color: var(--ink-3); }
.hero-stats strong { font-family: var(--serif); font-size: 20px; color: var(--ink); margin-right: 4px; }

.hero-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ring-wrap { position: relative; width: 132px; height: 132px; }
.big-ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.big-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-track { stroke: var(--ring-track); }
.ring-value { stroke: var(--ok); transition: stroke-dashoffset .5s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; gap: 1px; }
.ring-label strong { font-family: var(--serif); font-size: 27px; line-height: 1; }
.ring-label span { font-size: 11.5px; color: var(--ink-3); }
.hero-progress-note { font-size: 12.5px; color: var(--ink-3); max-width: 24ch; }
.ghost-btn {
  background: none; border: 1px solid var(--border); color: var(--ink-2);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--border-strong); color: var(--ink); background: var(--surface-2); }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-progress { flex-direction: row; text-align: left; align-items: center; flex-wrap: wrap; justify-content: flex-start; }
  .hero-progress-note { max-width: 30ch; flex: 1 1 160px; }
}

/* ---------- journey ribbon ---------- */
.journey {
  margin-top: 26px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 8px 4px; overflow: hidden;
}
.journey svg { display: block; width: 100%; height: auto; }
.journey .j-node { cursor: pointer; }
.journey .j-node:hover .j-dot, .journey .j-node:focus-visible .j-dot { r: 19; }
.journey .j-dot { transition: r .15s ease; }
.journey .j-label { font-family: var(--serif); font-size: 13px; fill: var(--ink); font-weight: 600; }
.journey .j-sub { font-size: 10.5px; fill: var(--ink-3); }
.journey .j-badge { font-size: 11px; font-weight: 700; font-family: var(--sans); }
.journey .j-path { stroke: var(--border-strong); stroke-width: 2; fill: none; stroke-dasharray: 3 5; }
.journey-list { display: none; }
@media (max-width: 720px) {
  .journey { padding: 6px; }
  .journey svg { display: none; }
  .journey-list { display: flex; flex-direction: column; gap: 2px; }
  .journey-list a {
    display: flex; align-items: center; gap: 12px; padding: 9px 10px;
    border-radius: var(--radius-s); text-decoration: none; color: var(--ink);
  }
  .journey-list a:hover { background: var(--surface-2); }
  .jl-dot {
    flex: none; display: grid; place-items: center; width: 42px; height: 30px;
    border-radius: 8px; background: var(--stage-c); color: var(--stage-t);
    font-size: 12px; font-weight: 700;
  }
  .jl-text { display: flex; flex-direction: column; min-width: 0; }
  .jl-text b { font-family: var(--serif); font-size: 15px; }
  .jl-text span { font-size: 12px; color: var(--ink-3); }
}

/* ---------- guide ---------- */
.guide {
  margin-top: 26px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide summary {
  cursor: pointer; padding: 15px 18px; font-weight: 600; font-size: 15px;
  list-style: none; display: flex; align-items: center; gap: 9px;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before {
  content: "›"; font-size: 20px; line-height: 1; color: var(--ink-3);
  transition: transform .18s ease; display: inline-block;
}
.guide[open] summary::before { transform: rotate(90deg); }
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px 26px; padding: 4px 18px 22px;
}
.guide-grid h4 { font-size: 15px; margin-bottom: 5px; }
.guide-grid p { font-size: 14px; color: var(--ink-2); }

/* ---------- matrix ---------- */
.matrix-wrap { position: relative; }
.matrix { display: grid; grid-template-columns: 172px repeat(6, minmax(0, 1fr)); gap: 7px; }
.m-corner { position: sticky; top: var(--topbar-h); z-index: 3; background: var(--bg); }
.m-colhead {
  position: sticky; top: var(--topbar-h); z-index: 3;
  background: var(--bg); padding-bottom: 6px;
}
.m-colhead-inner {
  border-radius: var(--radius-s); padding: 8px 10px; text-align: center;
  background: var(--stage-c); color: var(--stage-t);
}
.m-colhead-inner b { display: block; font-family: var(--serif); font-size: 14.5px; font-weight: 600; }
.m-colhead-inner span { display: block; font-size: 11px; opacity: .85; }
.m-rowhead {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 12px 10px 14px; border-radius: var(--radius-s);
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 4px solid hsl(var(--hue) var(--strand-s) var(--strand-l));
}
.m-rowhead b { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.m-rowhead span { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }

.cell {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  text-align: left; cursor: pointer; padding: 11px 12px 12px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-s); min-height: 104px;
  transition: transform .13s ease, box-shadow .13s ease, border-color .13s ease;
}
.cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); border-color: hsl(var(--hue) var(--strand-s) var(--strand-l)); }
.cell[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cell-stage { display: none; }
.cell-focus { font-size: 12.7px; line-height: 1.42; color: var(--ink-2); }
.cell-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cell-count { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mini-ring { width: 20px; height: 20px; transform: rotate(-90deg); flex: none; }
.mini-ring circle { fill: none; stroke-width: 3.4; stroke-linecap: round; }
.cell.is-done { background: color-mix(in srgb, var(--ok) 9%, var(--surface-1)); }
.cell.is-dim { opacity: .28; }
.cell.is-hit { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

@media (max-width: 900px) {
  .matrix { grid-template-columns: 1fr; gap: 0; }
  .m-corner, .m-colhead { display: none; }
  .m-rowhead { margin: 20px 0 9px; position: static; }
  .cell { min-height: 0; margin-bottom: 7px; }
  .cell-stage {
    display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; padding: 2px 7px; border-radius: 5px;
    background: var(--stage-c); color: var(--stage-t); align-self: flex-start;
  }
}

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip {
  cursor: pointer; padding: 7px 14px; border-radius: 999px; font-size: 14px;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--ink-2);
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- panels ---------- */
.panel-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 22px;
  padding: 22px 24px; border-radius: var(--radius); margin-bottom: 22px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-top: 4px solid var(--accent-bar, var(--accent));
}
.panel-head h3 { font-size: clamp(21px, 3vw, 27px); }
.panel-head .ph-main { flex: 1 1 340px; min-width: 0; }
.panel-head .ph-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.panel-head .ph-body { margin-top: 12px; color: var(--ink-2); font-size: 15px; max-width: 70ch; }
.panel-head .ph-side { flex: 0 1 240px; display: flex; flex-direction: column; gap: 9px; }
.fact { display: flex; gap: 10px; font-size: 13.5px; align-items: baseline; }
.fact dt { color: var(--ink-3); flex: none; width: 72px; }
.fact dd { margin: 0; color: var(--ink); font-weight: 500; }
.keyidea {
  margin-top: 16px; padding: 13px 16px; border-radius: var(--radius-s);
  background: var(--accent-soft); font-size: 14.5px; line-height: 1.55;
  border-left: 3px solid var(--accent);
}
.keyidea b { font-family: var(--serif); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 20px;
  border-left: 4px solid var(--card-bar, var(--border-strong));
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.card h4 { font-size: 16.5px; }
.card .c-focus { font-size: 14px; color: var(--ink-2); margin: 6px 0 13px; }
.tick-list { display: flex; flex-direction: column; gap: 3px; }
.tick {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 5px 7px; border-radius: 7px; font-size: 14px; line-height: 1.45;
}
.tick:hover { background: var(--surface-2); }
.tick input { margin: 3px 0 0; accent-color: var(--ok); width: 15px; height: 15px; flex: none; cursor: pointer; }
.tick.done span { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.note {
  margin-top: 14px; padding: 11px 14px; border-radius: var(--radius-s);
  font-size: 13.5px; line-height: 1.5; background: var(--surface-2);
}
.note b { display: block; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.note.milestone { background: color-mix(in srgb, var(--ok) 11%, var(--surface-1)); }
.note ul { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.note li { padding-left: 15px; position: relative; }
.note li::before { content: "→"; position: absolute; left: 0; color: var(--ink-3); }

.arc { display: grid; gap: 14px; }
.arc-step { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 18px; align-items: start; }
.arc-rail { position: relative; padding-top: 20px; text-align: right; }
.arc-rail b { font-family: var(--serif); font-size: 15px; display: block; }
.arc-rail span { font-size: 11.5px; color: var(--ink-3); }
.arc-rail::after {
  content: ""; position: absolute; right: -10px; top: 26px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--stage-c); border: 2px solid var(--surface-1);
}
@media (max-width: 680px) {
  .arc-step { grid-template-columns: 1fr; gap: 6px; }
  .arc-rail { text-align: left; padding-top: 4px; }
  .arc-rail::after { display: none; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 600px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
td.level { font-weight: 700; font-family: var(--mono); white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- chart ---------- */
.chart-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px 16px; }
.chart-card h3 { font-size: 18px; }
.chart-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; max-width: 76ch; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 4px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 22px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.chart-holder { position: relative; }
.chart-holder svg { display: block; width: 100%; height: auto; overflow: visible; }
.c-grid { stroke: var(--grid); stroke-width: 1; }
.c-axis { stroke: var(--border-strong); stroke-width: 1; }
.c-tick { font-size: 11px; fill: var(--ink-3); }
.c-label { font-size: 12px; fill: var(--ink-2); font-weight: 600; }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-dot { stroke: var(--surface-1); stroke-width: 2; }
.c-hit { fill: transparent; cursor: crosshair; }
.c-cross { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 160px;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); box-shadow: var(--shadow-2);
  padding: 9px 12px; font-size: 13px; transform: translate(-50%, -112%);
}
.chart-tip b { display: block; font-size: 13px; margin-bottom: 5px; }
.chart-tip div { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.chart-tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }
.chart-tip .tv { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; }
.chart-foot { font-size: 12px; color: var(--ink-3); margin-top: 12px; }

/* ---------- sounds grid ---------- */
.sound-group { margin-bottom: 18px; }
.sound-group h4 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 9px; font-family: var(--sans); }
.sound-row { display: flex; flex-wrap: wrap; gap: 7px; }
.phoneme {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 60px; padding: 7px 9px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--border);
}
.phoneme b { font-family: var(--mono); font-size: 15px; }
.phoneme span { font-size: 11px; color: var(--ink-3); }

/* ---------- search results ---------- */
.search-results {
  position: fixed; top: var(--topbar-h); left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px)); max-height: min(60vh, 520px); overflow-y: auto;
  z-index: 40; background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 8px;
}
.sr-empty { padding: 18px; color: var(--ink-3); font-size: 14px; text-align: center; }
.sr-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 9px 12px; border-radius: var(--radius-s); cursor: pointer;
}
.sr-item:hover, .sr-item:focus-visible { background: var(--surface-2); }
.sr-item .sr-where { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 7px; align-items: center; }
.sr-item .sr-where i { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--hue) var(--strand-s) var(--strand-l)); display: inline-block; }
.sr-item .sr-text { font-size: 14px; margin-top: 2px; }
.sr-item mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-count { font-size: 11.5px; color: var(--ink-3); padding: 6px 12px 8px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgb(10 10 8 / .45); z-index: 45; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  z-index: 50; background: var(--surface-1); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-2); overflow-y: auto; animation: slide .22s ease;
  display: flex; flex-direction: column;
}
@keyframes slide { from { transform: translateX(24px); opacity: .4 } to { transform: none; opacity: 1 } }
.drawer-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface-1);
  border-bottom: 1px solid var(--border); padding: 18px 22px 15px;
  border-top: 4px solid var(--card-bar, var(--accent));
}
.drawer-eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.drawer-eyebrow .pill { background: var(--stage-c); color: var(--stage-t); border-radius: 999px; padding: 2px 9px; font-weight: 600; }
.drawer-head h3 { font-size: 22px; margin-top: 7px; }
.drawer-close {
  position: absolute; top: 14px; right: 16px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); font-size: 17px; line-height: 1;
}
.drawer-close:hover { background: var(--surface-3); color: var(--ink); }
.drawer-body { padding: 18px 22px 26px; flex: 1; }
.drawer-body .c-focus { font-size: 15px; color: var(--ink-2); margin-bottom: 16px; }
.drawer-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-3); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--ring-track); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .3s ease; }
.drawer-nav { display: flex; gap: 8px; padding: 0 22px 22px; }
.drawer-nav button {
  flex: 1; cursor: pointer; padding: 9px 12px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; text-align: left;
}
.drawer-nav button:hover:not(:disabled) { background: var(--surface-3); }
.drawer-nav button:disabled { opacity: .4; cursor: not-allowed; }
.drawer-nav b { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }
@media (max-width: 560px) {
  .drawer { top: auto; height: 92vh; width: 100vw; border-radius: 18px 18px 0 0; border-left: none; }
  @keyframes slide { from { transform: translateY(30px); opacity: .5 } to { transform: none; opacity: 1 } }
}

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--maxw); margin: 0 auto; padding: 30px 16px 60px;
  border-top: 1px solid var(--border); font-size: 13.5px; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 9px;
}
.site-footer p { max-width: 90ch; }
