:root {
  --paper: #f3f0e6;
  --ink: #183a34;
  --orange: #f0643b;
  --yellow: #f6c64c;
  --muted: #6c776c;
  --line: #d4d4c4;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
.page { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }
.masthead { min-height: 82px; display: flex; align-items: center; gap: 26px; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-size: 23px; font-weight: 900; letter-spacing: -1.3px; }
.brand-icon { width: 39px; height: 39px; color: var(--orange); }
.brand-dot { color: var(--orange); }
.masthead-note { margin-left: auto; font-size: 10px; letter-spacing: 1.2px; font-weight: bold; display: flex; align-items: center; gap: 9px; }
.live-dot { width: 7px; height: 7px; background: #4c906b; border-radius: 50%; box-shadow: 0 0 0 4px #4c906b14; }
.icon-button { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; cursor: pointer; }
.icon-button:hover { background: #e6e7d9; }
.icon-button svg { width: 20px; height: 20px; }
.icon-button[aria-pressed="true"] { color: #8a8f83; }
.intro { display: flex; justify-content: space-between; align-items: center; padding: 39px 0 32px; }
.eyebrow { margin: 0 0 9px; font-size: 10px; letter-spacing: 1.6px; font-weight: bold; }
.eyebrow span { color: var(--orange); margin-right: 9px; }
h1 { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(45px, 6vw, 72px); font-weight: 900; letter-spacing: -4.8px; line-height: 1.03; margin: 0; }
h1 > span { color: var(--orange); }
.intro-copy { margin: 13px 0 0; font-size: 14px; line-height: 1.65; color: #6b756c; }
.intro-copy strong { color: var(--ink); }
.round-stamp { width: 151px; padding: 13px 10px 11px; border: 1px solid var(--ink); border-radius: 5px; text-align: center; transform: rotate(5deg); margin: 7px 14px 0 20px; position: relative; }
.round-stamp::before { content: ""; position: absolute; inset: 4px; border: 1px dashed #a6b0a0; border-radius: 2px; }
.stamp-top, .stamp-bottom { position: relative; font-size: 8px; font-weight: 900; letter-spacing: 1.3px; }
.stamp-number { position: relative; font-family: "Arial Black", Arial, sans-serif; font-size: 59px; letter-spacing: -4px; line-height: 1.1; }
.stamp-number span { font-size: 33px; vertical-align: top; line-height: 1.6; margin-left: 2px; }
.stamp-bottom { font-size: 6.7px; letter-spacing: .85px; }
.game-layout { display: grid; grid-template-columns: minmax(360px, 1.5fr) minmax(270px, 1fr); gap: 24px; align-items: start; }
.game-card { min-width: 0; border: 1px solid var(--ink); border-radius: 12px; overflow: hidden; background: var(--ink); box-shadow: 5px 6px 0 #183a3410; }
.hud { height: 73px; padding: 13px 22px; background: var(--ink); color: #fff8e8; display: grid; grid-template-columns: 1.25fr 1fr 1fr; align-items: center; }
.hud-item { display: flex; flex-direction: column; gap: 5px; }
.hud-label { font-size: 8px; font-weight: bold; letter-spacing: 1.7px; color: #b9c5b7; }
.hud-item strong { font-size: 26px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 1.1px; }
.time-item { border-left: 1px solid #ffffff23; padding-left: 22px; }
.time-item small { font-size: 9px; letter-spacing: 0; font-weight: normal; margin-left: 4px; color: #b9c5b7; }
.lives-item { padding-left: 20px; border-left: 1px solid #ffffff23; }
.lives { display: flex; gap: 7px; font-size: 21px; line-height: 24px; color: #ff7951; }
.lives span.lost { color: #ffffff22; }
.stage { width: 100%; position: relative; aspect-ratio: 480 / 760; background: #5c6260; overflow: hidden; }
canvas { width: 100%; height: 100%; display: block; touch-action: manipulation; cursor: crosshair; }
canvas:focus-visible { outline-offset: -5px; }
.street-sign { position: absolute; top: 19px; left: 11px; width: 75px; padding: 6px 3px 5px; background: #23634f; border: 2px solid #eff0d3; border-radius: 3px; color: white; text-align: center; box-shadow: 0 2px 0 #102e26; transform: rotate(-2deg); pointer-events: none; }
.street-sign span { display: block; font-size: 6px; font-weight: 900; letter-spacing: .2px; }
.street-sign small { display: block; margin-top: 3px; padding-top: 3px; border-top: 1px solid #ffffff6b; font-size: 4.5px; letter-spacing: .3px; }
.event-banner { position: absolute; top: 15px; left: 50%; z-index: 3; transform: translate(-50%, -10px); padding: 8px 13px; color: var(--ink); background: var(--yellow); border: 1px solid var(--ink); border-radius: 4px; box-shadow: 2px 3px 0 #183a3433; font-size: 10px; font-weight: 900; letter-spacing: .3px; opacity: 0; pointer-events: none; white-space: nowrap; transition: opacity .12s, transform .12s; }
.event-banner.show { opacity: 1; transform: translate(-50%, 0); }
.event-banner.danger { background: #ff7951; }
.event-banner.safe { background: #e4efba; }
.overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 28px; background: #102c27c9; backdrop-filter: blur(3px); }
.overlay[hidden] { display: none; }
.overlay-panel { width: 100%; padding: 29px 26px 20px; border: 1px solid #f4f0df; border-radius: 8px; background: var(--paper); text-align: center; box-shadow: 6px 7px 0 #0a211f4d; }
.panel-kicker { color: var(--orange); font-size: 8px; font-weight: 900; letter-spacing: 1.7px; text-transform: uppercase; }
.start-bike { width: 84px; height: 84px; margin: 17px auto 13px; color: var(--ink); background: var(--yellow); border: 1px solid var(--ink); border-radius: 50%; transform: rotate(-8deg); position: relative; }
.start-bike::after { content: ""; position: absolute; inset: -7px; border: 1px dashed var(--ink); border-radius: 50%; }
.start-bike svg { width: 75px; height: 75px; margin-top: 3px; }
.overlay-panel h2 { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(25px, 4vw, 35px); line-height: 1.06; letter-spacing: -1.5px; margin: 0; }
.overlay-panel h2 span { color: var(--orange); }
.overlay-panel p { font-size: 12px; line-height: 1.65; margin: 16px auto 20px; max-width: 280px; color: #5c6b60; }
.primary-button { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 18px; background: var(--orange); color: #fff9e9; border: 1px solid var(--ink); border-radius: 4px; box-shadow: 3px 4px 0 var(--ink); font-size: 12px; font-weight: 900; letter-spacing: 1px; cursor: pointer; }
.primary-button:hover { background: #db4d29; }
.primary-button:active { transform: translate(2px, 2px); box-shadow: 1px 2px 0 var(--ink); }
.primary-button > span { font-size: 22px; line-height: 1; }
.best-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; font-size: 8px; letter-spacing: 1.3px; color: var(--muted); }
.best-line strong { font-size: 13px; letter-spacing: .2px; color: var(--ink); }
.start-controls { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 6.8px; font-weight: bold; letter-spacing: .6px; color: var(--muted); }
.start-controls i { font-style: normal; color: var(--orange); }
.compact-panel { padding: 37px 28px 27px; }
.compact-panel h2 { font-size: 45px; margin-top: 13px; }
.compact-panel p { margin-bottom: 23px; }
.text-button { background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); font-size: 11px; cursor: pointer; padding: 17px 10px 0; }
.result-score { padding: 12px; background: #e5e9d6; border: 1px solid #cdd4be; border-radius: 5px; display: flex; flex-direction: column; gap: 3px; }
.result-score span { font-size: 8px; letter-spacing: 1.4px; font-weight: bold; }
.result-score strong { font-size: 38px; letter-spacing: -1px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 18px 0; }
.result-stats > div { display: flex; flex-direction: column; gap: 5px; }
.result-stats > div + div { border-left: 1px solid var(--line); }
.result-stats strong { font-size: 25px; }
.result-stats span { font-size: 6.5px; letter-spacing: .6px; color: var(--muted); }
.new-best { padding: 8px; margin: -4px 0 17px; background: var(--yellow); border-radius: 3px; font-size: 8px; font-weight: 900; letter-spacing: .5px; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 49px; padding: 9px 16px; gap: 10px; background: #f9f7ef; }
.wrong-legend { display: flex; align-items: center; gap: 7px; font-size: 7px; letter-spacing: .55px; }
.wrong-legend strong { font-size: 7px; }
.legend-pulse { width: 8px; height: 8px; background: #ec5a3e; border: 2px solid #ffb49b; border-radius: 50%; box-shadow: 0 0 0 3px #ed624317; }
.toolbar-button { padding: 7px 0 7px 10px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 8px; font-weight: bold; letter-spacing: .8px; cursor: pointer; min-width: 62px; min-height: 30px; }
.toolbar-button:disabled { opacity: .35; cursor: default; }
.toolbar-button:not(:disabled):hover { color: var(--orange); }
#pause-icon { font-size: 13px; margin-right: 4px; }
.side-panel { display: flex; flex-direction: column; gap: 19px; padding-top: 1px; }
.mission-card, .score-card { border-top: 2px solid var(--ink); padding-top: 17px; }
.section-heading { display: flex; align-items: center; gap: 10px; }
.section-number { font-size: 9px; font-weight: bold; color: var(--orange); }
.section-heading h2 { font-size: 10px; letter-spacing: 1.5px; margin: 0; }
.tiny-arrow { margin-left: auto; font-size: 24px; line-height: .7; }
.mission-title { font-family: "Arial Black", Arial, sans-serif; font-size: clamp(28px, 3.2vw, 38px); letter-spacing: -1.4px; line-height: 1.14; margin: 24px 0 18px; }
.mission-title span { color: var(--orange); }
.instruction-visual { display: flex; align-items: center; justify-content: space-around; height: 95px; background: #e5e8d9; border: 1px solid #d1d7c4; border-radius: 5px; margin-bottom: 22px; overflow: hidden; position: relative; }
.instruction-visual::after { content: ""; position: absolute; height: 100%; left: 50%; border-left: 1px dashed #bcc4b2; pointer-events: none; }
.mini-bike { position: relative; z-index: 1; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; }
.mini-bike small { position: absolute; width: 90px; bottom: -19px; text-align: center; font-size: 6px; font-weight: bold; letter-spacing: .8px; }
.wrong-mini { color: #ffefd9; background: #e95f41; border: 3px solid #ffc0a2; box-shadow: 0 0 0 5px #e95f4120; transform: rotate(180deg); }
.wrong-mini small { transform: rotate(180deg); }
.safe-mini { color: #e8efcf; background: #35765b; border: 3px solid #b4cd9c; }
.tap-symbol { position: relative; z-index: 1; display: flex; align-items: center; color: var(--ink); }
.tap-symbol span { font-size: 29px; font-weight: bold; transform: rotate(-15deg); }
.tap-symbol i { width: 17px; height: 17px; border: 1px solid var(--orange); border-radius: 50%; position: absolute; left: -12px; top: 0; }
.instructions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.instructions li { display: flex; align-items: flex-start; gap: 11px; }
.instructions li > span { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border: 1px solid #b9c2ae; border-radius: 50%; font-size: 9px; font-weight: bold; color: var(--orange); }
.instructions p { font-size: 11px; line-height: 1.6; margin: 1px 0 0; color: #687266; }
.instructions strong { color: var(--ink); }
.score-card { padding-top: 15px; }
.score-card .section-heading { margin-bottom: 15px; }
.score-rule { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.rule-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 4px; font-size: 18px; font-weight: 900; }
.rule-icon.orange { background: #fae2c9; color: #c2642d; }
.rule-icon.blue { background: #d7e4df; color: #397263; }
.rule-icon.red { background: #f3d6cd; color: #c9543c; }
.score-rule > div { display: flex; flex-direction: column; gap: 4px; }
.score-rule strong { font-size: 12px; }
.score-rule small { font-size: 10px; color: var(--muted); }
.safety-note { display: flex; align-items: center; gap: 12px; padding: 15px; background: #f6d66e; border: 1px solid #d5b959; border-radius: 5px; transform: rotate(-1deg); }
.helmet-icon { font-size: 32px; line-height: 1; }
.safety-note p { margin: 0; font-size: 10px; line-height: 1.6; }
.keyboard-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 8px; }
kbd { min-width: 21px; height: 21px; padding: 3px; display: inline-grid; place-items: center; border: 1px solid #b9c2b2; border-bottom-width: 2px; border-radius: 3px; color: var(--ink); font: 10px Arial, sans-serif; }
.combo-strip { margin-top: 25px; display: grid; grid-template-columns: 1.35fr 1fr .65fr; align-items: center; gap: 27px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 7px; background: #eaece0; }
.combo-caption { display: flex; align-items: center; gap: 14px; }
.combo-spark { font-size: 43px; color: var(--orange); line-height: 1; }
.combo-caption > div { display: flex; flex-direction: column; gap: 7px; }
.combo-caption strong { font-size: 9px; letter-spacing: .65px; }
.combo-caption small { font-size: 9px; color: var(--muted); line-height: 1.5; }
.multiplier-row { display: flex; align-items: center; gap: 10px; font-size: 8px; letter-spacing: 1px; font-weight: bold; }
.multiplier-row strong { font-size: 22px; line-height: 1; color: var(--orange); letter-spacing: -1px; }
.multiplier-row #combo-count { margin-left: auto; font-size: 7px; color: var(--muted); letter-spacing: .3px; }
.meter-track { height: 7px; background: #cfd6c2; margin-top: 8px; border-radius: 2px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--orange); transition: width .18s ease; }
.meter-labels { display: flex; justify-content: space-between; margin-top: 5px; font-size: 7px; color: var(--muted); }
.personal-best { display: flex; flex-direction: column; gap: 4px; padding-left: 22px; border-left: 1px solid #cbd1c0; }
.personal-best > span { font-size: 8px; font-weight: bold; letter-spacing: 1px; }
.personal-best strong { font-size: 29px; line-height: 1.1; letter-spacing: -1px; }
.personal-best small { font-size: 7px; color: var(--muted); }
footer { margin: 30px 0 24px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #788071; font-size: 8px; letter-spacing: .6px; }
footer i { font-style: normal; margin: 0 3px; }
footer a { color: var(--ink); font-size: 8px; font-weight: bold; text-decoration: none; }
footer a span { color: var(--orange); font-size: 13px; margin-left: 4px; }

@media (min-width: 1000px) {
  .game-layout { grid-template-columns: minmax(420px, 1.25fr) minmax(300px, 1fr); gap: 35px; }
  .overlay-panel { padding-left: 34px; padding-right: 34px; }
}

@media (max-width: 760px) {
  .page { width: min(540px, calc(100% - 32px)); }
  .masthead { min-height: 68px; gap: 14px; }
  .masthead-note { font-size: 7px; letter-spacing: .65px; }
  .brand { font-size: 21px; }
  .brand-icon { width: 34px; height: 34px; }
  .intro { padding: 29px 0 25px; }
  h1 { font-size: clamp(40px, 10vw, 60px); letter-spacing: -3px; }
  .intro-copy { font-size: 12px; }
  .round-stamp { width: 116px; margin-right: 5px; padding: 11px 7px 9px; }
  .stamp-number { font-size: 46px; }
  .stamp-number span { font-size: 26px; }
  .stamp-top { font-size: 7px; }
  .stamp-bottom { font-size: 5.5px; }
  .game-layout { grid-template-columns: 1fr; gap: 27px; }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .mission-card { grid-row: span 2; }
  .mission-title { font-size: 29px; }
  .instructions p { font-size: 10px; }
  .instruction-visual { height: 88px; }
  .safety-note { align-self: start; }
  .keyboard-note { display: none; }
  .combo-strip { grid-template-columns: 1.1fr 1fr; gap: 20px; }
  .personal-best { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; padding: 13px 0 0; border-left: 0; border-top: 1px solid #cbd1c0; }
  .personal-best strong { font-size: 22px; }
  .personal-best small { margin-left: auto; }
  .footer-center { display: none; }
}

@media (max-width: 440px) {
  .page { width: calc(100% - 24px); }
  .masthead { min-height: 61px; }
  .masthead-note { display: none; }
  .icon-button { margin-left: auto; width: 35px; height: 35px; }
  .intro { padding: 24px 0 21px; align-items: flex-start; }
  .eyebrow { font-size: 7px; letter-spacing: 1.1px; margin-bottom: 8px; }
  h1 { font-size: clamp(35px, 10.6vw, 46px); letter-spacing: -2.5px; }
  .intro-copy { font-size: 11px; line-height: 1.55; margin-top: 11px; }
  .round-stamp { width: 80px; margin: 5px 2px 0 10px; padding: 9px 5px 7px; transform: rotate(6deg); flex-shrink: 0; }
  .stamp-number { font-size: 35px; letter-spacing: -2px; }
  .stamp-number span { font-size: 20px; }
  .stamp-top { font-size: 5.5px; letter-spacing: .7px; }
  .stamp-bottom { font-size: 4.1px; letter-spacing: .2px; }
  .game-card { border-radius: 8px; box-shadow: 3px 4px 0 #183a3410; }
  .hud { height: 64px; padding: 11px 16px; }
  .hud-item strong { font-size: 23px; }
  .hud-label { font-size: 7px; letter-spacing: 1.1px; }
  .time-item { padding-left: 15px; }
  .lives-item { padding-left: 14px; }
  .lives { font-size: 18px; gap: 5px; }
  .overlay { padding: 17px; }
  .overlay-panel { padding: 23px 21px 17px; }
  .panel-kicker { font-size: 7px; letter-spacing: 1.3px; }
  .start-bike { width: 68px; height: 68px; margin: 14px auto 12px; }
  .start-bike svg { width: 63px; height: 63px; }
  .overlay-panel h2 { font-size: 29px; }
  .overlay-panel p { font-size: 11px; margin: 13px auto 17px; }
  .primary-button { min-height: 47px; font-size: 11px; }
  .best-line { margin-top: 17px; }
  .start-controls { margin-top: 15px; padding-top: 13px; font-size: 6px; gap: 5px; }
  .compact-panel h2 { font-size: 38px; }
  .result-score strong { font-size: 32px; }
  .result-stats { margin: 14px 0; }
  .result-stats strong { font-size: 22px; }
  .result-stats span { font-size: 6px; }
  .game-toolbar { padding-left: 12px; padding-right: 12px; }
  .wrong-legend { font-size: 6.5px; }
  .side-panel { grid-template-columns: 1fr; gap: 23px; }
  .mission-card { grid-row: auto; }
  .mission-title { font-size: 33px; margin-top: 18px; }
  .mission-title br { display: none; }
  .instructions { gap: 11px; }
  .instructions p { font-size: 12px; }
  .instruction-visual { height: 95px; }
  .score-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .score-card .section-heading { grid-column: 1 / -1; }
  .score-rule { gap: 8px; }
  .score-rule small { font-size: 8px; line-height: 1.5; }
  .score-rule strong { font-size: 10px; }
  .score-rule:last-child { grid-column: 1 / -1; }
  .safety-note { justify-content: center; }
  .combo-strip { padding: 17px 15px; gap: 15px; margin-top: 20px; }
  .combo-caption { gap: 7px; }
  .combo-spark { font-size: 29px; }
  .combo-caption strong { font-size: 7px; line-height: 1.5; letter-spacing: .2px; }
  .combo-caption small { font-size: 8px; }
  .multiplier-row { gap: 5px; }
  .multiplier-row #combo-count { display: none; }
  .personal-best small { font-size: 6px; }
  footer { margin-top: 24px; font-size: 7px; }
  .street-sign { transform: scale(.85) rotate(-2deg); transform-origin: top left; }
}

@media (max-width: 350px) {
  .round-stamp { display: none; }
  .overlay { padding: 13px; }
  .overlay-panel { padding: 20px 17px 15px; }
  .start-bike { width: 59px; height: 59px; margin: 12px auto; }
  .start-bike svg { width: 55px; height: 55px; }
  .overlay-panel h2 { font-size: 26px; }
  .overlay-panel p { font-size: 10px; }
  .start-controls { font-size: 5.4px; }
}

@media (max-height: 520px) and (min-width: 600px) {
  .overlay { position: fixed; padding: 15px; overflow-y: auto; }
  .overlay-panel { max-width: 420px; margin: auto; padding: 18px 25px; }
  .start-bike { width: 55px; height: 55px; margin: 10px auto; }
  .start-bike svg { width: 52px; height: 52px; }
  .overlay-panel h2 { font-size: 25px; }
  .overlay-panel p { margin: 10px auto 13px; }
  .start-controls { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
