:root {
  --ink: #1d2a3a;
  --sand: #f6e4b4;
  --sand-deep: #e6c78d;
  --sea: #12a3bd;
  --sea-deep: #0b6fa0;
  --coral: #e8534e;
  --paper: #fff8ea;
  --mint: #bfe8df;
  --danger: #b83f3a;
  --shadow: rgba(29, 42, 58, 0.9);
}

* { box-sizing: border-box; }

button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid #31b4d1;
  outline-offset: 3px;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b6fa0;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* --------------------------------------------------------------- loader --- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--ink);
  background: var(--paper);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.boot-screen::before,
.boot-screen::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 13px;
  background: var(--coral);
  border-color: var(--ink);
  border-style: solid;
}

.boot-screen::before { top: 0; border-width: 0 0 3px; }
.boot-screen::after {
  bottom: 0;
  background: var(--sea-deep);
  border-width: 3px 0 0;
}

.boot-screen.ready { opacity: 0; visibility: hidden; }

.boot-card {
  position: relative;
  z-index: 1;
  width: min(390px, 100%);
  text-align: center;
}

.boot-card h1 {
  margin: 17px 0 13px;
  font-size: clamp(46px, 10vw, 66px);
  white-space: nowrap;
}

.boot-card p {
  min-height: 22px;
  margin: 0 0 15px;
  color: #40546a;
  font-size: 14px;
  font-weight: 800;
}

.boot-glasses {
  display: flex;
  justify-content: center;
  gap: 17px;
  position: relative;
  width: max-content;
  margin: 0 auto;
}

.boot-glasses::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 35px;
  width: 20px;
  height: 4px;
  background: var(--ink);
}

.boot-glasses i {
  display: block;
  width: 39px;
  height: 34px;
  border: 6px solid var(--ink);
  border-radius: 48%;
  background: rgba(29, 42, 58, 0.12);
  animation: glasses-bob 1.2s ease-in-out infinite alternate;
}

.boot-glasses i:last-child { animation-delay: -0.6s; }

@keyframes glasses-bob {
  to { transform: translateY(-4px) rotate(3deg); }
}

.boot-track {
  height: 26px;
  padding: 4px;
  overflow: hidden;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
}

#boot-progress {
  display: block;
  width: 5%;
  height: 100%;
  background: repeating-linear-gradient(115deg, var(--coral) 0 18px, var(--paper) 18px 34px);
  border-radius: inherit;
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.25, 1);
  animation: loader-stripes 0.8s linear infinite;
}

@keyframes loader-stripes {
  to { background-position: 34px 0; }
}

/* ---------------------------------------------------------------- menu ---- */

#menu {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 240, 207, 0.35), transparent 60%),
    rgba(9, 46, 70, 0.42);
  backdrop-filter: blur(3px) saturate(1.1);
  transition: opacity 0.45s ease;
  z-index: 10;
}

#menu.fade { opacity: 0; pointer-events: none; }

.pause-label,
.result-kicker,
.leaderboard-kicker {
  margin: 0 0 7px;
  color: var(--sea-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.pause-label {
  display: inline-flex;
  padding: 5px 8px;
  color: var(--paper);
  background: var(--sea-deep);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 46, 70, 0.34);
  backdrop-filter: blur(3px) saturate(1.1);
  z-index: 12;
}

.card {
  width: min(430px, 100%);
  padding: 30px 32px 26px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 10px 10px 0 var(--shadow);
  animation: pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

@keyframes pop {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sea-deep);
}

h1 {
  margin: 0 0 12px;
  font-size: 54px;
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.menu-main h1 { white-space: nowrap; }

h1 em {
  font-style: normal;
  color: var(--coral);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
}

h2 {
  margin: 0 0 12px;
  font-size: 50px;
  line-height: 0.92;
}

h2 em {
  font-style: normal;
  color: var(--coral);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
}

.blurb {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #46586c;
}

.menu-best {
  display: flex;
  justify-content: space-between;
  margin: -5px 0 16px;
  padding: 9px 12px;
  color: var(--sea-deep);
  background: #e7f5f1;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.keys {
  display: grid;
  gap: 9px;
  padding: 16px 16px 14px;
  margin-bottom: 20px;
  background: var(--sand);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
}

.caps { display: flex; gap: 4px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 2px 0 var(--ink);
}

kbd.wide { min-width: 58px; }

#play,
#reset-run,
#restart,
#reload-game {
  width: 100%;
  padding: 15px;
  position: relative;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--paper);
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.2s ease;
}

