/* Same font and background as the home page, so every site feels like one world. */
@font-face {
  font-family: "Display";
  src: url("assets/display-font.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #000;
  --shadow: #acb4bf;
  --white: #fff;
  --panel: rgba(15, 23, 42, 0.85);
  --edge: rgba(255, 255, 255, 0.25);
}

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: #000 url("assets/background.jpg") center / cover no-repeat fixed;
  color: var(--white);
  font-family: "Display", "Arial Black", system-ui, sans-serif;
  font-weight: 700;
}

header { padding: 1.5rem; }

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: clamp(1.6rem, 6vw, 3.5rem);
  transition: transform 0.1s;
}
.brand:hover { transform: translateY(-2px); }
.emoji { font-size: 0.4em; margin: 0 0.15em; }

/* The "splice" effect from the home page: hollow outline over an offset grey copy. */
.splice {
  position: relative;
  z-index: 0;
  display: inline-block;
  color: transparent;
  -webkit-text-stroke: 0.04em var(--ink);
  line-height: 1.39;
  white-space: nowrap;
}
.splice::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  transform: translate(0.045em, 0.045em);
  color: var(--shadow);
  -webkit-text-stroke: 0;
  z-index: -1;
}

/* Game + leaderboard side by side; stacked on phones. */
main {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1rem;
}
.game { text-align: center; }
canvas {
  width: min(400px, 100%);     /* the game sets the real size once board upgrades are known */
  height: auto;
  aspect-ratio: 1;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  touch-action: none;           /* lets swipes control the snake instead of scrolling */
}
.status { margin: 0.75rem 0 0; font-family: system-ui, sans-serif; font-weight: 400; }
.status small { opacity: 0.7; }

.volume {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
#mute {
  font-size: 1.3rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
}
.volume input { width: 140px; accent-color: #4ade80; }

.leaderboard {
  width: min(280px, 100%);
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
}
.leaderboard h2 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.leaderboard ol { margin: 0; padding-left: 1.6rem; font-family: system-ui, sans-serif; font-weight: 400; }
.leaderboard li { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.leaderboard li.me { color: #4ade80; font-weight: 700; }
.leaderboard .muted { opacity: 0.6; }
.totals {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--edge);
  font-family: system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

.leaderboard h3 { margin: 1rem 0 0.4rem; font-size: 1.1rem; }
.unlocks {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
}
.unlocks li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.15rem 0; }
.unlocks .locked { opacity: 0.55; }
.unlocks .unlocked span:last-child { color: #4ade80; font-weight: 700; }

/* Small pill button, used for the shop. */
.pill {
  font: 700 0.95rem system-ui, sans-serif;
  padding: 0.3rem 0.9rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--white), var(--shadow));
  border: 2px solid var(--ink);
  border-radius: 100vw;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.pill:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }

.account { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.leaderboard li[title] { cursor: help; }

/* Shop */
.shop {
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 12px;
}
.shop-head { display: flex; align-items: center; gap: 1rem; }
.shop-head h2 { margin: 0; font-size: 1.8rem; flex: 1; }
.shop-wallet { font-size: 1.1rem; color: #fde047; }
.shop-head button {
  font-size: 1.2rem; background: none; border: 2px solid var(--edge); border-radius: 50%;
  color: var(--white); width: 2rem; height: 2rem; cursor: pointer;
}
.shop h3 { margin: 1.25rem 0 0.25rem; font-size: 1.2rem; }
.shop-hint { margin: 0 0 0.5rem; font-family: system-ui, sans-serif; font-weight: 400; font-size: 0.85rem; opacity: 0.7; }
.shop-row {
  display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 1rem; align-items: center;
  padding: 0.5rem 0; border-top: 1px solid var(--edge);
}
.shop-row.locked { opacity: 0.5; }
.shop-row .buy { grid-column: 2; grid-row: 1 / span 2; }
.shop-label { font-size: 1.05rem; }
.shop-detail { font-family: system-ui, sans-serif; font-weight: 400; font-size: 0.85rem; opacity: 0.75; }
.buy {
  font: inherit; font-size: 0.9rem; padding: 0.35rem 0.8rem; border-radius: 100vw;
  border: 2px solid var(--white); background: #4ade80; color: #000; cursor: pointer; white-space: nowrap;
}
.buy:disabled { background: #475569; color: #cbd5e1; border-color: var(--edge); cursor: default; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.skin-card {
  display: grid; justify-items: center; gap: 0.4rem; padding: 0.75rem;
  background: rgba(0,0,0,0.3); border: 2px solid var(--edge); border-radius: 8px;
}
.skin-card.equipped { border-color: #4ade80; }
.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 0.4rem; }
.flag {
  display: grid; justify-items: center; gap: 0.1rem; padding: 0.3rem 0.2rem;
  background: rgba(0,0,0,0.3); border: 2px solid var(--edge); border-radius: 8px; cursor: pointer;
  color: var(--white); font-family: system-ui, sans-serif; font-size: 0.7rem;
}
.flag .flag-emoji { font-size: 1.6rem; line-height: 1; }
.flag:disabled { opacity: 0.4; cursor: default; }
.flag.owned { border-color: rgba(255,255,255,0.5); }
.flag.picked { border-color: #4ade80; background: rgba(74,222,128,0.15); }
.flag.picked .flag-code { color: #4ade80; font-weight: 700; }
.skin-card canvas { width: 96px; height: 96px; }

/* A fixed-height strip above the board so notifications never cover the game. */
.notice-bar {
  height: 3.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.6rem;
}
#banner {
  padding: 0.35rem 1.2rem;
  font-size: 1.4rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--white), var(--shadow));
  border: 3px solid var(--ink);
  border-radius: 100vw;
  box-shadow: 4px 4px 0 var(--ink);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}
#banner.show { opacity: 1; transform: translateY(0); }

#countdown span {
  font-size: clamp(6rem, 25vw, 12rem);
  color: var(--white);
  -webkit-text-stroke: 4px var(--ink);
  animation: pop 1s ease-out;
}
@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  20%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* Name prompt */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
}
.overlay[hidden] { display: none; }
.overlay form {
  display: grid;
  gap: 1rem;
  padding: 2rem;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 12px;
  text-align: center;
}
.overlay h2 { margin: 0; font-size: 2rem; }

/* Death flash: turns the whole screen red, then fades. */
#flash {
  position: fixed;
  inset: 0;
  background: #dc2626;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
#flash.on { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%   { opacity: 0.95; }
  60%  { opacity: 0.6; }
  100% { opacity: 0; }
}

footer {
  padding: 1rem;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-weight: 400;
  font-size: 0.8rem;
  opacity: 0.7;
}
footer a { color: inherit; }
