:root {
  color-scheme: light;
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #25434f;
  background: #e6eef1;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 50% 12%, #f8fbfa, #e1ecf0 80%); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid #de803e; outline-offset: 4px; }
button { transition: background-color .15s, transform .15s; }
button:active:not(:disabled) { transform: translateY(2px); }
[hidden] { display: none !important; }
.app { width: min(100% - 40px, 740px); margin: 0 auto; padding: 26px 0 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 21px; letter-spacing: .03em; margin: 0 0 6px; font-weight: 800; }
.page-header p { font-size: 12px; color: #69818b; margin: 0; }
.best { font-size: 11px; color: #6b818a; text-align: right; white-space: nowrap; }
.best strong { display: block; margin-top: 5px; font-size: 19px; color: #25434f; font-variant-numeric: tabular-nums; }
.stage { position: relative; width: 100%; aspect-ratio: 25 / 24; overflow: hidden; border-radius: 22px; background: #add2de; box-shadow: 0 18px 60px #587e9220, 0 2px 8px #5d788417; isolation: isolate; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.hud { position: absolute; inset: 22px 24px auto; display: flex; align-items: flex-start; gap: 25px; pointer-events: none; }
.metric > span { display: block; font-size: 12px; color: #476a78; margin-bottom: 1px; }
.metric strong { display: block; font-size: 30px; font-weight: 800; line-height: 1.25; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 14px; font-weight: 600; }
.time { margin-left: auto; text-align: right; }
.time strong { font-size: 25px; letter-spacing: .01em; }
.pause-button { pointer-events: auto; border: 1px solid #ffffff8c; border-radius: 50%; width: 39px; height: 39px; color: #355463; background: #f6fbfb99; font-size: 22px; margin-top: 3px; }
.pause-button:disabled { opacity: .4; }
.speed-panel { position: absolute; bottom: 24px; left: 24px; width: 116px; pointer-events: none; }
.speed-panel > span { font-size: 11px; color: #62808e; }
.speed-panel strong { font-size: 24px; font-variant-numeric: tabular-nums; color: #2c5363; }
.speed-track { width: 100%; height: 4px; border-radius: 8px; background: #adcbd866; margin-top: 6px; overflow: hidden; }
.speed-track i { display: block; width: 24%; height: 100%; border-radius: 8px; background: #528b9e; }
.stage.boosting .speed-track i { background: #e2a348; }
.boost-panel { position: absolute; right: 24px; bottom: 24px; width: 130px; color: #9b692a; font-size: 11px; pointer-events: none; }
.boost-panel strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.boost-track { height: 4px; margin-top: 6px; overflow: hidden; border-radius: 8px; background: #e2c9a666; }
.boost-track i { display: block; height: 100%; background: #e3aa51; border-radius: 8px; }
.trick { position: absolute; top: 26%; left: 8%; right: 8%; font-size: clamp(14px, 2.5vw, 19px); font-weight: 800; text-align: center; color: #2d5768; text-shadow: 0 1px 2px #fff; pointer-events: none; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-shadow: 0 3px 0 #6c9cac; font-size: clamp(70px, 15vw, 108px); font-weight: 900; pointer-events: none; }
.veil { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: #c5e0e533; }
.dialog { width: min(100%, 350px); padding: 32px; border: 1px solid #ffffff; border-radius: 24px; background: #fafdfff2; box-shadow: 0 14px 45px #3157661a; text-align: center; }
.dialog h2 { font-size: 27px; letter-spacing: .02em; margin: 0 0 13px; }
.dialog p { font-size: 13px; line-height: 1.9; color: #6a818b; margin: 0 0 22px; }
.welcome-dialog { padding: 19px 28px 20px; }
.mascot { object-fit: contain; display: block; margin: -2px auto 9px; }
.welcome-dialog h2 { font-size: 26px; margin-bottom: 10px; }
.welcome-dialog .instructions { margin-bottom: 20px; line-height: 1.8; font-size: 12px; }
.perks { display: grid; gap: 9px; margin-bottom: 23px; text-align: left; }
.perks label { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 9px 11px; border: 1px solid #dce9ec; border-radius: 11px; background: #f0f6f7; }
.perks label:has(:checked) { border-color: #71a2af; background: #e5f1f2; }
.perks input { width: 17px; height: 17px; margin: 0; accent-color: #397b8d; }
.perks b { display: block; font-size: 13px; font-weight: 700; }
.perks small { display: block; color: #6e858e; font-size: 10px; margin-top: 3px; }
.primary, .secondary { display: block; width: 100%; min-height: 46px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.primary { border: 1px solid #2e6b7d; background: #367c90; color: #fff; box-shadow: 0 3px 0 #23586a; }
.primary:hover { background: #2b6e81; }
.primary:disabled { opacity: .6; }
.secondary { background: transparent; border: 1px solid #d5e4e9; color: #547480; margin-top: 13px; }
.secondary:hover { background: #e8f2f5; }
.dialog .round-note { font-size: 10px; margin: 13px 0 0; }
.dialog .eyebrow { margin-bottom: 9px; font-size: 13px; }
#result-title { font-size: 54px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
#result-title small { font-size: 18px; }
.result-stats { display: flex; justify-content: center; gap: 22px; margin: 10px 0 12px; }
.result-stats b { color: #2f5262; font-size: 18px; }
#results { grid-template-rows: minmax(0, 1fr); }
.results-dialog { padding: 22px 28px; max-height: 100%; overflow-y: auto; }
.results-dialog .eyebrow { margin-bottom: 4px; line-height: 1.5; }
.results-dialog #result-title { font-size: 44px; line-height: 1.1; margin-bottom: 8px; }
.results-dialog .result-stats { margin: 6px 0 12px; }
.results-dialog .result-stats p { margin: 0; line-height: 1.5; }
.result-perks { min-inline-size: 0; border: 0; padding: 0; margin: 0 0 16px; text-align: left; }
.result-perks legend { padding: 0; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.result-perks .perks { margin-bottom: 0; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 20px 2px 0; }
.controls p { font-size: 12px; line-height: 1.9; color: #577480; margin: 0; }
.controls p span { font-size: 11px; color: #7c929b; }
kbd { font: inherit; }
.jump-button { user-select: none; -webkit-user-select: none; touch-action: none; border-radius: 13px; background: #f8fbfc; border: 1px solid #c5dce4; color: #3c6576; padding: 11px 24px; min-width: 134px; font-weight: 700; font-size: 14px; box-shadow: 0 3px 0 #d2e1e7; }
.jump-button span { display: block; font-size: 10px; font-weight: 500; color: #7c939e; margin-top: 3px; }
.jump-button:disabled { opacity: .45; }
.jump-button.held { background: #d5e9ef; transform: translateY(2px); }
@media (min-width: 800px) {
  .app { width: min(740px, max(410px, calc((100dvh - 180px) * 25 / 24))); }
}
@media (min-width: 501px) and (max-height: 800px) {
  .welcome-dialog { padding: 14px 24px; width: 310px; }
  .mascot { width: 66px; height: 65px; margin-bottom: 6px; }
  .welcome-dialog h2 { font-size: 23px; margin-bottom: 7px; }
  .welcome-dialog .instructions { font-size: 11px; margin-bottom: 13px; }
  .perks { margin-bottom: 15px; gap: 7px; }
  .perks label { padding: 7px 10px; }
}
@media (max-width: 500px) {
  .app { width: 100%; padding: 18px 0 max(16px, env(safe-area-inset-bottom)); }
  .page-header { margin: 0 18px 15px; }
  h1 { font-size: 18px; }
  .page-header p { font-size: 10px; }
  .best strong { font-size: 16px; }
  .stage { border-radius: 0; }
  .hud { inset: 15px 16px auto; gap: 16px; }
  .metric strong { font-size: 25px; }
  .metric > span { font-size: 10px; }
  .time strong { font-size: 22px; }
  .pause-button { width: 33px; height: 33px; font-size: 19px; }
  .speed-panel { bottom: 16px; left: 16px; width: 85px; }
  .speed-panel strong { font-size: 20px; }
  .boost-panel { right: 16px; bottom: 16px; width: 110px; font-size: 10px; }
  .veil { padding: 12px; }
  .dialog { width: 285px; padding: 23px; border-radius: 19px; }
  .welcome-dialog { padding: 14px 23px 12px; }
  .mascot { width: 58px; height: 57px; margin-bottom: 5px; }
  .welcome-dialog h2 { font-size: 20px; margin-bottom: 6px; }
  .welcome-dialog .instructions { font-size: 10px; margin-bottom: 11px; }
  .perks { gap: 6px; margin-bottom: 13px; }
  .perks label { padding: 6px 10px; }
  .perks b { font-size: 11px; }
  .perks small { font-size: 9px; margin-top: 1px; }
  .results-dialog { padding: 16px 20px; }
  .results-dialog .eyebrow { font-size: 11px; }
  .results-dialog #result-title { font-size: 36px; margin-bottom: 4px; }
  .results-dialog .result-stats { margin: 4px 0 10px; }
  .result-perks { margin-bottom: 13px; }
  .result-perks legend { font-size: 11px; margin-bottom: 6px; }
  .primary, .secondary { min-height: 39px; font-size: 13px; }
  .dialog .round-note { margin-top: 9px; font-size: 9px; }
  .controls { margin: 18px 17px 0; }
  .controls p { font-size: 10px; }
  .controls p span { font-size: 9px; }
  .jump-button { padding: 11px 18px; min-width: 116px; }
}
@media (max-width: 350px) {
  .welcome-dialog .mascot { display: none; }
  .welcome-dialog { padding: 13px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
