:root {
  --bg: #0f1017;
  --bg-soft: #171926;
  --panel: rgba(25, 27, 40, 0.88);
  --panel-strong: rgba(18, 20, 31, 0.96);
  --gold: #d9b35d;
  --gold-strong: #f0ca78;
  --wine: #6d1234;
  --wine-soft: #8c1f47;
  --text: #f7f2e8;
  --muted: #c8bdac;
  --line: rgba(255, 255, 255, 0.08);
  --success: #244b2f;
  --error: #662433;
  --danger: #9f2e4a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(217, 179, 93, 0.14), transparent 28%),
    linear-gradient(180deg, #151523 0%, #0d0f18 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(109, 18, 52, 0.24), transparent 20%),
    radial-gradient(circle at 85% 10%, rgba(217, 179, 93, 0.12), transparent 18%),
    radial-gradient(circle at 50% 100%, rgba(109, 18, 52, 0.2), transparent 30%);
  pointer-events: none;
}

.site-shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.topbar, .site-footer, .admin-header, .category-admin-head, .section-title-row,
.hero-card, .grid-two, .stats-grid, .inline-fields, .admin-actions, .topbar-actions,
.reveal-toolbar, .reveal-controls {
  display: flex;
  gap: 18px;
}

.topbar, .site-footer, .admin-header, .reveal-toolbar {
  align-items: center;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 14, 24, 0.7);
  backdrop-filter: blur(16px);
}

.eyebrow, .section-badge, .kicker, .mini-label, .winner-label, .stat-label, .category-state {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
}

.eyebrow, .section-badge, .kicker, .mini-label, .winner-label, .stat-label {
  color: var(--gold-strong);
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
}

.topbar-actions {
  align-items: center;
}

.page-wrap {
  display: grid;
  gap: 22px;
}

.hero-card,
.form-card,
.info-card,
.stat-card,
.category-admin-card,
.privacy-banner,
.success-card,
.reveal-stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 36px;
  justify-content: space-between;
  align-items: stretch;
}

.hero-copy, .hero-side, .stage-copy { display: grid; gap: 16px; }
.hero-copy { max-width: 720px; }
.hero-side { min-width: 290px; }

h1, h2, h3, h4, .brand-title, .reveal-category-name, .winner-name {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0;
}

h1 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.05; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.lead, p, li, .support-text, label, input, textarea, select, .nominee-name, .nominee-subtitle {
  line-height: 1.55;
}

p, .support-text, .micro-note, .empty-state, .feature-list, .steps-list {
  color: var(--muted);
  margin: 0;
}

.hero-actions, .admin-actions, .stack-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.stage-panel {
  padding: 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(84, 18, 44, 0.7), rgba(32, 15, 29, 0.8));
  border: 1px solid rgba(240, 202, 120, 0.22);
}

.award-mark {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, var(--gold-strong), var(--gold));
  color: #311206;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(217, 179, 93, 0.25);
}

