:root { --ink: #293d37; --paper: #f4f2df; --sky: #4dbdc6; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--sky); color: var(--ink); font-family: 'Courier New', monospace; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #126a83; outline-offset: 4px; }
[hidden] { display: none !important; }
main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
/* Keep the entire playfield visible; overlays and canvas share one scale. */
.game { position: relative; width: min(100vw, 60vh); width: min(100vw, 60dvh); aspect-ratio: 3 / 5; overflow: hidden; background: var(--sky); touch-action: none; user-select: none; container-type: inline-size; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6.67cqw 7.78cqw 20.83cqw; text-align: center; }
.menu { justify-content: flex-start; padding-top: 10cqw; }
h2 { margin: 3.33cqw 0; font-family: Impact, 'Arial Black', sans-serif; font-size: 11.11cqw; line-height: 1.05; letter-spacing: .28cqw; }
.game-title { width: 100%; max-width: 73.89cqw; margin: 4.17cqw 0 2.78cqw; line-height: 0; }
.game-title img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.hero-face { height: 26.67cqw; position: relative; display: flex; align-items: center; animation: bob 2.3s ease-in-out infinite; }
.hero-face img { width: 18.61cqw; height: 23.89cqw; object-fit: contain; transform: rotate(-8deg); }
.spark { position: absolute; right: -6.94cqw; top: 3.06cqw; color: #fff4bc; font-size: 6.39cqw; }
.pixel-button { width: 100%; max-width: 70.83cqw; border: .83cqw solid #344338; box-shadow: .83cqw 1.11cqw 0 #344338; padding: 3.61cqw 4.44cqw; font-size: 4.17cqw; font-weight: 900; letter-spacing: .28cqw; display: flex; justify-content: space-between; align-items: center; color: var(--ink); }
.pixel-button:active { transform: translate(.56cqw, .83cqw); box-shadow: .28cqw .28cqw 0 #344338; }
.primary { background: #f58b49; color: #fffbea; text-shadow: .28cqw .28cqw #925b37; }
.secondary { background: #fff0c3; margin-top: 3.61cqw; font-size: 3.33cqw; padding: 3.06cqw 4.44cqw; }
.best { font-size: 2.5cqw; letter-spacing: .28cqw; margin-top: 6.39cqw; }
.best strong { margin-left: 2.5cqw; font-size: 4.17cqw; }
.score { position: absolute; top: 9.72cqw; left: 0; width: 100%; display: flex; justify-content: center; gap: .83cqw; }
.score img { height: 10cqw; image-rendering: pixelated; }
.pause { position: absolute; top: 3.33cqw; right: 3.33cqw; background: #fff0c3; border: .56cqw solid var(--ink); color: var(--ink); font-size: 5cqw; padding: .83cqw 2.5cqw; }
.sound { position: absolute; bottom: 6cqw; left: 50%; transform: translateX(-50%); border: 0; background: transparent; padding: 3cqw; font-size: 2.78cqw; color: var(--ink); }
/* Head bobs around y=245 (40.8%); reserve that whole band for it. */
.ready { pointer-events: none; padding: 0; display: block; }
.ready h2 { position: absolute; top: 20%; width: 100%; margin: 0; color: #fff3c4; text-shadow: .83cqw .83cqw var(--ink); }
.ready p { position: absolute; top: 57%; width: 100%; margin: 0; font-size: 3.33cqw; line-height: 1.5; }
.tap-icon { position: absolute; top: 47%; left: 50%; transform: translateX(-50%); font-size: 11.11cqw; line-height: 1; }
.little-label { font-size: 2.78cqw; letter-spacing: .56cqw; font-weight: bold; color: #345a4b; }
.panel { background: #f4e6b8; border: .83cqw solid var(--ink); box-shadow: 1.39cqw 1.39cqw 0 #34433855; padding: 6.94cqw 5.56cqw; width: 100%; }
.panel h2 { font-size: 9.17cqw; }
.panel p { font-size: 3.06cqw; line-height: 1.6; }
.results { display: flex; justify-content: space-around; margin: 6.94cqw 0; font-size: 3.06cqw; }
.results strong { display: block; font-size: 9.72cqw; margin-top: 1.94cqw; }
.text-button { border: 0; background: transparent; text-decoration: underline; padding: 5.56cqw 2.78cqw 0; color: var(--ink); font-size: 3.33cqw; }
dialog { border: 3px solid var(--ink); background: var(--paper); color: var(--ink); max-width: 390px; width: calc(100% - 36px); max-height: calc(100dvh - 36px); overflow: auto; padding: 35px; box-shadow: 8px 8px 0 #293d3740; text-align: center; }
dialog::backdrop { background: #1d393bc9; backdrop-filter: blur(4px); }
.close { position: absolute; right: 12px; top: 7px; background: none; border: 0; font-size: 28px; color: var(--ink); }
.profile { display: block; width: 88px; height: 100px; object-fit: contain; margin: 24px auto 20px; }
dialog h2 { font-size: 30px; margin: 12px 0; letter-spacing: 1px; }
dialog p { font-family: Arial, sans-serif; line-height: 1.7; font-size: 14px; color: #64726a; }
dialog .pixel-button { margin: auto; max-width: 255px; border-width: 3px; box-shadow: 3px 4px 0 #344338; padding: 13px 16px; font-size: 15px; letter-spacing: 1px; text-shadow: 1px 1px #925b37; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@keyframes bob { 50% { transform: translateY(-2.5cqw); } }
@media (prefers-reduced-motion: reduce) { .hero-face { animation: none; } }

.best { margin-top: 3cqw; }
.map-name { position: absolute; top: 29%; left: 0; width: 100%; font-weight: bold; font-size: 3.3cqw; letter-spacing: .7cqw; }
button:disabled { cursor: default; opacity: .6; }

#retry, #resume { justify-content: center; text-align: center; }

.hero-face { margin-bottom: 5cqw; }
.linkedin-link { display: inline-block; padding: 8px 0; color: #126a83; font-weight: bold; text-underline-offset: 4px; }
.linkedin-link:focus-visible { outline: 3px solid #126a83; outline-offset: 4px; }
#load-error { font-size: 3cqw; }

/* Photo stays smooth at native screen resolution; scenery retains hard pixels. */
#player-face {
  position: absolute;
  width: 12.222222%;
  height: 9.333333%;
  object-fit: fill;
  image-rendering: auto;
  pointer-events: none;
  user-select: none;
  transform-origin: center;
  will-change: transform, top;
}

.player-layer { position: absolute; inset: 0; pointer-events: none; clip-path: inset(0 0 13.333333% 0); }
