/* Road to Violet: black and white, one accent of meaning (Codeforces rank colours).
   Tokens first; every component reads from them so light and dark stay in step. */

:root {
  color-scheme: light;
  --paper: #fafaf9;
  --surface: #ffffff;
  --ink: #0b0b0c;
  --ink-2: #2b2b30;
  --muted: #66666c;
  --faint: #9a9aa1;
  --line: #e6e6e8;
  --line-2: #d3d3d7;
  --soft: #f1f1f2;
  --inv: #0b0b0c;
  --inv-ink: #fafaf9;
  --inv-muted: #a3a3aa;
  --ok: #1d7a35;
  --bad: #b3261e;
  --band: .085;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .08);
  /* Official Codeforces rank colours */
  --r-newbie: #808080;
  --r-pupil: #008000;
  --r-specialist: #03a89e;
  --r-expert: #0000ff;
  --r-cm: #aa00aa;
  --r-master: #ff8c00;
  --r-gm: #ff0000;

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0b0b0c;
    --surface: #121213;
    --ink: #f2f2f2;
    --ink-2: #d4d4d8;
    --muted: #9c9ca3;
    --faint: #6c6c73;
    --line: #242427;
    --line-2: #35353a;
    --soft: #19191b;
    --inv: #f2f2f2;
    --inv-ink: #0b0b0c;
    --inv-muted: #5a5a60;
    --ok: #4cc26a;
    --bad: #ff6b5e;
    --band: .13;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .55);
    --r-newbie: #a3a3a3;
    --r-pupil: #3dbe4e;
    --r-specialist: #2fd1c4;
    --r-expert: #7b93ff;
    --r-cm: #d565d5;
    --r-master: #ffa64d;
    --r-gm: #ff5a5a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b0b0c;
  --surface: #121213;
  --ink: #f2f2f2;
  --ink-2: #d4d4d8;
  --muted: #9c9ca3;
  --faint: #6c6c73;
  --line: #242427;
  --line-2: #35353a;
  --soft: #19191b;
  --inv: #f2f2f2;
  --inv-ink: #0b0b0c;
  --inv-muted: #5a5a60;
  --ok: #4cc26a;
  --bad: #ff6b5e;
  --band: .13;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .55);
  --r-newbie: #a3a3a3;
  --r-pupil: #3dbe4e;
  --r-specialist: #2fd1c4;
  --r-expert: #7b93ff;
  --r-cm: #d565d5;
  --r-master: #ffa64d;
  --r-gm: #ff5a5a;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
code, kbd, pre, samp { font-family: var(--mono); }
p code, li code, td code, .md code, .note code, .tip-body code {
  font-size: .86em;
  padding: .1em .38em;
  border-radius: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
kbd {
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--paper); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 20px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 12px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.eyebrow {
  font: 500 11.5px/1.2 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { color: var(--muted); max-width: 64ch; margin-top: 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font: 700 16px/1 var(--display);
  letter-spacing: -.015em;
  text-decoration: none;
  white-space: nowrap;
}
.brand svg { width: 24px; height: 24px; flex: none; }
.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative;
  padding: 19px 11px 18px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: color .2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tab-ink {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--ink);
  transition: transform .45s var(--ease), width .45s var(--ease);
  pointer-events: none;
}
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
.rank-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
}
.rank-chip i, .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rc, var(--faint)); display: inline-block; flex: none; }
.rank-chip b { font-family: var(--mono); font-weight: 600; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border: 0; border-radius: 999px;
  background: var(--inv); color: var(--inv-ink);
  font: 600 13px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.timer-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.6s ease-in-out infinite; }
.timer-pill.paused .pulse { animation: none; opacity: .35; }
@keyframes blink { 50% { opacity: .2; } }
@media (max-width: 720px) {
  .top-in { gap: 10px; }
  .brand span { display: none; }
  .rank-chip .rc-name { display: none; }
}

/* ---------- views ---------- */

