:root {
  --ink: #372119;
  --cream: #fff7e8;
  --orange: #ff7a1a;
  --orange-dark: #c94b0b;
  --red: #f43f3f;
  --blue: #2596ff;
  --blue-dark: #1167c4;
  --green: #35c94a;
  --green-dark: #168b2c;
  --line: rgba(91, 48, 18, .18);
  --shadow: 0 24px 70px rgba(105, 52, 16, .25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

body {
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at 12% 12%, rgba(255,255,255,.92), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(255,237,151,.8), transparent 25%),
    linear-gradient(160deg, #48b8ff 0%, #95ddff 35%, #ffe39b 72%, #ff9f43 100%);
}

button { font: inherit; }

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.game-card {
  overflow: hidden;
  border: 4px solid rgba(255,255,255,.86);
  background: rgba(255,250,239,.96);
  box-shadow: var(--shadow), 0 0 0 2px rgba(117,57,17,.12);
  border-radius: 30px;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 17px 24px 18px;
  border-bottom: 3px solid #e8b56e;
  background:
    linear-gradient(90deg, rgba(255,255,255,.7), rgba(255,250,225,.9)),
    repeating-linear-gradient(135deg, #ffdf78 0 18px, #ffc84d 18px 36px);
}

.topbar::after {
  content: "🍔  🍕  🍩  🌮  🍎";
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 3px 14px;
  border-radius: 999px;
  border: 2px solid #d88328;
  background: #fff8da;
  letter-spacing: .18rem;
  box-shadow: 0 5px 0 rgba(120,62,17,.15);
}

.eyebrow {
  margin: 0 0 2px;
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 1000;
  color: #9c4d16;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: .95;
  letter-spacing: -.045em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 white, 0 7px 0 rgba(101,45,12,.13);
}

.food-word { color: #ff8a12; }
.frenzy-word { color: #e72e45; }

.score-panel {
  min-width: 118px;
  padding: 9px 16px 10px;
  text-align: center;
  background: linear-gradient(#713611, #4b220d);
  color: white;
  border: 3px solid #2f1608;
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px #a96025, 0 5px 0 rgba(70,30,8,.18);
}

.score-panel span {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 1000;
  color: #fff4d1;
}

.score-panel strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1.05;
  color: #ffdc47;
}

.game-wrap {
  position: relative;
  overflow: hidden;
  background: #73cfff;
  touch-action: manipulation;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  background: #73cfff;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(rgba(35,109,158,.18), rgba(77,38,12,.38));
}

.hidden { display: none; }

.overlay-card {
  width: min(540px, 94%);
  padding: 25px 28px 28px;
  border: 4px solid #7b3c16;
  border-radius: 26px;
  background: linear-gradient(#fffdf3, #fff1cf);
  text-align: center;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.65), 0 18px 0 rgba(94,43,13,.13), 0 26px 55px rgba(0,0,0,.25);
}

.overlay-card h2 {
  margin: 4px 0 9px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: #d83b2d;
  text-transform: uppercase;
  letter-spacing: -.03em;
}

.overlay-card p {
  margin: 0 auto 18px;
  max-width: 46ch;
  color: #614233;
  line-height: 1.5;
  font-weight: 650;
}

.hero-icon {
  font-size: 3.25rem;
  filter: drop-shadow(0 7px 2px rgba(96,42,13,.16));
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 21px;
}

.controls-grid > div {
  padding: 11px 8px;
  border: 2px solid #e8bd7a;
  border-radius: 15px;
  background: #fffaf0;
  box-shadow: 0 4px 0 #e8bd7a;
}

.controls-grid small {
  display: block;
  margin-top: 8px;
  font-weight: 900;
  color: #76503d;
}

.key {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  margin: 0 2px;
  border: 2px solid #6b94b7;
  border-bottom-width: 5px;
  border-radius: 9px;
  background: #eaf7ff;
  color: #185d98;
  font-weight: 1000;
}

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

.primary-button {
  border: 3px solid #0d6d22;
  border-radius: 15px;
  padding: 12px 25px;
  background: linear-gradient(#5cea60, #24ba3c);
  color: white;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 7px 0 var(--green-dark);
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
  transition: transform .12s ease, box-shadow .12s ease;
}

.primary-button:hover { transform: translateY(-1px) scale(1.02); }
.primary-button:active {
  transform: translateY(5px);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 2px 0 var(--green-dark);
}
.primary-button:focus-visible {
  outline: 4px solid rgba(37,150,255,.38);
  outline-offset: 4px;
}

.game-footer {
  padding: 18px 24px 24px;
  border-top: 3px solid #e8b56e;
  background:
    radial-gradient(circle at 95% 0, rgba(255,202,69,.32), transparent 28%),
    #fff7e6;
}

.game-footer > p {
  margin: 0 0 14px;
  color: #624432;
}

.leaderboard-shell {
  min-height: 20px;
  border-radius: 14px;
}

@media (max-width: 650px) {
  body { padding: 0; background: #70cfff; }
  .game-card { border-radius: 0; border-width: 0; min-height: 100vh; }
  .topbar { padding: 13px 14px 16px; }
  .topbar::after { display: none; }
  .score-panel { min-width: 92px; padding: 8px 10px; }
  .game-footer { padding: 14px 16px 20px; }
  .overlay-card { padding: 18px 14px 22px; }
  .controls-grid { grid-template-columns: 1fr; gap: 7px; }
  .controls-grid > div { padding: 8px; }
}
