@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@400;600;700&display=swap');

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

:root {
  --p1: #ff4d6d;
  --p2: #ffd60a;
  --board: #1a1a6e;
  --bg: #06061a;
  --border: rgba(100,100,255,0.3);
  --text: #e0e0ff;
  --muted: #6060a0;
  --empty: #0a0a2e;
}

body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 20px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,77,109,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(255,214,10,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Header ── */
.game-header {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.brand {
  font-family: 'Orbitron', monospace;
  font-size: 0.55rem;
  font-weight: 900;
  color: var(--p1);
  letter-spacing: 2px;
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-size: 0.95rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  flex: 1;
}

/* ── Score pills ── */
.scores {
  width: 100%;
  max-width: 560px;
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.score-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid;
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.3s;
}

.score-pill.p1 {
  border-color: var(--p1);
  background: rgba(255,77,109,0.08);
  color: var(--p1);
}

.score-pill.p2 {
  border-color: var(--p2);
  background: rgba(255,214,10,0.08);
  color: var(--p2);
}

.score-pill.active-p1 { background: rgba(255,77,109,0.2); box-shadow: 0 0 18px rgba(255,77,109,0.3); }
.score-pill.active-p2 { background: rgba(255,214,10,0.2); box-shadow: 0 0 18px rgba(255,214,10,0.3); }

.score-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.score-dot.d1 { background: var(--p1); box-shadow: 0 0 8px rgba(255,77,109,0.6); }
.score-dot.d2 { background: var(--p2); box-shadow: 0 0 8px rgba(255,214,10,0.6); }

/* ── Turn indicator ── */
.turn-bar {
  width: 100%;
  max-width: 560px;
  text-align: center;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s;
}

.turn-bar.p1-turn { color: var(--p1); border-color: rgba(255,77,109,0.3); }
.turn-bar.p2-turn { color: var(--p2); border-color: rgba(255,214,10,0.3); }

/* ── Board ── */
.board-wrap {
  width: 100%;
  max-width: 560px;
}

.col-buttons {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  padding: 0 2px;
}

.col-btn {
  height: 28px;
  border: none;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--muted);
  font-size: 0.7rem;
  -webkit-tap-highlight-color: transparent;
}

.col-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.col-btn:active { transform: scale(0.95); }

.board {
  background: var(--board);
  border-radius: 14px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  box-shadow:
    0 0 30px rgba(26,26,110,0.8),
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1);
  border: 1px solid var(--border);
}

.cell {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--empty);
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.5);
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.cell.p1 {
  background: var(--p1);
  box-shadow: 0 0 12px rgba(255,77,109,0.6), 0 0 24px rgba(255,77,109,0.2), inset 0 -3px 6px rgba(0,0,0,0.3);
  animation: dropIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cell.p2 {
  background: var(--p2);
  box-shadow: 0 0 12px rgba(255,214,10,0.6), 0 0 24px rgba(255,214,10,0.2), inset 0 -3px 6px rgba(0,0,0,0.3);
  animation: dropIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cell.win-cell {
  animation: winPulse 0.6s ease-in-out infinite alternate !important;
}

@keyframes dropIn {
  from { transform: scale(0.3) translateY(-30px); opacity: 0.5; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes winPulse {
  from { box-shadow: 0 0 8px currentColor; transform: scale(0.95); }
  to   { box-shadow: 0 0 24px currentColor; transform: scale(1.05); }
}

/* ── Result overlay ── */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.result-overlay.hidden { display: none; }

.result-card {
  background: rgba(6,6,26,0.98);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 0 60px rgba(26,26,110,0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.result-emoji { font-size: 3rem; }
.result-title { font-family: 'Orbitron', monospace; font-size: 1.3rem; font-weight: 900; }
.result-title.p1-win { color: var(--p1); text-shadow: 0 0 20px rgba(255,77,109,0.6); }
.result-title.p2-win { color: var(--p2); text-shadow: 0 0 20px rgba(255,214,10,0.6); }
.result-title.draw   { color: var(--text); }

.play-again-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  color: #1a0a00;
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(255,77,109,0.4);
}

.play-again-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(255,77,109,0.5); }

/* ── Win count ── */
.win-count {
  font-family: 'Orbitron', monospace;
  font-size: 1.4rem;
  font-weight: 900;
}

/* ── Mobile ── */
@media (max-width: 400px) {
  .board { gap: 4px; padding: 6px; }
  .col-btn { height: 24px; font-size: 0.6rem; }
}

/* Column preview hover */
.hover-preview { opacity: 0.35; }
.preview-p1.hover-preview { background: #ef4444; }
.preview-p2.hover-preview { background: #eab308; }

