:root { --bg: #ffffff; --fg: #535353; --accent: #535353; --muted: #8a8a8a; --line: #e5e5e5; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); }
.site-header, .site-main, .site-footer { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--fg); }
.brand-logo { display: block; flex: none; }
.skin-nav { display: flex; gap: 12px; }
.skin-nav a { text-decoration: none; padding: 2px 8px; border-radius: 4px; }
.skin-nav a[aria-current="page"] { background: var(--accent); color: var(--bg); }
.site-main h1 { font-size: 1.8rem; margin: 24px 0 8px; }
.site-main h2 { font-size: 1.3rem; margin-top: 32px; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 16px; font-size: .9rem; color: var(--muted); text-align: center; }
.site-footer a { color: inherit; }
pre, textarea.snippet { width: 100%; font: 13px/1.4 ui-monospace, Menlo, monospace; background: #f4f4f4; color: #333; border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
textarea.snippet { height: 90px; resize: vertical; }
button { font: inherit; cursor: pointer; padding: 4px 12px; border: 1px solid var(--accent); background: var(--bg); color: var(--accent); border-radius: 4px; }
button:hover { background: var(--accent); color: var(--bg); }
/* Game */
.game { position: relative; margin: 16px 0; }
.game .interstitial-wrapper { position: relative; height: 150px; max-width: 600px; margin: 0 auto; color: var(--fg); }
.game .runner-container { position: absolute; top: 0; left: 0; height: 150px; max-width: 600px; overflow: hidden; width: 44px; }
.game .runner-canvas { position: absolute; top: 0; left: 0; height: 150px; max-width: 600px; opacity: 1; overflow: hidden; z-index: 2; image-rendering: pixelated; }
.game .controller { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; background: transparent; }
#offline-resources { display: none; }
body.inverted .game .runner-container { background: #fff; filter: invert(1); }
.game-hint { text-align: center; color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
@keyframes intro { from { width: 44px; } }
.leaderboards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.leaderboards h2 { font-size: 1rem; margin: 16px 0 4px; }
.leaderboards ol { margin: 0; padding-left: 24px; }
.leaderboards li span { float: right; font-variant-numeric: tabular-nums; }
.lb-status { grid-column: 1 / -1; color: var(--muted); margin: 0; }
.lb-reset { margin: 8px 0 0; color: var(--muted); }
.lb-status:empty { display: none; }
.lb-today-empty { margin: 0; color: var(--muted); }
.champions { text-align: center; }
.champions h2 { font-size: 1rem; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; margin: 32px 0 12px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 16px; list-style: none; margin: 0; padding: 0; }
.podium li { display: flex; flex-direction: column; align-items: center; width: 160px; line-height: 1.3; }
.podium .place-1 { order: 2; }
.podium .place-2 { order: 1; }
.podium .place-3 { order: 3; }
.podium .medal { font-size: 1.4rem; }
.podium .pn { font-size: 1.05rem; overflow-wrap: anywhere; }
.podium .ps { font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.podium .figure { width: 88px; height: 94px; background: no-repeat -1678px -2px; image-rendering: pixelated; }
.podium .step { align-self: stretch; height: 24px; background: color-mix(in srgb, var(--fg) 14%, var(--bg)); border-radius: 4px 4px 0 0; }
.podium .place-1 .step { height: 56px; }
.podium .place-2 .step { height: 36px; }
@media (max-width: 520px) {
  .podium { gap: 6px; }
  .podium li { width: 33%; }
  .podium .figure { zoom: .5; }
}
@media (max-width: 520px) { .leaderboards { grid-template-columns: 1fr; } }
/* Toolbar and dialogs */
.game .interstitial-wrapper { transform-origin: top center; }
.game-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; }
.game-toolbar button, .dialog-actions .button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--fg) 6%, var(--bg)); color: var(--fg); font-size: .95rem; text-decoration: none; }
.game-toolbar button:hover:not(:disabled), .dialog-actions .button:hover { background: color-mix(in srgb, var(--fg) 14%, var(--bg)); color: var(--fg); }
.game-toolbar button:disabled { opacity: .45; cursor: default; }
.game-toolbar.compact { position: fixed; top: 4px; left: 4px; margin: 0; gap: 4px; z-index: 3; }
.game-toolbar.compact button { padding: 1px 5px; font-size: 13px; opacity: .75; }
.game-toolbar.compact .tb-label { display: none; }
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: var(--bg); color: var(--fg); max-width: min(92vw, 640px); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
.name-dialog label { display: grid; gap: 6px; }
.name-dialog input { font: inherit; padding: 4px 8px; }
.nd-error { color: #b00020; min-height: 1.2em; margin: 6px 0; }
.shot-dialog img { display: block; width: 100%; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 4px; }
.sd-status { min-height: 1.2em; margin: 8px 0; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dialog-actions .button { border-color: var(--accent); color: var(--accent); background: var(--bg); }
.tb-toast { position: absolute; left: 50%; top: 0; transform: translate(-50%, calc(-100% + 8px)); z-index: 10; max-width: calc(100% - 16px); width: max-content; padding: 6px 14px; border-radius: 6px; background: rgb(0 0 0 / .78); color: #fff; font-size: .9rem; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.tb-toast.show { opacity: 1; transform: translate(-50%, -100%); }
/* Embed */
body.embed { overflow: hidden; height: 100vh; }
body.embed .game { margin: 0; height: 100vh; }
/* Wrapper capped at 600 px so the engine keeps its native width; ARCADE_MODE scales it up to fit the iframe. */
body.embed .interstitial-wrapper { max-width: 600px; margin: 0 auto; height: 100%; }
.embed-credit { position: fixed; right: 6px; bottom: 4px; font-size: 11px; color: var(--muted); text-decoration: none; z-index: 3; }
.embed-credit:hover { text-decoration: underline; }
/* Classroom */
.steps li, .features li, .activities li { margin: 6px 0; }
.snippet-builder { display: grid; gap: 8px; margin: 16px 0; }
.snippet-builder label { display: flex; gap: 8px; align-items: center; }
.snippet-builder select { font: inherit; }
.worksheet { border-collapse: collapse; width: 100%; max-width: 360px; }
.worksheet th, .worksheet td { border: 1px solid #999; padding: 8px 12px; text-align: left; height: 2.2em; }
.questions li { margin: 14px 0; }
pre.license { white-space: pre-wrap; font-size: 12px; }
@media print { .site-header, .site-footer, .no-print { display: none; } body { background: #fff; color: #000; } }