main { padding-block: 28px 64px; }
.view { display: none; }
.view.on { display: block; animation: view-in .4s var(--ease); }
@keyframes view-in { from { opacity: .001; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.view-head h2 { font: 800 clamp(30px, 4.4vw, 46px)/1.02 var(--display); letter-spacing: -.035em; margin-top: 6px; }
.view-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section-title { font: 700 20px/1.2 var(--display); letter-spacing: -.015em; }
.sub { margin-top: 36px; }
.sub > .section-title { margin-bottom: 12px; }

/* segmented control used for sub-sections */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 20px; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: background .2s, color .2s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* ---------- buttons and inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 14px; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-2); }
.btn.sm { min-height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn.ready { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 18%, transparent); }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.icon-btn svg { width: 17px; height: 17px; }
.linkish { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-size: inherit; }
.linkish:hover { text-decoration-color: var(--ink); }
.input, .select, .textarea {
  max-width: 100%; min-width: 0;
  min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font-size: 14px;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.textarea { width: 100%; min-height: 110px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.field { display: grid; gap: 6px; min-width: 0; }
.form-grid > *, .settings > * { min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 13px;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip small { font-family: var(--mono); opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  min-height: 320px;
}
.hero canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  padding: 30px 34px 28px;
  display: flex; flex-direction: column; gap: 14px;
  pointer-events: none;
}
.hero-copy > * { pointer-events: auto; }
.day-num {
  font: 800 clamp(68px, 11.5vw, 136px)/.86 var(--display);
  letter-spacing: -.055em;
  margin-top: 4px;
}
.day-num small { font-size: .2em; font-weight: 600; letter-spacing: -.01em; color: var(--muted); margin-left: .4em; vertical-align: .35em; }
.hero-sub { font-size: 17px; color: var(--ink-2); max-width: 46ch; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 4px; }
.hero-stats div { display: grid; gap: 2px; }
.hero-stats b { font: 600 20px/1.1 var(--sans); letter-spacing: -.01em; }
.hero-stats span { font-size: 12px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.field-cap {
  position: absolute; right: 14px; bottom: 12px; z-index: 1;
  padding: 5px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font: 500 11px/1 var(--mono); letter-spacing: .04em; color: var(--muted);
  pointer-events: none;
}
@media (max-width: 720px) {
  .hero-copy { padding: 22px 20px 20px; }
  .field-cap { display: none; }
}

.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin-top: 16px; padding: 14px 18px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface);
}
.banner p { max-width: 70ch; }
.banner b { font-weight: 600; }

/* ---------- today ---------- */

.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 36px; margin-top: 30px; align-items: start; }
@media (max-width: 1000px) { .today-grid { grid-template-columns: minmax(0, 1fr); } }
.block { border-top: 2px solid var(--ink); padding-top: 14px; margin-bottom: 34px; }
.block-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.block-head .idx { font: 600 12px/1 var(--mono); color: var(--muted); min-width: 14px; }
.block-head h3 { font: 700 23px/1.15 var(--display); letter-spacing: -.02em; }
.block-head .time { margin-left: auto; font: 500 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.block-note { color: var(--muted); font-size: 13.5px; margin: 2px 0 6px 26px; }
.bonus-toggle { margin: 10px 0 0 40px; font-size: 13px; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.check {
  width: 22px; height: 22px; margin-top: 1px;
  display: grid; place-items: center;
  padding: 0;
  border: 1.5px solid var(--ink); border-radius: 6px;
  background: transparent;
  transition: background .2s var(--ease), border-color .2s;
}
.check:hover { background: var(--soft); }
.check svg { width: 14px; height: 14px; fill: none; stroke: var(--paper); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 18; stroke-dashoffset: 18; transition: stroke-dashoffset .38s var(--ease) .04s; }
.row[data-s="ac"] > .check { background: var(--ink); }
.row[data-s="ac"] > .check svg { stroke-dashoffset: 0; }
.row[data-s="help"] > .check { background: var(--soft); }
.row[data-s="help"] > .check svg { stroke: var(--ink); stroke-dashoffset: 0; }
.row[data-s="skip"] > .check { border-color: var(--faint); border-style: dashed; }
.pbody { min-width: 0; }
.pname { font-weight: 500; font-size: 15.5px; text-decoration: none; overflow-wrap: anywhere; }
.pname:hover { text-decoration: underline; }
a.pname[href^="http"]::after { content: "↗"; font-size: .72em; margin-left: .3em; color: var(--faint); }
.row[data-s="ac"] .pname, .row[data-s="skip"] .pname { color: var(--muted); }
.pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.pmeta .id { font-family: var(--mono); color: var(--ink-2); }
.rating { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.rating::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rc); }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; line-height: 1.5; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; color: var(--ink-2); }
.bonus-label { font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.verdict { font: 600 11.5px/1 var(--mono); margin-left: 8px; white-space: nowrap; }
.verdict.ac { color: var(--ok); }
.verdict.help { color: var(--ink-2); }
.verdict.skip { color: var(--faint); }
.row-actions { display: flex; gap: 2px; margin-top: -4px; }
.row .spent { font: 500 11.5px/1 var(--mono); color: var(--muted); }

.learn-extra { margin: 6px 0 0 40px; display: grid; gap: 12px; }
.learn-extra .note { color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.alts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--muted); }
.alts a { color: var(--ink-2); }
.luv {
  border-radius: 12px;
  background: var(--soft);
  padding: 12px 14px 10px;
}
.luv-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.luv-head b { font-weight: 600; font-size: 14px; }
.luv-head span { font: 500 11px/1 var(--mono); color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.vids { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.vids a {
  display: grid;
  grid-template-columns: 22px 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 6px;
  border-radius: 8px;
  text-decoration: none;
  transition: background .15s;
}
.vids a:hover { background: var(--surface); }
.vids .play { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.vids .play svg { width: 9px; height: 9px; margin-left: 1px; fill: currentColor; }
.vids .ep { font: 600 12px/1 var(--mono); color: var(--ink-2); }
.vids .vt { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vids .vd { font: 500 12px/1 var(--mono); color: var(--muted); }
.luv details { margin-top: 4px; font-size: 13px; }
.luv summary { cursor: pointer; color: var(--muted); padding: 4px 6px; }
@media (max-width: 600px) {
  .vids a { grid-template-columns: 22px 44px minmax(0, 1fr) auto; gap: 8px; }
  .vids .vt { white-space: normal; }
}
.luv-none { font-size: 13px; color: var(--muted); }

.contest-card { border: 1px solid var(--line-2); border-radius: 14px; padding: 18px 20px; background: var(--surface); display: grid; gap: 10px; }
.contest-card h4 { font: 700 22px/1.2 var(--display); letter-spacing: -.015em; }
.contest-card .cc-top { display: flex; justify-content: space-between; gap: 12px; }
.contest-card p { color: var(--ink-2); max-width: 70ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.inline-check input { width: 18px; height: 18px; accent-color: var(--ink); }

.side-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); margin-bottom: 14px; }
.side-card h4 { font: 500 11.5px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.side-card.inv { background: var(--inv); color: var(--inv-ink); border-color: var(--inv); }
.side-card.inv h4 { color: var(--inv-muted); }
.side-card.inv code { background: transparent; border-color: color-mix(in srgb, var(--inv-ink) 25%, transparent); color: inherit; }
.side-card.inv a { color: inherit; }
.tip-title { font: 700 19px/1.2 var(--display); letter-spacing: -.01em; margin-bottom: 6px; }
.tip-body { font-size: 14px; line-height: 1.55; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.side-list li { display: flex; justify-content: space-between; gap: 10px; }
.side-list .mono { color: var(--muted); font-size: 12px; }
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekstrip button {
  aspect-ratio: 1; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface);
  display: grid; place-items: center; align-content: center; gap: 1px;
  font: 600 11px/1 var(--mono); color: var(--ink-2);
  padding: 0;
}
.weekstrip button small { font-size: 9.5px; font-weight: 500; color: var(--muted); }
.weekstrip button.done { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.weekstrip button.done small { color: inherit; opacity: .6; }
.weekstrip button.cur { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- road ---------- */

.road-chart { position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 14px 14px 6px; overflow-x: auto; }
.road-chart svg { display: block; width: 100%; min-width: 660px; height: auto; }
.road-results { margin-top: 12px; }
.road-results .rows { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; background: var(--surface); }
.road-results button.row { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); grid-template-columns: 70px minmax(0, 1fr) auto; }
.pulse-ring { transform-box: fill-box; transform-origin: center; animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(3.2); opacity: 0; } }

.phase { margin-top: 44px; }
.phase-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 22px;
  align-items: start;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}
.phase-num { font: 800 64px/.78 var(--display); letter-spacing: -.05em; }
.phase-title { font: 700 26px/1.1 var(--display); letter-spacing: -.02em; }
.phase-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.phase-meta b { color: var(--ink); font-weight: 600; }
.phase-why { color: var(--ink-2); max-width: 70ch; margin-top: 8px; font-size: 14.5px; }
.motif { width: 150px; height: 72px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: block; }
.meter { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 12px; max-width: 520px; }
.meter i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 99px; transition: width .6s var(--ease); }
.milestones { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.milestones label { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.milestones input { width: 16px; height: 16px; accent-color: var(--ink); }
.milestones .done span { text-decoration: line-through; color: var(--muted); }
@media (max-width: 520px) { #roadSearch { min-width: 0 !important; flex: 1; } }
@media (max-width: 720px) {
  .phase-head { grid-template-columns: auto minmax(0, 1fr); }
  .motif { grid-column: 1 / -1; width: 100%; height: 64px; }
  .phase-num { font-size: 48px; }
}

.weeks { display: grid; gap: 6px; margin-top: 18px; }
.week { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); gap: 6px; }
.week-label { font: 500 11px/1.2 var(--mono); color: var(--muted); align-self: center; }
.dcell {
  min-width: 0; min-height: 68px;
  padding: 8px 9px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface);
  text-align: left;
  position: relative;
  transition: border-color .15s, background .2s, color .2s;
}
.dcell:hover { border-color: var(--ink); }
.dcell .dn { font: 600 11px/1 var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 4px; }
.dcell .dt { font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dcell .dp { position: absolute; left: 9px; right: 9px; bottom: 5px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.dcell .dp i { display: block; height: 100%; background: var(--ink); }
.dcell.contest { background: var(--soft); }
.dcell.done { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.dcell.done .dn { color: color-mix(in srgb, var(--paper) 65%, transparent); }
.dcell.done .dp { display: none; }
.dcell.cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.dcell[aria-expanded="true"] { border-color: var(--ink); }
@media (max-width: 720px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .week-label { grid-column: 1 / -1; margin-top: 6px; }
  .dcell { min-height: 46px; padding: 6px; }
  .dcell .dt { display: none; }
}
.day-detail {
  grid-column: 1 / -1;
  border: 1px solid var(--ink); border-radius: 12px;
  background: var(--surface);
  padding: 16px 18px 6px;
  margin: 2px 0 8px;
  animation: view-in .3s var(--ease);
}
.day-detail .dd-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.day-detail h4 { font: 700 20px/1.2 var(--display); letter-spacing: -.015em; }
.day-detail .block { border-top-width: 1px; margin-bottom: 14px; padding-top: 10px; }
.day-detail .block-head h3 { font-size: 17px; }

/* ---------- train ---------- */

.train-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 900px) { .train-grid { grid-template-columns: minmax(0, 1fr); } }
.bezel-wrap { position: relative; width: min(420px, 100%); aspect-ratio: 1; margin: 0 auto; }
.bezel-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bezel-wrap .tick { stroke: var(--line-2); stroke-width: 2; stroke-linecap: round; transition: stroke .25s; }
.bezel-wrap .tick.mark { stroke-width: 2.5; }
.bezel-wrap .tick.on { stroke: var(--ink); }
.bezel-wrap .hand { stroke: var(--ink); stroke-width: 1.5; }
.bezel-center {
  position: absolute; inset: 16%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px;
}
.clock { font: 600 clamp(44px, 9vw, 66px)/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.clock-label { font-size: 13.5px; color: var(--muted); max-width: 22ch; }
.clock-stage { font: 600 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.train-panel { display: grid; gap: 18px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); transition: color .3s; }
.steps li b { display: block; color: var(--ink-2); font-weight: 600; }
.steps li .mono { font-size: 12px; padding-top: 2px; white-space: nowrap; }
.steps li.on { color: var(--ink); }
.steps li.on b { color: var(--ink); }
.steps li.on .mono::before { content: "● "; }
.pick-list { display: grid; gap: 6px; }
.pick-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pick-list button:hover { border-color: var(--ink); }
.mock-list { list-style: none; margin: 0; padding: 0; }
.mock-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.mock-list .letter { font: 700 18px/1 var(--display); }
.blocks-bar { display: grid; gap: 4px; }
.blocks-bar div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.blocks-bar div.on { border-color: var(--ink); background: var(--soft); font-weight: 600; }
.blocks-bar div.past { color: var(--muted); text-decoration: line-through; }

/* ---------- assess ---------- */

.assess-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--surface); display: grid; gap: 10px; align-content: start; }
.card h3 { font: 700 22px/1.15 var(--display); letter-spacing: -.02em; }
.card p { color: var(--ink-2); }
.card.inv { background: var(--inv); color: var(--inv-ink); border-color: var(--inv); }
.card.inv p { color: color-mix(in srgb, var(--inv-ink) 80%, transparent); }
.card.inv .btn.primary { background: var(--inv-ink); color: var(--inv); border-color: var(--inv-ink); }
.quiz { max-width: 760px; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.qprog { display: flex; gap: 3px; flex-wrap: wrap; }
.qprog i { width: 14px; height: 6px; border-radius: 2px; background: var(--line); }
.qprog i.done { background: var(--ink); }
.qprog i.cur { background: var(--muted); }
.qtext { font: 600 21px/1.3 var(--sans); letter-spacing: -.01em; margin-bottom: 14px; }
pre.code {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--inv); color: var(--inv-ink);
  font-size: 13px; line-height: 1.55;
  overflow-x: auto;
}
.opts { display: grid; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: center;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--surface);
  font-size: 15px;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--ink); }
.opt kbd { justify-self: start; }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }
.opt.idk { color: var(--muted); }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.judge { font-family: var(--mono); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); display: grid; gap: 12px; }
.judge-line { font-size: 15px; font-weight: 600; min-height: 1.4em; }
.judge-line.ac { color: var(--ok); }
.judge-line.wa { color: var(--bad); }
.judge-cells { display: flex; flex-wrap: wrap; gap: 4px; }
.judge-cells i { width: 16px; height: 16px; border-radius: 3px; border: 1.5px solid var(--line-2); transition: background .15s, border-color .15s; }
.judge-cells i.pass { background: var(--ink); border-color: var(--ink); }
.judge-cells i.fail { border-color: var(--ink); background: repeating-linear-gradient(135deg, transparent 0 3px, var(--ink) 3px 4.5px); }
.lvbars { display: grid; gap: 14px; }
.lvbar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 52px; gap: 12px; align-items: center; font-size: 14px; }
.lvbar .track { position: relative; height: 10px; border-radius: 99px; background: var(--soft); }
.lvbar .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--ink); width: 0; transition: width .8s var(--ease); }
.lvbar .track u { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--muted); }
.lvbar .pct { font-family: var(--mono); font-size: 13px; text-align: right; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; }
.review-list .yes { color: var(--ok); font-family: var(--mono); font-size: 12px; font-weight: 600; }
.review-list .no { color: var(--bad); font-family: var(--mono); font-size: 12px; font-weight: 600; }

