*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --obsidian: #0a0a08; --volcanic: #141210; --charcoal: #1e1c18;
  --earth-dark: #2a2520; --earth: #3d362e; --earth-light: #554c42;
  --sand: #8b7d6b; --sand-light: #b8a898; --bone: #d4c8b8; --parchment: #e8ddd0;
  --ember: #e85d26; --ember-glow: #ff7a3d; --fire: #f5a623;
  --fire-bright: #ffc857; --torch: #ffdd57; --blood: #8b1a1a;
  --jungle-light: #4a8a3a; --idol-gold: #c9a84c;
  --font-display: 'Cinzel Decorative', serif;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Alegreya', Georgia, serif;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 16px;
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--obsidian); color: var(--bone); min-height: 100vh; overflow-x: hidden; line-height: 1.6; }
body::before { content: ''; position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(232,93,38,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 80% 40% at 20% 100%, rgba(139,26,26,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 40% at 80% 100%, rgba(26,74,106,0.05) 0%, transparent 50%); }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30Z' fill='none' stroke='%23d4c8b8' stroke-width='0.5'/%3E%3Cpath d='M30 10L50 30L30 50L10 30Z' fill='none' stroke='%23d4c8b8' stroke-width='0.3'/%3E%3Ccircle cx='30' cy='30' r='3' fill='none' stroke='%23d4c8b8' stroke-width='0.3'/%3E%3C/svg%3E");
  background-size: 60px 60px; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--volcanic); }
::-webkit-scrollbar-thumb { background: var(--earth); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ember); }

/* HERO */
.hero { position: relative; text-align: center; padding: 3rem 1.5rem 2rem; overflow: hidden; }
.hero::before { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ember), var(--fire), var(--ember), transparent); }
.hero-cast-bg { position: absolute; inset: 0; z-index: 0; display: grid; grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 1fr 1fr; align-content: center; gap: 3px; opacity: 0.15; pointer-events: none;
  overflow: hidden; padding: 0.5rem 0; }
.hero-cast-bg img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; filter: grayscale(0.5); }
.hero-cast-bg::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 30%, var(--obsidian) 75%); }
.hero-torches { position: relative; z-index: 1; display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem; }
.hero h1, .hero .subtitle, .hero .season-badge { position: relative; z-index: 1; }
.torch { font-size: 2rem; animation: torch-flicker 2s ease-in-out infinite alternate; }
.torch:nth-child(2) { animation-delay: 0.5s; }
.torch:nth-child(3) { animation-delay: 1s; }
@keyframes torch-flicker { 0%,100% { filter: brightness(1); transform: scale(1); } 50% { filter: brightness(1.3); transform: scale(1.05); } }
.hero h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 900;
  background: linear-gradient(180deg, var(--torch) 0%, var(--fire) 40%, var(--ember) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.hero .subtitle { font-family: var(--font-heading); font-size: 0.85rem; color: var(--sand); letter-spacing: 0.25em; text-transform: uppercase; }
.hero .season-badge { display: inline-block; margin-top: 1rem; padding: 0.3rem 1.2rem;
  border: 1px solid var(--ember); border-radius: 2rem; font-family: var(--font-heading);
  font-size: 0.72rem; color: var(--ember-glow); letter-spacing: 0.15em; text-transform: uppercase; background: rgba(232,93,38,0.08); }

/* NAV */
.nav-bar { display: flex; justify-content: center; gap: 0.25rem; padding: 1rem 1.5rem;
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, var(--obsidian) 60%, transparent); backdrop-filter: blur(10px); flex-wrap: wrap; }
.nav-tab { font-family: var(--font-heading); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.5rem 1.1rem; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--sand); cursor: pointer; transition: all 0.3s ease; }
.nav-tab:hover { color: var(--bone); background: rgba(232,93,38,0.06); border-color: rgba(232,93,38,0.2); }
.nav-tab.active { color: var(--ember-glow); background: rgba(232,93,38,0.1); border-color: var(--ember); box-shadow: 0 0 20px rgba(232,93,38,0.1); }

/* PANELS */
.panel { display: none; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 3rem; animation: panel-in 0.4s ease; }
.panel.active { display: block; }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.section-title { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; color: var(--fire);
  margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--earth);
  display: flex; align-items: center; gap: 0.75rem; }
