* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #060d16;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Phone-shaped column; fills the screen on mobile, centred on desktop */
#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #060d16;
}

@media (min-width: 481px) {
  #stage { box-shadow: 0 0 80px rgba(89, 195, 255, 0.1); }
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden { display: none !important; }
.off { visibility: hidden; }

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 0;
  pointer-events: none;
}

.chip {
  display: flex;
  flex-direction: column;
  min-height: 46px;
  padding: 6px 12px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(6, 14, 24, 0.75);
  line-height: 1;
}

.chip.right {
  margin-left: auto;
  align-items: flex-end;
}

.label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9fd4ff;
}

.value {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pill {
  padding: 4px 11px 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e3141b;
  font-size: 15px;
  font-weight: 900;
  font-style: italic;
  white-space: nowrap;
}

.icon-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(6, 14, 24, 0.75);
  cursor: pointer;
}

.icon-btn span {
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: #fff;
}

/* ---------- Control tray ---------- */

.tray {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 14, 24, 0.94);
}

button { font: inherit; color: inherit; }

.timer-chip {
  flex: none;
  align-items: center;
  justify-content: center;
  width: 64px;
}

.timer-chip .value { font-size: 26px; }
.timer-chip.low .value { color: #ff5a4f; }

/* Big arcade buttons: hold to move, let go to stop */
.arcade {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 78px;
  border: 3px solid #fff;
  border-radius: 22px;
  background: #e3141b;
  box-shadow: 0 5px 0 #8a1014;
  cursor: pointer;
  touch-action: none;
}

.arcade svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #fff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arcade small {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.arcade:not(:disabled) { animation: ready 1.1s ease-in-out infinite; }

.arcade.held {
  background: #ff3b3f;
  box-shadow: 0 1px 0 #8a1014;
  transform: translateY(4px);
  animation: none;
}

.arcade:disabled {
  border-color: rgba(255, 255, 255, 0.16);
  background: #18324d;
  box-shadow: 0 5px 0 #0b1828;
  opacity: 0.55;
  cursor: default;
}

@keyframes ready {
  50% { box-shadow: 0 5px 0 #8a1014, 0 0 24px rgba(255, 90, 80, 0.8); }
}

/* ---------- Win banner ---------- */

.banner {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.banner-icon {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 4px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff7d6, #ffd54a 60%, #e0a21a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.banner small {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ffe7a0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.banner span {
  display: block;
  font-size: 40px;
  font-weight: 900;
  font-style: italic;
  white-space: nowrap;
  text-shadow: 0 3px 0 #9b1b1e, 0 6px 18px rgba(0, 0, 0, 0.7);
}

.banner.show { animation: banner 2.4s ease-out forwards; }

@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  20% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -75%); }
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 26px) 22px calc(env(safe-area-inset-bottom) + 26px);
  text-align: center;
}

.screen.dim { background: rgba(3, 8, 14, 0.72); }

.spacer {
  flex: 1;
  min-height: 12px;
}

.title-screen {
  background: linear-gradient(rgba(4, 10, 18, 0.85), rgba(4, 10, 18, 0.3) 38%, rgba(4, 10, 18, 0.3) 55%, rgba(4, 10, 18, 0.9));
}

/* Stand-in wordmark until we get the real logo files */
.osk {
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #e3141b;
  text-shadow:
    -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff,
    0 -2px 0 #fff, 0 2px 0 #fff, -2px 0 0 #fff, 2px 0 0 #fff,
    3px 4px 0 #1a1a1a;
}

.osk.small {
  font-size: 18px;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 2px 2px 0 #1a1a1a;
}

h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 14px;
  line-height: 1;
}

.title-small {
  margin-right: -0.32em;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #ffd54a;
  text-shadow: 0 3px 0 #7a4a06;
}

.title-big {
  font-size: 86px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 6px 0 #9b1b1e, 0 12px 24px rgba(0, 0, 0, 0.5);
}

.tagline {
  max-width: 300px;
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: #e6f3ff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.howto {
  list-style: none;
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 330px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(6, 14, 24, 0.88);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.howto li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  font-style: normal;
}

.ico-key {
  border: 2px solid #fff;
  border-radius: 8px;
  background: #e3141b;
  font-size: 15px;
  font-weight: 900;
}

.ico-cam::before {
  content: "";
  width: 22px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 4px;
  background: linear-gradient(#5a93c4, #2d5a86);
  box-shadow: inset -7px -5px 0 #10263d;
}

.ico-ball::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #11161b;
  border-radius: 50%;
  background: linear-gradient(#ffb020 50%, #f3f6f9 50%);
}

.btn {
  appearance: none;
  padding: 14px 44px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #e3141b;
  color: #fff;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 #8a1014, 0 10px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #8a1014, 0 6px 14px rgba(0, 0, 0, 0.4);
}

.best {
  min-height: 16px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cfe7ff;
}

/* ---------- Results ---------- */

.screen .card {
  width: 100%;
  max-width: 330px;
  margin-bottom: 22px;
  padding: 22px 18px 18px;
  border-top: 8px solid #e3141b;
  border-radius: 22px;
  background: #f6fbff;
  color: #10243a;
  box-shadow: 0 6px 0 #3d6a96, 0 18px 40px rgba(0, 0, 0, 0.45);
}

.caught {
  font-size: 40px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
  color: #e3141b;
}

.quip {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #3d5a78;
}

/* What the player won, one tile per kind of prize */
.haul-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
}

.haul-list:empty { display: none; }

.haul-list li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 2px 6px;
  border-radius: 12px;
  background: #e2eef8;
}

.haul-list canvas {
  display: block;
  width: 44px;
  height: 44px;
}

.haul-list b {
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.haul-list .count {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 12px;
  font-weight: 900;
  color: #e3141b;
}

.final-label,
.final-row span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5b7d9e;
}

.final-label { margin-top: 14px; }

.final-score {
  font-size: 54px;
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.new-best {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ffd54a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.final-row {
  display: flex;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #d5e4f2;
}

.final-row div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.final-row b {
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #3d5a78;
}

.paused-title {
  margin-bottom: 22px;
  font-size: 44px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  text-shadow: 0 4px 0 #9b1b1e;
}

/* Shorter phones */
@media (max-height: 700px) {
  .title-big { font-size: 68px; }
  .tagline { font-size: 14px; }
  .howto { gap: 7px; margin-bottom: 14px; padding: 11px 14px; font-size: 13px; }
  .screen .card { padding: 16px 16px 14px; }
  .caught { font-size: 34px; }
  .final-score { font-size: 44px; }
  .arcade { height: 70px; }
}
