:root {
  --bg-main: #0a0b10;
  --bg-card: #13151f;
  --bg-card-hover: #1a1e2d;
  --bg-glass: rgba(19, 21, 31, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(245, 158, 11, 0.3);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}

.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: 30px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

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

.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 10px var(--accent-gold-glow));
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-beta {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Nav Tabs */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.nav-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

/* Views */
.main-content {
  flex: 1;
  position: relative;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.view.active {
  display: block;
}

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

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-primary:active {
  transform: scale(0.97);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Lobby Hero */
.hero-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border-glow);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.hero-banner h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.hero-banner p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-notice {
  display: flex;
  gap: 12px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.info-notice strong {
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 2px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
}

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}

.category-card:hover, .category-card:active {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.category-icon {
  font-size: 32px;
  min-width: 44px;
  text-align: center;
}

.category-info h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.category-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* DUEL / ARENA VIEW */
.duel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.round-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.1));
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.match-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.bracket-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.3s ease;
}

/* Arena Layout */
.arena {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.movie-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: row;
  height: 190px;
  position: relative;
}

.movie-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  transform: translateY(-2px);
}

.movie-card.selected-winner {
  border-color: var(--accent-gold);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.5);
  animation: winnerPulse 0.4s ease;
}

@keyframes winnerPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.poster-container {
  width: 130px;
  min-width: 130px;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent 60%, var(--bg-card) 100%);
}

.info-toggle {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.synopsis-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 16, 0.94);
  padding: 10px;
  display: none;
  font-size: 0.72rem;
  overflow-y: auto;
  z-index: 4;
}

.synopsis-overlay.show {
  display: block;
}

.card-details {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.movie-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}

.year-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.genres-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.genre-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.btn-vote {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  width: 100%;
}

.movie-card:hover .btn-vote {
  background: var(--accent-gold);
  color: #000;
}

/* VS Badge */
.vs-circle {
  align-self: center;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
  z-index: 3;
  margin: -6px 0;
}

.duel-footer-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 14px;
}

/* 24H LOCKOUT SCREEN */
.lockout-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.lock-glow-icon {
  font-size: 48px;
  filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.5));
  margin-bottom: 8px;
}

.badge-locked {
  display: inline-block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.lockout-card h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.lockout-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.45;
}

.timer-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.timer-label {
  font-size: 0.7rem;
  color: var(--accent-gold);
  font-weight: 800;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 10px;
}

.countdown-clock {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 60px;
}

.time-block .num {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.time-block .lbl {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

.colon {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent-gold);
}

.champion-mini-card {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid var(--border-glow);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  text-align: left;
}

.mini-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 8px;
}

.mini-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-poster {
  width: 44px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.mini-info h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
}

.mini-crown {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.lockout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* WINNER VIEW */
.winner-card {
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.3);
}

.winner-particles {
  font-size: 28px;
  margin-bottom: 6px;
}

.winner-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 12px;
}

.winner-card h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 16px;
}

.winner-poster-wrap {
  position: relative;
  width: 170px;
  height: 250px;
  margin: 0 auto 20px;
  border-radius: var(--radius-md);
  overflow: visible;
}

.winner-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  border: 2px solid var(--accent-gold);
}

.winner-crown {
  position: absolute;
  top: -18px;
  right: -14px;
  font-size: 34px;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.8));
}

.reward-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  text-align: left;
  font-size: 0.82rem;
}

.reward-alert strong {
  color: #4ade80;
  display: block;
}

.winner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* BRACKET VIEW */
.bracket-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.bracket-status-tag {
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.bracket-scroll-area {
  overflow-x: auto;
  padding-bottom: 12px;
}

.bracket-tree {
  display: flex;
  gap: 20px;
  min-width: 650px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 150px;
}

.round-title-sm {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-align: center;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.bracket-match {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.bracket-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-team:last-child {
  border-bottom: none;
}

.bracket-team.winner {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  font-weight: 700;
}

/* PODIUM VIEW */
.podium-header {
  margin-bottom: 16px;
}

.podium-header h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
}

.podium-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.podium-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.podium-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.podium-rank {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 900;
  min-width: 24px;
  text-align: center;
}

.podium-rank.gold { color: #f59e0b; }
.podium-rank.silver { color: #94a3b8; }
.podium-rank.bronze { color: #b45309; }

.podium-poster {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
}

.podium-details {
  flex: 1;
  min-width: 0;
}

.podium-details h4 {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-details p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.podium-stat {
  text-align: right;
}

.podium-winrate {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.podium-trophies {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
