/* ==================== GLOBAL STYLES & THEMING ==================== */
:root {
  --bg-color: #080d1a;
  --card-bg: #0f172a;
  --primary-blue: #00d2ff;
  --deep-blue: #0055ff;
  --accent-neon: #00ffff;
  --accent-red: #ef4444;
  --glow-red: 0 0 10px rgba(239, 68, 68, 0.6);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --shadow-glow: 0 0 15px rgba(0, 210, 255, 0.4);
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center;
  padding: 15px;
}

header {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 15px 20px;
  border-radius: 12px;
  border: 2px solid var(--primary-blue);
  box-shadow: var(--shadow-glow);
  margin-bottom: 20px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.brand-blue {
  color: var(--accent-neon);
  text-shadow: 0 0 8px var(--primary-blue);
}

.brand-red {
  color: var(--accent-red);
  text-shadow: 0 0 8px var(--accent-red);
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 15px;
}

.difficulty-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: bold;
}

.difficulty-toggle select {
  background: #1e293b;
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.ticket-badge {
  background: #1e293b;
  border: 1px solid var(--accent-red);
  padding: 6px 12px;
  border-radius: 20px;
  color: #ffd700;
  font-weight: bold;
  font-size: 0.95rem;
  box-shadow: var(--glow-red);
}

/* Navigation Tabs */
nav {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 800px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid #1e293b;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  transition: all 0.2s;
  min-width: 80px;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--deep-blue);
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
}

/* Main Container */
main {
  width: 100%;
  max-width: 800px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-top: 3px solid var(--accent-red);
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.view-section {
  display: none;
  flex-direction: column;
  align-items: center;
}

.view-section.active {
  display: flex;
}

/* Buttons */
.btn {
  background: linear-gradient(135deg, var(--deep-blue), var(--primary-blue));
  color: #fff;
  border: 1px solid var(--accent-red);
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 10px;
  transition: transform 0.1s, opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
  box-shadow: var(--glow-red);
}

.btn:active {
  transform: scale(0.98);
}

.btn-claim {
  background: linear-gradient(135deg, #b91c1c, var(--accent-red));
}

.btn-claim:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.cooldown-text {
  font-size: 0.85rem;
  color: var(--accent-red);
  margin-top: 5px;
  font-weight: bold;
}

/* ==================== PROFILE SECTION ==================== */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
  max-width: 400px;
}

.profile-avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  box-shadow: var(--glow-red);
  background: #1e293b;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 5px;
}

.emoji-option {
  font-size: 1.5rem;
  padding: 5px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.emoji-option:hover, .emoji-option.selected {
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
  background: #2b394e;
}

.form-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group input {
  padding: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--text-main);
  border-radius: 6px;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-red);
}

/* ==================== GAME CONTAINERS & SHARED UI ==================== */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.game-header h3 {
  border-left: 4px solid var(--accent-red);
  padding-left: 8px;
}

.game-message {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent-neon);
  margin-bottom: 15px;
  text-align: center;
  min-height: 1.5em;
}

/* --- Tic Tac Toe --- */
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
}

.ttt-cell {
  background: #1e293b;
  border: 2px solid var(--deep-blue);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--accent-neon);
}

.ttt-cell.x { color: var(--primary-blue); }
.ttt-cell.o { color: var(--accent-red); text-shadow: var(--glow-red); }

/* --- Connect Four --- */
.c4-board {
  background: var(--deep-blue);
  border: 2px solid var(--accent-red);
  padding: 10px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-glow);
}

.c4-cell {
  aspect-ratio: 1;
  background: var(--bg-color);
  border-radius: 50%;
  cursor: pointer;
}

.c4-cell.player1 { background: var(--accent-red); box-shadow: var(--glow-red); }
.c4-cell.player2 { background: #f59e0b; }

/* --- Ping Pong --- */
#pongCanvas {
  background: #020617;
  border: 2px solid var(--accent-red);
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  height: auto;
  touch-action: none;
  box-shadow: var(--glow-red);
}

/* Mobile Controls for Pong */
.pong-controls {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  width: 100%;
  max-width: 300px;
}

.pong-btn {
  flex: 1;
  padding: 15px;
  background: #1e293b;
  border: 1px solid var(--accent-red);
  color: white;
  font-size: 1.2rem;
  border-radius: 8px;
  user-select: none;
}

/* Responsive Design Adjustments */
@media (max-width: 600px) {
  .header-stats {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
  
  .brand {
    font-size: 1.1rem;
  }

  nav {
    gap: 5px;
  }

  .tab-btn {
    padding: 8px 4px;
    font-size: 0.75rem;
  }
}