/* =========================================================
   Flappy Bird — Premium Edition
   Glassmorphism UI · dark/light themes · responsive layout
   ========================================================= */

/* ---------- Theme tokens (dark is the default) ---------- */
:root {
  --bg-1: #131a33;
  --bg-2: #3a1d5c;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --text: #f4f1ff;
  --text-dim: rgba(244, 241, 255, 0.6);
  --accent: #ffd166;
  --primary-1: #4dd6ff;
  --primary-2: #7a5cff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme overrides (toggled on <body> by JS) */
body.light {
  --bg-1: #dceeff;
  --bg-2: #f4e3ff;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.8);
  --text: #24243c;
  --text-dim: rgba(36, 36, 60, 0.6);
  --shadow: 0 20px 50px rgba(90, 80, 160, 0.25);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  overflow: hidden;
  padding: 12px;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Decorative animated blobs ---------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  z-index: 0;
  animation: drift 20s ease-in-out infinite alternate;
  pointer-events: none;
}
.blob-1 { width: 380px; height: 380px; background: var(--primary-2); top: -110px; left: -110px; }
.blob-2 { width: 320px; height: 320px; background: var(--primary-1); bottom: -90px; right: -90px; animation-delay: -8s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, -40px) scale(1.15); }
}

/* ---------- Glass card ---------- */
.game-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 18px 18px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: card-in 0.6s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.title  { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.5px; }
.title .accent { color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  font-size: 1rem;
  padding: 7px 9px;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}
.icon-btn:hover { transform: scale(1.1); background: rgba(255, 255, 255, 0.16); }

/* ---------- Score pills ---------- */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }

.score-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}
.score-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.score-value { font-size: 1.25rem; font-weight: 800; color: var(--accent); }

/* ---------- Stage (canvas + overlays) ---------- */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;               /* keeps the play field proportional */
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.15);
}

#game { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: manipulation; }

/* ---------- Overlays (start / pause / game over) ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 30, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.3s ease both;
  z-index: 2;
}
.overlay.hidden { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.overlay-panel {
  text-align: center;
  padding: 26px 30px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 85%;
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.overlay-emoji { font-size: 2.2rem; margin-bottom: 6px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.overlay-panel h2 { font-size: 1.3rem; margin-bottom: 6px; }
.overlay-panel p  { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 14px; }
.overlay-panel kbd {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
}

.final-scores strong { color: var(--accent); font-size: 1.1rem; }
.new-record { color: var(--accent); font-weight: 700; animation: bob 1.2s ease-in-out infinite; }
.new-record.hidden { display: none; }

/* ---------- Buttons ---------- */
.btn {
  padding: 11px 26px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-primary {
  color: #14102b;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  box-shadow: 0 8px 22px rgba(77, 214, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 12px 28px rgba(77, 214, 255, 0.5); }

/* ---------- Hint text ---------- */
.hint { margin-top: 10px; text-align: center; font-size: 0.75rem; color: var(--text-dim); }

/* ---------- Responsive tweaks ---------- */
@media (max-height: 720px) {
  .game-card { padding: 12px 12px 10px; }
  .scores { margin-bottom: 8px; }
  .hint { display: none; }
}