.section-title .icon { font-size: 1.3rem; }
.sub-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 600; color: var(--sand-light);
  margin: 1.5rem 0 0.75rem; }

/* STATS */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 2rem; }
.stat-card { background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); padding: 0.9rem; text-align: center; }
.stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 0.2rem; }
.stat-card .stat-value { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; color: var(--fire-bright); }
.stat-card .stat-label { font-size: 0.7rem; color: var(--sand); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--font-heading); }

/* LEADERBOARD */
.leaderboard { display: flex; flex-direction: column; gap: 0.5rem; }
.leader-row { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 1rem;
  padding: 0.9rem 1.1rem; background: var(--charcoal); border: 1px solid var(--earth-dark);
  border-radius: var(--radius-md); transition: all 0.3s ease; cursor: default; position: relative; overflow: hidden; }
.leader-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--earth-light); }
.leader-row:hover { border-color: var(--earth-light); background: var(--earth-dark); transform: translateX(4px); }
.leader-row.rank-1::before { background: var(--torch); }
.leader-row.rank-2::before { background: var(--sand-light); }
.leader-row.rank-3::before { background: var(--ember); }
.leader-row.rank-1 { border-color: rgba(255,221,87,0.2); }
.leader-row.rank-2 { border-color: rgba(184,168,152,0.2); }
.leader-row.rank-3 { border-color: rgba(232,93,38,0.2); }
.rank-badge { width: 2.8rem; height: 2.8rem; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-family: var(--font-heading); font-weight: 700; font-size: 1rem;
  background: var(--earth); color: var(--sand); border: 2px solid var(--earth-light); }
