@font-face {
  font-family: BarlowCondensed;
  src: url('../sneaker-run/assets/fonts/barlow-condensed-black.ttf');
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: Space;
  src: url('../sneaker-run/assets/fonts/space-grotesk.ttf');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #211f18;
  --paper: #f1e8c9;
  --paper-bright: #faf2d6;
  --yellow: #d9c75d;
  --red: #ed624c;
  --muted: #8e8666;
  --display: BarlowCondensed, 'Arial Narrow', sans-serif;
  --body: Space, 'Helvetica Neue', sans-serif;
  font-family: var(--body);
  color: var(--ink);
  background: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100svh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.arcade {
  width: min(100%, 1680px);
  height: 100svh;
  min-height: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 80px #100f0b;
}
.arcade[data-state='ready'] .scoreboard { display: none; }
.arcade:not([data-state='running']) .map-panel,
.arcade:not([data-state='running']) .wayfinding,
.arcade:not([data-state='running']) .center-mark { display: none; }
.arcade[data-state='ready'] .overlay-index { display: none; }
.masthead {
  height: 58px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  color: var(--paper);
  background: var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand span { padding-left: 12px; border-left: 1px solid #f1e8c955; color: #c8bf9c; font-size: 10px; letter-spacing: .15em; }
.edition { margin: 0 auto; color: #c8bf9c; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.edition span { color: var(--yellow); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.exit-link, .tool-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border: 1px solid #f1e8c94a; color: var(--paper); background: transparent; text-decoration: none; font-size: 10px; font-weight: 700; letter-spacing: .1em; transition: color .16s, background .16s, border-color .16s; }
.exit-link:hover, .tool-button:hover:not(:disabled) { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.tool-button:disabled { cursor: default; opacity: .45; }
.pause-button { width: 44px; padding: 0; font-size: 20px; }
.sound-button { gap: 5px; }
.arcade[data-state='ready'] .pause-button { display: none; }

.scoreboard {
  height: 78px;
  flex: none;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, .86fr) minmax(180px, .86fr);
  align-items: center;
  gap: clamp(16px, 4vw, 54px);
  padding: 10px 28px 13px;
  border-bottom: 1px solid #211f1826;
  background: var(--paper);
}
.status-title, .exit-status, .pursuer-status { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.status-title span, .exit-status>span, .pursuer-status>span { font-size: 9px; line-height: 1.25; font-weight: 700; letter-spacing: .15em; }
.status-title strong { font-size: 15px; font-weight: 500; }
.exit-status { position: relative; padding-left: 14px; border-left: 3px solid var(--yellow); }
.exit-status strong, .pursuer-status strong { font-size: 13px; font-weight: 700; letter-spacing: .045em; font-variant-numeric: tabular-nums; }
.pursuer-status { position: relative; padding-left: 14px; border-left: 3px solid var(--red); }
.progress-track, .pressure-track { height: 4px; margin-top: 2px; overflow: hidden; background: #211f1822; }
.progress-track i, .pressure-track i { display: block; width: 0; height: 100%; background: var(--red); transition: width .25s ease; }
.progress-track i { background: var(--yellow); }
.pressure-track i { background: var(--red); }

.playfield { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; background: #cbbb70; }
#worldCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.map-panel {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  width: 154px;
  padding: 9px;
  color: var(--paper-bright);
  background: #211f18e8;
  border: 1px solid #faf2d666;
  box-shadow: 4px 4px 0 #211f1850;
  pointer-events: none;
}
.map-panel:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.panel-label { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 6px; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.panel-label output { color: var(--yellow); font-variant-numeric: tabular-nums; }
#mapCanvas { display: block; width: 132px; height: 132px; image-rendering: pixelated; }
.wayfinding { position: absolute; z-index: 2; top: 16px; right: 16px; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; row-gap: 2px; padding: 8px 11px; color: var(--ink); background: var(--paper-bright); border: 1px solid #211f1866; box-shadow: 4px 4px 0 #211f1840; pointer-events: none; }
.cue-arrow { grid-row: span 2; width: 38px; height: 38px; display: grid; place-items: center; color: var(--paper-bright); background: var(--ink); border-radius: 50%; font-size: 22px; font-style: normal; font-weight: 700; line-height: 1; transition: transform .12s linear; }
.cue-arrow[data-here='true'], .cue-arrow[data-detour='true'] { background: var(--red); }
.wayfinding span { justify-self: end; font-size: 8px; font-weight: 700; letter-spacing: .16em; color: var(--muted); }
.wayfinding strong { justify-self: end; font-family: var(--display); font-size: 22px; line-height: .95; letter-spacing: .02em; }
.center-mark { position: absolute; z-index: 1; top: 50%; left: 50%; width: 14px; height: 14px; display: grid; place-items: center; transform: translate(-50%,-50%); pointer-events: none; }
.center-mark::before, .center-mark::after { content: ''; position: absolute; background: #f9f0ce; box-shadow: 0 1px 3px #211f1880; }
.center-mark::before { width: 11px; height: 1px; }
.center-mark::after { width: 1px; height: 11px; }
.center-mark i { z-index: 1; width: 3px; height: 3px; border-radius: 50%; background: var(--red); }
.speech-caption { position: absolute; z-index: 4; left: 50%; bottom: 18px; width: min(760px, calc(100% - 34px)); padding: 11px 16px 13px; transform: translateX(-50%); color: var(--paper-bright); background: #211f18ef; border: 1px solid #faf2d666; box-shadow: 4px 4px 0 #211f1850; }
.speech-caption span { display: block; margin-bottom: 3px; color: var(--yellow); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.speech-caption strong { display: block; font-size: 15px; line-height: 1.35; font-weight: 500; }

.screen-overlay { position: absolute; z-index: 5; inset: 0; display: flex; align-items: center; padding: clamp(20px, 5vw, 72px); overflow: hidden; background: linear-gradient(90deg, #211f18ed 0%, #211f18a8 46%, #211f1833 100%); }
.screen-overlay::before { content: ''; position: absolute; inset: 0; z-index: -1; background-image: url('./assets/yellow-wallpaper.jpg'); background-size: 310px 310px; opacity: .14; mix-blend-mode: screen; }
.screen-card { position: relative; z-index: 2; width: min(600px, 61%); min-width: 0; padding: clamp(22px, 4vw, 50px); background: var(--paper); border: 3px solid var(--ink); box-shadow: 10px 10px 0 #211f18a8; }
.eyebrow { margin: 0 0 17px; color: #71694b; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.screen-card h1 { max-width: 8ch; margin: 0; color: var(--ink); font-family: var(--display); font-size: clamp(58px, 8vw, 112px); font-weight: 900; letter-spacing: -.035em; line-height: .79; }
.overlay-copy { max-width: 31ch; margin: 19px 0 25px; font-size: 16px; line-height: 1.45; }
.primary { width: min(100%, 345px); min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border: 2px solid var(--ink); color: var(--paper-bright); background: var(--ink); box-shadow: 4px 4px 0 var(--red); font-size: 12px; font-weight: 700; letter-spacing: .08em; cursor: pointer; transition: transform .14s, box-shadow .14s, color .14s, background .14s; }
.primary:hover { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--red); color: var(--ink); background: var(--yellow); }
.primary span { color: var(--yellow); font-size: 19px; }
.overlay-controls { margin: 17px 0 0; color: #6a6247; font-size: 9px; font-weight: 700; letter-spacing: .09em; }
.overlay-controls b { padding: 0 5px; color: var(--red); }
.runner-portrait { position: absolute; right: 3%; bottom: 0; z-index: 1; width: clamp(180px, 29vw, 420px); max-height: 88%; object-fit: contain; object-position: bottom; image-rendering: pixelated; filter: drop-shadow(9px 8px 0 #211f1870); animation: idle-bob 2.6s ease-in-out infinite; }
@keyframes idle-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.overlay-index { position: absolute; top: 18px; right: 20px; z-index: 2; color: var(--paper-bright); font-family: var(--display); font-size: 22px; letter-spacing: .07em; }
.arcade[data-state='running'] .screen-overlay { visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .28s ease, visibility .28s; }
.arcade[data-state='paused'] .runner-portrait, .arcade[data-state='escaped'] .runner-portrait { display: none; }
.arcade[data-state='caught'] .screen-card h1 { color: var(--red); }
.arcade[data-state='escaped'] .screen-card h1 { color: #71632e; }

.control-deck { height: 76px; flex: none; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 10px 28px; color: var(--paper); background: var(--ink); }
.key-guide { display: flex; align-items: center; gap: 12px; }
.key-guide>div { display: flex; align-items: center; gap: 6px; color: #d0c8a8; font-size: 9px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
kbd { min-width: 27px; height: 27px; display: grid; place-items: center; padding: 0 5px; color: var(--paper-bright); background: #403d30; border: 1px solid #eee4bd55; border-bottom-width: 3px; font: 700 11px var(--body); }
.guide-note { padding-left: 6px; color: #aaa184; font-size: 10px; white-space: nowrap; }
.track-credit { justify-self: end; margin: 0; color: #aaa184; font-size: 8px; line-height: 1.55; letter-spacing: .14em; text-align: right; }
.track-credit strong { display: block; color: var(--paper); font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.touch-guide { display: none; margin: 0; color: #d0c8a8; font-size: 9px; font-weight: 700; letter-spacing: .08em; line-height: 1.7; text-align: center; }
.touch-guide b { color: var(--yellow); }
.touch-guide i { padding: 0 4px; color: var(--red); font-style: normal; }
kbd.wide { min-width: 46px; font-size: 9px; }
.key-guide>div kbd + kbd { margin-left: -2px; }

.arcade:not([data-state='running']) .stamina,
.arcade:not([data-state='running']) .look-hint,
.arcade:not([data-state='running']) .threat { display: none; }
.threat { position: absolute; z-index: 3; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff4ea; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 2px 0 #211f18); }
.threat i { color: var(--red); font-size: 30px; font-style: normal; line-height: 1; }
.threat span { padding: 2px 6px; background: var(--red); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.danger { position: absolute; z-index: 1; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 48%, #b3261e55 74%, #7d120cd9 100%); transition: opacity .12s linear; }
.look-hint { position: absolute; z-index: 2; left: 50%; top: calc(50% + 26px); padding: 6px 10px; transform: translateX(-50%); color: var(--paper-bright); background: #211f18c4; font-size: 9px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; pointer-events: none; }
.stamina { --stamina: 1; position: absolute; z-index: 2; left: 50%; bottom: 18px; width: min(220px, 44%); display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; padding: 7px 10px; transform: translateX(-50%); color: var(--paper-bright); background: #211f18d6; border: 1px solid #faf2d655; pointer-events: none; transition: opacity .3s ease; }
.stamina span { font-size: 8px; font-weight: 700; letter-spacing: .16em; }
.stamina i { height: 5px; background: var(--yellow); transform: scaleX(var(--stamina)); transform-origin: left center; }
.stamina[data-state='full'] { opacity: .55; }
.stamina[data-state='sprinting'] i { background: #fff4c8; }
.stamina[data-state='spent'] i { background: var(--red); }
.speech-caption:not([hidden]) ~ .stamina { display: none; }
.stick { position: absolute; z-index: 3; width: 116px; height: 116px; border: 2px solid #faf2d6a8; border-radius: 50%; background: #211f1840; transform: translate(-50%, -50%); pointer-events: none; }
.stick i { position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; border-radius: 50%; background: #faf2d6e6; border: 2px solid var(--ink); transform: translate(-50%, -50%); }
.flash { position: absolute; z-index: 4; inset: 0; opacity: 0; pointer-events: none; }
.flash.is-caught { background: var(--red); animation: flash-caught .95s ease-in forwards; }
.flash.is-escaped { background: #fffbea; animation: flash-escaped .9s ease-in forwards; }
@keyframes flash-caught { 0% { opacity: 0; } 12% { opacity: .55; } 30% { opacity: .15; } 100% { opacity: .85; } }
@keyframes flash-escaped { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 760px) {
  .arcade { min-height: 620px; }
  .masthead { height: 52px; gap: 8px; padding: 0 14px; }
  .brand { gap: 0; font-size: 11px; }
  .brand span { display: none; }
  .edition { display: none; }
  .toolbar { gap: 4px; }
  .exit-link { display: none; }
  .tool-button { min-height: 44px; padding: 0 7px; font-size: 8px; }
  .pause-button { width: 44px; font-size: 19px; }
  .scoreboard { height: 70px; grid-template-columns: .8fr 1fr 1.1fr; gap: 10px; padding: 8px 14px 10px; }
  .status-title span, .exit-status>span, .pursuer-status>span { font-size: 8px; letter-spacing: .11em; }
  .status-title strong { font-size: 11px; }
  .exit-status, .pursuer-status { padding-left: 8px; }
  .exit-status strong, .pursuer-status strong { font-size: 10px; letter-spacing: 0; white-space: nowrap; }
  .map-panel { top: 10px; left: 10px; width: 116px; padding: 6px; }
  .panel-label { padding-bottom: 3px; font-size: 8px; }
  #mapCanvas { width: 102px; height: 102px; }
  .wayfinding { top: 10px; right: 10px; padding: 7px 8px; }
  .wayfinding strong { font-size: 18px; }
  .cue-arrow { width: 32px; height: 32px; font-size: 18px; }
  .runner-portrait { left: 50%; right: auto; width: min(300px, 78vw); max-height: 48%; transform: translateX(-50%); animation-name: idle-bob-mobile; }
  @keyframes idle-bob-mobile { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,-7px); } }
  .screen-overlay { align-items: flex-start; padding: 18px; background: linear-gradient(90deg, #211f18ef 0%, #211f18c9 65%, #211f1855 100%); }
  .screen-card { width: min(460px, 100%); padding: 20px; }
  .eyebrow { margin-bottom: 12px; font-size: 8px; }
  .screen-card h1 { font-size: clamp(51px, 13vw, 76px); }
  .overlay-copy { max-width: 27ch; margin: 13px 0 17px; font-size: 14px; }
  .primary { min-height: 50px; font-size: 11px; }
  .overlay-controls { max-width: 29ch; font-size: 8px; line-height: 1.6; }
  .overlay-index { top: auto; right: 12px; bottom: 12px; font-size: 17px; }
  .control-deck { height: auto; min-height: 56px; grid-template-columns: 1fr; gap: 10px; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); }
  .key-guide, .track-credit { display: none; }
  .touch-guide { display: block; grid-column: 1 / -1; }
  .stamina { bottom: 12px; }
  .speech-caption { bottom: 9px; width: calc(100% - 20px); padding: 9px 11px 10px; }
  .speech-caption span { font-size: 8px; }
  .speech-caption strong { font-size: 12px; }
}
@media (max-width: 380px) {
  .edition { font-size: 8px; letter-spacing: .08em; }
  .scoreboard { gap: 6px; padding-inline: 10px; }
  .map-panel { width: 106px; }
  #mapCanvas { width: 92px; height: 92px; }
  .wayfinding { top: 122px; right: 10px; }
  .screen-overlay { padding: 12px; }
  .screen-card { padding: 17px; }
  .screen-card h1 { font-size: 50px; }
  .runner-portrait { right: 0; width: min(244px, 74vw); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
