/* ============================================================
   FLAPPY DOG — game page styles
   self-contained: base + nav + footer + game UI
   (body.light / body.dark get toggled by the in-game
    day/night cycle — both must look right)
   ============================================================ */

:root {
  --bg: #0a0e16;
  --bg-deep: #070b12;
  --panel: #101827;
  --border: #1d2b45;
  --border-bright: #2e4a7a;

  --text: #d9e4f5;
  --text-dim: #8fa0bb;
  --text-faint: #5b6b87;

  --neon-green: #00ff9c;
  --neon-cyan: #00d4ff;
  --neon-gold: #ffd75e;

  --accent: var(--neon-green);
  --accent-2: var(--neon-cyan);

  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, 'DejaVu Sans Mono', monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --content-max-width: 800px;
}

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

html { scroll-padding-top: 64px; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  min-height: 100vh;
  transition: background-color 0.8s ease;
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
  color: var(--accent-2);
  transition: color 0.15s, text-shadow 0.15s;
}

a:hover {
  text-decoration: none;
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0, 255, 156, 0.6);
}

h1, h2, h3 { font-family: var(--mono); line-height: 1.25; color: #eef4ff; letter-spacing: 0.5px; }
h1 { font-size: 30px; margin-bottom: 20px; }
h2 { font-size: 22px; margin-top: 36px; margin-bottom: 14px; color: var(--neon-green); text-shadow: 0 0 14px rgba(0, 255, 156, 0.35); }
h3 { font-size: 18px; margin-top: 24px; margin-bottom: 12px; color: #cfe6ff; }
p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 28px; }
li { margin-bottom: 8px; }

/* ============ NAV ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: rgba(7, 11, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--neon-green);
  text-shadow: 0 0 10px rgba(0, 255, 156, 0.5);
  flex-shrink: 0;
}

.nav-logo .logo-dim { color: var(--text-faint); text-shadow: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
}

.nav-link {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
}

.nav-link:hover { color: var(--text); border-bottom-color: rgba(0, 212, 255, 0.6); }
.nav-link.active {
  color: var(--neon-green);
  border-bottom-color: var(--neon-green);
  text-shadow: 0 0 8px rgba(0, 255, 156, 0.55);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--neon-green);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 767px) {
  .hamburger { display: flex; }

  .nav-links {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(7, 11, 18, 0.97);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.menu-open { max-height: 320px; }

  .nav-link {
    display: block;
    padding: 14px 24px;
    min-height: 48px;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 16px;
  }

  .nav-link:hover { border-left-color: rgba(0, 212, 255, 0.6); }
  .nav-link.active { border-left-color: var(--neon-green); }
}

/* ============ HERO ============ */
.hero {
  text-align: center;
  padding: 40px 20px 8px;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 { font-size: 34px; margin-bottom: 10px; }

.hero h1 .neon {
  color: var(--neon-green);
  text-shadow: 0 0 18px rgba(0, 255, 156, 0.75);
}

.hero .subtitle {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* ============ GAME SECTION ============ */
.game-section {
  display: flex;
  justify-content: center;
  padding: 20px;
}

#game-container {
  position: relative;
  width: min(400px, 100%);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 212, 255, 0.12);
  transition: background-color 0.8s ease;
}

.light #game-container { background-color: #87CEEB; }
.dark #game-container { background-color: #0e1a3a; }

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#ui-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#score {
  position: absolute;
  top: 30px;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  z-index: 11;
}

#best-score {
  position: absolute;
  top: 84px;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--neon-gold);
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
  z-index: 11;
}

#lives {
  position: absolute;
  top: 30px;
  right: 16px;
  font-size: 22px;
  z-index: 11;
}

#start-screen, #gameover-screen, #pause-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  pointer-events: all;
}

#pause-screen {
  background: rgba(4, 8, 16, 0.6);
  backdrop-filter: blur(2px);
}

#pause-screen h1 {
  font-size: 48px;
  margin-bottom: 10px;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.6);
}

#pause-screen p {
  font-family: var(--mono);
  font-size: 16px;
  color: #fff;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.6);
}

#start-screen h1 {
  font-size: 42px;
  margin-bottom: 10px;
}

.light #start-screen h1 { color: #fff; text-shadow: 2px 2px 8px rgba(0,0,0,0.35); }
.dark #start-screen h1 { color: var(--neon-gold); text-shadow: 0 0 18px rgba(255, 215, 94, 0.55); }

#start-screen p, #gameover-screen p {
  font-family: var(--mono);
  font-size: 15px;
  margin-bottom: 20px;
  opacity: 0.85;
}

.light #start-screen p { color: #fff; }
.dark #start-screen p { color: #cdd8ea; }

