:root {
  color-scheme: dark;
  --bg: #1a0f1e;
  --bg-deep: #110a14;
  --panel: #1e1525;
  --border: rgba(200, 140, 180, 0.15);
  --text: #f0e6ef;
  --muted: #b89aaf;
  --accent: #e8657a;
  --accent-glow: rgba(232, 101, 122, 0.3);
  --warm: #d4a0a0;
  --pixel-font: "Press Start 2P", monospace;
  --body-font: "Quicksand", system-ui, sans-serif;
}

.florida-chapter { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 26px 0; padding: 24px 28px; background: #174e58; border-radius: 14px; text-decoration: none; color: #fff7df; box-shadow: 0 7px 24px #08081133; }
.florida-chapter h2 { font-family: var(--body-font); font-size: 24px; margin: 0 0 7px; }
.florida-chapter p { margin: 0; font-size: 15px; line-height: 1.5; }
.florida-chapter > span { color: #ffdf64; font-weight: 700; white-space: nowrap; font-size: 16px; }
.florida-chapter:hover { background: #1c626a; }
.florida-chapter:focus-visible { outline: 3px solid #ffdf64; outline-offset: 5px; }
@media (max-width: 600px) { .florida-chapter { align-items: flex-start; flex-direction: column; gap: 15px; padding: 22px; } }

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: var(--body-font);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(140, 60, 90, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(80, 50, 120, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(30, 15, 35, 1) 0%, var(--bg-deep) 70%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Floating Hearts ── */
.hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.heart {
  position: absolute;
  left: var(--x);
  bottom: -30px;
  font-size: 14px;
  color: var(--accent);
  opacity: 0;
  animation: floatUp var(--dur) var(--delay) infinite ease-in;
  filter: blur(0.5px);
}

.heart:nth-child(odd) {
  font-size: 10px;
  color: var(--warm);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.6) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) scale(1) rotate(20deg);
    opacity: 0;
  }
}

/* ── Snow ── */
.snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.flake {
  position: absolute;
  left: var(--x);
  top: -8px;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0;
  /* pixel-style square flakes */
  opacity: 0;
  animation: snowFall var(--dur) var(--delay) infinite linear;
}

.flake:nth-child(even) {
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
}

@keyframes snowFall {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  5% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(100vh) translateX(30px);
    opacity: 0;
  }
}

/* ── Page Layout ── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
  gap: 28px;
}

/* ── Header / Intro ── */
.intro {
  text-align: center;
  max-width: 640px;
}

.pretitle {
  font-family: var(--pixel-font);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 12px;
  animation: blink 1.2s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.title {
  font-family: var(--pixel-font);
  font-size: clamp(1.6rem, 4vw + 0.5rem, 3rem);
  color: var(--text);
  text-shadow:
    0 0 40px var(--accent-glow),
    0 2px 0 rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
  line-height: 1.3;
}

.tagline {
  font-family: var(--body-font);
  font-size: clamp(1rem, 2vw + 0.3rem, 1.25rem);
  font-weight: 600;
  color: var(--warm);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.story-intro {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 400;
}

/* ── Game Frame ── */
.frame {
  width: min(100%, 960px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(8px, 2vw, 16px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 60px -20px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
}

/* Corner pixel decorations */
.frame::before,
.frame::after {
  content: "♦";
  position: absolute;
  font-size: 8px;
  color: var(--accent);
  opacity: 0.4;
}

.frame::before {
  top: 8px;
  left: 12px;
}

.frame::after {
  bottom: 8px;
  right: 12px;
}

.game {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 10px;
  background: #0f0a14;
}

/* ── Controls ── */
.controls {
  text-align: center;
  max-width: 500px;
}

.control-group {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.keys {
  display: flex;
  gap: 4px;
}

kbd {
  font-family: var(--pixel-font);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  min-width: 36px;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s;
}

kbd:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.control-label {
  font-family: var(--body-font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.touch-hint {
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.6;
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .touch-hint {
    display: block;
  }
  .control-group {
    display: none;
  }
}

/* ── Footer ── */
.footer {
  margin-top: auto;
  padding-top: 24px;
}

.footer p {
  font-family: var(--body-font);
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.5;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .page {
    padding: 32px 12px 24px;
    gap: 20px;
  }

  .frame {
    border-radius: 12px;
    padding: 6px;
  }

  canvas {
    border-radius: 8px;
  }

  .control-group {
    gap: 16px;
  }
}

/* Score overlay */
.score-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 10, 20, 0.92);
  display: grid;
  place-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.score-overlay.hidden { display: none; }

.score-modal {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 0 40px rgba(232, 101, 122, 0.2);
}

.score-final-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
  text-transform: uppercase;
}

.score-final-number {
  font-family: 'Press Start 2P', monospace;
  font-size: 48px;
  color: var(--accent);
  margin: 0 0 24px;
  text-shadow: 0 0 20px rgba(232, 101, 122, 0.4);
}

.score-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.score-name-input {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  padding: 10px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 160px;
  outline: none;
}
.score-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(232, 101, 122, 0.3);
}
.score-name-input::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.score-submit-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.score-submit-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

/* Leaderboard */
.leaderboard {
  width: min(100%, 600px);
  margin-top: 12px;
}

.leaderboard-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--accent);
  text-align: center;
  margin: 0 0 16px;
}

.leaderboard-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  overflow: hidden;
}

.leaderboard-empty {
  font-family: 'Quicksand', sans-serif;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  margin: 8px 0;
}

.lb-row {
  display: flex;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
}
.lb-row:last-child { border-bottom: none; }
.lb-top { background: rgba(232, 101, 122, 0.06); }

.lb-rank {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.lb-name {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  flex: 1;
}

.lb-score {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: #ffe9a8;
  flex-shrink: 0;
}
