/* ── Fonts (Varonis brand) ─────────────────────────────── */

/* Graphik Cond */
@font-face {
  font-family: 'Graphik Cond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Regular-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Regular-Web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Cond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Medium-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Medium-Web.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Cond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Semibold-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Semibold-Web.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Cond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Bold-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikCondensed-Bold-Web.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Graphik XCond */
@font-face {
  font-family: 'Graphik XCond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Regular-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Regular-Web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik XCond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Medium-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Medium-Web.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik XCond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Semibold-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Semibold-Web.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik XCond';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Bold-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/GraphikXCondensed-Bold-Web.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Graphik Wide */
@font-face {
  font-family: 'Graphik Wide';
  src:
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Thin-Web.woff2') format('woff2'),
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Thin-Web.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Wide';
  src:
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Regular-Web.woff2') format('woff2'),
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Regular-Web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Wide';
  src:
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Medium-Web.woff2') format('woff2'),
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Medium-Web.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Wide';
  src:
    url('https://info.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Semibold-Web.woff2') format('woff2'),
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Semibold-Web.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Wide';
  src:
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Bold-Web.woff2') format('woff2'),
    url('https://www.varonis.com/hubfs/Fonts/GraphikWide/GraphikWide-Bold-Web.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Graphik LC Web (legacy regular Graphik) */
@font-face {
  font-family: 'Graphik LC Web';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Regular-Cy-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Regular-Cy-Web.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik LC Web';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Medium-Cy-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Medium-Cy-Web.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik LC Web';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Semibold-Cy-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Semibold-Cy-Web.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik LC Web';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Bold-Cy-Web.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/Graphik-Bold-Cy-Web.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Varonis Icons */
@font-face {
  font-family: 'VaronisIcons';
  src:
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/VaronisIcons.woff2') format('woff2'),
    url('https://142972.fs1.hubspotusercontent-na1.net/hubfs/142972/Fonts/VaronisIcons.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --border: #1e293b;
  --accent: #06b6d4;
  --accent2: #22d3ee;
  --danger: #ef4444;
  --gold: #f59e0b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --power: #a855f7;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg);
  background-image: url('CrabDash_BG.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

#app {
  width: 100%;
  height: calc(100% - 70px); /* leave room for the fixed footer */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Footer ────────────────────────────────────────────── */
.brought-to-you-by {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-sizing: content-box;
  background: #040B0F;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.brought-to-you-by img {
  height: 40px;
  width: auto;
  display: block;
}

/* ── Screens ───────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 80px;
  padding: 80px;
  width: 780px;
  max-width: 100%;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 100vh;
  background: #081921;
  border: 1px solid rgba(32, 228, 234, 0.20);
  border-radius: 8px;
}
.screen.active { display: flex; }

/* Start screen: tighter gap between logo and buttons */
#start-screen {
  gap: 40px;
}

/* Game screen fills viewport */
#game-screen.active {
  max-width: 100%;
  width: 100%;
  height: 100%;
  padding: 0;
  gap: 10px;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  border: none;
  border-radius: 0;
}

/* ── Title art ─────────────────────────────────────────── */
.title-art {
  text-align: center;
  align-self: stretch;
}

.pixel-title {
  display: block;
  width: 100%;
  max-width: 464px;
  aspect-ratio: 464 / 173.5;
  margin: 0 auto;
  background-image: url('CrabDashLogo.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  /* hide the ASCII fallback while keeping it in the DOM */
  font-size: 0;
  line-height: 0;
  color: transparent;
  text-shadow: none;
  white-space: pre;
}

.subtitle {
  display: none;
}

/* ── Buttons ───────────────────────────────────────────── */
.menu-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-self: stretch;
  width: 100%;
}
#btn-play,
#btn-retry {
  grid-column: 1 / -1;
}

.btn {
  padding: .7rem 1.4rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: .5rem;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
  background: var(--surface);
  color: var(--text);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.btn:active { transform: translateY(0); }

.btn-primary {
  display: flex;
  padding: 15px 22px;
  justify-content: center;
  align-items: center;
  gap: 10px;
  align-self: stretch;
  border-radius: 8px;
  border: 1px solid rgba(145, 251, 88, 0.40);
  background: rgba(145, 251, 88, 0.10);
  box-shadow: 0 0 15px 0 rgba(45, 212, 191, 0.20);
  color: #91FB58;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.btn-primary:hover {
  background: rgba(145, 251, 88, 0.20);
  border-color: rgba(145, 251, 88, 0.60);
  box-shadow: 0 0 20px 0 rgba(45, 212, 191, 0.30);
}

/* CTF Mode & How to Play — same styling for both */
.btn-danger,
.btn-secondary {
  display: flex;
  padding: 15px 22px;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: #CCF6F1;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 8px;
  border: 1px solid rgba(32, 228, 234, 0.20);
  background: transparent;
  box-shadow: 0 0 15px 0 rgba(45, 212, 191, 0.20);
}
.btn-danger:hover,
.btn-secondary:hover {
  background: rgba(32, 228, 234, 0.08);
  border-color: rgba(32, 228, 234, 0.40);
  box-shadow: 0 0 20px 0 rgba(45, 212, 191, 0.30);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: .3rem;
  font-size: 1.1rem;
  cursor: pointer;
  padding: .15rem .4rem;
  line-height: 1;
  transition: border-color .15s;
}
.btn-icon:hover { border-color: var(--accent); }

/* In-game music button (overrides .btn-icon for #btn-music only) */
#btn-music {
  display: flex;
  width: 30px;
  height: 30px;
  padding: 3px 15px;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(32, 228, 234, 0.20);
  background: #FFF url('SoundOff.svg') center / 16px 14px no-repeat;
  box-shadow: 0 0 15px 0 rgba(45, 212, 191, 0.20);
  cursor: pointer;
  /* hide the emoji that's in the HTML */
  font-size: 0;
  color: transparent;
}
#btn-music.playing {
  background-image: url('SoundOn.svg');
}

/* ── How to Play ───────────────────────────────────────── */
/* ── How to Play ───────────────────────────────────────── */
#how-screen {
  color: #FFF;
  max-height: calc(100% - 200px); /* 100px breathing room top + 100px bottom */
}
#how-screen .controls-info {
  color: #FFF;
}
/* Pull content closer to its heading: effective gap becomes 80 - 40 = 40px */
#how-screen h2 + *,
#how-screen h3 + * {
  margin-top: -40px;
}

#how-screen h2 {
  color: #FFF;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 38px;
  font-style: normal;
  font-weight: 700;
  line-height: 130%;
  text-transform: uppercase;
}
#how-screen h3 {
  color: #FFF;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 28px;
  font-style: normal;
  font-weight: 700;
  line-height: 130%;
}

