:root {
  color-scheme: dark;
  --cream: #fff6db;
  --muted: #aebca6;
  --lime: #c8f35f;
  --green: #72c653;
  --deep-green: #15261a;
  --yellow: #ffc75c;
  --red: #ed765e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: #0b100c; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 18% 4%, rgba(155, 219, 65, .13), transparent 28rem),
    radial-gradient(circle at 86% 84%, rgba(239, 177, 69, .08), transparent 28rem),
    linear-gradient(145deg, #111a13, #080b09 62%, #16120d);
}

button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(205, 255, 112, .8);
  outline-offset: 3px;
}

.page-shell {
  width: min(1160px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 24px;
}

.topbar,
.brand,
.scorebar,
.overlay-actions {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 50px;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.brand {
  gap: 9px;
  font-size: .92rem;
  font-weight: 950;
  text-decoration: none;
}

.brand span {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(200, 243, 95, .55);
  background: linear-gradient(145deg, rgba(200,243,95,.2), rgba(95,185,87,.08));
  color: #e7ffc4;
}

.preview-label {
  margin: 0 auto 0 4px;
  color: #7e8e7a;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.sound-toggle {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: #d6dfd1;
  font-size: .72rem;
  font-weight: 850;
}

.sound-toggle:hover { background: rgba(255,255,255,.1); }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 315px) minmax(0, 756px);
  gap: clamp(22px, 3.4vw, 44px);
  align-items: center;
  min-height: calc(100vh - 130px);
  padding: 30px 0;
}

.game-intro { min-width: 0; align-self: center; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--lime);
  font-size: .69rem;
  font-weight: 950;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.game-intro h1 {
  margin: 0;
  color: #fff9e6;
  font-size: clamp(4.4rem, 7.7vw, 6.25rem);
  line-height: .7;
  letter-spacing: -.085em;
  text-transform: uppercase;
  text-shadow: 0 8px 38px rgba(0,0,0,.4);
}

.game-intro h1 span {
  color: var(--lime);
  text-shadow: 0 0 32px rgba(174, 235, 79, .13);
}

.tagline {
  margin: 28px 0 0;
  color: #e3eadf;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 780;
  line-height: 1.45;
}

.how-to-play {
  display: grid;
  gap: 8px;
  margin-top: 27px;
}

.how-to-play > div {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 11px;
  align-items: center;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}