.rank-1 .rank-badge { background: linear-gradient(135deg, #c9a84c, #f5d76e, #c9a84c); color: var(--obsidian);
  border-color: var(--torch); box-shadow: 0 0 15px rgba(255,221,87,0.3); }
.rank-2 .rank-badge { background: linear-gradient(135deg, #8b8b8b, #c0c0c0, #8b8b8b); color: var(--obsidian); border-color: var(--sand-light); }
.rank-3 .rank-badge { background: linear-gradient(135deg, #8b4513, #cd7f32, #8b4513); color: var(--parchment); border-color: var(--ember); }
.leader-info { display: flex; flex-direction: column; gap: 0.1rem; }
.leader-name { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; color: var(--parchment); }
.leader-tribe { font-family: var(--font-heading); font-size: 0.75rem; color: var(--ember-glow); letter-spacing: 0.05em; }
.leader-detail { font-size: 0.8rem; color: var(--sand); }
.leader-contestants { font-size: 0.75rem; color: var(--earth-light); margin-top: 0.15rem; }
.leader-score { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; color: var(--fire-bright); text-align: right; min-width: 3.5rem; }
.leader-score .pts-label { display: block; font-size: 0.6rem; color: var(--sand); letter-spacing: 0.15em; text-transform: uppercase; font-weight: 400; }

/* ROUND SELECTOR */
.round-selector { display: flex; gap: 0.4rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.round-btn { font-family: var(--font-heading); font-size: 0.72rem; letter-spacing: 0.05em;
  padding: 0.45rem 0.9rem; border: 1px solid var(--earth); border-radius: var(--radius-sm);
  background: var(--charcoal); color: var(--sand); cursor: pointer; transition: all 0.25s ease; }
.round-btn:hover { border-color: var(--ember); color: var(--bone); }
.round-btn.active { background: var(--ember); border-color: var(--ember); color: var(--obsidian); font-weight: 700; }

/* PLAYER SCORING SECTIONS */
.player-section { margin-bottom: 2rem; background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); overflow: hidden; }
.player-section-header { display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1rem; background: var(--earth-dark); border-bottom: 1px solid var(--earth); cursor: pointer; }
.player-section-header:hover { background: var(--earth); }
.player-section-name { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; color: var(--parchment); }
.player-section-tribe { font-family: var(--font-heading); font-size: 0.75rem; color: var(--ember-glow); margin-left: 0.5rem; }
.player-section-score { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: var(--fire); }
.player-section-body { display: none; padding: 0.75rem; }
.player-section-body.open { display: block; }
.contestant-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.contestant-card { background: var(--volcanic); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); overflow: hidden; }
.contestant-card.unassigned { opacity: 0.5; border-style: dashed; }
.contestant-card-header { padding: 0.6rem 0.8rem; background: rgba(232,93,38,0.08); border-bottom: 1px solid var(--earth-dark);
  font-family: var(--font-heading); font-size: 0.85rem; font-weight: 600; color: var(--fire);
  display: flex; justify-content: space-between; align-items: center; transition: background 0.3s ease; }
.contestant-card-header .slot-score { font-size: 0.9rem; color: var(--fire-bright); }
.tribe-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 2rem; font-family: var(--font-heading);
  font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(74,138,58,0.15);
  color: var(--jungle-light); border: 1px solid rgba(74,138,58,0.3); margin-left: 0.4rem; vertical-align: middle; white-space: nowrap; }
.tribe-select { padding: 0.15rem 0.3rem; border: 1px solid var(--earth); border-radius: var(--radius-sm);
  background: var(--volcanic); color: var(--bone); font-family: var(--font-heading); font-size: 0.68rem;
  text-align: center; margin-left: auto; flex-shrink: 0; cursor: pointer; }
.tribe-select:focus { outline: none; border-color: var(--ember); }
.contestant-card-body { padding: 0.6rem 0.8rem; }

/* SCORING ROWS */
.scoring-group { margin-bottom: 0.6rem; }
.scoring-group-title { font-family: var(--font-heading); font-size: 0.65rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--sand); margin-bottom: 0.3rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--earth-dark); }
.scoring-row { display: flex; align-items: center; padding: 0.25rem 0; font-size: 0.82rem; color: var(--bone); }
.scoring-row label { cursor: pointer; flex: 1; user-select: none; }
.scoring-row .pts-val { font-family: var(--font-heading); font-size: 0.7rem; min-width: 2.5rem; text-align: right; margin-left: 0.4rem; }
.scoring-row .pts-val.positive { color: var(--jungle-light); }
.scoring-row .pts-val.negative { color: var(--blood); }
.scoring-row .pts-val.neutral { color: var(--sand); }
.scoring-row input[type="checkbox"] { appearance: none; width: 1.05rem; height: 1.05rem; border: 2px solid var(--earth-light);
  border-radius: 3px; background: var(--volcanic); cursor: pointer; transition: all 0.2s; position: relative; flex-shrink: 0; margin-right: 0.5rem; }
.scoring-row input[type="checkbox"]:checked { background: var(--ember); border-color: var(--ember-glow); }
.scoring-row input[type="checkbox"]:checked::after { content: '\2713'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: var(--obsidian); font-size: 0.7rem; font-weight: 700; }
.scoring-row input[type="number"] { width: 3rem; padding: 0.15rem 0.3rem; border: 1px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-heading); font-size: 0.8rem; text-align: center; flex-shrink: 0; margin-right: 0.5rem; }
.scoring-row input[type="number"]:focus { outline: none; border-color: var(--ember); }
.scoring-row .readonly-val { font-family: var(--font-heading); font-size: 0.82rem; color: var(--sand-light); margin-right: 0.5rem; min-width: 3rem; }
.placement-selector { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px dashed var(--earth); }
.placement-selector label { font-family: var(--font-heading); font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sand); display: block; margin-bottom: 0.2rem; }
.placement-selector select { width: 100%; padding: 0.3rem 0.4rem; border: 1px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-body); font-size: 0.82rem; cursor: pointer; }
.placement-selector select:focus { outline: none; border-color: var(--idol-gold); }
.placement-readonly { font-size: 0.82rem; color: var(--sand-light); margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px dashed var(--earth); }
.placement-readonly .placement-label { font-family: var(--font-heading); font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sand); display: block; margin-bottom: 0.2rem; }

/* BREAKDOWN TABLE */
.breakdown-table-wrap { overflow-x: auto; border: 1px solid var(--earth-dark); border-radius: var(--radius-md); margin-bottom: 1.5rem; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.breakdown-table th:first-child, .breakdown-table td:first-child { min-width: 130px; }
.breakdown-table thead { background: var(--earth-dark); }
.breakdown-table th { font-family: var(--font-heading); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--fire); padding: 0.6rem 0.6rem; text-align: left;
  border-bottom: 2px solid var(--earth); white-space: nowrap; }