.how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .8rem;
}
.how-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
}
.how-item::before {
  content: "•";
  flex-shrink: 0;
  font-size: 1.5em;
  line-height: 1;
  color: inherit;
}

.controls-info {
  font-family: 'Cascadia Code', monospace;
  font-size: .9rem;
  color: var(--muted);
}
kbd {
  display: inline-block;
  padding: .15rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: .85rem;
}

/* ── High Scores ───────────────────────────────────────── */
#scores-screen {
  color: #FFF;
  max-height: calc(100% - 200px); /* 100px breathing room top + 100px bottom */
}
#scores-screen h2 {
  color: #FFF;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 38px;
  font-style: normal;
  font-weight: 700;
  line-height: 130%;
  text-transform: uppercase;
}
#scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
#scores-table th {
  text-align: left;
  color: #FFF;
  padding: .5rem .6rem;
  border-bottom: 2px solid var(--border);
}
#scores-table td {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border);
}
#scores-table tbody tr:hover { background: rgba(6,182,212,.08); }

/* ── Game HUD ──────────────────────────────────────────── */
.hud {
  display: flex;
  width: 728px;
  max-width: 100%;
  padding: 15px 20px;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  border: 1px solid rgba(32, 228, 234, 0.20);
  background: #081921;
  flex-shrink: 0;
}
.hud-mode {
  display: flex;
  width: 130px;
  height: 30px;
  padding: 3px 15px;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(32, 228, 234, 0.20);
  background: #359FA2;
  box-shadow: 0 0 15px 0 rgba(45, 212, 191, 0.20);
  color: #081921;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hud-mode.mode-ctf {
  background: #ff4c25;
}

