:root {
  color-scheme: light;
  --paper: #f6f8f5;
  --surface: #ffffff;
  --ink: #1d2923;
  --muted: #69746d;
  --line: #d9e1db;
  --teal: #087d72;
  --teal-soft: #d9eee9;
  --coral: #c75745;
  --coral-soft: #f8e3dd;
  --indigo: #3f5f9d;
  --indigo-soft: #e4e9f4;
  --shadow: 0 12px 35px rgb(34 52 42 / 8%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141b17;
  --surface: #1d2721;
  --ink: #edf4ed;
  --muted: #aab7ad;
  --line: #354238;
  --teal: #53b5a6;
  --teal-soft: #183b35;
  --coral: #e78672;
  --coral-soft: #4b2b26;
  --indigo: #aabce5;
  --indigo-soft: #28344d;
  --shadow: 0 12px 35px rgb(0 0 0 / 22%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #141b17;
    --surface: #1d2721;
    --ink: #edf4ed;
    --muted: #aab7ad;
    --line: #354238;
    --teal: #53b5a6;
    --teal-soft: #183b35;
    --coral: #e78672;
    --coral-soft: #4b2b26;
    --indigo: #aabce5;
    --indigo-soft: #28344d;
    --shadow: 0 12px 35px rgb(0 0 0 / 22%);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: ui-sans-serif, system-ui, sans-serif; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--indigo) 45%, transparent); outline-offset: 2px; }
.topbar { height: 58px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100vw - 1420px) / 2)); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, ui-serif, serif; font-size: 18px; font-weight: 700; }
.brand-mark { width: 16px; height: 16px; display: block; border: 4px solid var(--teal); border-radius: 50%; box-shadow: 7px -4px 0 -3px var(--coral); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }.connection { color: var(--muted); font-size: 12px; }
.theme-toggle { height: 28px; padding: 0 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 11px; }
.shell { width: min(1420px, 100%); margin: 0 auto; padding: 32px 28px 42px; }
.overview { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { text-wrap: balance; }
h1 { margin: 0; max-width: 650px; font-family: Georgia, ui-serif, serif; font-size: clamp(27px, 4vw, 42px); line-height: 1.05; letter-spacing: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); border-left: 1px solid var(--line); }
.metrics div { padding: 0 18px; border-right: 1px solid var(--line); }
.metrics span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.metrics strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.controls { display: grid; grid-template-columns: minmax(150px, 230px) minmax(220px, 1fr) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
input, select { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400; letter-spacing: 0; }
button { height: 38px; padding: 0 16px; border: 0; border-radius: 4px; background: var(--indigo); color: #fff; cursor: pointer; font-size: 13px; font-weight: 700; }
button:hover { filter: brightness(1.08); }
.search-results { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.topic-choice { height: auto; min-height: 52px; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.topic-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 18px; margin-top: 18px; }
.map-panel, .detail-panel { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.map-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.legend { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 10px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-mastered { background: var(--teal); }.legend-learning { background: var(--indigo); }.legend-blocked { background: var(--coral); }
.canvas-wrap { position: relative; min-height: 540px; overflow: auto; background: var(--paper); }
canvas { display: block; width: 100%; height: 540px; cursor: crosshair; }
#empty-state { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 14px; pointer-events: none; }
.detail-panel { padding: 20px; }
.detail-panel h2 { margin: 0; font-family: Georgia, ui-serif, serif; font-size: 23px; line-height: 1.15; }
.node-domain, .node-description, .recommendation p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.node-domain { margin: 6px 0 24px; }.node-description { margin: 18px 0; }
.mastery-row { display: flex; justify-content: space-between; font-size: 12px; }.mastery-row span { color: var(--muted); }
.mastery-track { height: 7px; margin-top: 8px; overflow: hidden; background: var(--line); }.mastery-track span { display: block; width: 0%; height: 100%; background: var(--teal); transition: width .25s ease; }
.recommendation { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }.recommendation h3 { margin: 0; font-size: 16px; }.recommendation p { margin-bottom: 0; }
@media (max-width: 850px) { .shell { padding: 22px 16px 34px; }.overview, .workspace { grid-template-columns: 1fr; display: grid; }.metrics { grid-template-columns: repeat(3, 1fr); }.metrics div { padding: 12px; }.controls { grid-template-columns: 1fr; }.map-toolbar { align-items: flex-start; flex-direction: column; padding: 11px 15px; }.legend { white-space: normal; flex-wrap: wrap; }.canvas-wrap, canvas { min-height: 440px; height: 440px; } }
@media (prefers-reduced-motion: reduce) { .mastery-track span { transition: none; } }