.how-to-play p { margin: 0; color: #98a492; font-size: .76rem; }
.how-to-play strong { display: block; color: #f5f3df; font-size: .82rem; }

.food-icon { position: relative; display: block; width: 29px; height: 29px; }

.bean-icon::before,
.bean-icon::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 23px;
  border: 2px solid #301d17;
  border-radius: 60% 38% 56% 42%;
  background: radial-gradient(circle at 35% 27%, #ffbe6d 0 8%, #a94e2f 11% 58%, #612b24 76%);
  transform: rotate(29deg);
}

.bean-icon::before { left: 2px; top: 4px; }
.bean-icon::after { right: 1px; bottom: 2px; transform: rotate(-35deg) scale(.82); }

.burrito-icon {
  width: 31px;
  height: 20px;
  border: 2px solid #58341c;
  border-radius: 45% 13% 13% 45%;
  background: linear-gradient(90deg, #e9ad54, #ffd482 55%, #d8923f);
  transform: rotate(-9deg);
}

.burrito-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  right: -2px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(#79a84c 0 30%, #9a3d2f 31% 65%, #f5d763 66%);
}

.desktop-help {
  margin: 16px 0 0;
  color: #697766;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .06em;
}

.game-card {
  width: min(100%, 756px);
  justify-self: end;
  border: 1px solid rgba(207,255,126,.22);
  border-radius: 17px;
  overflow: hidden;
  background: #101912;
  box-shadow: 0 34px 90px rgba(0,0,0,.5), inset 0 0 40px rgba(124,211,84,.05);
}

.scorebar {
  min-height: 72px;
  justify-content: space-around;
  gap: 8px;
  padding: 9px clamp(12px, 3vw, 24px);
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, #17231a, #111a13);
}

.scorebar > div { min-width: 70px; }
.scorebar > div:not(:first-child) { text-align: center; }

.scorebar span {
  display: block;
  margin-bottom: 2px;
  color: #7f8f7b;
  font-size: .6rem;
  font-weight: 950;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.scorebar strong {
  color: #f9f6e5;
  font-size: clamp(1rem, 2.3vw, 1.3rem);
  font-weight: 950;
}

.challenge-stat strong { color: var(--yellow); }

.board-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #18241a;
  touch-action: none;
}

#gameCanvas { display: block; width: 100%; height: 100%; }

.board-vignette {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 62px rgba(3,8,4,.42);
}

.game-cue {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 18px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: rgba(8,14,9,.8);
  color: #f8f4dd;
  font-size: clamp(.64rem, 2vw, .78rem);
  font-weight: 950;
  letter-spacing: .07em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity .16s ease, transform .16s ease;
  white-space: nowrap;
}

.game-cue.is-visible { opacity: 1; transform: translate(-50%, 0); }
.game-cue.is-hot { border-color: rgba(255,199,92,.55); color: #ffe39d; }

.rush-badge {
  position: absolute;
  z-index: 4;
  right: 16px;
  top: 15px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 211, 105, .62);
  border-radius: 8px;
  background: rgba(66, 28, 8, .86);
  color: #ffe7a6;
  box-shadow: 0 0 22px rgba(255, 144, 43, .24);
  pointer-events: none;
}

.rush-badge[hidden] { display: none; }
.rush-badge span { font-size: .58rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.rush-badge strong { color: #fff3c2; font-size: .84rem; font-variant-numeric: tabular-nums; }

.board-wrap.is-rushing::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  border: 3px solid rgba(255, 180, 65, .5);
  box-shadow: inset 0 0 42px rgba(255, 128, 29, .16);
  pointer-events: none;
  animation: rush-pulse .62s ease-in-out infinite alternate;
}

@keyframes rush-pulse {
  to { border-color: rgba(255, 229, 120, .9); box-shadow: inset 0 0 56px rgba(255, 128, 29, .28); }
}

.game-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5,11,7,.48);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}

.game-overlay.is-visible { opacity: 1; visibility: visible; }

.overlay-card {
  width: min(430px, 100%);
  padding: clamp(25px, 5vw, 44px);
  border: 1px solid rgba(215,255,154,.3);
  border-radius: 14px;
  background:
    radial-gradient(circle at 85% 8%, rgba(190,243,88,.12), transparent 35%),
    linear-gradient(150deg, rgba(28,48,32,.96), rgba(10,17,12,.97));
  box-shadow: 0 22px 70px rgba(0,0,0,.52);
  text-align: center;
}

.overlay-kicker {
  margin: 0 0 10px;
  color: var(--lime);
  font-size: .66rem;
  font-weight: 950;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.overlay-card h2 {
  margin: 0;
  color: #fff8e1;
  font-size: clamp(2.25rem, 8vw, 4.35rem);
  line-height: .84;
  letter-spacing: -.06em;
}

.overlay-copy {
  max-width: 340px;
  margin: 19px auto 0;
  color: #b9c4b4;
  font-size: clamp(.8rem, 2vw, .94rem);
  line-height: 1.48;
}

.result-block { margin-top: 18px; }
.result-block strong { display: block; color: var(--yellow); font-size: clamp(2.5rem, 8vw, 4.8rem); line-height: .9; letter-spacing: -.06em; }
.result-block span { display: block; margin-top: 8px; color: #f6f2dd; font-size: .78rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }

.overlay-actions { gap: 9px; margin-top: 24px; }
.overlay-actions button {
  flex: 1;
  min-height: 50px;
  padding: 0 15px;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 950;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, #d3f765, #78d25a);
  color: #102014;
  box-shadow: 0 9px 24px rgba(119,207,85,.18);
}

.share-button { border: 1px solid rgba(255,215,127,.44); background: rgba(255,194,79,.1); color: #ffe4a4; }
.overlay-actions button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.share-status { min-height: 15px; margin: 10px 0 -10px; color: #9dae97; font-size: .68rem; font-weight: 800; }

.mobile-controls {
  display: none;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 50px);
  justify-content: center;
  gap: 7px;
  padding: 13px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: #0d150f;
}

.mobile-controls button {
  border: 1px solid rgba(212,255,160,.24);
  border-radius: 9px;
  background: linear-gradient(145deg, #202f22, #121b14);
  color: #eff8db;
  font-size: 1.35rem;
  font-weight: 900;
  touch-action: manipulation;
}

.mobile-controls button:active { background: #344d30; transform: scale(.96); }
.mobile-controls .up { grid-column: 2; grid-row: 1; }
.mobile-controls .left { grid-column: 1; grid-row: 2; }
.mobile-controls .down { grid-column: 2; grid-row: 2; }
.mobile-controls .right { grid-column: 3; grid-row: 2; }

footer { color: #647061; font-size: .7rem; font-weight: 750; text-align: right; }

@media (max-width: 800px) {
  .page-shell { width: min(100% - 18px, 700px); padding-top: 8px; }
  .game-layout { grid-template-columns: 1fr; gap: 18px; min-height: 0; padding: 20px 0; }
  .game-intro { text-align: center; }
  .game-intro h1 { font-size: clamp(4.2rem, 24vw, 7.5rem); }
  .tagline { margin-top: 20px; }
  .how-to-play { display: none; }
  .desktop-help { display: none; }
  .game-card { justify-self: center; }
  .mobile-controls { display: grid; }
  footer { text-align: center; }
}

@media (max-width: 480px) {
  .page-shell { width: 100%; padding: 8px 9px 18px; }
  .preview-label { display: none; }
  .game-layout { padding-top: 15px; }
  .eyebrow { margin-bottom: 11px; font-size: .59rem; }
  .game-intro h1 { font-size: clamp(4.2rem, 25vw, 6.7rem); }
  .tagline { margin-top: 17px; font-size: .91rem; }
  .game-card { border-radius: 12px; }
  .scorebar { min-height: 61px; padding-inline: 8px; }
  .scorebar > div { min-width: 56px; }
  .scorebar span { font-size: .52rem; }
  .game-overlay { padding: 14px; }
  .overlay-card { padding: 24px 18px; }
  .overlay-actions { flex-direction: column; }
  .overlay-actions button { width: 100%; flex-basis: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html.arcade-embed,
html.arcade-embed body {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0b100c;
}

.arcade-embed .page-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.arcade-embed .topbar,
.arcade-embed .game-intro,
.arcade-embed .mobile-controls,
.arcade-embed footer {
  display: none;
}

.arcade-embed .game-layout {
  display: block;
  min-height: 0;
  height: 100%;
  padding: 0;
}

.arcade-embed .game-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.arcade-embed .scorebar {
  flex: 0 0 44px;
  min-height: 44px;
  padding: 4px 9px;
}

.arcade-embed .scorebar > div { min-width: 0; }
.arcade-embed .scorebar span { font-size: .48rem; }
.arcade-embed .scorebar strong { font-size: .84rem; }
.arcade-embed .challenge-stat { display: none; }

.arcade-embed .board-wrap {
  width: min(100vw, calc(100vh - 44px));
  height: min(100vw, calc(100vh - 44px));
  margin: auto;
  flex: 0 0 auto;
}

.arcade-embed .overlay-card {
  width: min(88%, 360px);
  padding: clamp(18px, 5vw, 28px);
}

.arcade-embed .overlay-card h2 { font-size: clamp(2.2rem, 12vw, 3.5rem); }
.arcade-embed .overlay-copy { font-size: .78rem; }
