@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --ink: #101517;
  --muted: #667273;
  --yellow: #e6f24b;
  --acid: #b6d20e;
  --paper: #e9e4d8;
  --line: rgba(16, 21, 23, .18);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 5%, rgba(230,242,75,.18), transparent 24rem),
    radial-gradient(circle at 86% 84%, rgba(94,130,129,.12), transparent 26rem),
    #c9c5b9;
  font-family: "Space Mono", monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.page-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px 88px;
}

.game-card {
  position: relative;
  width: min(100%, 1120px);
  background: rgba(232, 228, 216, .9);
  border: 1px solid rgba(16, 21, 23, .36);
  box-shadow: 0 26px 70px rgba(17, 26, 26, .24), 8px 8px 0 rgba(16, 21, 23, .08);
  overflow: hidden;
}

.game-header {
  min-height: 76px;
  padding: 17px 20px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 235, 224, .86);
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  font: 800 15px/1 "Barlow Condensed", sans-serif;
  letter-spacing: .03em;
}

h1 {
  max-width: none;
  margin: 0;
  font: 800 23px/.89 "Barlow Condensed", sans-serif;
  letter-spacing: -.035em;
  text-transform: uppercase;
}

.scoreboard { display: grid; justify-items: end; }
.score-label, .best-label, .eyebrow {
  font-size: 9px;
  letter-spacing: .17em;
  font-weight: 700;
}
.scoreboard strong {
  margin: -1px 0 1px;
  font: 800 30px/.9 "Barlow Condensed", sans-serif;
}
.best-label { color: var(--muted); font-size: 8px; }
.best-label b { color: var(--ink); }

.game-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #7b7f78;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.start-screen, .game-over-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 27, 27, .04), rgba(20, 27, 27, .24));
}

.title-stamp {
  padding: 18px 22px 20px;
  background: rgba(233, 228, 216, .91);
  border: 1px solid rgba(16, 21, 23, .5);
  box-shadow: 8px 8px 0 var(--yellow);
  transform: rotate(-2deg);
}

.title-stamp h2, .game-over-screen h2 {
  margin: 9px 0 12px;
  font: 900 clamp(42px, 11vw, 67px)/.74 "Barlow Condensed", sans-serif;
  letter-spacing: -.055em;
  text-transform: uppercase;
}
.title-stamp h2 em { color: #8b2538; font-style: normal; }
.title-stamp p { margin: 0; font-size: 10px; color: var(--muted); }

.game-button {
  border: 0;
  cursor: pointer;
  font: 700 14px "Space Mono", monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.game-button.primary {
  margin-top: 29px;
  min-width: 164px;
  padding: 15px 21px 14px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.game-button.primary:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.game-button.primary:active { transform: translate(4px, 4px); box-shadow: none; }

.game-over-screen { background: rgba(14, 18, 18, .52); color: #f4f0e6; }
.game-over-screen h2 { font-size: clamp(52px, 13vw, 78px); }
.game-over-screen .eyebrow { color: var(--yellow); }
.final-score { display: grid; gap: 4px; }
.final-score span { font-size: 9px; letter-spacing: .16em; }
.final-score strong { font: 800 55px/.8 "Barlow Condensed", sans-serif; }
.game-over-screen .game-button { color: var(--ink); }

.hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  color: rgba(233, 228, 216, .72);
  font-size: 8px;
  letter-spacing: .16em;
  pointer-events: none;
}

.bottom-nav {
  min-height: 54px;
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.5fr;
  border-top: 1px solid var(--line);
  background: rgba(238, 235, 224, .9);
}
.bottom-nav a, .bottom-nav button {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  font: 700 10px "Space Mono", monospace;
  text-decoration: none;
  letter-spacing: .08em;
}
.bottom-nav a:last-child { border-right: 0; }
.bottom-nav a:hover, .bottom-nav button:hover { background: var(--yellow); }

.toast {
  position: absolute;
  left: 50%;
  bottom: 66px;
  z-index: 4;
  padding: 9px 12px;
  color: var(--paper);
  background: var(--ink);
  font-size: 10px;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none; }

@media (max-width: 500px) {
  .page-shell { padding: 0 0 54px; }
  .game-card { width: 100%; border: 0; box-shadow: none; }
  .game-viewport { width: 100%; aspect-ratio: 16 / 9; }
  .game-header { min-height: 70px; }
  h1 { font-size: 19px; }
  .title-stamp h2 { font-size: clamp(34px, 11vw, 52px); }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 10; }
}

/* Full-browser game override */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.page-shell {
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  padding: 0;
  display: block;
}

.game-card {
  width: 100%;
  height: 100%;
  border: 0;
  box-shadow: none;
  background: #1c2522;
}

.game-viewport {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.game-header {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  left: 0;
  color: #f4f0e6;
  background: linear-gradient(180deg, rgba(7,11,11,.82), transparent);
  pointer-events: none;
}

.bottom-nav {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  color: #f4f0e6;
  background: rgba(9,14,14,.84);
  backdrop-filter: blur(8px);
  border-top-color: rgba(244,240,230,.25);
}

.bottom-nav a,
.bottom-nav button {
  color: #f4f0e6;
  border-right-color: rgba(244,240,230,.18);
}

.bottom-nav a:hover,
.bottom-nav button:hover {
  color: #101517;
}

.hint {
  z-index: 1;
  bottom: 72px;
}

.hint {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .12em;
}