/* ---------- notebook ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; align-items: end; }
.form-grid .wide { grid-column: span 2; }
@media (max-width: 560px) { .form-grid .wide { grid-column: auto; } }
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.list > li:last-child { border-bottom: 0; }
.list .li-top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: space-between; }
.list .li-text { font-size: 15px; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; font-size: 14px; }
.steps-dots { letter-spacing: 2px; font-family: var(--mono); }
.letters { display: flex; flex-wrap: wrap; gap: 4px; }
.letters button { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); font: 600 13px/1 var(--mono); }
.letters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- library ---------- */

.tip-grid { columns: 3 300px; column-gap: 16px; }
.tip-card { break-inside: avoid; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); margin-bottom: 16px; }
.tip-card .eyebrow { margin-bottom: 8px; }
.tip-card h3 { font: 700 17px/1.25 var(--display); letter-spacing: -.01em; margin-bottom: 6px; }
.tip-card p { font-size: 14px; color: var(--ink-2); }
.snips { display: grid; gap: 22px; }
.snip-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; margin-bottom: 8px; }
.snip-head h3 { font: 700 18px/1.2 var(--display); letter-spacing: -.01em; }
.snip-head p { color: var(--muted); font-size: 13.5px; max-width: 70ch; margin-top: 3px; }
.badge { font: 600 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 6px; color: var(--muted); margin-left: 8px; vertical-align: 2px; }
.tbl { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 500 11.5px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
td.warn { color: var(--bad); }
.tbl table.wide { min-width: 640px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.res-grid a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: border-color .15s; }
.res-grid a:hover { border-color: var(--ink); }
.res-grid b { font: 700 16px/1.2 var(--display); }
.res-grid span { color: var(--muted); font-size: 13.5px; }
.rules { counter-reset: r; list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 780px; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.rules li::before { content: counter(r); font: 800 38px/.9 var(--display); letter-spacing: -.04em; }
.rules b { display: block; font: 700 18px/1.25 var(--display); margin-bottom: 4px; }
.calc { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- stats ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); }
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { font: 600 34px/1.1 var(--sans); letter-spacing: -.025em; margin-top: 6px; }
.tile .value small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.chart-panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px 12px; background: var(--surface); }
.chart-panel header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; margin-bottom: 10px; }
.chart-panel h3 { font: 600 15px/1.3 var(--sans); }
.chart-panel .cap { font-size: 12.5px; color: var(--muted); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .mark { fill: var(--ink); transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .mark, .chart .hit:focus + .mark { opacity: .6; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.hm-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.hm-legend i { width: 11px; height: 11px; border-radius: 2px; background: var(--ink); display: inline-block; }
.table-toggle { font-size: 12.5px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.settings label.switch { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.settings input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); }
.status-line { font-size: 13.5px; color: var(--muted); min-height: 1.4em; }
.status-line.err { color: var(--bad); }

/* ---------- overlays ---------- */

.menu {
  position: fixed; z-index: 60;
  min-width: 236px; padding: 6px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop .16s var(--ease);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 7px;
  background: none; text-align: left; text-decoration: none; font-size: 14px;
}
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--soft); outline: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu small { color: var(--muted); margin-left: auto; font-size: 12px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.tip {
  position: fixed; z-index: 70; left: 0; top: 0;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--inv); color: var(--inv-ink);
  font-size: 12px; line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}
.tip.on { opacity: 1; }
.tip b { display: block; font: 600 14px/1.25 var(--sans); }
.tip span { color: color-mix(in srgb, var(--inv-ink) 72%, transparent); }

.toast {
  position: fixed; left: 50%; z-index: 80;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--inv); color: var(--inv-ink);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .35s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.dlg {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  padding: 0;
  border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
}
.dlg::backdrop { background: rgba(8, 8, 10, .45); backdrop-filter: blur(3px); }
.dlg[open] { animation: pop .2s var(--ease); }
.dlg-in { padding: 22px 22px 18px; display: grid; gap: 14px; }
.dlg h3 { font: 700 22px/1.2 var(--display); letter-spacing: -.02em; }
.dlg p { color: var(--ink-2); }
.dlg-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.foot { padding-block: 26px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; }
.foot a { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- road chart ---------- */

.road-chart text { font: 500 10.5px var(--mono); fill: var(--muted); }
.road-chart .band-label { fill: var(--ink-2); font: 500 11.5px var(--sans); }
.road-chart .ph-label { fill: var(--ink); font-weight: 600; }
.road-chart .sep { stroke: var(--line-2); stroke-width: 1; }
.road-chart .future { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-linejoin: round; }
.road-chart .travel { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.road-chart .now { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.road-chart .now-ring { fill: var(--ink); }
.road-chart .strip { fill: var(--soft); }
.road-chart .strip-done, .road-chart .strip-now { fill: var(--ink); }
.road-chart .xhair { stroke: var(--ink); stroke-width: 1; }
.road-chart .overlay { fill: transparent; cursor: pointer; }
.chart .cap-label { fill: var(--ink-2); font-size: 10px; }
.steps-dots { font-size: 11px; letter-spacing: 1px; padding-top: 4px; color: var(--ink-2); }

/* ---------- v2: top bar additions ---------- */

.theme-btn { width: 34px; height: 34px; border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.theme-btn svg { width: 17px; height: 17px; }
.account-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px 0 4px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface);
  text-decoration: none; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.account-btn:hover, .theme-btn:hover, .rank-chip:hover { border-color: var(--ink); }
.account-btn svg { width: 18px; height: 18px; margin-left: 4px; }
.account-btn .avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 700 12px/1 var(--display); }
.account-btn .pro { font: 700 10px/1 var(--mono); letter-spacing: .06em; }
.sync { font: 500 11.5px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.sync.offline { color: var(--bad); }
.sync:empty { display: none; }
.timer-pill .pl { font-weight: 500; opacity: .65; }
@media (max-width: 720px) {
  .sync, .timer-pill .pl, .account-btn .acc-t { display: none; }
  .account-btn { padding: 0 4px; }
}

/* ---------- v2: today ---------- */

.day-num small { white-space: nowrap; }
.shields { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; font: 600 13px/1 var(--mono); color: var(--muted); vertical-align: 3px; }
.shields svg { width: 14px; height: 14px; }
.feel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13.5px; color: var(--muted); }
.feel > span { margin-right: 4px; }
.unit-foot { margin: -12px 0 30px; padding: 12px 0 0; border-top: 1px dashed var(--line-2); }
.done-list { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.done-list li { display: flex; gap: 10px; align-items: baseline; }
.skip-topic { font-size: 13px; color: var(--muted); }
.side-list.cal li { align-items: flex-start; }
.side-list.cal b { display: block; font-weight: 600; }
.side-list.cal small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; max-width: 22ch; }
.cal-pick { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; width: 100%; padding: 4px 6px; margin: -4px -6px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; box-sizing: content-box; }
.cal-pick:hover { background: var(--soft); }
.side-list.cal li.skipped b { text-decoration: line-through; color: var(--muted); }
.cal-c { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cal-c:hover b, .cal-c:focus-visible b { text-decoration: underline; text-underline-offset: 2px; }
.cal-skips { margin-top: auto; display: grid; gap: 2px; }
.cal-c.skip { font-size: 11.5px; color: var(--muted); }
.cal-c.skip s { color: var(--muted); }
.cal-legend s { color: var(--muted); }
.weekstrip .wday {
  aspect-ratio: 1; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 8px;
  display: grid; place-items: center; align-content: center; gap: 2px;
  font: 500 10px/1 var(--mono); color: var(--muted);
}
.weekstrip .wday b { font: 700 13px/1 var(--mono); color: var(--ink); }
.weekstrip .wday.contest { background: var(--ink); border-color: var(--ink); color: var(--inv-muted); }
.weekstrip .wday.contest b { color: var(--paper); }
.weekstrip .wday.rest { border-style: dashed; }
.weekstrip .wday.cur { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- v2: road ---------- */

.road-top { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .road-top { grid-template-columns: minmax(0, 1fr); } }
.sched-panel { padding: 16px 18px; }
.sched { list-style: none; margin: 0; padding: 0; display: grid; }
.sched li { display: grid; grid-template-columns: 56px 62px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sched li:last-child { border-bottom: 0; }
.sched .sd { font: 500 12px/1.2 var(--mono); color: var(--muted); }
.sched .sd b { color: var(--ink); font-weight: 600; }
.sched .stype { font: 600 10.5px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sched li.contest .stype { color: var(--ink); }
.sched li.contest .swhat b { font-weight: 600; }
.sched li.today { background: var(--soft); margin: 0 -8px; padding-inline: 8px; border-radius: 6px; }
.sched li.rest .swhat { color: var(--muted); }
.units { display: grid; gap: 6px; margin-top: 18px; }
.unit-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.unit-row .day-detail { grid-column: 1 / -1; }
@media (max-width: 720px) { .unit-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.unit-row .dcell { min-height: 72px; }

/* ---------- v2: onboarding ---------- */

body.onb-open { overflow: hidden; }
.onb {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  animation: view-in .35s var(--ease);
}
.onb-card {
  width: min(620px, 100%);
  border: 1px solid var(--line-2); border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 26px 28px 22px;
  display: grid; gap: 14px;
}
.onb-card h2 { font: 800 clamp(26px, 5vw, 34px)/1.08 var(--display); letter-spacing: -.03em; }
.onb-card .lede { margin-top: -4px; }
.onb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 30px; }
.onb-dots { display: flex; gap: 5px; }
.onb-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); transition: background .3s; }
.onb-dots i.done { background: var(--ink); }
.onb-dots i.cur { background: var(--muted); }
.onb-body { display: grid; gap: 10px; }
.onb-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.ob-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.ob-opt {
  display: grid; gap: 3px; text-align: left;
  padding: 13px 15px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.ob-opt:hover { border-color: var(--ink); }
.ob-opt b { font-weight: 600; font-size: 15px; }
.ob-opt span { font-size: 13px; color: var(--muted); }
.ob-opt[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }
.ob-sum { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }

/* ---------- v2: cards, premium, account ---------- */

.bul { margin: 0; padding-left: 1.1em; display: grid; gap: 5px; font-size: 14px; color: var(--ink-2); }
.card.locked { border-style: dashed; }
.card.locked .eyebrow svg, .ilock { width: 12px; height: 12px; vertical-align: -1px; }
.price { font: 700 22px/1.2 var(--display); letter-spacing: -.01em; }
.h4 { font: 600 14px/1.3 var(--sans); margin-top: 6px; }
.auth { max-width: 460px; display: grid; gap: 14px; }
.settings-panel { display: grid; gap: 22px; }
.set-group h4 { font: 500 11.5px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.letters .lt { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-2); font: 600 12px/1 var(--mono); color: var(--muted); }
.letters .lt.in { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.letters .lt.up { border: 2px solid var(--ink); color: var(--ink); }
.dlg-in.wide { width: min(720px, calc(100vw - 32px)); }
.dlg:has(.dlg-in.wide) { width: min(760px, calc(100% - 32px)); }
.linkish.muted { color: var(--muted); }

/* ---------- v2: login page ---------- */

.auth-page {
  position: fixed; inset: 0; z-index: 95;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--paper);
  animation: view-in .35s var(--ease);
  overflow-y: auto;
}
.auth-art { position: relative; overflow: hidden; background: #0b0b0c; color: #f2f2f2; min-height: 100%; box-shadow: inset -1px 0 0 rgba(255, 255, 255, .09); }
.auth-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.auth-art-copy {
  position: relative; z-index: 1;
  height: 100%; min-height: 520px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  padding: calc(34px + env(safe-area-inset-top, 0px)) 40px 40px;
  background: linear-gradient(90deg, rgba(11, 11, 12, .92) 0%, rgba(11, 11, 12, .55) 55%, rgba(11, 11, 12, .1) 100%);
  pointer-events: none;
}
.auth-brand { color: #f2f2f2; }
.auth-art h1 { font: 800 clamp(34px, 4.4vw, 58px)/1 var(--display); letter-spacing: -.04em; max-width: 13ch; }
.auth-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 38ch; font-size: 15px; color: #c9c9ce; }
.auth-art li { padding-left: 22px; position: relative; }
.auth-art li::before { content: ""; position: absolute; left: 0; top: .62em; width: 10px; height: 2px; background: #f2f2f2; }
.auth-side { display: grid; place-items: center; padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px)); }
.auth-box { width: min(420px, 100%); display: grid; gap: 14px; }
.auth-box h2 { font: 800 clamp(28px, 4vw, 38px)/1.05 var(--display); letter-spacing: -.035em; }
.auth-box .lede { margin-top: -6px; }
.auth-form { display: grid; gap: 14px; margin-top: 6px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin-top: -6px; font-size: 13.5px; }
.auth-switch { font-size: 14px; color: var(--muted); text-align: center; }
.wide-btn { width: 100%; min-height: 44px; font-size: 15px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { width: 100%; padding-right: 70px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 28px; padding: 0 10px; border: 0; border-radius: 6px;
  background: var(--soft); color: var(--ink-2);
  font: 600 12px/1 var(--mono);
}
.pw-eye:hover { background: var(--line); }
.pw-meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 4px; align-items: center; margin-top: 2px; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--line); transition: background .25s; }
.pw-meter i.on { background: var(--ink); }
.pw-meter[data-n="1"] i.on { background: var(--bad); }
.pw-meter em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; min-width: 4ch; }
.auth-page .field .input { font-size: 15px; min-height: 44px; }
@media (max-width: 860px) {
  .auth-page { display: flex; flex-direction: column; }
  .auth-art { flex: none; min-height: 0; box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .09); }
  .auth-side { flex: 1 0 auto; }
  .auth-art-copy { min-height: 0; padding: calc(22px + env(safe-area-inset-top, 0px)) 22px 22px; gap: 14px; }
  .auth-art h1 { font-size: 30px; }
  .auth-art ul { display: none; }
}

/* ---------- v2: road calendar ---------- */

.road-chart { margin-bottom: 16px; }
.cal-panel { padding: 18px 20px 16px; }
.cal-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 20px; margin-bottom: 14px; }
.cal-title p { font-size: 13px; max-width: 70ch; }
.calendar { overflow-x: auto; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; min-width: 640px; }
.cal-head { margin-bottom: 6px; }
.cal-head span { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-left: 4px; }
.cal-cell {
  min-height: 96px; min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s;
}
.cal-cell:hover { border-color: var(--ink); }
.cal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.cal-d { font: 700 15px/1 var(--display); }
.cal-d small { font: 500 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.cal-t { font: 600 9.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cal-what { font-size: 12px; line-height: 1.3; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cal-what b { display: block; font-weight: 600; color: var(--ink); }
.cal-what .mono { font-size: 11px; color: inherit; opacity: .75; }
.cal-cell.contest { background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.cal-cell.contest .cal-t, .cal-cell.contest .cal-d small { color: var(--inv-muted); }
.cal-cell.contest .cal-what, .cal-cell.contest .cal-what b { color: var(--inv-ink); }
.cal-cell.review { background: var(--soft); }
.cal-cell.rest { border-style: dashed; background: transparent; }
.cal-cell.past { opacity: .5; }
.cal-cell.past.did { opacity: .78; }
.cal-cell.today { outline: 2px solid var(--ink); outline-offset: 2px; opacity: 1; }
.cal-wd { display: none; }
@media (max-width: 640px) {
  /* Phones get an agenda list from today onwards instead of a seven-column grid. */
  .calendar { overflow: visible; }
  .cal-head { display: none; }
  .cal-grid { grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 5px; }
  .cal-cell { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 2px 12px; min-height: 0; padding: 9px 12px; }
  .cal-cell.past:not(.today) { display: none; }
  .cal-top { display: contents; }
  .cal-d { grid-row: 1 / span 2; display: grid; align-content: start; gap: 3px; }
  .cal-wd { display: block; font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .cal-cell.contest .cal-wd { color: var(--inv-muted); }
  .cal-t { grid-column: 2; grid-row: 1; }
  .cal-what { grid-column: 2; font-size: 13px; -webkit-line-clamp: 2; }
  .cal-what b { display: inline; margin-right: 6px; }
  .cal-skips { grid-column: 2; }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--surface); display: inline-block; }
.lg.contest { background: var(--inv); border-color: var(--inv); }
.lg.review { background: var(--soft); }
.lg.rest { border-style: dashed; background: transparent; }
.lg.did { background: var(--surface); opacity: .6; }

/* ---------- admin page ---------- */

.admin-badge { margin-left: 0; }
.admin-who { font-size: 13px; }
@media (max-width: 640px) { .admin-who { display: none; } }
.admin-main { padding-block: 32px 48px; min-height: 70vh; }
.admin-main > #app { display: grid; align-content: start; gap: 18px; }
.admin-main .view-head { margin-bottom: 0; }
.admin-main .seg { margin-bottom: 0; }
.admin-main .seg .count { font: 600 11px/1 var(--mono); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 2px 6px; margin-left: 4px; }
.admin-main .seg button[aria-selected="true"] .count { background: var(--paper); color: var(--ink); }
#pane { display: grid; gap: 16px; }
.tile-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s; }
.tile-btn:hover:not([disabled]) { border-color: var(--ink); }
.tile-btn[disabled] { cursor: default; opacity: 1; }
.admin-help { max-width: 760px; display: grid; gap: 10px; }
.admin-search { display: flex; gap: 8px; max-width: 520px; }
.admin-search .input { flex: 1; }
.admin-main td .small, td.small, .small { font-size: 12.5px; }
.admin-main td { vertical-align: middle; }
form.inline { display: inline-flex; gap: 6px; align-items: center; }
.sm-select { min-height: 30px; padding: 0 8px; font-size: 13px; width: auto; }
.pager { justify-content: flex-end; }
.settings-form { display: grid; gap: 16px; max-width: 760px; }
.switch-line { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.switch-line input { width: 18px; height: 18px; accent-color: var(--ink); }
@media (max-width: 700px) {
  /* Each table row becomes a card so the action buttons stay on screen. */
  .admin-main .tbl table, .admin-main .tbl table.wide { min-width: 0; }
  .admin-main thead { display: none; }
  .admin-main tbody tr { display: grid; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .admin-main tbody tr:last-child { border-bottom: 0; }
  .admin-main tbody td { display: block; padding: 0; border: 0; }
  .admin-main tbody td:empty { display: none; }
  .admin-search { max-width: none; }
}
.admin-gate { max-width: 560px; margin: 8vh auto; display: grid; gap: 12px; }
.admin-gate h2 { font: 800 clamp(28px, 4vw, 40px)/1.05 var(--display); letter-spacing: -.03em; }

/* ---------- legal pages ---------- */

.legal { max-width: 720px; padding-block: 40px 56px; }
.legal h1 { font: 800 clamp(32px, 5vw, 48px)/1.02 var(--display); letter-spacing: -.035em; margin: 6px 0 8px; }
.legal h2 { font: 700 20px/1.25 var(--display); letter-spacing: -.01em; margin: 30px 0 8px; }
.legal p, .legal li { color: var(--ink-2); max-width: 68ch; }
.legal p + p { margin-top: 10px; }
.legal ul { padding-left: 20px; display: grid; gap: 6px; margin-top: 8px; }

/* ---------- team page ---------- */

.team { padding-block: 28px 56px; display: grid; gap: 22px; }
.team-hero {
  position: relative; overflow: hidden;
  min-height: min(78vh, 640px);
  border-radius: 22px; background: #0b0b0c; color: #f2f2f2;
  display: flex; align-items: flex-end;
}
.team-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.team-hero-copy { position: relative; z-index: 1; padding: clamp(28px, 5vw, 64px); max-width: 900px; pointer-events: none; }
.team-hero .eyebrow { color: #a9a9ae; }
.team-hero h1 { font: 800 clamp(56px, 11vw, 150px)/.9 var(--display); letter-spacing: -.055em; margin: 14px 0 22px; }
.team-lede { font-size: clamp(16px, 1.6vw, 19px); line-height: 1.5; color: #c9c9ce; max-width: 52ch; }
.team-hero .field-cap { color: #8b8b91; background: rgba(11, 11, 12, .72); }
.team-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 22px; }
.person {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(18px, 3vw, 34px); align-items: end;
  padding: clamp(24px, 4vw, 44px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  transition: border-color .2s var(--ease), transform .3s var(--ease);
}
.person:hover { border-color: var(--ink); transform: translateY(-2px); }
.person-mark {
  display: grid; place-items: center;
  width: clamp(96px, 13vw, 150px); aspect-ratio: 1; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font: 800 clamp(38px, 5.2vw, 60px)/1 var(--display); letter-spacing: -.04em;
}
.person h2 { font: 800 clamp(34px, 5vw, 64px)/.95 var(--display); letter-spacing: -.045em; text-transform: uppercase; }
.person-meta { margin-top: 12px; font: 500 13px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.person-meta span { opacity: .5; margin: 0 4px; }
.team-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 22px; }
.how { padding: 26px 26px 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); display: grid; gap: 10px; align-content: start; }
.how-n { font: 600 12px/1 var(--mono); letter-spacing: .1em; color: var(--muted); }
.how h3 { font: 800 clamp(24px, 2.6vw, 32px)/1.05 var(--display); letter-spacing: -.03em; }
.how p { color: var(--ink-2); }
.how.inv { background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.how.inv .how-n { color: var(--inv-muted); }
.how.inv p { color: var(--inv-ink); opacity: .85; }
.team-note { padding: 26px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; }
.team-note p:not(.eyebrow) { font-size: 17px; max-width: 60ch; }
@media (max-width: 560px) {
  .person { grid-template-columns: minmax(0, 1fr); }
  .team-hero { min-height: 520px; }
}

/* ---------- leaderboard ---------- */

.lb-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; margin-bottom: 18px; }
.lb-top .seg { margin-bottom: 0; }
.lb-me { font-size: 15px; }
.lb-me b { font: 700 18px/1 var(--display); }
.lb-gate { display: grid; gap: 12px; max-width: 560px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; margin: 6px 0 22px; }
.podium.n1 { grid-template-columns: minmax(0, 360px); }
.podium.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pod {
  position: relative; display: grid; gap: 4px; justify-items: start;
  padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
}
.pod.p1 { padding-top: 34px; background: var(--inv); border-color: var(--inv); color: var(--inv-ink); }
.pod.p1 .pod-unit, .pod.p1 .lb-handle { color: var(--inv-muted); }
.pod.you { box-shadow: 0 0 0 2px var(--ink); }
.pod-pos { font: 800 clamp(40px, 6vw, 64px)/.9 var(--display); letter-spacing: -.05em; }
.pod.p1 .pod-pos { font-size: clamp(56px, 8vw, 88px); }
.pod-name { font: 700 18px/1.2 var(--display); letter-spacing: -.01em; margin-top: 6px; overflow-wrap: anywhere; }
.pod-val { font: 700 30px/1 var(--mono); margin-top: 10px; color: var(--rc, currentColor); }
.pod-unit { font-size: 12.5px; color: var(--muted); }
.lb-tbl td { vertical-align: middle; }
.lb-tbl tr.you td { background: var(--soft); }
.lb-name { display: block; font-weight: 600; }
.lb-name .badge { margin-left: 6px; }
.lb-handle { display: inline-block; font-size: 12.5px; color: var(--rc, var(--muted)); text-decoration: none; }
a.lb-handle:hover { text-decoration: underline; }
.lb-rating, .lb-max { color: var(--rc, inherit); font-family: var(--mono); }
.lb-rating { font-weight: 700; }
@media (max-width: 640px) {
  .podium, .podium.n1, .podium.n2 { grid-template-columns: minmax(0, 1fr); }
  .podium .pod.p1 { order: -1; }
  .lb-opt { display: none; }
}

/* ---------- admin "view as" ---------- */

.view-banner { position: relative; z-index: 31; background: var(--inv); color: var(--inv-ink); font-size: 13.5px; }
.view-banner .muted { color: var(--inv-muted); }
.view-banner-in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding-block: 8px; }
.view-banner .btn { background: var(--inv-ink); color: var(--inv); border-color: var(--inv-ink); }
body.viewing #accountBtn, body.viewing #syncState { display: none !important; }
body.viewing .check, body.viewing form button, body.viewing [data-act="toggle"] { cursor: not-allowed; }
.user-link { color: inherit; text-decoration: none; }
.user-link:hover b { text-decoration: underline; text-underline-offset: 2px; }