#hud-score {
  color: #FFF;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#hud-lives {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.heart {
  display: inline-block;
  width: 24px;
  height: 21px; /* maintains 17:15 native aspect ratio */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.heart-full  { background-image: url('Heart_Full.svg'); }
.heart-empty { background-image: url('Heart_Empty.svg'); }
.hud-combo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8BE000;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
  animation: comboPulse .3s ease;
}
.hud-combo::before {
  content: '';
  display: inline-block;
  width: 17px;
  height: 14px;
  background-image: url('Speed.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
.hud-combo.hidden { display: none; }
@keyframes comboPulse { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
.hud-speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8BE000;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hud-speed::before {
  content: '';
  display: inline-block;
  width: 17px;
  height: 14px;
  background-image: url('Speed.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
#hud-power {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #20E4EA;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
  animation: pulse .5s infinite alternate;
}
#hud-power::before {
  content: '';
  display: inline-block;
  width: 11px;
  height: 15px;
  background-image: url('LightningBolt.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}
#hud-power.hidden { display: none; }
@keyframes pulse { to { opacity: .4; } }

/* ── Hints bar ─────────────────────────────────────────── */
.hints-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .35rem .8rem;
  font-size: .85rem;
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .25);
  border-top: none;
  color: var(--gold);
  transition: opacity .3s;
  flex-shrink: 0;
}
.hints-bar.hidden { display: none; }
.hints-bar.hint-new {
  animation: hintFlash .6s ease 3;
}
@keyframes hintFlash {
  50% { background: rgba(245, 158, 11, .25); }
}
.hints-icon { font-size: 1rem; }

/* ── Canvas ────────────────────────────────────────────── */
#game-canvas {
  display: block;
  image-rendering: pixelated;
}

/* ── D-pad (mobile) ────────────────────────────────────── */
.dpad {
  display: none;
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 150px;
  z-index: 100;
  opacity: .7;
}
.dpad-btn {
  position: absolute;
  width: 50px;
  height: 50px;
  font-size: 1.3rem;
  border: 1px solid rgba(32, 228, 234, 0.20);
  border-radius: 8px;
  background: #081921;
  color: #CCF6F1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  box-shadow: 0 0 15px 0 rgba(45, 212, 191, 0.20);
  transition: background 0.1s, border-color 0.1s;
}
.dpad-btn:active {
  background: rgba(32, 228, 234, 0.20);
  border-color: rgba(32, 228, 234, 0.40);
}
.dpad-up    { top: 0;   left: 50px; }
.dpad-down  { bottom: 0;left: 50px; }
.dpad-left  { top: 50px;left: 0; }
.dpad-right { top: 50px;right: 0; }

@media (hover: none) and (pointer: coarse) {
  .dpad {
    display: block;
    bottom: calc(80px + env(safe-area-inset-bottom, 0));
  }
}

/* ── Game Over ─────────────────────────────────────────── */
/* ── Game Over ─────────────────────────────────────────── */
#gameover-screen {
  gap: 60px;
}
#gameover-screen h2 {
  color: #FFF;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 38px;
  font-style: normal;
  font-weight: 700;
  line-height: 130%;
  text-transform: uppercase;
}
#gameover-title { font-size: 2rem; }
#gameover-score { font-size: 1.4rem; color: #91FB58; }
.gameover-stats {
  font-size: .9rem;
  color: #FFF;
}
.gameover-stats .stat-icon {
  vertical-align: middle;
  margin-right: 4px;
}
#gameover-newhigh p { color: var(--gold); font-size: 1.2rem; font-weight: 600; }
#gameover-newhigh.hidden { display: none; }