.feature-list, .steps-list {
  padding-left: 20px;
  margin: 0;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.info-card, .form-card, .stat-card, .success-card, .privacy-banner, .category-admin-card {
  padding: 26px;
}
.danger-zone-card {
  border: 1px solid rgba(159, 46, 74, 0.45);
  background: linear-gradient(180deg, rgba(102, 36, 51, 0.28), rgba(25, 27, 40, 0.92));
}

.compact-card { max-width: 560px; margin: 0 auto; }
.success-card { text-align: center; display: grid; gap: 18px; max-width: 680px; margin: 0 auto; }
.success-icon {
  width: 76px; height: 76px; border-radius: 999px; margin: 0 auto;
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
  background: radial-gradient(circle, #f5d48f, var(--gold)); color: #321406;
}

.stack-form { display: grid; gap: 12px; }
label { font-size: 0.92rem; color: #f5ecdb; }
input, textarea, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}
textarea { resize: vertical; }

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.btn, .ghost-link {
  appearance: none;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn:hover, .ghost-link:hover { transform: translateY(-1px); }
.btn-primary {
  color: #331507;
  background: linear-gradient(180deg, #f4d48f, var(--gold));
}
.btn-secondary {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}
.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-danger, .btn-ghost-danger {
  background: rgba(159, 46, 74, 0.18);
  color: #ffcad5;
  border: 1px solid rgba(159, 46, 74, 0.45);
}
.btn-ghost-danger { padding: 8px 12px; font-size: 0.85rem; }
.ghost-link {
  color: var(--muted);
  background: transparent;
  padding: 0;
}
.btn-wide { width: 100%; justify-content: center; }

.flash-stack { display: grid; gap: 10px; }
.flash {
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.flash-success { background: rgba(36, 75, 47, 0.35); }
.flash-error { background: rgba(102, 36, 51, 0.45); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.stat-card { display: grid; gap: 10px; }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.privacy-banner { color: #f7ecdd; }

.category-admin-card {
  display: grid;
  gap: 18px;
}
.category-admin-head {
  justify-content: space-between;
  align-items: flex-start;
}
.category-state {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.category-state.active {
  background: rgba(217,179,93,0.18);
  color: var(--gold-strong);
}
.category-state.inactive {
  background: rgba(255,255,255,0.08);
  color: var(--muted);
}
.nested-grid { grid-template-columns: 1.1fr 0.9fr; }
.nested-card { background: rgba(255,255,255,0.03); }
.nominee-admin-list { display: grid; gap: 10px; }
.nominee-admin-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
}

.codes-output {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.output-title { font-weight: 700; }

.ballot-card { padding: 30px; }
.ballot-form { display: grid; gap: 22px; }
.category-block {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255,255,255,0.025);
}
.category-block legend {
  padding: 0 8px;
}
.category-title { display: block; font-weight: 800; font-size: 1.1rem; }
.category-description { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.nominee-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.nominee-option input { position: absolute; opacity: 0; pointer-events: none; }
.nominee-card {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,0.035);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.nominee-option input:checked + .nominee-card {
  border-color: var(--gold-strong);
  background: rgba(217,179,93,0.12);
  transform: translateY(-1px);
}
.nominee-avatar {
  width: 52px; height: 52px; border-radius: 999px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #f0ca78, var(--gold));
  color: #351507; font-weight: 800; font-size: 1.2rem;
}
.nominee-name { font-weight: 800; }
.nominee-subtitle { font-size: 0.92rem; color: var(--muted); }

.reveal-body .site-shell {
  max-width: min(1600px, calc(100vw - 24px));
  padding: 14px 18px 18px;
}
.reveal-body .topbar {
  margin-bottom: 12px;
  padding: 10px 16px;
}
.reveal-body .page-wrap { gap: 12px; }
.reveal-body .site-footer { display: none; }
.reveal-toolbar {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: end;
}
.reveal-toolbar-main {
  display: grid;
  gap: 10px;
}
.reveal-toolbar h1 {
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 0.96;
}
.reveal-toolbar .support-text { max-width: 760px; }
.reveal-toolbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.reveal-selector { display: grid; gap: 8px; min-width: 340px; }
.btn-gala-start {
  min-height: 48px;
  padding: 13px 24px;
  font-size: 1rem;
  box-shadow: 0 16px 28px rgba(217, 179, 93, 0.18);
}
.audio-status {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
}
.audio-status span {
  font-size: 0.92rem;
  font-weight: 700;
}
.audio-status small {
  color: var(--muted);
  font-size: 0.82rem;
}
.audio-status-ok {
  border-color: rgba(117, 196, 120, 0.28);
  background: rgba(85, 150, 78, 0.12);
}
.audio-status-warn {
  border-color: rgba(240, 202, 120, 0.22);
  background: rgba(217,179,93,0.08);
}
#showFinalistsBtn { display: none !important; }

.reveal-stage {
  position: relative;
  overflow: hidden;
  min-height: min(72vh, 760px);
  padding: clamp(20px, 2.4vh, 30px);
  background:
    linear-gradient(180deg, rgba(33, 18, 28, 0.9), rgba(12, 12, 20, 0.98)),
    radial-gradient(circle at top center, rgba(217,179,93,0.18), transparent 25%);
}

.spotlight {
  position: absolute;
  top: -120px;
  width: 420px;
  height: 820px;
  background: radial-gradient(ellipse at top, rgba(244,212,143,0.22), rgba(244,212,143,0.04) 46%, transparent 70%);
  filter: blur(10px);
  transform-origin: top center;
  animation: sway 6s ease-in-out infinite;
}
.spotlight.left { left: 4%; transform: rotate(18deg); }
.spotlight.right { right: 4%; transform: rotate(-18deg); animation-delay: 1.8s; }

@keyframes sway {
  0%, 100% { transform: rotate(18deg); }
  50% { transform: rotate(12deg); }
}

.reveal-inner {
  position: relative;
  z-index: 2;
  display: grid;
  gap: clamp(8px, 1.35vh, 14px);
  justify-items: center;
  text-align: center;
  align-content: start;
  min-height: min(68vh, 700px);
}
.gala-opening-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  width: min(1180px, 100%);
  padding: clamp(22px, 3vh, 34px) clamp(20px, 3vw, 40px);
  border-radius: 28px;
  border: 1px solid rgba(240, 202, 120, 0.18);
  background: linear-gradient(180deg, rgba(19, 17, 28, 0.9), rgba(11, 12, 20, 0.84));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}
.gala-opening-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.2vw, 3.7rem);
  line-height: 0.98;
  max-width: 14ch;
}
.gala-opening-copy {
  max-width: 42ch;
  font-size: clamp(1.02rem, 2vh, 1.22rem);
  color: #f7ecdb;
  min-height: 3.1em;
}
.gala-nominees-showcase {
  width: min(1160px, 100%);
  display: grid;
  gap: 16px;
}
.gala-nominees-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--gold-strong);
}
.gala-nominees-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.gala-nominee-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(240, 202, 120, 0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  color: #f8f0e2;
  font-weight: 700;
  min-height: 62px;
  display: grid;
  place-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.36s ease, transform 0.36s ease, border-color 0.36s ease, box-shadow 0.36s ease;
}
.gala-nominee-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  border-color: rgba(240, 202, 120, 0.34);
  box-shadow: 0 18px 34px rgba(217, 179, 93, 0.12);
}
.reveal-hero {
  display: grid;
  gap: clamp(8px, 1vh, 12px);
  justify-items: center;
  width: min(860px, 100%);
}
.reveal-callout {
  position: relative;
  z-index: 5;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(640px, 100%);
}
.award-badge {
  width: clamp(72px, 8vh, 88px);
  height: clamp(72px, 8vh, 88px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #f6d895 0%, var(--gold) 65%, #ab7a27 100%);
  color: #341206;
  font-size: clamp(2rem, 3.8vh, 2.25rem);
  box-shadow: 0 0 50px rgba(217,179,93,0.28);
}
.reveal-category-name {
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  line-height: 1.04;
  max-width: 16ch;
}
.reveal-category-description { color: var(--muted); font-size: clamp(0.95rem, 1.8vh, 1.02rem); }
.stage-message {
  position: relative;
  z-index: 5;
  font-size: clamp(1rem, 2vh, 1.14rem);
  min-height: 1.35em;
  max-width: 36ch;
  color: #f8eedc;
}
.finalists-grid {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.finalist-card, .winner-panel {
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.045);
  backdrop-filter: blur(12px);
}
.finalist-card {
  padding: 22px;
  display: grid;
  gap: 10px;
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}
.finalist-rank {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-strong);
}
.finalist-name { font-family: Georgia, serif; font-size: 1.65rem; }
.finalist-subtitle, .winner-subtitle { color: var(--muted); }
.finalist-votes, .winner-meta { font-size: 0.96rem; color: #eadfcf; }
.finalist-secret {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(240, 202, 120, 0.88);
}
.finalist-card.is-winner {
  border-color: rgba(240, 202, 120, 0.48);
  background: linear-gradient(180deg, rgba(240, 202, 120, 0.18), rgba(255,255,255,0.045));
  box-shadow: 0 20px 48px rgba(217, 179, 93, 0.18);
  transform: translateY(-4px);
}

.envelope-card {
  width: 100%;
  position: relative;
  margin-top: 0;
  perspective: 1000px;
}
.envelope-slot {
  width: min(400px, 100%);
  padding-top: 94px;
  position: relative;
  z-index: 2;
}
.reveal-stage.gala-opening-active .reveal-hero,
.reveal-stage.gala-opening-active .reveal-callout,
.reveal-stage.gala-opening-active .envelope-slot,
.reveal-stage.gala-opening-active .winner-panel,
.reveal-stage.gala-closing-active .reveal-hero,
.reveal-stage.gala-closing-active .reveal-callout,
.reveal-stage.gala-closing-active .envelope-slot,
.reveal-stage.gala-closing-active .winner-panel {
  display: none !important;
}
.reveal-stage.gala-opening-complete .gala-opening-panel {
  border-color: rgba(240, 202, 120, 0.28);
}
.reveal-stage.gala-closing-active .gala-opening-panel {
  border-color: rgba(240, 202, 120, 0.28);
}
.reveal-stage.auto-reveal-pending .stage-message {
  color: var(--gold-strong);
}
.reveal-stage.is-revealing .award-badge {
  animation: badgePulse 1.1s ease-in-out infinite;
}
.reveal-stage.is-revealing .stage-message {
  animation: stageGlow 1.4s ease-in-out infinite;
}
.reveal-stage.is-revealing .envelope-card {
  animation: envelopeSuspense 0.9s ease-in-out infinite;
}
.reveal-stage.winner-announced .winner-panel {
  box-shadow: 0 24px 60px rgba(217, 179, 93, 0.18);
}
.envelope-body {
  border-radius: 22px;
  padding: 36px 20px 18px;
  background: linear-gradient(180deg, #f2dfbf, #d8b276);
  color: #301408;
  font-weight: 800;
}
.envelope-flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  margin: auto;
  width: 100%;
  height: 94px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #f6e9cf, #dcb67c);
  transform-origin: top center;
  transition: transform 0.8s ease;
}
.envelope-card.open .envelope-flap {
  transform: rotateX(180deg);
}
.winner-panel {
  padding: 20px 22px;
  width: min(700px, 100%);
  display: grid;
  gap: 8px;
}
.winner-name {
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 0.98;
}
.hidden { display: none !important; }

@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 50px rgba(217,179,93,0.28); }
  50% { transform: scale(1.06); box-shadow: 0 0 70px rgba(217,179,93,0.38); }
}

@keyframes stageGlow {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

@keyframes envelopeSuspense {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(-0.5deg); }
  75% { transform: translateY(2px) rotate(0.5deg); }
}

.empty-state.large {
  padding: 44px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 20px;
}
.small { font-size: 0.9rem; }
.site-footer { margin-top: 28px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 980px) {
  .grid-two, .stats-grid, .nominee-grid, .finalists-grid, .nested-grid, .gala-nominees-grid {
    grid-template-columns: 1fr;
  }
  .hero-card, .topbar, .admin-header, .reveal-toolbar, .category-admin-head {
    flex-direction: column;
    align-items: stretch;
  }
  .reveal-toolbar {
    grid-template-columns: 1fr;
  }
  .reveal-toolbar-main {
    justify-items: start;
  }
  .reveal-inner {
    min-height: auto;
  }
  .reveal-hero, .reveal-callout { width: 100%; }
  .envelope-slot {
    width: min(340px, 100%);
    padding-top: 76px;
  }
  .gala-opening-panel {
    padding: 20px 18px 24px;
  }
  .reveal-selector { min-width: auto; }
}