.button-spinner {
  display: none;
  position: absolute;
  top: 50%;
  right: 16px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 3px solid rgba(255, 248, 234, 0.42);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
}

#play.loading .button-spinner { display: block; }

@keyframes ui-spin { to { transform: rotate(360deg); } }

#reset-run {
  margin-top: 10px;
  color: var(--ink);
  background: var(--paper);
}

#play:hover:not(:disabled), #restart:hover, #reload-game:hover { background: #f4655f; }
#reset-run:hover { background: var(--sand); }
#play:active:not(:disabled), #reset-run:active, #restart:active, #reload-game:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
#play:disabled { background: #b9c4cf; cursor: default; box-shadow: 0 5px 0 var(--ink); }

.result-card {
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-linear-gradient(110deg, var(--coral) 0 18px, var(--paper) 18px 34px) border-box;
}

.result-card::before {
  content: "";
  display: block;
  height: 9px;
  margin: -30px -32px 25px;
  background: repeating-linear-gradient(110deg, var(--coral) 0 22px, var(--paper) 22px 40px);
  border-bottom: 3px solid var(--ink);
}

.result-card h2 { font-size: 46px; }
.result-kicker { margin-bottom: 10px; }
.result-time {
  margin: 20px 0 3px;
  font-size: 46px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.result-best { margin: 0 0 7px; color: var(--sea-deep); font-weight: 900; }
.result-penalty { margin: 0 0 9px; color: var(--danger); font-size: 11px; font-weight: 900; }

/* -------------------------------------------------------- ranked menu ---- */

.menu-card {
  width: min(880px, 100%);
  max-height: calc(100vh - 48px);
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(310px, 0.88fr);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--sea-deep) transparent;
  scrollbar-width: thin;
}

.menu-card::-webkit-scrollbar { width: 8px; }
.menu-card::-webkit-scrollbar-track { background: transparent; }
.menu-card::-webkit-scrollbar-thumb {
  background: var(--sea-deep);
  border: 2px solid var(--paper);
  border-radius: 999px;
}

.menu-main { padding: 29px 30px 24px; }
.menu-main h1 { margin-bottom: 11px; font-size: 48px; }
.menu-main .blurb { margin-bottom: 15px; }

.callsign-label,
.section-label {
  display: block;
  margin: 0 0 6px;
  color: #46586c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.callsign {
  width: 100%;
  height: 46px;
  margin: 0 0 14px;
  padding: 0 13px;
  color: var(--ink);
  background: #fffdf6;
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  outline: none;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--ink);
}

.callsign:focus { border-color: var(--sea-deep); box-shadow: 0 3px 0 var(--sea-deep); }
.callsign:disabled { color: #46586c; background: #eef1ed; opacity: 1; }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mode-card {
  width: 100%;
  min-height: 71px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  color: var(--ink);
  background: var(--sand);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
  font: inherit;
  cursor: pointer;
}