#player-name {
  padding: .5rem .8rem;
  font-size: 1rem;
  border: 2px solid var(--accent);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  width: 220px;
  text-align: center;
}
#player-name:focus { border-color: var(--accent2); box-shadow: 0 0 8px rgba(6,182,212,.3); }

/* ── Celebrate cat ─────────────────────────────────────── */
.celebrate-cat {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: clamp(.7rem, 2vw, 1rem);
  line-height: 1.3;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245, 158, 11, .5);
  white-space: pre;
  animation: celebrateBounce 1s ease infinite alternate;
}
@keyframes celebrateBounce {
  0%   { transform: translateY(0) rotate(-2deg); }
  100% { transform: translateY(-8px) rotate(2deg); }
}
#gameover-celebrate.hidden { display: none; }

/* ── Hints in game over ────────────────────────────────── */
/* ── Hints in game over ────────────────────────────────── */
.gameover-hints {
  width: 100%;
  max-width: 350px;
  text-align: left;
}
.gameover-hints.hidden { display: none; }
.gameover-hints h3 {
  margin-bottom: .6rem;
  color: #FFF;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 130%;
}
.gameover-hints ul {
  list-style: none;
  padding: 0;
}
.gameover-hints li {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .25rem 0;
  font-size: .9rem;
  color: #FFF;
}
.gameover-hints li::before {
  content: "•";
  flex-shrink: 0;
  font-size: 1.5em;
  line-height: 1;
}

/* ── Social share ──────────────────────────────────────── */
.share-section {
  text-align: center;
}
.share-label {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .4rem;
}
.share-buttons {
  display: flex;
  gap: .5rem;
  justify-content: center;
}
.btn-share {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.btn-share:hover { transform: scale(1.1); }
.btn-share-x:hover { border-color: #fff; background: #000; color: #fff; }
.btn-share-li:hover { border-color: #0a66c2; background: #0a66c2; color: #fff; }
.btn-share-fb:hover { border-color: #1877f2; background: #1877f2; color: #fff; }
.btn-share-copy:hover { border-color: var(--accent); }
.btn-share-copy.copied { border-color: #22c55e; background: #22c55e; }

/* ── Utilities ─────────────────────────────────────────── */
.hidden { display: none !important; }

h2 { font-size: 1.6rem; color: var(--accent); }
h3 { font-size: 1.1rem; color: var(--muted); margin-top: .3rem; }

/* ── Barrier bar (in-game) ─────────────────────────────── */
.barrier-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .35rem .8rem;
  font-size: .82rem;
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .2);
  border-top: none;
  color: var(--danger);
  transition: opacity .3s;
  flex-shrink: 0;
}
.barrier-bar.hidden { display: none; }
.barrier-icon { font-size: 1rem; }
.barrier-timer {
  margin-left: auto;
  font-family: 'Cascadia Code', monospace;
  font-size: .8rem;
  opacity: .8;
}

/* ── Barrier status (scores screen) ────────────────────── */
.barrier-status {
  width: 100%;
  text-align: center;
  font-size: .85rem;
  padding: .4rem;
  border-radius: .3rem;
  background: rgba(239, 68, 68, .06);
  border: 1px solid rgba(239, 68, 68, .15);
  color: #FFF;
  min-height: 1.6rem;
}
.barrier-status.barrier-active { color: var(--danger); }

/* ── Barrier info (game over) ──────────────────────────── */
.gameover-barrier {
  text-align: center;
  font-size: .9rem;
  color: var(--danger);
  padding: .4rem .8rem;
  border: 1px solid rgba(239, 68, 68, .2);
  border-radius: .4rem;
  background: rgba(239, 68, 68, .06);
}
.gameover-barrier.hidden { display: none; }
.gameover-barrier p { margin: 0; }

/* ── Hint links in game over ───────────────────────────── */
.gameover-hints li a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}
.gameover-hints li a:hover { color: var(--accent2); }

/* ── Mute button on main screen ────────────────────────── */
.btn-mute-main {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  font-size: 1.4rem;
  padding: .3rem .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .4rem;
  color: var(--text);
  cursor: pointer;
}
.btn-mute-main:hover { border-color: var(--accent); }

/* ── CTF login screen ──────────────────────────────────── */
#ctf-screen {
  gap: 60px;
}
#ctf-screen h2 {
  color: #FFF;
  text-align: center;
  font-family: "Graphik Wide", "Graphik LC Web", system-ui, sans-serif;
  font-size: 38px;
  font-style: normal;
  font-weight: 700;
  line-height: 130%;
  text-transform: uppercase;
}
.ctf-desc {
  color: #FFF;
  text-align: center;
  max-width: 320px;
}
.ctf-input {
  padding: .6rem 1rem;
  font-size: 1rem;
  font-family: 'Cascadia Code', monospace;
  border: 2px solid var(--danger);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  width: 280px;
  text-align: center;
}
.ctf-input:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(6,182,212,.3); }
.ctf-error { color: var(--danger); font-size: .9rem; }

