:root {
  --ink: #101b2d;
  --paper: #f1f3f6;
  --surface: #ffffff;
  --line: #d8dde5;
  --muted: #5d6a7e;
  --focus: #1b5fd1;
  --spooned: #076b67;
  --lucky: #2aa399;
  --even: #8793a6;
  --dry: #c4661f;
  --very-dry: #8f2d0f;
  --band: #e6e9ee;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8ecf2;
    --paper: #0c1420;
    --surface: #131d2e;
    --line: #26344b;
    --muted: #94a1b5;
    --focus: #6ea2ff;
    --spooned: #43d3c6;
    --lucky: #2aa399;
    --even: #6f7d93;
    --dry: #f09a52;
    --very-dry: #ff7a55;
    --band: #1b283d;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
.num, .score, td, .tabular { font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration-color: var(--even); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.shell { max-width: 1040px; margin: 0 auto; padding: 0 20px 80px; }
.top { display: flex; justify-content: space-between; align-items: baseline; padding: 22px 0; }
.brand { font: 800 20px/1 var(--display); letter-spacing: -0.01em; text-decoration: none; }
.top__link { color: var(--muted); font-size: 14px; }

/* intro */
.intro { padding: 36px 0 20px; max-width: 720px; }
h1 { font: 800 clamp(34px, 6vw, 58px)/1.02 var(--display); letter-spacing: -0.03em; margin: 0 0 16px; text-wrap: balance; }
.intro__lede { font-size: 18px; color: var(--muted); margin: 0 0 28px; max-width: 58ch; }
.search { display: flex; gap: 10px; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.search input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search button { font: 700 16px var(--body); padding: 0 26px; border: 0; border-radius: 10px; background: var(--ink); color: var(--paper); cursor: pointer; }
.search button:disabled { opacity: .5; cursor: progress; }
.options { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); cursor: pointer; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--even); text-underline-offset: 3px; cursor: pointer; }
.assume { margin-top: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.assume__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.assume label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.assume input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); }
.status { min-height: 1.5em; margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.status[data-tone="error"] { color: var(--dry); }

/* section headings */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
h2 { font: 700 26px/1.15 var(--display); letter-spacing: -0.015em; margin: 0; }
h3 { font: 700 17px/1.2 var(--display); margin: 0 0 8px; }

/* leaderboard */
.board { margin-top: 36px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ladder__row { display: grid; grid-template-columns: 34px minmax(120px, 190px) 1fr 96px; align-items: center; gap: 18px; padding: 16px 20px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ladder__row:hover { border-color: var(--even); }
.ladder__row[aria-current="true"] { border-color: var(--ink); }
.ladder__rank { font: 700 18px var(--display); color: var(--muted); }
.ladder__name { font: 700 19px/1.2 var(--display); overflow-wrap: anywhere; }
.ladder__meta { display: block; font: 400 13px var(--body); color: var(--muted); margin-top: 2px; }
.score { text-align: right; }
.score__n { display: block; font: 800 40px/1 var(--display); letter-spacing: -0.03em; }
.score__l { font-size: 12px; color: var(--muted); }

/* spectrum strip: the one distinctive element */
.strip { position: relative; height: 62px; padding-bottom: 14px; }
.strip__axis { position: absolute; left: 0; right: 0; top: calc(50% - 7px); height: 2px; background: var(--band); transform: translateY(-50%); }
.strip__mid { position: absolute; top: 6px; bottom: 6px; left: 15%; right: 15%; background: var(--band); opacity: .55; border-radius: 6px; }
.strip__dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 1.5px solid var(--surface); }
.strip__ends { position: absolute; left: 0; right: 0; bottom: -2px; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.strip--lg { height: 84px; }

.tone-spooned { --tone: var(--spooned); }
.tone-lucky { --tone: var(--lucky); }
.tone-on-rate { --tone: var(--even); }
.tone-dry { --tone: var(--dry); }
.tone-very-dry { --tone: var(--very-dry); }
.strip__dot, .pill__dot, .meter__mark { background: var(--tone); }

.failed { list-style: none; padding: 0; margin: 12px 0 0; color: var(--dry); font-size: 14px; }

/* player detail */
.player { margin-top: 44px; }
.player__head { display: grid; grid-template-columns: 1fr auto; gap: 8px 32px; align-items: end; margin-bottom: 18px; }
.player__name { font: 800 clamp(30px, 5vw, 44px)/1.05 var(--display); letter-spacing: -0.025em; margin: 0; overflow-wrap: anywhere; }
.player__facts { margin: 8px 0 0; color: var(--muted); }
.player__facts b { color: var(--ink); font-weight: 600; }
.player__strip { grid-column: 1 / -1; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; }
.seg { display: inline-flex; background: var(--band); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { font: 500 14px var(--body); padding: 7px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.rows { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.rows__head, .act__main { display: grid; grid-template-columns: minmax(150px, 1.4fr) 96px 70px 78px minmax(150px, 1.2fr) 108px; gap: 14px; align-items: center; padding: 0 18px; }
.rows__head { padding-top: 10px; padding-bottom: 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.act { border-bottom: 1px solid var(--line); }
.act:last-child { border-bottom: 0; }
.act summary { list-style: none; cursor: pointer; }
.act summary::-webkit-details-marker { display: none; }
.act__main { min-height: 54px; }
.act[open] .act__main { background: color-mix(in srgb, var(--band) 45%, transparent); }
.act__name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.act__name::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.act[open] .act__name::before { transform: rotate(45deg); }
.tag { font: 500 12px var(--body); padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.num { text-align: right; }
.meter { position: relative; height: 8px; background: var(--band); border-radius: 4px; }
.meter__zone { position: absolute; top: 0; bottom: 0; left: 15%; right: 15%; background: color-mix(in srgb, var(--even) 30%, transparent); }
.meter__mark { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; }
.meter__val { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pill { display: inline-flex; gap: 7px; align-items: center; font-weight: 600; font-size: 14px; white-space: nowrap; }
.pill__dot { width: 9px; height: 9px; border-radius: 50%; }
.act__body { padding: 6px 18px 16px; font-size: 14px; }
.act__body table { width: 100%; max-width: 640px; border-collapse: collapse; margin: 6px 0 10px; }
.act__body th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 4px 8px 4px 0; }
.act__body td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line); }
.act__body td.n, .act__body th.n { text-align: right; }
.warn { color: var(--dry); margin: 6px 0; }
.empty { padding: 28px 18px; color: var(--muted); }
.notice { background: color-mix(in srgb, var(--dry) 12%, transparent); border: 1px solid color-mix(in srgb, var(--dry) 40%, var(--line)); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }

/* method */
.method { margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); }
.method__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; margin-top: 18px; }
.method p { margin: 0 0 10px; color: var(--muted); max-width: 52ch; }

@media (max-width: 760px) {
  .ladder__row { grid-template-columns: 26px 1fr auto; gap: 10px 14px; padding: 14px; }
  .ladder__row .strip { grid-column: 1 / -1; order: 4; }
  .rows__head { display: none; }
  .act__main { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 16px; }
  .act__main > :nth-child(n+2) { font-size: 13px; }
  .act__kc, .act__log, .act__exp { text-align: left; }
  .act__main > .meter-cell { grid-column: 1 / -1; }
  .player__head { grid-template-columns: 1fr; }
  .search { flex-direction: column; }
  .search button { padding: 13px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .act__name::before { transition: none; } }