.breakdown-table th.score-col { text-align: center; }
.breakdown-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--earth-dark); color: var(--bone); }
.breakdown-table td.score-col { text-align: center; font-family: var(--font-heading); font-weight: 600; }
.breakdown-table td.score-col.positive { color: var(--jungle-light); }
.breakdown-table td.score-col.negative { color: #e05555; }
.breakdown-table td.score-col.zero { color: var(--earth-light); }
.breakdown-table tbody tr:hover { background: rgba(232,93,38,0.04); }
.breakdown-table .player-name-cell { font-family: var(--font-heading); font-weight: 700; color: var(--parchment); white-space: nowrap; }
.breakdown-table .total-cell { font-size: 0.95rem; color: var(--fire-bright) !important; }
.breakdown-table .contestant-name-cell { font-size: 0.78rem; color: var(--sand-light); padding-left: 1.5rem; white-space: nowrap;
  display: table-cell; vertical-align: middle; }
.breakdown-table .contestant-name-cell .cast-photo { vertical-align: middle; margin-right: 0.4rem; }

/* REF GRID */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.ref-card { background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); overflow: hidden; }
.ref-card-header { padding: 0.7rem 1rem; font-family: var(--font-heading); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.1em; text-transform: uppercase; border-bottom: 1px solid var(--earth-dark); }
.ref-card.positive .ref-card-header { background: rgba(45,106,45,0.15); color: var(--jungle-light); }
.ref-card.negative .ref-card-header { background: rgba(139,26,26,0.15); color: #e05555; }
.ref-card.neutral .ref-card-header { background: rgba(139,139,139,0.12); color: var(--sand-light); }
.ref-card.neutral .ref-row .points { color: var(--sand); }
.ref-card.placement .ref-card-header { background: rgba(201,168,76,0.12); color: var(--idol-gold); }
.ref-card-body { padding: 0.5rem 0; }
.ref-row { display: flex; justify-content: space-between; padding: 0.4rem 1rem; font-size: 0.85rem; }
.ref-row:hover { background: rgba(255,255,255,0.02); }
.ref-row .action { color: var(--bone); }
.ref-row .points { font-family: var(--font-heading); font-weight: 600; min-width: 5rem; text-align: right; }
.ref-card.positive .ref-row .points { color: var(--jungle-light); }
.ref-card.negative .ref-row .points { color: #e05555; }
.ref-card.placement .ref-row .points { color: var(--idol-gold); }

/* SETTINGS */
.settings-section { background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); padding: 1.25rem; margin-bottom: 1.25rem; }
.settings-section h3 { font-family: var(--font-heading); font-size: 1rem; color: var(--fire); margin-bottom: 0.75rem; }
.settings-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.btn { font-family: var(--font-heading); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.5rem 1.2rem; border: 1px solid var(--earth); border-radius: var(--radius-sm);
  background: var(--earth-dark); color: var(--bone); cursor: pointer; transition: all 0.25s ease; }
.btn:hover { border-color: var(--ember); background: rgba(232,93,38,0.1); color: var(--ember-glow); }
.btn.btn-danger { border-color: var(--blood); color: #e05555; }
.btn.btn-danger:hover { background: rgba(139,26,26,0.2); border-color: #e05555; }
.btn.btn-primary { border-color: var(--ember); background: var(--ember); color: var(--obsidian); font-weight: 700; }
.btn.btn-primary:hover { background: var(--ember-glow); }

/* CAST PHOTOS */
.cast-photo { border-radius: 50%; object-fit: cover; border: 1.5px solid var(--earth-light); flex-shrink: 0; }
.cast-photo-sm { width: 24px; height: 24px; }
.cast-photo-md { width: 28px; height: 28px; }
.cast-photo-lg { width: 36px; height: 36px; }
.leader-contestants { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.contestant-chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--earth-light); }
.contestant-card-header { gap: 0.5rem; }
.contestant-card-header > span:first-of-type { display: flex; align-items: center; gap: 0.4rem; }
.contestant-name-cell { display: flex; align-items: center; gap: 0.4rem; }
.roster-photo-cell { display: flex; align-items: center; gap: 0.4rem; }

/* ROSTER TABLE */
.roster-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.roster-table th { font-family: var(--font-heading); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fire); padding: 0.5rem 0.6rem; text-align: left;
  border-bottom: 2px solid var(--earth); }
.roster-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--earth-dark); vertical-align: middle; }
.roster-table input[type="text"] { width: 100%; padding: 0.3rem 0.5rem; border: 1px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-body); font-size: 0.85rem; }
.roster-table input[type="text"]:focus { outline: none; border-color: var(--ember); }
.roster-table select { width: 100%; padding: 0.3rem 0.4rem; border: 1px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-body); font-size: 0.82rem; }
.roster-table select:focus { outline: none; border-color: var(--ember); }

