﻿:root {
  --bg-primary: #0f111a;
  --bg-secondary: #1a1d2d;
  --bg-card: rgba(30, 34, 53, 0.7);
  --accent-cyan: #00f2fe;
  --accent-purple: #4facfe;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --accent-gold: #ffb703;
  --accent-danger: #fb8500;
  --neon-glow: 0 0 20px rgba(0, 242, 254, 0.4);
  --neon-glow-magenta: 0 0 20px rgba(255, 0, 128, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-full: 9999px;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at top center, #1b2038 0%, #0c0e17 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  overflow-x: hidden;
}

/* Glassmorphism containers */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.header {
  width: 100%;
  max-width: 580px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0c0e17;
  box-shadow: var(--neon-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #334155;
  object-fit: cover;
}

/* Main game wrapper */
.game-container {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Lobby Section */
.lobby-section {
  padding: 24px;
  text-align: center;
}

.lobby-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lobby-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.mode-icon {
  font-size: 1.8rem;
}

.mode-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.difficulty-container {
  margin-bottom: 20px;
  text-align: left;
}

.difficulty-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.diff-pills {
  display: flex;
  gap: 8px;
}

.diff-pill {
  flex: 1;
  padding: 8px;
  font-size: 0.8rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.diff-pill.active {
  background: var(--accent-cyan);
  color: #0c0e17;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: #0b0f19;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--neon-glow);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

/* Scoreboard */
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.player-card.reverse {
  flex-direction: row-reverse;
  text-align: right;
}

.player-avatar-wrap {
  position: relative;
}

.player-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  object-fit: cover;
  transition: border-color 0.3s;
}

.turn-active .player-avatar-img {
  border-color: var(--accent-cyan);
  box-shadow: var(--neon-glow);
}

.player-symbol-tag {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sym-x {
  background: #ff007a;
  box-shadow: var(--neon-glow-magenta);
}

.sym-o {
  background: #00f2fe;
  box-shadow: var(--neon-glow);
}

.player-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.player-score {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vs-badge {
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0 12px;
}

/* Game Status Info */
.game-status-bar {
  text-align: center;
  padding: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-cyan);
}

/* Tic Tac Toe Board */
.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(3, 100px);
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-lg);
}

@media (max-width: 480px) {
  .ttt-board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 8px;
  }
}

.cell {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cell:hover:not(.taken) {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.cell.cell-x {
  color: #ff007a;
  text-shadow: 0 0 15px rgba(255, 0, 122, 0.6);
}

.cell.cell-o {
  color: #00f2fe;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
}

.cell.winner-cell {
  animation: pulse-win 1s infinite alternate;
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-cyan);
}

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

/* Action Controls footer */
.controls-footer {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}
