:root {
  --bg-dark: #090d16;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-10k: #f59e0b;
  --accent-uno: #ef4444;
  --accent-skipbo: #3b82f6;
  --accent-ohhell: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.brand-icon {
  font-size: 1.8rem;
  -webkit-text-fill-color: initial;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Main Container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Components */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* Buttons & Controls */
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.8rem 1.6rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: #ef4444;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: #10b981;
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-lg {
  padding: 1.2rem 2rem;
  font-size: 1.2rem;
  border-radius: 16px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
}

/* Player Selection Grid */
.player-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.player-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.player-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Scorer View Styles */
.scorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.current-turn-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.turn-player-name {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
}

.turn-score-display {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--accent-10k);
  margin: 0.5rem 0;
}

/* Standings Table */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.standings-table th, .standings-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.standings-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.standings-table tr.current-turn-row {
  background: rgba(99, 102, 241, 0.15);
}

.rank-badge {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
}

.rank-1 { background: #f59e0b; color: #000; }
.rank-2 { background: #94a3b8; color: #000; }
.rank-3 { background: #b45309; color: #fff; }

/* Read-Only Live Display Screen (Room Readable) */
.display-screen {
  background: #050811;
  min-height: 100vh;
  padding: 2rem;
}

.display-title {
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #a5b4fc, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.display-phase {
  font-size: 1.8rem;
  text-align: center;
  color: var(--accent-10k);
  margin-bottom: 2rem;
  font-weight: 700;
}

.display-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.display-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.5rem;
}

.display-table th, .display-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.display-score {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-10k);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

/* QR Code Display */
.qr-container {
  text-align: center;
  padding: 1.5rem;
  background: #fff;
  border-radius: 16px;
  margin: 1rem 0;
}

.qr-container img {
  max-width: 220px;
  width: 100%;
}

.game-code-badge {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--primary);
  margin: 0.5rem 0;
}

/* Scorer Main Layout Side-by-Side */
.scorer-main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 992px) {
  .scorer-main-layout {
    grid-template-columns: 1.2fr 1fr;
  }
}
