/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red:    #f43f5e;
  --blue:   #3b82f6;
  --green:  #22c55e;
  --yellow: #eab308;

  --red-glow:    rgba(244, 63, 94,  0.75);
  --blue-glow:   rgba(59,  130,246, 0.75);
  --green-glow:  rgba(34,  197, 94, 0.75);
  --yellow-glow: rgba(234, 179,  8, 0.75);

  --bg:     #f5f3ff;
  --card:   #ffffff;
  --text:   #1e1b4b;
  --muted:  #94a3b8;
  --spring: cubic-bezier(.34,1.56,.64,1);
  --radius: 1.4rem;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow: hidden;
  position: relative;
}

/* ── Background Blobs ────────────────────────────────────── */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 500px; height: 500px;
  background: #8b5cf6;
  top: -150px; left: -150px;
}
.blob-2 {
  width: 400px; height: 400px;
  background: #ec4899;
  bottom: -120px; right: -120px;
}

/* ── Game Wrapper ────────────────────────────────────────── */
.game-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 480px;
}

/* ── Header ──────────────────────────────────────────────── */
.game-header {
  text-align: center;
}

.game-header h1 {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.3rem;
}

/* ── Stats Row ───────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1rem;
}

.stat-pill {
  background: var(--card);
  border-radius: 100px;
  padding: 0.5rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  min-width: 1.8rem;
  text-align: center;
  transition: transform 0.3s var(--spring);
}

.stat-value.bump {
  animation: scoreBump 0.4s var(--spring);
}

/* ── Board ───────────────────────────────────────────────── */
.board-wrap {
  position: relative;
  display: inline-flex;
}

.gameBoard {
  display: grid;
  grid-template-columns: repeat(2, 155px);
  grid-template-rows: repeat(2, 155px);
  gap: 14px;
}

/* ── Colored Buttons ─────────────────────────────────────── */
.btn {
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 1.8rem;
  opacity: 0.42;
  transition: opacity 0.15s ease, box-shadow 0.15s ease,
              transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

/* Shimmer layer */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}

.red    { background: var(--red);    border-radius: 1.8rem 1.8rem 1.8rem 3.5rem; }
.blue   { background: var(--blue);   border-radius: 1.8rem 1.8rem 3.5rem 1.8rem; }
.green  { background: var(--green);  border-radius: 1.8rem 3.5rem 1.8rem 1.8rem; }
.yellow { background: var(--yellow); border-radius: 3.5rem 1.8rem 1.8rem 1.8rem; }

/* Lit state — triggered by JS + .lit class */
.btn.lit {
  opacity: 1;
  transform: scale(1.04);
}
.btn.red.lit    { box-shadow: 0 0 0 6px rgba(244,63,94,.2),  0 8px 40px var(--red-glow); }
.btn.blue.lit   { box-shadow: 0 0 0 6px rgba(59,130,246,.2), 0 8px 40px var(--blue-glow); }
.btn.green.lit  { box-shadow: 0 0 0 6px rgba(34,197,94,.2),  0 8px 40px var(--green-glow); }
.btn.yellow.lit { box-shadow: 0 0 0 6px rgba(234,179,8,.2),  0 8px 40px var(--yellow-glow); }

.btn:hover:not(:disabled) {
  opacity: 0.7;
  transform: scale(1.03);
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  cursor: not-allowed;
}


/* ── Status Message ──────────────────────────────────────── */
.status-msg {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.2px;
  min-height: 1.5rem;
  transition: color 0.3s;
}

.status-msg.watching { color: #8b5cf6; }
.status-msg.your-turn { color: #22c55e; }
.status-msg.correct  { color: #22c55e; }

/* ── Start Button ────────────────────────────────────────── */
.start {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0.85rem 2.6rem;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
  letter-spacing: 0.3px;
}

.start:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 28px rgba(99,102,241,0.45);
}

.start:active {
  transform: scale(0.96);
}

/* ── Game Over Overlay ───────────────────────────────────── */
.game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,10,40,0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  transition: opacity 0.3s ease;
}

.game-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.4rem 2.8rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  animation: cardPop 0.4s var(--spring);
  max-width: 340px;
  width: 100%;
}

.overlay-emoji {
  font-size: 2.8rem;
  line-height: 1;
  font-weight: 900;
  color: #ef4444;
  font-family: 'Nunito', sans-serif;
  animation: emojiWobble 0.6s var(--spring);
}

.overlay-card h2 {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text);
}

.overlay-sub {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.overlay-level {
  font-size: 2.2rem;
  font-weight: 900;
  color: #8b5cf6;
  line-height: 1;
}

.overlay-play-btn {
  margin-top: 0.5rem;
}

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes scoreBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes cardPop {
  0%   { transform: scale(0.75); opacity: 0; }
  70%  { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes emojiWobble {
  0%   { transform: rotate(-20deg) scale(0.5); }
  60%  { transform: rotate(12deg) scale(1.1); }
  100% { transform: rotate(0deg)  scale(1); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 420px) {
  .gameBoard {
    grid-template-columns: repeat(2, 130px);
    grid-template-rows: repeat(2, 130px);
    gap: 10px;
  }
  .game-header h1 { font-size: 2.4rem; }
}
