@font-face {
  font-family: "Manrope";
  src: url("./manrope-latin.e310b55a7fd9.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Manrope";
  src: url("./manrope-latin-ext.ce093b341d9c.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Syne";
  src: url("./syne-latin.cfff412005ee.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Syne";
  src: url("./syne-latin-ext.79bc839264c4.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


:root {
  --bg: #fbfdff;
  --ink: #07184b;
  --ink-2: #2a3b73;
  --ice: #eafcff;
  --night: #07184b;
  --night-ink: #fbfdff;
  --blue: #3157ff;
  --panel: #1834b8;
  --panel-deep: #10278c;
  --panel-ink: #ffffff;
  --panel-line: rgba(255, 255, 255, 0.55);
  --cyan: #82f3ff;
  --acid: #dfff4f;
  --magenta: #ff3ba7;
  --accent: #1834b8;
  --hot: #a30059;
  --line: #07184b;
  --line-soft: #6f82c8;
  --band: rgba(49, 87, 255, 0.2);
  --result-bg: #82f3ff;
  --shadow: #82f3ff;
  --pos-1: #ffe6f3; --pos-2: #ffc4e2; --pos-3: #ffa6d6; --pos-4: #ff86c5;
  --neg-1: #e4f7ff; --neg-2: #bfeaff; --neg-3: #8fd8ff; --neg-4: #62c4f7;
  --cell-ink: #07184b;
  --max: 1240px;
  --bar-h: 56px;
  color-scheme: light;
  font-family: "Manrope", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060d24; --ink: #eaf0ff; --ink-2: #b4c2ee; --ice: #0a1640;
    --night: #02081f; --night-ink: #eaf0ff;
    --panel: #0f2279; --panel-deep: #0a1858; --panel-line: rgba(234, 240, 255, 0.5);
    --accent: #82f3ff; --hot: #ff7cc4; --line: #eaf0ff; --line-soft: #566bb8;
    --band: rgba(130, 243, 255, 0.2); --result-bg: #0b2a55; --shadow: #1d3a8f;
    --pos-1: #2a1030; --pos-2: #4d1342; --pos-3: #70145a; --pos-4: #8f1570;
    --neg-1: #0c2a4a; --neg-2: #0f3d66; --neg-3: #135183; --neg-4: #14578f;
    --cell-ink: #ffffff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #060d24; --ink: #eaf0ff; --ink-2: #b4c2ee; --ice: #0a1640;
  --night: #02081f; --night-ink: #eaf0ff;
  --panel: #0f2279; --panel-deep: #0a1858; --panel-line: rgba(234, 240, 255, 0.5);
  --accent: #82f3ff; --hot: #ff7cc4; --line: #eaf0ff; --line-soft: #566bb8;
  --band: rgba(130, 243, 255, 0.2); --result-bg: #0b2a55; --shadow: #1d3a8f;
  --pos-1: #2a1030; --pos-2: #4d1342; --pos-3: #70145a; --pos-4: #8f1570;
  --neg-1: #0c2a4a; --neg-2: #0f3d66; --neg-3: #135183; --neg-4: #14578f;
  --cell-ink: #ffffff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.58;
  overflow-x: hidden;
}

section[id] { scroll-margin-top: calc(var(--bar-h) + 8px); }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.16em; }

button, a:focus-visible { outline: none; }

button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid var(--magenta);
  outline-offset: 3px;
}

.skip-link {
  position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px;
  color: var(--bg); background: var(--ink); transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.shell { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: var(--bar-h); padding-inline: max(16px, calc((100% - var(--max)) / 2));
  background: var(--bg); border-bottom: 2px solid var(--line);
}
.home {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  font: 800 0.86rem/1 "Syne", sans-serif; letter-spacing: 0.02em; text-decoration: none;
}
.home-ball {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  color: #07184b; background: var(--acid); border: 2px solid #07184b; font: 800 0.8rem/1 "Syne", sans-serif;
}
.topnav {
  display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-size: 0.8rem; font-weight: 750; text-decoration: none; border-bottom: 3px solid transparent;
}
.topnav a:hover { border-bottom-color: var(--line-soft); }
.topnav a[aria-current="true"] { border-bottom-color: var(--magenta); }
.spacer { flex: 1 1 0; }
.chip {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px;
  border: 2px solid var(--line); border-radius: 999px; font-size: 0.78rem; font-weight: 800; text-decoration: none;
}
.icon-btn {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  color: var(--ink); background: transparent; border: 2px solid var(--line); border-radius: 50%; cursor: pointer;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
.progress { position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; pointer-events: none; }
.progress-ball {
  position: absolute; left: 0; top: -6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--acid); border: 2px solid #07184b;
  transform: translateX(calc(var(--progress, 0) * (100vw - 14px)));
}

/* ---------- reading rail */
.rail { display: none; }
@media (min-width: 76rem) {
  .rail {
    position: fixed; z-index: 30; right: 1.4rem; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 4px;
  }
  .rail a {
    position: relative; display: flex; align-items: center; justify-content: flex-end;
    width: 22px; height: 22px; text-decoration: none;
  }
  .rail a::after {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-soft);
    transition: transform 140ms ease, background-color 140ms ease;
  }
  .rail a[aria-current="true"]::after { background: var(--magenta); transform: scale(1.5); }
  .rail-label {
    position: absolute; right: 26px; padding: 3px 8px; font-size: 0.72rem; font-weight: 800; white-space: nowrap;
    color: var(--bg); background: var(--ink); opacity: 0; pointer-events: none; transition: opacity 120ms ease;
  }
  .rail a:hover .rail-label, .rail a:focus-visible .rail-label { opacity: 1; }
}

/* ---------- type */
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3 {
  font-family: "Syne", sans-serif; line-height: 1; letter-spacing: -0.04em; text-wrap: balance;
  overflow-wrap: normal; word-break: normal; hyphens: none;
}
h1 { max-width: 1000px; margin: 0; font-size: clamp(2.3rem, 5.2vw, 4.8rem); font-weight: 800; }
h3 { margin: 0 0 14px; font-size: clamp(1.15rem, 1.8vw, 1.6rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.12; }
.eyebrow { margin: 0 0 22px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.14em; line-height: 1.3; text-transform: uppercase; }

/* ---------- hero */
.hero { display: grid; align-content: center; padding-block: clamp(48px, 8vw, 108px) 44px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr); gap: clamp(36px, 6vw, 90px); align-items: end; }
.hero-grid > *, .tool-heading > *, .section-heading > *, .result-summary > * { min-width: 0; }
.hero-lead { max-width: 780px; margin: 30px 0 0; font-size: clamp(1.1rem, 1.9vw, 1.45rem); line-height: 1.45; }
.hero-gauge { position: relative; min-height: 340px; display: grid; place-items: center; }
.hero-drum {
  position: absolute; width: min(100%, 340px); aspect-ratio: 1; border: 3px solid var(--line); border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255,255,255,0.9) 0 5%, transparent 5.5%),
    repeating-radial-gradient(circle, transparent 0 15%, rgba(49,87,255,0.15) 15.4% 15.9%),
    var(--ice);
  box-shadow: 12px 16px 0 var(--shadow), inset 0 0 0 14px rgba(255,255,255,0.35);
  transform: rotate(-7deg);
}
.hero-drum::before, .hero-drum::after { content: ""; position: absolute; border-radius: 50%; border: 3px solid #07184b; background: #fbfdff; }
.hero-drum::before { width: 21%; aspect-ratio: 1; left: 17%; top: 49%; }
.hero-drum::after { width: 15%; aspect-ratio: 1; right: 18%; top: 31%; background: var(--acid); }
.gauge-readout {
  position: relative; z-index: 1; width: min(100%, 290px); padding: 16px 20px; border: 3px solid #07184b;
  color: #07184b; background: #fbfdff; transform: rotate(2deg); box-shadow: 8px 8px 0 var(--magenta);
}
.gauge-value { display: block; font: 800 clamp(2.6rem, 4vw, 3.4rem)/1 "Syne", sans-serif; letter-spacing: -0.06em; }
.gauge-label { display: block; margin-top: 6px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }

.hero-facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 48px 0 0; padding: 0; list-style: none;
  border: 2px solid var(--line);
}
.hero-facts li { border-right: 2px solid var(--line); }
.hero-facts li:last-child { border-right: 0; }
.hero-facts a { display: block; height: 100%; padding: 22px; text-decoration: none; }
.hero-facts a:hover { background: var(--ice); }
.hero-facts strong { display: block; margin-bottom: 8px; color: var(--accent); font: 800 1.15rem/1.1 "Syne", sans-serif; letter-spacing: -0.02em; }
.hero-facts span { display: block; font-size: 0.96rem; line-height: 1.5; }
.hero-foot { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 32px; margin-top: 30px; padding-top: 18px; border-top: 2px solid var(--line); }
.asof { margin: 0; max-width: 700px; font-weight: 700; }
.asof a { color: var(--hot); }
.jump-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; min-height: 44px; }
.jump-link::after { content: "↓"; font-size: 1.3rem; }