.mode-card.active { background: var(--coral); color: var(--paper); }
.mode-card.active:hover { background: #f4655f; }
.mode-card.active:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mode-card span { font-size: 15px; font-weight: 900; }
.mode-card small { margin-top: 3px; font-size: 10px; font-weight: 700; opacity: 0.78; }
.mode-card.daily:disabled { color: #78828b; background: #dce2df; cursor: not-allowed; }
.start-button { margin-top: 11px; }

.ranking-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 17px;
  margin: 10px 1px 9px;
  color: var(--sea-deep);
  font-size: 11px;
  font-weight: 800;
}

.ranking-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: #3fac84;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.ranking-status.loading::before {
  background: var(--sand-deep);
  animation: status-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes status-pulse { to { transform: scale(0.58); opacity: 0.5; } }

.ranking-status[data-kind="error"] { color: #a33b36; }
.ranking-status[data-kind="error"]::before { background: var(--coral); }
.menu-main .menu-best { margin: 0 0 10px; }

.controls summary {
  color: #536578;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.controls .keys {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 8px;
  margin: 9px 0 0;
  padding: 11px 13px;
}
.controls .row { font-size: 12px; }
.controls kbd { height: 22px; min-width: 22px; font-size: 10px; }

.leaderboard {
  min-width: 0;
  padding: 28px 26px 22px;
  background: var(--sand);
  border-left: 3px solid var(--ink);
}

.leaderboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(29, 42, 58, 0.2);
}

.leaderboard h2 {
  margin: 0;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: 0 2px 0 var(--ink);
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.icon-button:active { transform: translateY(2px); box-shadow: none; }
.icon-button:disabled { cursor: wait; opacity: 0.55; }

.leaderboard-list {
  min-height: 300px;
  margin: 12px 0 10px;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 12px;
}

.leaderboard-entry:nth-child(odd) { background: rgba(255, 248, 234, 0.56); }
.leaderboard-entry.current { background: #bfe8df; outline: 2px solid var(--ink); }
.leaderboard-rank { color: var(--sea-deep); font-weight: 900; }
.leaderboard-name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-time { font-variant-numeric: tabular-nums; font-weight: 900; }

.leaderboard-message {
  display: grid;
  min-height: 270px;
  place-items: center;
  color: #667687;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.leaderboard-loading {
  display: grid;
  gap: 8px;
  padding: 3px 5px;
}

.leaderboard-loading i {
  display: block;
  height: 28px;
  overflow: hidden;
  position: relative;
  background: rgba(255, 248, 234, 0.58);
  border-radius: 8px;
}

.leaderboard-loading i::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: skeleton-sweep 1.25s ease-in-out infinite;
}

.leaderboard-loading i:nth-child(2)::after { animation-delay: 0.08s; }
.leaderboard-loading i:nth-child(3)::after { animation-delay: 0.16s; }
.leaderboard-loading i:nth-child(4)::after { animation-delay: 0.24s; }
.leaderboard-loading i:nth-child(5)::after { animation-delay: 0.32s; }
.leaderboard-loading i:nth-child(6)::after { animation-delay: 0.4s; }

@keyframes skeleton-sweep { to { transform: translateX(100%); } }

.leaderboard-player {
  margin: 9px 0;
  padding: 9px 10px;
  color: var(--sea-deep);
  background: #e7f5f1;
  border: 2px solid var(--ink);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 900;
}

.result-rank {
  min-height: 18px;
  margin: 6px 0 20px;
  color: #46586c;
  font-size: 12px;
  font-weight: 800;
}

.result-rank.loading::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 7px -2px 0;
  border: 2px solid #9da9b3;
  border-top-color: var(--sea-deep);
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
}

.icon-button.loading span { display: inline-block; animation: ui-spin 0.7s linear infinite; }

@media (max-width: 760px) {
  #menu { padding: 12px; place-items: start center; overflow-y: auto; }
  .menu-card { max-height: none; grid-template-columns: 1fr; overflow: hidden; }
  .menu-main { padding: 24px 22px 20px; }
  .leaderboard { padding: 22px; border-top: 3px solid var(--ink); border-left: 0; }
  .leaderboard-list { min-height: 0; }
  .leaderboard-message { min-height: 150px; }
}

@media (max-width: 430px) {
  .mode-grid { grid-template-columns: 1fr; }
  .controls .keys { grid-template-columns: 1fr; }
  .menu-main h1 { font-size: 42px; }
}

/* ----------------------------------------------------------------- hud ---- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#hud .scoreboard,
#hud .waldo-help,
#hud #crosshair,
#hud #hint,
#hud #callout-feedback {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#hud.cinematic .scoreboard,
#hud.cinematic .waldo-help,
#hud.cinematic #crosshair,
#hud.cinematic #hint,
#hud.cinematic #callout-feedback {
  opacity: 0;
}

#hud.cinematic .scoreboard { transform: translateY(-12px); }
#hud.cinematic .waldo-help { transform: translateY(-12px); }

/* ------------------------------------------------------ found cinematic --- */

.found-cinematic {
  position: fixed;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  pointer-events: none;
}

.found-cinematic::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 48%, transparent 20%, rgba(12, 31, 45, 0.08) 48%, rgba(12, 31, 45, 0.42) 105%);
  opacity: 0;
  transition: opacity 0.55s ease;
}

.found-cinematic.active::before { opacity: 1; }

