:root {
  color-scheme: dark;
  --pink: #ff3ca6;
  --cyan: #3cf0ff;
  --violet: #9b6bff;
  --leaf: #8fe34a;
  --leaf-deep: #3f9e2a;
  --ink: #f0f0f5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Chakra Petch", system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Inside the OS shell, the shell chrome owns volume + fullscreen + home. */
html.in-shell .mute-btn,
html.in-shell .fs-btn,
html.in-shell .back-link {
  display: none;
}

.back-link {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  z-index: 6;
  color: #8f8fb0;
  text-decoration: none;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  text-transform: uppercase;
}
.back-link:hover { color: var(--leaf); }

.arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 0.7rem;
  padding: 1rem;
}

/* HUD row above the board */
.hudbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(78vw, 62vh);
  min-width: 300px;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}
.hud-score { color: var(--leaf); text-shadow: 0 0 12px rgba(143, 227, 74, 0.6); }
.hud-score span { color: #eafff0; }
.hud-best { color: #b6a6e0; font-size: 0.8rem; }
.hud-best span { color: #e7dcff; }
/* Green pixel hearts (layout + glow come from the shared .gh-heart rules). */
.hud-lives { color: var(--leaf); }

.stage {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  line-height: 0;
}
canvas {
  display: block;
  max-width: min(78vw, 62vh);
  height: auto;
  background:
    radial-gradient(circle at 50% 18%, rgba(64, 42, 138, 0.4) 0%, transparent 60%),
    rgba(5, 8, 6, 0.82);
  /* NOTE: no backdrop-filter here on purpose. The game paints an opaque fridge
     over the whole canvas every frame, so blurring what's behind it was invisible
     — but the GPU compositor still paid for it on every tick. Big win to drop it. */
  touch-action: none;
  cursor: crosshair;
}

/* Title card / result overlay */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.5rem;
  text-align: center;
  line-height: 1.4;
  background:
    radial-gradient(ellipse 90% 55% at 50% 8%, rgba(143, 227, 74, 0.12), transparent 60%),
    rgba(5, 10, 6, 0.74);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: opacity 0.3s ease;
}
/* While the overlay is hidden (during active play) don't run its blur — no
   point compositing a backdrop-filter for something you can't see. */
.overlay.hidden { opacity: 0; pointer-events: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

.overlay-logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05em;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
}
.wm-max {
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: #eafff0;
  text-shadow: 0 0 10px rgba(143, 227, 74, 0.6);
}
/* "Sliced" wordmark — the name is cut by a blade, the lower half slid off.
   Two clipped copies of the text + a bright blade line. em-based offsets so
   it scales with the responsive font size. */
.cuke-slice {
  position: relative;
  display: inline-block;
  font-family: "Audiowide", "Orbitron", sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: clamp(1.55rem, 7vw, 2.8rem);
  line-height: 1;
  white-space: nowrap;
}
.cuke-slice .half {
  display: block;
  background: linear-gradient(180deg, #d6ff9e 0%, var(--leaf) 55%, var(--leaf-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(143, 227, 74, 0.6));
}
.cuke-slice .top {
  clip-path: polygon(0 0, 100% 0, 100% 44%, 0 62%);
}
.cuke-slice .bot {
  position: absolute;
  left: 0;
  top: 0;
  clip-path: polygon(0 62%, 100% 44%, 100% 100%, 0 100%);
  transform: translate(0.14em, 0.11em);
}
.cuke-slice .blade {
  position: absolute;
  left: -6%;
  top: 52%;
  width: 112%;
  height: 2px;
  transform: rotate(-6.5deg);
  background: linear-gradient(90deg, transparent, #fff 38%, #fff 62%, transparent);
  box-shadow: 0 0 14px #b6ff5b, 0 0 4px #fff;
}
.overlay-tag {
  margin: 0.1rem 0;
  max-width: 92%;
  color: #c8e6bf;
  font-size: 0.86rem;
  line-height: 1.5;
}
.overlay-result {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.03em;
  background: linear-gradient(90deg, #b6ff5b, #ffe23d, #4dd2ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(143, 227, 74, 0.5));
}
.overlay-result:empty { display: none; }
.overlay-sub { margin: 0; color: #d9ffc4; font-size: 0.95rem; min-height: 1.1em; }
.overlay-sub:empty { display: none; }
.overlay-hint { margin: 0.2rem 0 0; color: #8fae86; font-size: 0.75rem; }

.overlay-btn {
  margin-top: 0.3rem;
  padding: 0.6rem 2rem;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: #06210a;
  background: linear-gradient(90deg, #b6ff5b, #6fe04a);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(143, 227, 74, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.overlay-btn:hover { transform: scale(1.05); box-shadow: 0 0 32px rgba(143, 227, 74, 0.85); }
.overlay-btn:active { transform: scale(0.98); }

/* Corner buttons (hidden inside the shell) */
.mute-btn,
.fs-btn {
  position: fixed;
  top: 14px;
  z-index: 80;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 8, 0.7);
  border: 2px solid rgba(143, 227, 74, 0.5);
  border-radius: 11px;
  color: var(--leaf);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.mute-btn { right: 14px; }
.fs-btn { right: 62px; color: #ffd23c; border-color: rgba(255, 210, 60, 0.55); }
.mute-btn svg,
.fs-btn svg { width: 21px; height: 21px; filter: drop-shadow(0 0 5px currentColor); }
.mute-btn:hover { border-color: var(--leaf); box-shadow: 0 0 16px rgba(143, 227, 74, 0.5); }
.fs-btn:hover { border-color: #ffd23c; box-shadow: 0 0 16px rgba(255, 210, 60, 0.5); }
.mute-btn:active,
.fs-btn:active { transform: scale(0.92); }
.mute-btn.muted { color: var(--pink); border-color: rgba(255, 60, 166, 0.6); }

/* On phones the square board is too short for the title card — let it use the
   whole screen so the button and hint aren't clipped. */
@media (max-width: 640px) {
  .overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    overflow-y: auto;
    /* Full-screen card covers the HUD row — make it near-opaque so the
       SCORE / BEST / lives don't bleed through the glass. */
    background:
      radial-gradient(ellipse 90% 45% at 50% 8%, rgba(143, 227, 74, 0.12), transparent 60%),
      rgba(5, 10, 6, 0.94);
  }
}


/* ---------- Pause (P key, the ⏸ chip, or switching tabs) ---------- */
.pause-btn {
  position: absolute;
  /* bottom-right, matching Neon Breakout so the pause chip is always in the
     same place. The scared tomato scoots left a little to make room. */
  right: 12px;
  bottom: 12px;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 16, 8, 0.6);
  border: 2px solid rgba(143, 227, 74, 0.4);
  border-radius: 11px;
  color: #a9d996;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.pause-btn svg { width: 20px; height: 20px; }
.pause-btn:hover { border-color: var(--leaf); color: var(--leaf); box-shadow: 0 0 14px rgba(143, 227, 74, 0.45); }
.pause-btn:active { transform: scale(0.92); }

.pause-veil {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  line-height: 1.4; /* the .stage zeroes line-height for the canvas — reset it */
  background: rgba(5, 10, 6, 0.74);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.pause-veil.show { opacity: 1; pointer-events: auto; }
.pause-veil .pv-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: 0.14em;
  color: #eafff0;
  text-shadow: 0 0 18px rgba(143, 227, 74, 0.75), 0 0 40px rgba(143, 227, 74, 0.4);
}
.pause-veil .pv-sub { color: #a9d996; font-size: 0.85rem; letter-spacing: 0.04em; }
.pause-veil .pv-sub b { color: #b6ff5b; }

/* The title/result overlay sits above the pause chip + veil (the chip has
   z-index 4 for play, which would otherwise float over the card). */
.overlay { z-index: 6; }
