:root {
  color-scheme: light;
  --paper: #f4f6ef;
  --white: #fff;
  --ink: #152e26;
  --hero: #102c24;
  --accent: #17533e;
  --lime: #d5f58a;
  --border: #cdd8ce;
  --muted: #50665c;
  --wire: #557062;
  --unlock: #255977;
  --shadow: 0 4px 16px #102c2409;
  font: 100%/1.5 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button, input, summary { min-height: 44px; }
button, summary { cursor: pointer; }
a { color: var(--accent); text-underline-offset: .22em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hero :focus-visible { outline-color: var(--lime); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page { width: 100%; max-width: 1440px; margin: auto; padding: 24px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 32%);
  align-items: center;
  gap: 24px;
  padding: clamp(20px, 3vw, 38px);
  color: var(--paper);
  background: var(--hero);
  border-radius: 18px;
}
.court { position: absolute; z-index: -1; bottom: -25%; right: 24%; width: min(34%, 410px); stroke: #d5f58a55; stroke-width: 1.25; }
.eyebrow { font-size: .75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.hero-mark { letter-spacing: .21em; }
.hero-mark span, .hero h1 span { color: var(--lime); }
.hero h1 { margin: 10px 0; font-size: clamp(2.35rem, 4.5vw, 4.6rem); line-height: 1; letter-spacing: -.06em; }
.hero-copy > p:not(.eyebrow) { color: #dfebe2; }
.hero a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 8px; color: var(--lime); font-weight: 700; }
.curriculum-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 10px 0; border: 1px solid #709082; border-radius: 12px; background: #1c3b30; }
.curriculum-facts div { display: flex; flex-direction: column-reverse; justify-content: end; padding: 4px 10px; text-align: center; }
.curriculum-facts div + div { border-inline-start: 1px solid #709082; }
.curriculum-facts dt { font-size: .8rem; font-weight: 650; }
.curriculum-facts dd { margin: 0; color: var(--lime); font-size: clamp(1.5rem, 3vw, 2.15rem); font-weight: 750; letter-spacing: -.04em; }
.search label { display: block; font-size: .875rem; font-weight: 700; margin-bottom: 4px; }
.search input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; background-color: var(--white); }
#web-status:not(:empty), noscript p { padding: 18px 0; }

#tree-views { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
#tree-views button { padding: 6px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-weight: 730; }
#tree-views button[aria-pressed="true"] { border-color: var(--accent); color: var(--white); background: var(--accent); }
.browse { margin-top: 20px; }
.browse-top { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-kicker { color: var(--accent); }
.section-kicker span { color: var(--ink); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); line-height: 1.15; letter-spacing: -.035em; }
.browse h2 { margin: 6px 0; }
.search { position: relative; width: min(100%, 295px); }
.search input { padding-left: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2350665c' stroke-width='2'%3E%3Ccircle cx='10' cy='10' r='5.5'/%3E%3Cpath d='m14 14 5 5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; background-size: 20px; }
.search-results { position: absolute; top: calc(100% + 4px); inset-inline: 0; z-index: 3; max-height: 300px; overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); box-shadow: 0 12px 28px #102c2420; }
.search-results p { padding: 8px; }
#branch-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
#branch-nav button { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-size: .875rem; font-weight: 720; }
#branch-nav button:hover { border-color: var(--accent); }
#branch-nav button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--white); }
.count { white-space: nowrap; border-radius: 5px; background: #e9efe6; color: var(--ink); padding: 2px 7px; font-size: .75rem; font-weight: 750; }
#branch-nav button[aria-pressed="true"] .count { background: var(--lime); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 16px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.board-header, .inspector-header { padding: 18px; }
.browse[hidden] + .workspace { margin-top: 16px; }
[data-mode="sets"] .graph-scroll { max-height: none; }
[data-mode="sets"] .graph-canvas { width: 100%; min-width: 640px; }
.set-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(50px, auto); gap: 22px clamp(64px, 8vw, 108px); }
.set-map .skill-card, .set-standalone .skill-card { border-left-width: 1px; }
.set-map .skill-card[aria-pressed="true"], .set-standalone .skill-card[aria-pressed="true"] { border-color: var(--accent); background: var(--lime); }
.set-map .linked-set { border-color: #678c7a; }
.set-standalone { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.set-standalone h3 { margin-bottom: 8px; font-size: .875rem; color: var(--muted); }
.set-standalone .skill-card { display: inline-grid; width: auto; min-width: 140px; margin-inline-end: 8px; }
#connector-paths .set-edge { opacity: .7; stroke-linejoin: round; }
#connector-paths .set-edge.muted-edge { opacity: .22; }
#connector-paths .set-edge.requirement-edge, #connector-paths .set-edge.unlock-edge { opacity: 1; }
.board-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.back-to-map { margin-inline-start: auto; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-size: .875rem; font-weight: 700; }
.back-to-map:hover { border-color: var(--accent); }
.board-header p, #selected-skill-branch, #inspector-hint, footer { color: var(--muted); }
.board-header p { margin-top: 6px; font-size: .875rem; }
.graph-scroll {
  overflow: auto;
  max-height: min(68vh, 760px);
  border-top: 1px solid var(--border);
  border-radius: 0 0 17px 17px;
  background: radial-gradient(#97aa9d65 1px, transparent 1px) 6px 6px / 16px 16px, #eef3eb;
}
.graph-canvas { position: relative; width: max-content; min-width: 100%; padding: 16px 18px 20px; }
.skill-layers { --card-width: 176px; --lane-gap: 38px; position: relative; }
.rank-labels, .lane-columns { display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-width); gap: var(--lane-gap); align-items: start; }
.rank-labels { padding-bottom: 10px; }
.rank-label, .mobile-layer-label { color: var(--muted); font-size: .73rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.skill-lane + .skill-lane { margin-top: 18px; }
.lane-label { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .875rem; font-weight: 760; }
.lane-label::before { content: ''; width: 10px; height: 10px; flex: none; border: 2px solid var(--accent); border-radius: 50%; background: var(--lime); }
.lane-label::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.layer { display: grid; grid-row: 1; grid-column: var(--rank); gap: 7px; }
.mobile-layer-label { display: none; }
#graph-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#arrow { fill: var(--wire); }
#arrow-active { fill: var(--accent); }
#arrow-unlock { fill: var(--unlock); }
#connector-paths path { fill: none; stroke: var(--wire); stroke-width: 1.8; }
#connector-paths .cross-edge { stroke-dasharray: 5 4; opacity: .65; }
#connector-paths .requirement-edge { stroke: var(--accent); stroke-width: 3; opacity: 1; }
#connector-paths .unlock-edge { stroke: var(--unlock); stroke-width: 3; opacity: 1; }
.skill-card { display: grid; align-content: center; justify-items: start; gap: 2px; width: 100%; text-align: left; padding: 7px 10px; border: 1px solid var(--border); border-left: 3px solid #9fb4a6; border-radius: 10px; background: var(--white); box-shadow: var(--shadow); }
.skill-card:hover { border-color: var(--accent); }
[data-mode="focus"] .graph-scroll { max-height: none; }
[data-mode="focus"] .graph-canvas { width: 100%; }
.focus-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(36px, 6vw, 92px); }
.focus-column { display: flex; flex-direction: column; gap: 12px; }
.focus-column h3 { font-size: 1rem; line-height: 1.2; }
.focus-before h3 { color: var(--accent); }
.focus-after h3 { color: var(--unlock); }
.focus-cards { display: grid; gap: 10px; margin-block: auto; }
.focus-grid .skill-card { min-height: 58px; }
.focus-current .skill-card { min-height: 86px; border: 2px solid var(--accent); background: #f4fbe8; }
.focus-current .card-name { font-size: 1.05rem; }
.focus-after .skill-card { border-left-color: var(--unlock); }
.focus-empty { padding: 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--white); color: var(--muted); font-size: .875rem; }
#skill-relations .link-button { min-height: 44px; }
.card-name { font-size: .92rem; font-weight: 740; line-height: 1.25; }
.card-meta, .mobile-requires { font-size: .72rem; color: var(--muted); }
.mobile-requires { display: none; }
.inspector { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
#inspector-hint { font-size: .875rem; }
.skill-relations:empty { display: none; }

.inspector-header { border-radius: 17px 17px 0 0; background: #edf4e9; border-bottom: 1px solid var(--border); }
.inspector-header h2 { margin: 7px 0 4px; }
#selected-skill-branch { margin-bottom: 9px; font-size: .875rem; }
.skill-relations { padding: 6px 18px 14px; }
.skill-relations section { padding: 11px 0; }
.skill-relations section + section { border-top: 1px solid var(--border); }
.skill-relations h3 { margin-bottom: 6px; font-size: .875rem; }
.skill-relations p { font-size: .875rem; color: var(--muted); }
.skill-relations ul { padding: 0; margin: 0; list-style: none; font-size: .875rem; }
.link-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: .875rem; font-weight: 680; }
.link-button:hover { background: #edf4e9; }
.link-button small { display: block; color: var(--muted); font-size: .75rem; font-weight: 500; }
.link-button .arrow { color: var(--accent); flex: none; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; border-top: 1px solid var(--border); margin-top: 30px; padding-top: 14px; font-size: .875rem; }

@media (max-width: 760px) {
  .page { padding: 16px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 18px 20px; }
  .court { width: 60%; top: 0; right: -10%; bottom: auto; }
  .browse-top { align-items: start; flex-direction: column; }
  .search { width: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .inspector { grid-row: 1; position: static; max-height: none; overflow: visible; }
  .browse[hidden] + .workspace .inspector { grid-row: auto; }
  [data-mode="sets"] .graph-scroll { overflow: auto; }
  [data-mode="sets"] #graph-edges { display: block; }
  .graph-scroll { overflow: visible; max-height: none; }
  .graph-canvas { width: auto; padding: 12px; }
  .rank-labels, .cross-count { display: none; }
  .lane-columns { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .layer { grid-column: 1; grid-row: auto; }
  .mobile-layer-label { display: block; }
  .focus-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .focus-column + .focus-column { padding-top: 12px; border-top: 1px solid var(--border); }
  [data-mode="focus"] .back-to-map { margin-inline-start: 0; }
  #graph-edges { display: none; }
  .mobile-requires { display: block; }
}