.cinematic-bar {
  position: absolute;
  right: 0;
  left: 0;
  height: clamp(30px, 4.8vh, 52px);
  background: var(--ink);
  transition: transform 0.48s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.cinematic-bar.top { top: 0; transform: translateY(-105%); }
.cinematic-bar.bottom { bottom: 0; transform: translateY(105%); }
.found-cinematic.active .cinematic-bar { transform: translateY(0); }
.found-cinematic.leaving .cinematic-bar.top { transform: translateY(-105%); }
.found-cinematic.leaving .cinematic-bar.bottom { transform: translateY(105%); }

.cinematic-burst {
  position: absolute;
  top: 48%;
  left: 50%;
  width: min(72vw, 760px);
  aspect-ratio: 1;
  background: repeating-conic-gradient(from 8deg, rgba(255, 210, 63, 0.19) 0 7deg, transparent 7deg 18deg);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35) rotate(-8deg);
  -webkit-mask-image: radial-gradient(circle, transparent 0 17%, #000 27% 67%, transparent 75%);
  mask-image: radial-gradient(circle, transparent 0 17%, #000 27% 67%, transparent 75%);
}

.found-cinematic.celebration .cinematic-burst {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(4deg);
  transition: opacity 0.2s ease, transform 0.8s cubic-bezier(0.15, 0.9, 0.25, 1);
}

.cinematic-found {
  position: absolute;
  right: 0;
  bottom: clamp(55px, 9vh, 94px);
  left: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.92);
}

.cinematic-found span,
.cinematic-found strong { display: block; }
.cinematic-found span {
  margin-bottom: 3px;
  color: #f8c65a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-shadow: 0 2px 0 var(--ink);
  text-transform: uppercase;
}
.cinematic-found strong {
  color: var(--paper);
  font-size: clamp(22px, 3.4vw, 38px);
  font-weight: 900;
  letter-spacing: -0.03em;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
}

.found-cinematic.celebration .cinematic-found {
  opacity: 1;
  transform: none;
  transition: opacity 0.24s 0.12s ease, transform 0.42s 0.08s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.cinematic-confetti i {
  position: absolute;
  top: 48%;
  left: 50%;
  width: 8px;
  height: 16px;
  background: var(--coral);
  border: 1.5px solid var(--ink);
  opacity: 0;
}

.cinematic-confetti i:nth-child(2n) { background: #f8c65a; }
.cinematic-confetti i:nth-child(3n) { background: #35a6c8; }
.found-cinematic.celebration .cinematic-confetti i { animation: confetti-pop 1.15s cubic-bezier(0.15, 0.75, 0.3, 1) forwards; }
.cinematic-confetti i:nth-child(1) { --cx: -210px; --cy: -160px; --cr: -75deg; }
.cinematic-confetti i:nth-child(2) { --cx: -125px; --cy: -230px; --cr: 48deg; animation-delay: 0.06s !important; }
.cinematic-confetti i:nth-child(3) { --cx: 105px; --cy: -225px; --cr: 82deg; animation-delay: 0.11s !important; }
.cinematic-confetti i:nth-child(4) { --cx: 225px; --cy: -135px; --cr: -35deg; animation-delay: 0.03s !important; }
.cinematic-confetti i:nth-child(5) { --cx: -245px; --cy: 10px; --cr: 115deg; animation-delay: 0.14s !important; }
.cinematic-confetti i:nth-child(6) { --cx: 250px; --cy: 15px; --cr: 56deg; animation-delay: 0.09s !important; }
.cinematic-confetti i:nth-child(7) { --cx: -175px; --cy: 120px; --cr: -95deg; animation-delay: 0.18s !important; }
.cinematic-confetti i:nth-child(8) { --cx: 180px; --cy: 115px; --cr: 125deg; animation-delay: 0.16s !important; }

@keyframes confetti-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  20% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--cx)), calc(-50% + var(--cy))) rotate(var(--cr)); }
}

.scoreboard {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  gap: 8px;
}

.scoreboard > div {
  min-width: 104px;
  padding: 8px 11px 9px;
  color: var(--paper);
  background: rgba(19, 34, 48, 0.66);
  border: 2px solid rgba(255, 248, 234, 0.76);
  border-radius: 11px;
  box-shadow: 3px 3px 0 rgba(29, 42, 58, 0.65);
}

.scoreboard span {
  display: block;
  margin-bottom: 1px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}

.scoreboard strong { font-size: 19px; font-variant-numeric: tabular-nums; }

.scoreboard > .penalty-score {
  min-width: 96px;
  color: #fff5e7;
  background: rgba(151, 48, 45, 0.82);
  border-color: rgba(255, 235, 216, 0.86);
  animation: penalty-in 0.22s cubic-bezier(0.2, 1.45, 0.4, 1) both;
}

@keyframes penalty-in {
  from { transform: translateX(-8px) scale(0.92); opacity: 0; }
}

.waldo-help {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 238px;
  color: var(--ink);
  pointer-events: auto;
}

.waldo-help summary {
  width: max-content;
  margin-left: auto;
  padding: 6px 8px 6px 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--paper);
  background: rgba(19, 34, 48, 0.78);
  border: 2px solid rgba(255, 248, 234, 0.76);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(29, 42, 58, 0.6);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
}