.game-btn {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  padding: 13px 38px;
  border: 1px solid var(--neon-green);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(0, 255, 156, 0.1);
  color: var(--neon-green);
  box-shadow: 0 0 18px rgba(0, 255, 156, 0.35);
  pointer-events: all;
  transition: all 0.15s ease;
}

.game-btn:hover {
  background: var(--neon-green);
  color: #06130c;
  box-shadow: 0 0 26px rgba(0, 255, 156, 0.6);
}

#final-score {
  font-family: var(--mono);
  font-size: 60px;
  font-weight: 900;
  color: var(--neon-gold);
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
  margin: 10px 0 2px;
}

#gameover-best {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 900;
  color: var(--neon-gold);
  text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  margin: 2px 0 4px;
}

#gameover-screen h1 {
  font-size: 36px;
  margin-bottom: 6px;
  color: #ff6b8a;
  text-shadow: 0 0 16px rgba(255, 61, 129, 0.6);
}

#theme-indicator {
  position: absolute;
  bottom: 12px;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  opacity: 0.65;
  z-index: 11;
}

.light #theme-indicator { color: #fff; }
.dark #theme-indicator { color: #9fb0cc; }

#new-best {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 900;
  color: var(--neon-gold);
  text-shadow: 0 0 14px rgba(255,215,0,0.9);
  margin-bottom: 8px;
  display: none;
  animation: pulse 0.6s ease-in-out infinite alternate;
}

.pause-btn {
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  z-index: 12;
  pointer-events: all;
  touch-action: manipulation;
  transition: background 0.15s, transform 0.15s;
}

.pause-btn:hover { background: rgba(0, 0, 0, 0.55); }
.pause-btn:active { transform: scale(0.92); }

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.info-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 25;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.info-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: all;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 24px;
  border-radius: 12px;
  max-width: 340px;
  width: 90%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.modal-close:hover { opacity: 1; }

.modal-content h3 { margin-top: 0; margin-bottom: 16px; font-size: 18px; }
.modal-content p { margin-bottom: 12px; line-height: 1.5; font-size: 14px; color: var(--text-dim); }
.modal-content a { color: var(--accent-2); }

/* ============ POST-GAME LINKS ============ */
.after-game {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 20px 0;
}

.after-game .btn {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 8px;
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  background: rgba(0, 255, 156, 0.06);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.after-game .btn:hover {
  background: var(--neon-green);
  color: #06130c;
  box-shadow: 0 0 22px rgba(0, 255, 156, 0.55);
}

.after-game .btn-ghost {
  border-color: var(--border-bright);
  color: var(--text-dim);
  background: transparent;
}

.after-game .btn-ghost:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 212, 255, 0.07);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.4);
}

/* ============ HOW TO PLAY CARD ============ */
.page-content { padding: 40px 20px; }

.container { max-width: var(--content-max-width); margin: 0 auto; }

.content-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

/* ============ FOOTER ============ */
.site-footer {
  text-align: center;
  padding: 28px 20px;
  margin-top: 40px;
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
}

.footer-inner { max-width: var(--content-max-width); margin: 0 auto; }

.footer-brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--neon-green);
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(0, 255, 156, 0.4);
}

.footer-brand .logo-dim { color: var(--text-faint); text-shadow: none; }

.footer-copy {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 767px) {
  .hero h1 { font-size: 26px; }
  .hero .subtitle { font-size: 15px; }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; }
  h3 { font-size: 16px; }
  .page-content { padding: 28px 16px; }
  .content-card { padding: 20px; }
}

/* phone = narrow, short, FHD-portrait, 21:9-landscape, or any touch device */
@media (max-width: 480px), (max-height: 500px), (orientation: portrait) and (max-width: 1080px), (orientation: landscape) and (max-height: 1080px) and (min-aspect-ratio: 2/1), (pointer: coarse) and (max-width: 2000px) {
  .navbar { padding: 10px 16px; height: 48px; }
  .hero { padding: 12px 0 8px; }
  .hero .logo { width: 20px; height: 20px; }
  .hero h1 { font-size: 21px; }
  .hero .subtitle { font-size: 13.5px; margin-top: 3px; }
  .game-section { padding: 14px 10px 0; }
  #game-container { width: min(330px, 100%); }
  #start-screen h1, #gameover-screen h1 { font-size: 24px; }
}

/* landscape phones: cap canvas height so it fits the viewport */
@media (orientation: landscape) and (max-height: 520px) {
  #game-container {
    width: auto;
    height: min(480px, calc(100vh - 110px));
  }
  #start-screen h1, #gameover-screen h1 { font-size: 18px; margin-bottom: 6px; }
  #start-screen p, #gameover-screen p { font-size: 12px; margin-bottom: 6px; }
  #ui-overlay #score { transform: scale(0.85); }
}