/* EPISODE LOG */
.episode-entry { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem;
  background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md); margin-bottom: 0.4rem; }
.episode-entry .ep-number { font-family: var(--font-heading); font-weight: 700; font-size: 0.7rem;
  letter-spacing: 0.08em; color: var(--ember); min-width: 3rem; }
.episode-entry .ep-title { flex: 1; }
.episode-entry input { width: 100%; padding: 0.3rem 0.5rem; border: 1px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-body); font-size: 0.85rem; }
.episode-entry input:focus { outline: none; border-color: var(--ember); }

/* TOAST */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { font-family: var(--font-body); font-size: 0.88rem; padding: 0.65rem 1.1rem; border-radius: var(--radius-sm);
  background: var(--earth-dark); border: 1px solid var(--ember); color: var(--bone);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); animation: toast-in 0.35s ease, toast-out 0.35s ease 2.5s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(30px); } }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 500; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--charcoal); border: 1px solid var(--earth); border-radius: var(--radius-lg);
  padding: 2rem; max-width: 500px; width: 90%; animation: modal-in 0.3s ease; }
@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-family: var(--font-heading); font-size: 1.1rem; color: var(--fire); margin-bottom: 0.75rem; }
.modal p { color: var(--sand-light); margin-bottom: 1.25rem; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

/* AUTH */
.admin-lock { font-family: var(--font-heading); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.5rem 1.1rem; border: 1px solid var(--earth); border-radius: var(--radius-sm);
  background: transparent; color: var(--sand); cursor: pointer; transition: all 0.3s ease; margin-left: 0.5rem; }
.admin-lock:hover { border-color: var(--idol-gold); color: var(--idol-gold); }
.admin-lock.unlocked { color: var(--jungle-light); border-color: var(--jungle-light); background: rgba(74,138,58,0.1); }
.admin-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 2rem; font-family: var(--font-heading);
  font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; margin-left: 0.75rem; vertical-align: middle; }
.admin-badge.unlocked { background: rgba(74,138,58,0.15); color: var(--jungle-light); border: 1px solid rgba(74,138,58,0.3); }

.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-form label { font-family: var(--font-heading); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sand); }
.auth-form input[type="text"],
.auth-form input[type="password"] { width: 100%; padding: 0.5rem 0.75rem; border: 2px solid var(--earth);
  border-radius: var(--radius-sm); background: var(--volcanic); color: var(--bone);
  font-family: var(--font-body); font-size: 1rem; }
.auth-form input:focus { outline: none; border-color: var(--idol-gold); box-shadow: 0 0 12px rgba(201,168,76,0.2); }
.auth-error { color: #e05555; font-size: 0.85rem; display: none; }

.viewer-notice { background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.2); border-radius: var(--radius-md);
  padding: 0.75rem 1rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem; color: var(--idol-gold); }
.viewer-notice .notice-icon { font-size: 1.1rem; }
.readonly-text { color: var(--sand-light); font-size: 0.85rem; }

/* LOADING OVERLAY */
.loading-overlay { display: flex; position: fixed; inset: 0; background: var(--obsidian);
  z-index: 9998; align-items: center; justify-content: center; flex-direction: column; gap: 1rem; }
.loading-overlay.hidden { display: none; }
.loading-spinner { width: 3rem; height: 3rem; border: 3px solid var(--earth); border-top-color: var(--ember);
  border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-family: var(--font-heading); font-size: 0.85rem; color: var(--sand); letter-spacing: 0.1em; text-transform: uppercase; }

/* MUSIC PLAYER */
.music-controls { position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 200;
  display: flex; align-items: center; gap: 0.4rem; }