/* ---------- picker */
.tool-section { color: var(--panel-ink); background: var(--panel); border-block: 3px solid var(--line); }
.tool-shell { padding-block: clamp(56px, 8vw, 104px); }
.tool-heading { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: clamp(24px, 5vw, 72px); align-items: end; margin-bottom: 46px; }
.tool-heading h2, .section-heading h2 { margin: 0; font-size: clamp(2rem, 3.8vw, 3.7rem); font-weight: 800; }
.tool-intro { max-width: 590px; margin: 0 0 4px; font-size: 1.12rem; }
.machine { display: grid; grid-template-columns: minmax(370px, 0.84fr) minmax(470px, 1.16fr); border: 3px solid var(--panel-ink); background: var(--panel-deep); box-shadow: 14px 14px 0 var(--shadow); }
.controls-panel { padding: clamp(24px, 4vw, 48px); border-right: 3px solid var(--panel-ink); }
.selection-fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.selection-fieldset legend { width: 100%; margin-bottom: 16px; font-weight: 800; }
.selection-rack { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-bottom: 12px; }
.selection-slot { display: grid; place-items: center; min-width: 0; aspect-ratio: 1; border: 2px solid var(--panel-line); border-radius: 50%; color: transparent; background: rgba(255,255,255,0.06); font-weight: 800; font-variant-numeric: tabular-nums; }
.selection-slot.filled { color: #07184b; background: var(--acid); border-color: #07184b; box-shadow: inset -3px -4px 0 rgba(7,24,75,0.18); }
.selected-count { min-height: 1.5em; margin: 0 0 18px; color: var(--cyan); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.number-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ball-button { min-width: 44px; min-height: 44px; aspect-ratio: 1; padding: 0; border: 2px solid var(--panel-ink); border-radius: 50%; color: var(--panel-ink); background: transparent; font: 750 0.82rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; cursor: pointer; transition: color 140ms ease, background-color 140ms ease, transform 140ms ease; }
.ball-button:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.ball-button[aria-pressed="true"] { color: #07184b; background: var(--acid); border-color: var(--acid); box-shadow: inset -3px -3px 0 rgba(7,24,75,0.2); transform: translateY(-2px); }
.ball-button:disabled { opacity: 0.7; cursor: wait; }
.machine-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 22px; }
.action-button { min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); color: var(--ink); background: transparent; font: 800 0.8rem/1.2 "Manrope", sans-serif; cursor: pointer; }
.tool-section .action-button { border-color: var(--panel-ink); color: var(--panel-ink); }
.action-button.primary { grid-column: 1 / -1; min-height: 58px; color: #07184b !important; background: var(--cyan); border-color: #07184b !important; box-shadow: 6px 6px 0 #07184b; font-size: 0.88rem; }
.action-button:hover:not(:disabled) { background: var(--acid); color: #07184b; border-color: #07184b; }
.action-button:disabled { opacity: 0.62; cursor: not-allowed; box-shadow: none; }
.no-js-note { padding: 13px 15px; margin: 20px 0 0; color: #07184b; background: var(--acid); font-size: 0.86rem; }
.js .no-js-note { display: none; }
.js.load-failed .no-js-note { display: block; }
.drum-panel { position: relative; display: grid; min-width: 0; padding: clamp(20px, 3vw, 40px); overflow: hidden; background: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px), var(--panel-deep); background-size: 28px 28px; }
.drum-frame { position: relative; width: 100%; max-width: 660px; margin: auto; aspect-ratio: 1; border: 3px solid var(--panel-ink); border-radius: 50%; background: radial-gradient(circle, rgba(130,243,255,0.18), transparent 64%); box-shadow: inset 0 0 0 12px rgba(255,255,255,0.07), 10px 12px 0 rgba(130,243,255,0.4); }
.drum-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ring-line { fill: none; stroke: rgba(255,255,255,0.42); stroke-width: 1.2; }
.ring-line.inner { stroke: var(--cyan); stroke-width: 1.8; }
.draw-mark { fill: #ffffff; opacity: 0.8; }
.draw-mark.best { fill: var(--magenta); opacity: 1; stroke: #ffffff; stroke-width: 0.8; }
.draw-mark.exact { fill: var(--acid); stroke: #07184b; stroke-width: 1.2; }
.draw-layer { opacity: 0; transition: opacity 420ms ease; }
.drum-ready .draw-layer { opacity: 1; }
.drum-center { position: absolute; inset: 50% auto auto 50%; width: 72px; aspect-ratio: 1; display: grid; place-items: center; border: 2px solid #ffffff; border-radius: 50%; color: #07184b; background: var(--cyan); font: 800 0.82rem/1 "Syne", sans-serif; transform: translate(-50%, -50%); pointer-events: none; }
.drum-axis-label { position: absolute; left: 50%; padding: 2px 7px; color: #07184b; background: #fbfdff; font-size: 0.64rem; font-weight: 800; transform: translateX(-50%); pointer-events: none; }
.drum-axis-label[data-ring="0"] { top: 1.2%; }
.drum-axis-label[data-ring="1"] { top: 8.2%; }
.drum-axis-label[data-ring="2"] { top: 15.8%; }
.drum-axis-label[data-ring="3"] { top: 23.8%; }
.drum-axis-label[data-ring="4"] { top: 31.6%; }
.drum-axis-label[data-ring="5"] { top: 39%; }
.drum-caption { max-width: 540px; margin: 26px auto 0; color: var(--panel-ink); font-size: 0.86rem; text-align: center; }

/* ---------- result */
.result-section { border-top: 3px solid var(--line); background: var(--result-bg); }
.result-shell { padding-block: clamp(56px, 8vw, 96px); }
.result-summary { display: grid; grid-template-columns: 0.72fr 1.28fr; gap: clamp(28px, 6vw, 90px); align-items: start; }
.result-figure { margin: 0; font: 800 clamp(5rem, 12vw, 10rem)/0.82 "Syne", sans-serif; letter-spacing: -0.08em; }
.result-figure small { font-size: 0.26em; letter-spacing: -0.03em; }
.result-copy h2 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.8rem); }
.best-list { padding: 0; margin: 28px 0 0; list-style: none; border-top: 2px solid var(--line); }
.best-draw, .best-list li { display: grid; grid-template-columns: minmax(130px, 0.45fr) 1fr auto; gap: 16px; align-items: center; padding-block: 14px; border-bottom: 1px solid var(--line-soft); }
.best-numbers { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-ball { display: inline-grid; place-items: center; width: 34px; aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 50%; font-size: 0.7rem; font-weight: 800; flex: none; }
.mini-ball.common { color: #ffffff; background: var(--blue); border-color: var(--blue); }
.best-count { font-size: 0.74rem; font-weight: 800; text-align: right; }
.distribution { margin-top: 64px; padding-top: 30px; border-top: 3px solid var(--line); }
.distribution-head { display: grid; grid-template-columns: 1fr 0.8fr; gap: 40px; align-items: end; margin-bottom: 28px; }
.distribution h3 { margin: 0; font-size: clamp(1.8rem, 3.4vw, 3.2rem); }
.distribution-intro { margin: 0; }
.histogram { display: grid; gap: 12px; }
.hist-header { margin-bottom: 9px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.hist-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) 110px 110px; gap: 14px; align-items: center; }
.hist-row > * { min-width: 0; }
.hist-label { font-weight: 800; }
.hist-track { position: relative; display: block; width: 100%; min-width: 0; height: 28px; border-block: 1px solid var(--line); background: rgba(255,255,255,0.3); overflow: visible; }
.hist-observed { fill: var(--blue); }
.hist-expected { stroke: var(--hot); stroke-width: 7; }
.hist-value { font-variant-numeric: tabular-nums; text-align: right; }
.hist-value.expected { font-size: 0.84rem; }
.crowd { margin-top: 56px; padding: 26px 28px; border: 2px solid var(--line); background: var(--bg); }
.crowd h3 { margin: 0 0 10px; font-size: 1.5rem; }
.crowd-text { margin: 0 0 10px; font-size: 1.1rem; font-weight: 650; }
.crowd-note { margin: 0; color: var(--ink-2); font-size: 0.92rem; }

/* ---------- editorial sections */
.static-section { padding-block: clamp(64px, 9vw, 120px); }
.section-heading { display: grid; grid-template-columns: 0.4fr 1.6fr; gap: clamp(28px, 6vw, 90px); align-items: start; }
.section-body { max-width: 780px; margin: 36px 0 0 auto; font-size: clamp(1.06rem, 1.7vw, 1.26rem); }
.static-section p { max-width: 74ch; }
.chance-section { color: var(--night-ink); background: var(--night); }
.chance-section h3 { color: var(--night-ink); }
.chance-fraction { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 28px; margin-top: 44px; padding-block: 16px; border-block: 2px solid var(--cyan); }
.chance-one { color: var(--acid); font: 800 clamp(4.4rem, 13vw, 11rem)/0.8 "Syne", sans-serif; letter-spacing: -0.08em; }
.chance-denominator { font: 800 clamp(2rem, 6vw, 5.6rem)/0.95 "Syne", sans-serif; letter-spacing: -0.06em; overflow-wrap: anywhere; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); margin-top: 64px; }
.two-col > * { min-width: 0; }
.ring-ledger { margin-top: 24px; border-block: 3px solid var(--cyan); }
.ring-row { display: grid; grid-template-columns: 76px 1fr; gap: 16px; align-items: baseline; padding-block: 13px; border-bottom: 1px solid rgba(255,255,255,0.3); }
.ring-row:last-child { border-bottom: 0; }
.ring-match { font: 800 1.35rem/1 "Syne", sans-serif; }
.ring-total { font: 800 clamp(1.4rem, 2.6vw, 2.3rem)/1 "Syne", sans-serif; letter-spacing: -0.05em; }
.ring-unit { margin-left: 10px; font-size: 0.8rem; font-weight: 700; }

/* rows with bar tracks */
.rows { display: grid; gap: 10px; margin: 22px 0; }
.row { display: grid; grid-template-columns: minmax(150px, 0.9fr) 64px minmax(0, 1.6fr); gap: 14px; align-items: center; }
.row > * { min-width: 0; }
.row-label { font-weight: 750; font-size: 0.94rem; }
.row-label small { display: block; color: var(--ink-2); font-weight: 600; font-size: 0.78rem; }
.row-fig { font: 800 1rem/1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; text-align: right; }
.row-n { display: none; }
.row-head { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.gap-rows .row { grid-template-columns: minmax(130px, 0.9fr) 70px 70px minmax(0, 1.5fr); }
.gap-rows .row-n { display: block; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; font-size: 0.86rem; }
.chance-section .row-label small, .chance-section .row-fig { color: var(--night-ink); }
.track { display: block; width: 100%; height: 28px; overflow: visible; border-block: 1px solid var(--line-soft); }
.t-band { fill: var(--band); }
.t-bar { fill: var(--accent); }
.t-bar.pos { fill: var(--accent); }
.t-bar.neg { fill: var(--hot); }
.t-bar.accent { fill: var(--magenta); }
.t-mark { stroke: var(--accent); stroke-width: 4; vector-effect: non-scaling-stroke; }
.t-mark.pos { stroke: var(--accent); }
.t-mark.neg { stroke: var(--hot); }
.t-ref { stroke: var(--hot); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.t-zero { stroke: var(--line); stroke-width: 2; vector-effect: non-scaling-stroke; }
.row.now .row-label { color: var(--hot); }
.legend { color: var(--ink-2); font-size: 0.88rem; }
.chance-section .legend { color: var(--night-ink); }
.chance-section .track { border-color: rgba(255,255,255,0.4); }
.chance-section .t-bar { fill: var(--cyan); }
.chance-section .t-bar.accent { fill: var(--acid); }
.chance-section .row.now .row-label { color: var(--acid); }

/* ball board */
.tests-section { background: var(--ice); }
.board-wrap { margin-top: 56px; }
.board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 18px 0; padding: 0; list-style: none; max-width: 760px; }
.ball-stat { display: grid; place-items: center; align-content: center; gap: 2px; aspect-ratio: 1.15; min-width: 0; padding: 4px; border: 2px solid var(--line); border-radius: 50%; background: var(--bg); text-align: center; }
.ball-stat .b-num { font: 800 1rem/1 "Syne", sans-serif; }
.ball-stat .b-count { font-size: 0.74rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ball-stat.out { border-color: var(--magenta); border-width: 4px; box-shadow: 0 0 0 2px var(--bg); }
.board.simulated .ball-stat { border-style: dashed; background: transparent; }
.board-badge { display: inline-block; margin: 0 0 6px; padding: 4px 10px; color: #07184b; background: var(--acid); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; }
.board-note { color: var(--ink-2); font-size: 0.9rem; }
.board-actions { margin: 14px 0; }
.board-actions .action-button { min-width: 240px; }
.board-table { margin-top: 18px; max-width: 760px; }
.board-table summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.table-scroll { position: relative; overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th { border-bottom: 2px solid var(--line); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
tbody th { font-weight: 650; }
.score { min-width: 640px; }
.score tbody th { min-width: 240px; }
.score td:nth-child(n+2) { white-space: nowrap; }
.verdict-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--accent); }
tr.outside .verdict-dot { background: var(--magenta); border: 2px solid var(--hot); }
tr.outside td, tr.outside th { background: rgba(255, 59, 167, 0.12); }
.score-wrap, .trend-wrap { margin-top: 64px; }

/* lists */
.lists { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin: 40px 0; }
.ball-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ball-list li { display: flex; align-items: center; gap: 12px; }
.gap-section { background: var(--bg); }
.players-section { background: var(--ice); }
.players-section h3 { margin-top: 52px; }
.prose-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); margin-top: 36px; }
.prose-pair p { margin: 0; font-size: 1.1rem; }
.stair-rows .row { grid-template-columns: minmax(170px, 0.9fr) 64px minmax(0, 1.6fr); }
.effect-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 760px; margin: 18px 0; padding: 0; list-style: none; }
.effect-cell { display: grid; place-items: center; align-content: center; gap: 2px; aspect-ratio: 1.15; min-width: 0; padding: 3px; color: var(--cell-ink); border: 1px solid var(--line-soft); text-align: center; }
.effect-cell .b-num { font: 800 0.95rem/1 "Syne", sans-serif; }
.effect-cell .b-count { font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-1 { background: var(--pos-1); } .pos-2 { background: var(--pos-2); } .pos-3 { background: var(--pos-3); } .pos-4 { background: var(--pos-4); }
.neg-1 { background: var(--neg-1); } .neg-2 { background: var(--neg-2); } .neg-3 { background: var(--neg-3); } .neg-4 { background: var(--neg-4); }
.key { display: inline-block; width: 14px; height: 14px; margin: 0 6px 0 14px; vertical-align: -2px; border: 1px solid var(--line-soft); }
.legend .key:first-child { margin-left: 0; }
.takeaway { margin-top: 56px; padding: 28px 30px; border: 3px solid var(--line); background: var(--bg); box-shadow: 10px 10px 0 var(--magenta); }
.takeaway h3 { margin-top: 0; }
.takeaway p { margin: 0; font-size: 1.12rem; }

/* method, sources, footer */
.method-section { background: var(--bg); }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 48px; border: 2px solid var(--line); }
.method-grid > div { padding: 24px; border-right: 2px solid var(--line); }
.method-grid > div:last-child { border-right: 0; }
.method-grid h3 { font-size: 1.15rem; }
.method-grid p { margin: 0; font-size: 0.94rem; }
.sources { padding: 54px 0 90px; border-top: 3px solid var(--line); }
.sources h2 { margin: 0 0 24px; font-size: 1.6rem; }
.source-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 0; margin: 0; list-style: none; }
.source-list a { font-weight: 750; }
.source-meta { display: block; margin-top: 6px; font-size: 0.78rem; color: var(--ink-2); }
.related-title { margin-top: 44px; }
.related-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 0; margin: 0; list-style: none; }
.related-list a { display: block; height: 100%; padding: 16px 18px; border: 2px solid var(--line); text-decoration: none; }
.related-list a:hover { background: var(--ice); }
.related-list strong { display: block; margin-bottom: 4px; }
.related-list span { font-size: 0.9rem; color: var(--ink-2); }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 36px; }
.share-label { margin-right: 6px; color: var(--ink-2); font-size: 0.82rem; font-weight: 700; }
.icon-link { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--line-soft); border-radius: 50%; cursor: pointer; text-decoration: none; }
.icon-link:hover { color: var(--accent); border-color: var(--accent); }
.share-status { min-width: 1px; margin-left: 8px; font-size: 0.82rem; color: var(--ink-2); }
.site-footer { color: var(--night-ink); background: var(--night); border-top: 12px solid var(--magenta); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; min-height: 140px; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 20px; }
.top-target:focus { outline: none; }
.back-to-top {
  position: fixed; z-index: 40; right: 18px; bottom: calc(var(--back-top-lift, 18px) + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 9px 14px;
  border: 2px solid #07184b; border-radius: 999px; color: #07184b; background: var(--acid);
  font: 800 0.76rem/1.1 "Manrope", sans-serif; cursor: pointer; text-decoration: none;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px); transition: transform 160ms ease;
}
.back-to-top.visible { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.no-js .back-to-top { position: static; width: max-content; margin: 0 24px 24px auto; opacity: 1; visibility: visible; pointer-events: auto; transform: none; display: flex; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }

@media (max-width: 980px) {
  .hero-grid, .tool-heading, .section-heading, .result-summary, .two-col, .prose-pair { grid-template-columns: 1fr; }
  .hero-gauge { min-height: 300px; }
  .hero-facts { grid-template-columns: 1fr; }
  .hero-facts li { border-right: 0; border-bottom: 2px solid var(--line); }
  .hero-facts li:last-child { border-bottom: 0; }
  .machine { grid-template-columns: 1fr; }
  .controls-panel { border-right: 0; border-bottom: 3px solid var(--panel-ink); }
  .drum-panel { min-height: 560px; }
  .distribution-head { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .method-grid > div:nth-child(2) { border-right: 0; }
  .method-grid > div:nth-child(-n+2) { border-bottom: 2px solid var(--line); }
  .lists { grid-template-columns: 1fr; }
  .section-body { margin-left: 0; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  .shell { width: min(100% - 32px, var(--max)); }
  .tool-section .shell { width: min(100% - 12px, var(--max)); }
  .topbar { gap: 8px; padding-inline: 12px; }
  .home { font-size: 0; gap: 0; }
  .home-ball { font-size: 0.8rem; }
  .hero { padding-top: 40px; }
  h1 { font-size: clamp(1.7rem, 7.2vw, 2.4rem); }
  .tool-heading h2, .section-heading h2 { font-size: clamp(1.9rem, 8vw, 2.7rem); }
  .hero-gauge { min-height: 260px; }
  .hero-drum { max-width: 240px; }
  .hero-foot { grid-template-columns: 1fr; margin-top: 26px; }
  .machine { box-shadow: 7px 8px 0 var(--shadow); }
  .controls-panel { padding: 20px 14px 26px; }
  .number-grid { gap: 4px; }
  .ball-button { min-width: 0; }
  .machine-actions { grid-template-columns: 1fr; }
  .action-button.primary { grid-column: auto; }
  .drum-panel { min-height: auto; padding: 26px 16px 36px; }
  .drum-frame { max-width: 430px; }
  .drum-center { width: 54px; font-size: 0.67rem; }
  .drum-axis-label { font-size: 0.55rem; }
  .best-draw, .best-list li { grid-template-columns: 1fr; gap: 8px; }
  .best-count { text-align: left; }
  .hist-row { grid-template-columns: 45px minmax(0,1fr) 72px; gap: 8px; }
  .hist-header span:nth-child(2) { display: none; }
  .hist-header span:nth-child(4) { grid-column: 2 / -1; }
  .hist-value.expected { grid-column: 2 / -1; text-align: left; margin-top: -8px; }
  .chance-fraction { grid-template-columns: 1fr; gap: 12px; }
  .row, .stair-rows .row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .row .track { grid-column: 1 / -1; }
  .gap-rows .row { grid-template-columns: 1fr auto auto; }
  .gap-rows .row-head .row-label { grid-column: 1; }
  .board, .effect-grid { gap: 4px; }
  .ball-stat .b-count, .effect-cell .b-count { font-size: 0.62rem; }
  .ball-stat .b-num, .effect-cell .b-num { font-size: 0.85rem; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid > div { border-right: 0; border-bottom: 2px solid var(--line); }
  .method-grid > div:last-child { border-bottom: 0; }
  .source-list, .related-list { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; padding-block: 38px; }
  .footer-links { justify-content: flex-start; }
  .takeaway { padding: 20px; box-shadow: 6px 6px 0 var(--magenta); }
  .crowd { padding: 20px; }
}

@media (max-width: 350px) {
  .tool-section .shell { width: calc(100% - 8px); }
  .controls-panel { padding-inline: 10px; }
  .number-grid { grid-template-columns: repeat(6, 1fr); }
  .selection-rack { gap: 4px; }
  h1 { font-size: 1.8rem; }
  .gauge-value { font-size: 2.2rem; }
  .ring-row { grid-template-columns: 56px minmax(0, 1fr); gap: 7px; }
}

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

@media (prefers-contrast: more) and (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --line-soft: #07184b; }
  .draw-mark { opacity: 1; }
}

@media print {
  .back-to-top, .topbar, .rail { display: none !important; }
}
