:root { color-scheme:dark; font:16px system-ui,sans-serif; color:#fff8e6; background:#192d2a; }
* { box-sizing:border-box; }
body { margin:0; }
button,a { touch-action:manipulation; }
button { font:inherit; color:inherit; cursor:pointer; }
button:focus-visible,a:focus-visible { outline:3px solid #f6d486; outline-offset:4px; }
button:disabled { cursor:default; }
header { margin:auto; min-height:58px; padding:6px 20px; display:flex; justify-content:space-between; align-items:center; gap:10px; }
header a { color:#f8e3ab; text-decoration:none; font-size:14px; min-height:44px; display:flex; align-items:center; }
.wordmark { font:600 25px Georgia,serif; white-space:nowrap; }
em { color:#f7cf78; }
header button { background:#2e4841; border:1px solid #a7bda153; padding:9px 12px; min-height:44px; border-radius:10px; display:flex; gap:6px; align-items:center; font-size:13px; }
header button svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.7; }
main { margin:auto; padding:0 10px; }
.course { position:relative; height:max(360px, calc(100dvh - 100px)); border:1px solid #a7bda153; border-radius:20px; overflow:hidden; background:#e8a373; }
canvas { display:block; width:100%; height:100%; touch-action:none; }
.hud { position:absolute; inset:12px 12px auto; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:16px; padding:8px 12px; border-radius:13px; }
.run-gauges { display:grid; grid-template-columns:auto minmax(60px,220px) minmax(68px,auto); align-items:center; gap:clamp(8px,3vw,36px); }
.run-progress { display:flex; align-items:center; justify-content:flex-end; gap:clamp(7px,1.4vw,22px); }
.run-progress > div { min-width:52px; }
.run-progress strong { color:#ffdba2; }
.hud-label,.meter label { display:block; color:#f0e0ba; font-size:12px; }
.hud strong { display:block; font-variant-numeric:tabular-nums; white-space:nowrap; }
.meter>div { display:flex; justify-content:space-between; align-items:center; gap:5px; }
.meter strong { font-size:12px; }
progress { display:block; width:100%; height:9px; margin-top:5px; accent-color:#ffd47b; }
#pause { width:44px; height:44px; border-radius:9px; border:0; }
#finish, #finish-paused { min-height:44px; padding:6px 10px; border:1px solid #ffe8c44d; border-radius:9px; background:#30243f; color:#ffe6bc; font-size:13px; white-space:nowrap; }
#pause:disabled,#finish:disabled { opacity:.5; }
#finish-paused { margin-left:6px; }
.overlay { position:absolute; inset:var(--hud-bottom, 76px) 0 0; display:grid; place-items:center; padding:14px; overflow:auto; background:#122a2945; }
.overlay[hidden] { display:none; }
.welcome { background:#192f2deb; width:min(100%,480px); padding:clamp(16px,4vw,34px); border:1px solid #e6c78b70; border-radius:20px; text-align:center; box-shadow:0 14px 55px #122a2955; }
h1 { font:400 clamp(38px,7vw,68px)/1 Georgia,serif; margin:6px 0 14px; letter-spacing:-.04em; }
.welcome p { line-height:1.45; margin:8px 0 14px; }
.welcome .eyebrow { font-size:11px; color:#f1d696; letter-spacing:.18em; margin-top:0; }
.welcome .best { color:#f1d696; font-size:13px; margin-bottom:0; }
#start { font-weight:700; }
#start { min-height:46px; padding:8px 20px; border:1px solid; border-radius:12px; }
.message { position:absolute; top:calc(var(--hud-bottom, 76px) + 7px); left:12px; right:12px; text-align:center; pointer-events:none; }
.message:not(:empty) { width:max-content; max-width:calc(100% - 24px); margin:auto; padding:7px 13px; border-radius:14px; background:#18352de8; }
.guide { margin:8px 0; text-align:center; color:#e4e6d4; font-size:13px; line-height:1.35; }
kbd { color:#ffdd92; }

/* Sunbloom's twilight glass, warm light, and serif welcome screen. */
:root { background:#13162b; color:#fdf8f0; }
header button, .hud, #pause {
  background:rgba(18,20,40,.74); border:1px solid #ffeccc38;
  backdrop-filter:blur(12px);
}
.course {
  border-color:#ffeccc38;
  background:
    radial-gradient(circle at 73% 28%, #fff0b8 0 3.4%, #fbd2acb0 3.6%, transparent 12%),
    radial-gradient(ellipse at 71% 62%, #f3b58b 0, transparent 53%),
    linear-gradient(155deg, #242447 8%, #654b7f 40%, #bf8091 66%, #f3bd90);
}
.course canvas { position:absolute; inset:0; }
#scene-3d { pointer-events:none; }
#scene-3d[hidden] { display:none; }
#world { cursor:crosshair; }
.overlay { background:#10102750; backdrop-filter:blur(2px); }
.welcome { background:#14162cbd; border-color:#ffe8c445; backdrop-filter:blur(18px); box-shadow:0 24px 64px #080a188c; }
.sun-mark {
  display:grid; place-items:center; margin:0 auto 12px; width:52px; height:52px;
  border:1px solid #ffe2a654; border-radius:16px;
  background:linear-gradient(135deg,#fbbf4846,#f474b63d); color:#ffdb9e; font-size:29px;
}
h1 { color:#fff2d5; }
#start {
  background:linear-gradient(135deg,#f8b94f,#fb965b 52%,#ef83b1);
  border-color:#ffdea27d; color:#241828; box-shadow:0 8px 28px #f59e0b40;
}
#charge.ready { filter:drop-shadow(0 0 5px #ffd28e); accent-color:#ffdf9b; }
.message:not(:empty) { background:#18182eda; border:1px solid #ffe5ae47; color:#fff1cd; }
.guide { color:#ddd0dd; }

#run-summary {
  width:min(650px, calc(100% - 26px)); max-height:calc(100dvh - 24px); overflow:auto;
  padding:clamp(17px,4vw,34px); border:1px solid #ecb9ad60; border-radius:24px;
  color:#fdf4e6; background:radial-gradient(ellipse at 50% 0,#51364f 0,transparent 46%),#1b1b34;
  box-shadow:0 22px 80px #090a21b3;
}
#run-summary::backdrop { background:#09091dad; backdrop-filter:blur(6px); }
.summary-hero { text-align:center; }
.summary-hero h2 { font:400 clamp(29px,6vw,44px)/1.05 Georgia,serif; margin:6px 0 9px; color:#ffe9ba; }
.summary-hero p { margin:0 auto 20px; color:#e9d5dd; }
.summary-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0; }
.summary-metrics > div { padding:10px; border:1px solid #f4c5a026; border-radius:13px; background:#fff3dd0b; }
.summary-metrics dt { color:#e3cad8; font-size:12px; line-height:1.25; }
.summary-metrics dd { margin:4px 0 0; color:#ffe7b3; font:600 clamp(17px,4vw,25px)/1.05 Georgia,serif; }
.summary-section { margin-top:19px; }
.summary-section h3 { font:400 clamp(18px,4vw,23px) Georgia,serif; margin:0 0 7px; }
.summary-tally { list-style:none; padding:0; margin:0; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.summary-tally li { display:flex; align-items:center; gap:8px; padding:7px 9px; background:#ffffff0b; border-radius:8px; font-size:13px; }
.summary-tally li::before { content:''; width:7px; height:7px; flex:none; border-radius:50%; background:var(--tally-colour,#f5b3ba); box-shadow:0 0 8px var(--tally-colour,#f5b3ba); }
.summary-tally strong { margin-left:auto; color:#ffe6be; font-variant-numeric:tabular-nums; }
.summary-empty { margin:0; color:#ddc7d6; font-size:13px; }
.summary-actions { display:flex; gap:9px; flex-wrap:wrap; justify-content:center; margin-top:22px; }
.summary-actions > * { min-height:44px; padding:9px 15px; display:inline-flex; align-items:center; justify-content:center; border-radius:10px; text-decoration:none; font-size:14px; font-weight:600; }
#run-again { background:linear-gradient(135deg,#ffcd72,#ec94ae); border:0; color:#2a1d2e; }
.summary-actions a { color:#ffe5bc; border:1px solid #ffe8c44d; }
#share-run { background:#ffe3aa; border:1px solid #ffe3aa; color:#302035; }
#share-run:disabled { opacity:.68; }
#share-options { margin-top:18px; border-top:1px solid #ffe8c435; padding-top:14px; }
#share-options h3 { margin:0 0 12px; font:400 21px Georgia,serif; }
.share-preview { display:grid; grid-template-columns:112px minmax(0,1fr); gap:12px; align-items:start; }
.share-preview > img { width:100%; border-radius:9px; border:1px solid #ffe8c438; }
.share-preview label { display:block; color:#e8cfda; font-size:13px; margin-bottom:5px; }
#share-text { width:100%; resize:vertical; min-height:105px; border:1px solid #ffe8c438; border-radius:8px; padding:8px; background:#121328; color:#fff5e3; font:13px/1.4 system-ui,sans-serif; }
.share-tools { display:flex; flex-wrap:wrap; gap:6px; }
.share-tools > * { display:inline-flex; min-height:44px; align-items:center; padding:6px 9px; border-radius:8px; border:1px solid #ffe8c44d; background:#30243f; color:#ffe6bc; text-decoration:none; font:600 13px system-ui,sans-serif; }
.share-tools > [hidden] { display:none; }
#share-status { color:#e8cfda; text-align:center; margin:9px 0 0; font-size:13px; }
#share-status:empty { display:none; }
@media(max-width:480px) { .share-preview { grid-template-columns:78px minmax(0,1fr); gap:8px; } }
@media(max-width:650px) {
  .hud { grid-template-columns:1fr; gap:5px; }
  .run-gauges { grid-template-columns:auto minmax(60px,1fr) auto; }
  .run-progress { border-top:1px solid #ffeccc24; padding-top:4px; }
  .run-progress > div:first-child { margin-right:auto; }
}
@media(max-width:480px) {
  header { min-height:53px; padding:4px 10px; }
  main { padding:0 6px; }
  .wordmark { font-size:clamp(16px,5vw,22px); }
  .hud { inset:7px 7px auto; gap:8px; padding:5px 8px; }
  .course { height:max(360px, calc(100dvh - 106px)); }
  .welcome p { font-size:14px; }
}
