:root {
  --bg: #10141f; --card: #1a2030; --line: #2c354a; --ink: #f2f4f8; --soft: #9aa5bd;
  --accent: #4cc9f0; --good: #3ddc97; --bad: #ff5d73; --band: rgba(76, 201, 240, .28);
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
.page { max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.02em; }
h1::after { content: ''; display: block; width: 44px; height: 4px; border-radius: 2px; background: var(--accent); margin-top: 2px; }
.day { margin: 6px 0 0; color: var(--soft); font-size: .9rem; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 10px 14px; }
button:disabled { opacity: .45; cursor: default; }
.ghost { font-size: .85rem; padding: 8px 12px; }
.primary { background: var(--accent); border-color: var(--accent); color: #04212b; font-weight: 700; }
.wide { width: 100%; margin-top: 14px; }

.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 18px 0 14px; }
.pip { height: 34px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--soft); }
.pip.now { border-color: var(--accent); color: var(--accent); }
.pip.hit { background: rgba(61, 220, 151, .16); border-color: var(--good); color: var(--good); }
.pip.miss { background: rgba(255, 93, 115, .14); border-color: var(--bad); color: var(--bad); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.count { margin: 0; color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h2 { margin: 6px 0 16px; font-size: 1.35rem; line-height: 1.3; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.double[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: rgba(76, 201, 240, .12); font-weight: 700; }

.verdict { margin-top: 12px; min-height: 5.2em; text-align: center; }
.verdict .points { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.verdict .points.hit { color: var(--good); }
.verdict .points.miss { color: var(--bad); }
.verdict p { margin: 4px 0 0; color: var(--soft); font-size: .92rem; }
.verdict p b { color: var(--ink); }

.result h2 { margin-top: 0; }
.big { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--accent); }
.big small { font-size: 1rem; color: var(--soft); font-weight: 400; }
.marks { font-size: 1.5rem; letter-spacing: 3px; margin: 10px 0; }
.rows { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.rows li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px; border-radius: 12px; background: var(--bg); font-size: .88rem; }
.rows .q { color: var(--soft); }
.rows .a { grid-column: 2; }
.rows .p { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-weight: 700; }
.rows .m { grid-row: 1 / span 2; align-self: center; font-size: 1.2rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 14px 0; }
.stats b { display: block; font-size: 1.3rem; }
.stats span { color: var(--soft); font-size: .72rem; }
.foot { text-align: center; color: var(--soft); font-size: .85rem; margin-top: 18px; }

dialog { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; max-width: 420px; width: calc(100% - 32px); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog ol { padding-left: 20px; display: grid; gap: 6px; }
dialog b { color: var(--accent); }
dialog form { margin-top: 14px; text-align: right; }
@media (prefers-reduced-motion: reduce) { .bar.miss, .bar.hit .band { animation: none; } }
.share-text { width: 100%; margin-top: 14px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; }
.top-actions { display: flex; gap: 6px; }
.day b { color: var(--accent); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.rank { margin: 0 0 4px; font-size: 1.3rem; font-weight: 800; }
.standing { margin: 0 0 6px; font-size: 1.05rem; }
.standing b { color: var(--accent); }
.foot .small { font-size: .75rem; opacity: .8; }
.foot a { color: var(--soft); }
.about { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--soft); font-size: .92rem; }
.about h2 { font-size: 1.1rem; color: var(--ink); margin: 0 0 8px; }
.about h3 { font-size: .95rem; color: var(--ink); margin: 18px 0 6px; }
.about details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.about summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.about details p { margin: 8px 0 0; }
.about a { color: var(--soft); }
.about .small { margin-top: 16px; font-size: .8rem; text-align: center; }

/* The chart game. */
h2#ask { margin: 6px 0 2px; }
.sub { margin: 0 0 10px; color: var(--soft); font-size: .92rem; }
.pip.mid { background: rgba(255, 183, 3, .14); border-color: #ffb703; color: #ffb703; }
.chart { display: block; width: 100%; height: auto; border-radius: 12px; background: #141a28; border: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.chart .grid { stroke: #232c40; stroke-width: 1; }
.chart .tick { fill: var(--soft); font: 500 9.5px var(--sans); }
.chart .tick.strong { fill: var(--ink); font-weight: 700; }
.chart .zone { fill: rgba(76, 201, 240, .08); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .zone.locked { fill: rgba(255, 255, 255, .03); stroke: var(--line); }
.chart .zone-label { fill: var(--accent); font: 700 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.chart path { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.chart .known { stroke: var(--ink); stroke-width: 2.5; }
.chart .guess { stroke: #ffb703; stroke-width: 2.5; stroke-dasharray: 1 5; }
.chart .real { stroke: var(--good); stroke-width: 3; filter: drop-shadow(0 0 4px rgba(61, 220, 151, .6)); }
.chart .dot { fill: var(--ink); pointer-events: none; }
.legend { margin: 6px 0 0; color: var(--soft); font-size: .75rem; text-align: center; }
.key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 4px 0 10px; }
.key.known { background: var(--ink); } .key.guess { background: #ffb703; } .key.real { background: var(--good); }
.status { margin: 12px 0; min-height: 1.5em; text-align: center; font-weight: 600; font-size: .95rem; }
.actions.three { grid-template-columns: auto 1fr 1fr; }
.verdict { margin-top: 12px; text-align: center; }
.verdict .points.mid { color: #ffb703; }
.verdict .source { font-size: .78rem; }
.verdict a { color: var(--soft); }

/* The page has one look, and it is dark. This tells a browser with a night mode not to change the colours. */
:root { color-scheme: dark; }
/* A phone zooms the page on a fast double tap. "manipulation" stops that. A scroll and a zoom with two fingers still work. */
html, body, body * { touch-action: manipulation; }
.chart, .chart * { touch-action: none; }

/* A phone: less space above the chart, so the chart and its buttons fit in one screen. */
@media (max-width: 480px) {
  .page { padding-top: 12px; }
  h1 { font-size: 1.6rem; }
  .progress { margin: 12px 0 10px; }
  .pip { height: 28px; }
  .card { padding: 14px; }
  h2 { font-size: 1.2rem; }
  .status { margin: 8px 0; }
}
/* The status line keeps the height of two lines, so the buttons do not move when its text changes.
   It is a plain block: a grid that centred the text cut the first line on an iPhone. */
.status { min-height: 3.1em; line-height: 1.45; }

/* The year and the value above the finger during a stroke. */
.chart .tip circle { fill: none; stroke: #ffb703; stroke-width: 2; }
.chart .tip text { fill: #ffb703; font: 700 14px var(--sans); paint-order: stroke; stroke: #141a28; stroke-width: 5px; stroke-linejoin: round; }
/* The switch between the two views, in the chart. Both choices show, and the one in use has the colour. */
.chart .view-box { fill: #141a28; stroke: var(--accent); stroke-width: 1; }
.chart .view-on { fill: var(--accent); }
.chart .view-text { fill: var(--accent); font-family: var(--sans); font-weight: 700; pointer-events: none; }
.chart .view-text.on { fill: #04212b; }
/* On a phone the chart fills the screen. The script adds the class "fit" and gives the card its height. */
@media (max-width: 480px) {
  .fit .page { padding: 8px 0 40px; }
  .fit .top { padding: 0 12px; align-items: center; }
  .fit h1 { font-size: 1.15rem; }
  .fit h1::after { display: none; }
  .fit .day { margin: 0; font-size: .8rem; }
  .fit .progress { margin: 6px 12px; }
  .fit .pip { height: 20px; font-size: .7rem; border-radius: 6px; }
  .fit #play:not([hidden]) { display: flex; flex-direction: column; border-radius: 0; border-left: 0; border-right: 0; padding: 10px 14px 12px; }
  .fit .chart { flex: 1 1 0; height: 0; min-height: 220px; width: calc(100% + 28px); max-width: none; margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; }
  .fit #play:has(#controls:not([hidden])) .legend { display: none; }
  .fit .sub { margin-bottom: 6px; }
  .fit .status { margin: 6px 0; }
  .fit .foot, .fit .about { padding-left: 16px; padding-right: 16px; }
}