.waldo-help summary::-webkit-details-marker { display: none; }
.waldo-help[open] summary { margin-bottom: 6px; }
.waldo-help summary kbd {
  width: 22px;
  min-width: 22px;
  height: 20px;
  padding: 0;
  color: var(--ink);
  background: #f8c65a;
  border-width: 1.5px;
  border-radius: 5px;
  box-shadow: none;
  font-size: 9px;
}

.waldo-help summary > i {
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

.waldo-help[open] summary > i { transform: rotate(225deg) translate(-1px, -1px); }

.waldo-help-content {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  background: rgba(255, 248, 234, 0.96);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 rgba(29, 42, 58, 0.72);
  animation: guide-open 0.18s ease-out both;
}

@keyframes guide-open {
  from { transform: translateY(-5px); opacity: 0; }
}

.waldo-target-copy { min-width: 0; }
.waldo-target-copy .target-label {
  display: block;
  margin-bottom: 2px;
  color: var(--sea-deep);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.waldo-target-copy strong { display: block; margin-bottom: 6px; font-size: 14px; }
.waldo-target-copy ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.waldo-target-copy li {
  padding: 3px 5px;
  color: #46586c;
  background: var(--sand);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.waldo-mini {
  position: relative;
  width: 42px;
  height: 73px;
  flex: 0 0 42px;
}

.waldo-mini > span { position: absolute; display: block; }
.waldo-hat {
  z-index: 3;
  top: 0;
  left: 8px;
  width: 27px;
  height: 12px;
  background: var(--coral);
  border: 2px solid var(--ink);
  border-radius: 12px 12px 4px 4px;
}

.waldo-head {
  z-index: 2;
  top: 8px;
  left: 10px;
  width: 23px;
  height: 22px;
  background: #e8a06f;
  border: 2px solid var(--ink);
  border-radius: 45%;
}

.waldo-head i {
  position: absolute;
  top: 6px;
  width: 8px;
  height: 7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.waldo-head i:first-child { left: 1px; }
.waldo-head i:last-child { right: 1px; }

.waldo-shirt {
  top: 28px;
  left: 5px;
  width: 33px;
  height: 29px;
  background: repeating-linear-gradient(to bottom, var(--paper) 0 6px, var(--coral) 6px 12px);
  border: 2px solid var(--ink);
  border-radius: 7px 7px 3px 3px;
}

.waldo-pants {
  top: 55px;
  left: 10px;
  width: 23px;
  height: 17px;
  background: #2675a8;
  border: 2px solid var(--ink);
  border-radius: 2px 2px 5px 5px;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(29, 42, 58, 0.45);
  opacity: 0.85;
}

#callout-feedback {
  position: absolute;
  left: 50%;
  top: calc(50% + 24px);
  transform: translate(-50%, -4px) scale(0.96);
  min-width: 150px;
  padding: 9px 14px 10px;
  color: var(--paper);
  background: rgba(19, 34, 48, 0.75);
  border: 2px solid var(--paper);
  border-radius: 10px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

#callout-feedback.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#callout-feedback.bump { animation: feedback-bump 0.22s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes feedback-bump {
  50% { transform: translate(-50%, 0) scale(1.08); }
}
#callout-feedback strong { display: block; font-size: 12px; font-weight: 900; }
#callout-feedback span { display: block; margin-top: 2px; font-size: 9px; font-weight: 800; opacity: 0.88; }
#callout-feedback[data-kind="miss"] { background: rgba(140, 43, 43, 0.88); }
#callout-feedback[data-kind="hit"] { background: rgba(11, 111, 96, 0.9); }

#hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--paper);
  background: rgba(19, 34, 48, 0.5);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  transition: opacity 0.6s ease;
}

#hint kbd {
  height: 20px;
  min-width: 20px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--paper);
  box-shadow: none;
}

#hint.faded { opacity: 0; }

/* ---------------------------------------------------------------- error --- */

.error-overlay { z-index: 40; }

.error-card { text-align: center; }
.error-card h2 { margin-bottom: 12px; font-size: 34px; line-height: 1; }
.error-card p { margin: 0 0 22px; color: #526477; font-size: 14px; font-weight: 700; line-height: 1.5; }
.error-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 17px;
  place-items: center;
  color: var(--paper);
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 30px;
  font-weight: 900;
}

@media (max-width: 620px) {
  .scoreboard { top: 10px; left: 10px; gap: 5px; }
  .scoreboard > div { min-width: 85px; padding: 6px 8px 7px; }
  .scoreboard strong { font-size: 16px; }
  .waldo-help { top: 10px; right: 10px; width: 220px; }
  #hint { bottom: 12px; max-width: calc(100vw - 20px); text-align: center; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
