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

:root {
  --bg: #1a1a2e;
  --card-bg: #16213e;
  --text: #eee;
  --text-muted: #888;
  --border: #333;
  --gold: #d4af37;
  --gold-light: #f5d442;
  --gold-dark: #b8960c;
  --success: #4CAF50;
  --error: #f44336;
  --correct-bg: rgba(76, 175, 80, 0.15);
  --incorrect-bg: rgba(244, 67, 54, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

.hidden {
  display: none !important;
}

/* Header */
header {
  text-align: center;
  padding: 1.5rem 0 1rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #000;
  font-weight: 600;
}

.tab-btn:hover:not(.active) {
  background: #1f2a4a;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Status Bar */
.status-bar {
  text-align: center;
  padding: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.75rem 1rem;
  text-align: left;
}

.leaderboard-table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.leaderboard-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.2s;
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.rank-1 { background: rgba(212, 175, 55, 0.15) !important; }
.rank-2 { background: rgba(192, 192, 192, 0.1) !important; }
.rank-3 { background: rgba(205, 127, 50, 0.1) !important; }

.rank-medal {
  font-size: 1.1rem;
}

.score-cell {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--gold-light);
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

/* Score animation */
@keyframes scoreFlash {
  0% { color: var(--gold-light); }
  50% { color: #fff; transform: scale(1.2); }
  100% { color: var(--gold-light); }
}

.score-updated {
  animation: scoreFlash 0.6s ease;
}

/* Latest Reveal Panel */
.reveal-panel {
  margin-top: 1.5rem;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--gold-dark);
  overflow: hidden;
}

.reveal-header {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #000;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reveal-winner {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.reveal-winner .category-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.reveal-winner .winner-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-top: 0.25rem;
}

.reveal-results {
  padding: 0.75rem 1rem;
}

.reveal-results h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.reveal-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.95rem;
}

.reveal-player .check {
  color: var(--success);
  font-weight: bold;
}

.reveal-player .cross {
  color: var(--error);
  font-weight: bold;
}

.reveal-player .pick-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.should-win-section {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.should-win-section h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.should-win-entry {
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.should-win-entry .sw-name {
  font-weight: 600;
  color: var(--gold);
}

.should-win-entry .sw-response {
  color: var(--text-muted);
  font-style: italic;
}

.reveal-placeholder {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* All Categories */
.category-card {
  background: var(--card-bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.category-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.category-header .cat-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.category-header .cat-winner {
  font-size: 0.85rem;
  color: var(--gold);
}

.category-header .cat-tbd {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.category-header .chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  font-size: 0.8rem;
}

.category-card.expanded .chevron {
  transform: rotate(90deg);
}

.category-detail {
  display: none;
  padding: 0 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.category-card.expanded .category-detail {
  display: block;
}

.cat-pick-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cat-pick-row:last-child {
  border-bottom: none;
}

.cat-pick-row.correct {
  background: var(--correct-bg);
  padding: 0.4rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 4px;
}

.cat-pick-row.incorrect {
  opacity: 0.6;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #000;
}

.btn-gold:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

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

.btn-danger {
  background: var(--error);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* Admin */
.auth-prompt {
  display: flex;
  justify-content: center;
  padding-top: 2rem;
}

.auth-prompt .card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-prompt h2 {
  margin-bottom: 1rem;
  color: var(--gold);
}

.auth-prompt input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.auth-prompt input:focus {
  outline: none;
  border-color: var(--gold);
}

.error-text {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.admin-actions .btn {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}

#csv-paste-area textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: monospace;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  resize: vertical;
}

/* Admin category list */
.admin-category {
  background: var(--card-bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.admin-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-cat-header .cat-name {
  font-weight: 600;
}

.admin-cat-header .winner-badge {
  background: var(--gold-dark);
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.nominee-buttons {
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nominee-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  text-align: left;
}

.nominee-btn:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

.nominee-btn.is-winner {
  background: var(--gold-dark);
  border-color: var(--gold);
  color: #000;
  font-weight: 600;
}

.odds-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: var(--gold-light);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.nominee-btn.is-winner .odds-badge {
  background: rgba(0, 0, 0, 0.2);
  color: #000;
}

.admin-category.revealed {
  opacity: 0.6;
  order: 1;
}

.admin-cat-actions {
  padding: 0 1rem 0.75rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
  .app-container {
    padding: 0.75rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.6rem 0.75rem;
  }

  .nominee-btn {
    font-size: 0.8rem;
    padding: 0.6rem;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.updating {
  animation: pulse 1s infinite;
}