/* ── Game over rank ────────────────────────────────────── */
.gameover-rank {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
}
.gameover-rank.hidden { display: none; }

/* ── Combo popup ───────────────────────────────────────── */
.combo-popup {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(245, 158, 11, .7);
  pointer-events: none;
  animation: comboFloat .8s ease forwards;
  z-index: 50;
}
@keyframes comboFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.5); }
}

/* ── Mobile responsiveness ─────────────────────────────── */
@media (max-width: 600px) {
  /* #app sits above the shorter mobile footer */
  #app {
    height: calc(100% - 56px - env(safe-area-inset-bottom, 0));
  }

  /* Cards: less padding/gap; uncap height (let them scroll if needed) */
  .screen {
    padding: 24px 16px;
    gap: 24px;
  }
  #how-screen,
  #scores-screen {
    max-height: 100%;
  }
  #start-screen   { gap: 24px; }
  #ctf-screen     { gap: 28px; }
  #gameover-screen{ gap: 24px; }

  /* Scale down headings from 38px / 28px */
  #how-screen h2,
  #ctf-screen h2,
  #scores-screen h2,
  #gameover-screen h2 {
    font-size: 24px;
  }
  #how-screen h3,
  .gameover-hints h3 {
    font-size: 18px;
  }

  /* How-to-play: single column; let the .screen gap handle the heading spacing
     (the desktop -40px trick is overkill at mobile gaps) */
  .how-grid { grid-template-columns: 1fr; }
  #how-screen h2 + *,
  #how-screen h3 + * {
    margin-top: 0;
  }

  /* CTF input fits any viewport */
  .ctf-input {
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
  }

  /* Stats line: smaller text, allow wrapping */
  .gameover-stats {
    font-size: 12px;
    line-height: 1.6;
  }

  /* Hide share section (existing behavior) */
  .share-section { display: none; }

  /* HUD: wrap + shrink elements so everything fits */
  .hud {
    padding: 8px 12px;
    gap: 6px 10px;
    flex-wrap: wrap;
    justify-content: space-around;
  }
  .hud-mode {
    width: auto;
    height: 24px;
    padding: 2px 10px;
    font-size: 12px;
    letter-spacing: 0.5px;
  }
  #hud-score,
  #hud-power,
  .hud-combo,
  .hud-speed {
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0.5px;
  }
  .heart {
    width: 18px;
    height: 16px;
  }
  #hud-lives { gap: 2px; }
  #btn-music {
    width: 36px;
    height: 36px;
    padding: 0;
    background-size: 18px 16px;
  }

  /* Hints + barrier bars: smaller text so long messages don't blow up the row */
  .hints-bar,
  .barrier-bar {
    font-size: 12px;
    padding: 4px 10px;
  }

  /* Footer logo smaller so it doesn't crowd narrow screens */
  .brought-to-you-by { height: 56px; }
  .brought-to-you-by img { height: 28px; }
}
