/* FlingOS (Slingshot). Palette and type from the Geodesick tour player (tours/player/player.css). */
@font-face { font-family: 'Plex Mono Num'; font-weight: 500; src: url(fonts/plex-mono-500-sub.woff) format('woff'); font-display: swap; }
:root {
  --bg: #0b0f18; --bg-2: #121826; --line: #243044; --fg: #eef2f8; --fg-2: #a9b4c6; --fg-3: #6b788f;
  --faster: #f0a93a; --slower: #5aa0ff; --same: #dfe6f0; --crashed: #ff6b6b; --planet: #4ccf8a;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --num: 'Plex Mono Num', ui-monospace, Menlo, Consolas, monospace;
  --pad: max(16px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.4 var(--ui); overflow: hidden; }
p { margin: 0; }

#field { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#field:focus { outline: none; }
#field:focus-visible { outline: 2px solid var(--fg-2); outline-offset: -2px; }

.bar, .hud { position: fixed; left: 0; right: 0; display: flex; pointer-events: none; padding-left: var(--pad); padding-right: max(16px, env(safe-area-inset-right)); }
.bar a, .bar button, .hud button { pointer-events: auto; }
.bar { top: 0; align-items: center; gap: 14px; padding-top: max(10px, env(safe-area-inset-top)); font-size: 14px; }
.home { color: var(--fg-2); text-decoration: none; padding: 8px 0; }
.home:hover, .home:focus-visible { color: var(--fg); text-decoration: underline; }
.piece { color: var(--fg); font-weight: 600; }
#how { margin-left: auto; }

button { font: inherit; font-size: 14px; color: var(--fg); background: rgba(11, 15, 24, .7); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
button:hover { border-color: var(--fg-3); }
button:focus-visible, .home:focus-visible { outline: 2px solid var(--fg-2); outline-offset: 2px; }

/* Phones in portrait: the number centred at the bottom. */
.hud { bottom: 0; flex-direction: column; align-items: center; gap: 10px; padding-bottom: max(14px, env(safe-area-inset-bottom)); text-align: center; }
.readout { display: grid; justify-items: center; min-height: 86px; align-content: end; }
.readout > * { grid-area: 1 / 1; }
.hint { color: var(--fg-2); font-size: 17px; align-self: center; transition: opacity .6s; }
.hint.gone { opacity: 0; }
.meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--fg-2); }
.meta #clear { order: -1; }
.tally { display: flex; align-items: flex-end; gap: 22px; }
.clock { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.clock-n { font: 500 clamp(24px, 7vw, 32px)/1 var(--num); font-variant-numeric: tabular-nums; color: var(--fg); padding-bottom: 4px; }
.clock-n.low { color: var(--crashed); }
.score { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.score-label { font-size: 12px; letter-spacing: .08em; color: var(--fg-2); margin-bottom: 4px; }
.score-n { font: 500 clamp(40px, 12vw, 60px)/1 var(--num); font-variant-numeric: tabular-nums; color: var(--faster); text-shadow: 0 0 18px rgba(240, 169, 58, .45); }
.score-n.bump { animation: bump .28s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); color: #ffd27a; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .score-n.bump { animation: none; } }
.key { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--fg-2); }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-left: 4px; }
.sw.slower { background: var(--slower); } .sw.same { background: var(--same); } .sw.faster { background: var(--faster); }

/* Wider screens and phones in landscape: the score bottom left. */
@media (min-width: 720px), (orientation: landscape) and (max-height: 520px) {
  .hud { flex-direction: row; align-items: flex-end; justify-content: space-between; text-align: left; }
  .readout { justify-items: start; }
  .hint { align-self: end; }
  .score, .clock { align-items: flex-start; }
  .meta { flex-direction: column; align-items: flex-end; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .readout { min-height: 64px; }
  .score-n { font-size: 40px; }
  .clock-n { font-size: 24px; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

dialog { background: var(--bg-2); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; width: min(36rem, calc(100% - 32px)); max-height: calc(100% - 32px); font-size: 15px; line-height: 1.5; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0 0 10px; font-size: 20px; }
dialog h3 { margin: 18px 0 6px; font-size: 15px; }
dialog p { margin: 0 0 10px; }
dialog ul { margin: 0 0 12px; padding-left: 20px; }
dialog li { margin-bottom: 4px; }
.eq { font-family: math, 'Cambria Math', 'STIX Two Math', serif; font-size: 18px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px 10px; margin: 0 0 12px; overflow-x: auto; }
.eq mtd { padding: 6px 2px; }
.eq mtd:first-child { text-align: right; }
.eq mtd:last-child { text-align: left; }
dialog form { margin: 6px 0 0; }

#over { width: min(22rem, calc(100% - 32px)); text-align: center; }
#over h2 { font-size: 22px; }
.final { display: flex; flex-direction: column; align-items: center; line-height: 1; margin: 6px 0 16px; }
.final-n { font: 500 52px/1 var(--num); color: var(--faster); text-shadow: 0 0 18px rgba(240, 169, 58, .45); }
.initials { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 0 0 6px; }
.initials label { font-size: 13px; color: var(--fg-2); }
.initials input { width: 4.2ch; font: 700 30px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; text-transform: uppercase; text-align: center; color: var(--faster); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 0 6px .15em; }
.initials input:focus-visible { outline: 2px solid var(--faster); outline-offset: 2px; }
.scores { list-style: none; margin: 0 auto 16px; padding: 0; max-width: 15rem; counter-reset: rank; }
.scores li { counter-increment: rank; display: grid; grid-template-columns: 2.2em 3.5em 1fr; align-items: baseline; padding: 3px 0; color: var(--fg-2); }
.scores li::before { content: counter(rank); font: 500 14px var(--num); text-align: left; }
.scores .ini { font: 700 16px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; text-align: left; color: var(--fg); }
.scores .pts { font: 500 16px var(--num); text-align: right; color: var(--fg); }
.scores li.mine, .scores li.mine .ini, .scores li.mine .pts { color: var(--faster); }
.over-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.button-link { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; font-size: 14px; color: var(--fg); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; }
.button-link:hover { border-color: var(--fg-3); }
.button-link:focus-visible { outline: 2px solid var(--fg-2); outline-offset: 2px; }

.coach { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 54px); left: 50%; transform: translateX(-50%); width: min(26rem, calc(100% - 32px)); background: rgba(18, 24, 38, .94); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
.coach-sub { margin-top: 4px; font-size: 13px; color: var(--fg-2); }
.coach-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.panel-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.panel-actions form { margin: 0; }