.music-toggle { width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--earth); background: var(--charcoal); color: var(--sand);
  font-size: 1.1rem; cursor: pointer; transition: all 0.3s ease;
  display: flex; align-items: center; justify-content: center; }
.music-toggle:hover { border-color: var(--ember); color: var(--ember-glow); background: var(--earth-dark); }
.music-toggle.playing { border-color: var(--ember); color: var(--ember-glow);
  box-shadow: 0 0 12px rgba(232,93,38,0.25); }
.music-volume { overflow: hidden; max-width: 0; opacity: 0; transition: max-width 0.3s ease, opacity 0.3s ease; }
.music-controls:hover .music-volume,
.music-controls.vol-open .music-volume { max-width: 100px; opacity: 1; }
.music-volume input[type="range"] { width: 80px; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--earth); border-radius: 2px; outline: none; cursor: pointer; }
.music-volume input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ember); border: none; cursor: pointer; }
.music-volume input[type="range"]::-moz-range-thumb { width: 12px; height: 12px;
  border-radius: 50%; background: var(--ember); border: none; cursor: pointer; }

/* ELIMINATION TRACKING */
.eliminated { filter: grayscale(0.85); opacity: 0.55; }
.eliminated .leader-name,
.eliminated .contestant-name-cell,
.eliminated .contestant-card-header > span:first-of-type,
.eliminated .player-name-cell { text-decoration: line-through; text-decoration-color: var(--blood); }
.eliminated-badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 2rem; font-family: var(--font-heading);
  font-size: 0.55rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(139,26,26,0.35);
  color: #e05555; border: 1px solid rgba(139,26,26,0.5); margin-left: 0.4rem; vertical-align: middle; white-space: nowrap; }

/* BOOT ORDER TIMELINE */
.boot-order { margin-bottom: 2rem; }
.boot-order-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: var(--fire);
  margin-bottom: 1rem; display: flex; align-items: center; gap: 0.6rem; }
.boot-timeline { position: relative; padding-left: 2.5rem; }
.boot-timeline::before { content: ''; position: absolute; left: 1rem; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--blood), rgba(139,26,26,0.3)); border-radius: 2px; }
.boot-entry { position: relative; padding: 0.6rem 0 0.6rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.boot-entry::before { content: ''; position: absolute; left: -1.5rem; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%; background: var(--blood); border: 2px solid var(--earth-dark); z-index: 1; }
.boot-number { font-family: var(--font-heading); font-weight: 700; font-size: 0.7rem; width: 1.6rem; height: 1.6rem;
  display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--earth-dark);
  color: var(--sand); border: 1px solid var(--earth); flex-shrink: 0; }
.boot-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; filter: grayscale(0.85); opacity: 0.7;
  border: 1.5px solid var(--earth-light); flex-shrink: 0; }
.boot-info { display: flex; flex-direction: column; gap: 0.1rem; }
.boot-name { font-family: var(--font-heading); font-size: 0.85rem; color: var(--sand); text-decoration: line-through;
  text-decoration-color: var(--blood); }
.boot-detail { font-size: 0.72rem; color: var(--earth-light); }
.boot-snuff { font-size: 0.9rem; opacity: 0.35; margin-left: auto; flex-shrink: 0; }

/* SCORE CHART */
.chart-wrap { background: var(--charcoal); border: 1px solid var(--earth-dark); border-radius: var(--radius-md);
  padding: 1.25rem; margin-bottom: 2rem; }
.chart-title { font-family: var(--font-heading); font-size: 0.85rem; font-weight: 700; color: var(--fire);
  margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--earth-dark); }
.chart-legend-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: var(--sand); }
.chart-legend-swatch { width: 12px; height: 3px; border-radius: 1px; flex-shrink: 0; }
.chart-empty { text-align: center; padding: 1.5rem 1rem; color: var(--earth-light); font-size: 0.85rem;
  font-family: var(--font-heading); }

@media (max-width: 600px) {
  .contestant-cards { grid-template-columns: 1fr; }
  .nav-tab { padding: 0.4rem 0.6rem; font-size: 0.65rem; }
  .leader-row { grid-template-columns: 2.3rem 1fr auto; }
  .rank-badge { width: 2.3rem; height: 2.3rem; font-size: 0.85rem; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}
