:root {
  --bg-top: #091120;
  --bg-mid: #0d1730;
  --bg-bottom: #03060d;
  --surface: rgba(10, 16, 31, 0.82);
  --surface-strong: rgba(12, 19, 38, 0.94);
  --text: #f3ead2;
  --muted: #b9b1a3;
  --gold: #d7b269;
  --gold-soft: rgba(215, 178, 105, 0.28);
  --border: rgba(215, 198, 160, 0.16);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  padding: 2rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  background:
    radial-gradient(circle at top, rgba(201, 164, 92, 0.16), transparent 24%),
    radial-gradient(circle at 18% 22%, rgba(78, 110, 197, 0.14), transparent 20%),
    radial-gradient(circle at 82% 14%, rgba(42, 139, 92, 0.13), transparent 20%),
    radial-gradient(circle at 50% 110%, rgba(107, 46, 33, 0.22), transparent 36%),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 42%, var(--bg-bottom));
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(255, 244, 214, 0.22) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 18%, rgba(255, 244, 214, 0.18) 0 1px, transparent 1.5px),
    radial-gradient(circle at 84% 68%, rgba(255, 244, 214, 0.14) 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 74%, rgba(255, 244, 214, 0.12) 0 1px, transparent 1.5px),
    linear-gradient(transparent, rgba(0, 0, 0, 0.22));
  opacity: 0.95;
  transform-origin: center;
  animation: starlightDrift 11s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 212, 128, 0.1), transparent 25%),
    radial-gradient(circle at 50% 100%, rgba(255, 212, 128, 0.05), transparent 22%),
    radial-gradient(circle at 20% 30%, rgba(95, 131, 225, 0.12), transparent 24%),
    radial-gradient(circle at 78% 26%, rgba(71, 176, 144, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(5, 10, 20, 0) 0%, rgba(5, 10, 20, 0.16) 62%, rgba(2, 3, 7, 0.54) 100%);
  mix-blend-mode: screen;
  opacity: 0.48;
  transform-origin: center bottom;
  animation: auraShift 9s ease-in-out infinite alternate;
}

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.ambient-layer-castle {
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(9, 17, 32, 0) 0%, rgba(9, 17, 32, 0.22) 55%, rgba(3, 6, 13, 0.78) 100%),
    linear-gradient(180deg, rgba(13, 23, 48, 0.42) 0%, rgba(9, 17, 32, 0.05) 28%, rgba(9, 17, 32, 0.1) 62%, rgba(3, 6, 13, 0.82) 100%),
    url("assets/hp-castle.webp") center 38% / cover no-repeat;
  opacity: 0.52;
  filter: saturate(0.88) contrast(1.02) brightness(0.92);
  transform-origin: center center;
  animation: castleDrift 22s ease-in-out infinite alternate;
}

.ambient-layer-castle::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 32%, rgba(122, 163, 255, 0.18), transparent 32%),
    radial-gradient(circle at 80% 24%, rgba(111, 236, 196, 0.14), transparent 30%),
    radial-gradient(circle at 54% 78%, rgba(255, 214, 136, 0.1), transparent 28%);
  mix-blend-mode: screen;
  opacity: 0.55;
  animation: stellarTintShift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

.ambient-layer-glow {
  background:
    radial-gradient(circle at 20% 25%, rgba(103, 145, 245, 0.22), transparent 32%),
    radial-gradient(circle at 78% 18%, rgba(105, 232, 195, 0.18), transparent 30%),
    radial-gradient(circle at 56% 68%, rgba(255, 214, 136, 0.12), transparent 30%),
    radial-gradient(circle at 35% 78%, rgba(160, 120, 255, 0.1), transparent 28%);
  opacity: 0.8;
  animation: glowDrift 14s ease-in-out infinite alternate;
}

.ambient-layer-sparks {
  inset: -18% 0 0;
  background-image:
    radial-gradient(circle, rgba(255, 237, 189, 0.95) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(140, 192, 255, 0.9) 0 1.8px, transparent 2.6px),
    radial-gradient(circle, rgba(129, 232, 193, 0.86) 0 1.4px, transparent 2.2px),
    radial-gradient(circle, rgba(255, 215, 140, 0.82) 0 1px, transparent 1.8px);
  background-size: 210px 210px, 280px 280px, 240px 240px, 180px 180px;
  background-position: 18% 70%, 78% 60%, 52% 80%, 62% 48%;
  opacity: 0.5;
  animation: sparkRise 16s ease-in-out infinite;
}

.ambient-layer-trails {
  inset: 8% -12%;
  background:
    radial-gradient(ellipse at 18% 36%, rgba(127, 171, 255, 0.2), transparent 30%),
    radial-gradient(ellipse at 78% 42%, rgba(111, 236, 196, 0.18), transparent 28%),
    linear-gradient(118deg, transparent 30%, rgba(255, 224, 156, 0.12) 50%, transparent 60%),
    linear-gradient(62deg, transparent 36%, rgba(122, 163, 255, 0.1) 52%, transparent 66%);
  opacity: 0.55;
  animation: trailSweep 10s ease-in-out infinite alternate;
}

.page {
  width: min(1080px, 100%);
  position: relative;
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(1.4rem, 2.4vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: 1.75rem;
  background:
    linear-gradient(180deg, rgba(18, 27, 50, 0.6), rgba(7, 11, 21, 0.86)),
    radial-gradient(circle at top, rgba(255, 214, 134, 0.06), transparent 38%);
  box-shadow: var(--shadow);
}

.page > * {
  position: relative;
  z-index: 1;
}

.page::before,
.page::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 1.3rem;
  pointer-events: none;
}

.page::before {
  border: 1px solid rgba(215, 178, 105, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.page::after {
  inset: auto 8% calc(100% - 56px) 8%;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(215, 178, 105, 0.75), transparent);
  opacity: 0.9;
}

.page-header {
  position: relative;
  z-index: 1;
  margin-bottom: 2rem;
  text-align: center;
}

.admin-login-button {
  position: absolute;
  top: 0;
  right: 0;
  border: 1px solid rgba(215, 178, 105, 0.14);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: rgba(8, 14, 28, 0.22);
  color: rgba(243, 234, 210, 0.62);
  font-family: "Cinzel", serif;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
  display: inline-grid;
  place-items: center;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    background-color 140ms ease;
}

.admin-login-button:hover,
.admin-login-button:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
  border-color: rgba(215, 178, 105, 0.3);
  color: rgba(248, 220, 151, 0.9);
  background: rgba(8, 14, 28, 0.46);
}

.admin-login-button:focus-visible {
  outline: none;
}

.admin-login-button[hidden] {
  display: none;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-family: "Cinzel", serif;
}

.page-header h1 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(2.35rem, 4.5vw, 4.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.04em;
  text-wrap: balance;
  text-shadow: 0 0 24px rgba(215, 178, 105, 0.18);
}

.intro {
  width: min(620px, 100%);
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.45;
}

.leaderboard {
  width: min(440px, 100%);
  position: relative;
  margin: 1.55rem auto 0;
  padding: 1.2rem 1.4rem 1.1rem;
  border: 1px solid rgba(212, 179, 111, 0.24);
  border-radius: 1.25rem;
  background:
    linear-gradient(180deg, rgba(212, 179, 111, 0.14), rgba(255, 255, 255, 0.02)),
    rgba(7, 14, 28, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 24px rgba(215, 178, 105, 0.08);
  text-align: center;
}

.leaderboard::before {
  content: "✦";
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 1.1rem;
  text-shadow: 0 0 14px rgba(215, 178, 105, 0.48);
}

.leaderboard-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
}

.leaderboard-value {
  margin: 0.35rem 0 0;
  color: #f8dc97;
  font-family: "Cinzel", serif;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(215, 178, 105, 0.18);
}

.admin-actions {
  display: none;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.save-round-button,
.clear-draft-button,
.end-game-button,
.reset-button,
.logout-button,
.modal-cancel-button,
.modal-confirm-button,
.delete-round-button {
  margin-top: 1.25rem;
  border: 1px solid rgba(215, 178, 105, 0.22);
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  color: var(--text);
  font-family: "Cinzel", serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.save-round-button,
.clear-draft-button,
.end-game-button,
.reset-button,
.logout-button,
.modal-cancel-button,
.modal-confirm-button,
.delete-round-button {
  margin-top: 0;
}

.save-round-button:hover,
.save-round-button:focus-visible,
.clear-draft-button:hover,
.clear-draft-button:focus-visible,
.end-game-button:hover,
.end-game-button:focus-visible,
.reset-button:hover,
.reset-button:focus-visible,
.logout-button:hover,
.logout-button:focus-visible,
.modal-cancel-button:hover,
.modal-cancel-button:focus-visible,
.modal-confirm-button:hover,
.modal-confirm-button:focus-visible,
.delete-round-button:hover,
.delete-round-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(212, 179, 111, 0.48);
  box-shadow: 0 0 0 3px rgba(212, 179, 111, 0.08);
}

.save-round-button:focus-visible,
.clear-draft-button:focus-visible,
.end-game-button:focus-visible,
.reset-button:focus-visible,
.logout-button:focus-visible,
.modal-cancel-button:focus-visible,
.modal-confirm-button:focus-visible,
.delete-round-button:focus-visible {
  outline: none;
}

.save-round-button {
  border-color: rgba(128, 219, 167, 0.34);
  background: linear-gradient(180deg, rgba(30, 103, 64, 0.4), rgba(13, 48, 28, 0.25));
}

.clear-draft-button,
.modal-cancel-button {
  border-color: rgba(122, 163, 255, 0.28);
}

.end-game-button {
  border-color: rgba(196, 86, 56, 0.38);
  background: linear-gradient(180deg, rgba(140, 38, 20, 0.5), rgba(84, 16, 10, 0.35));
  box-shadow: 0 0 18px rgba(196, 86, 56, 0.14);
}

.end-game-button:hover,
.end-game-button:focus-visible {
  border-color: rgba(232, 145, 111, 0.56);
  box-shadow: 0 0 0 3px rgba(196, 86, 56, 0.12);
}

.modal-confirm-button,
.delete-round-button {
  border-color: rgba(196, 86, 56, 0.38);
  background: linear-gradient(180deg, rgba(140, 38, 20, 0.44), rgba(84, 16, 10, 0.28));
}

.draft-status {
  display: none;
  width: min(640px, 100%);
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(212, 179, 111, 0.18);
  border-radius: 1rem;
  background: rgba(7, 14, 28, 0.45);
  color: var(--muted);
  font-size: 1rem;
}

body.admin-mode .draft-status {
  display: block;
}

.rounds-panel {
  position: relative;
  margin-bottom: 1.5rem;
  padding: 1.3rem;
  border: 1px solid rgba(212, 179, 111, 0.18);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(8, 15, 29, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 40px rgba(0, 0, 0, 0.18);
}

.rounds-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.rounds-kicker {
  margin: 0 0 0.35rem;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-family: "Cinzel", serif;
}

.rounds-panel h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.rounds-summary {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  text-align: right;
}

.saved-rounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.round-card {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.1rem;
  background: rgba(9, 16, 31, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.round-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.9rem;
}

.round-card-title,
.round-card-points {
  margin: 0;
}

.round-card-title {
  font-family: "Cinzel", serif;
  font-size: 1.05rem;
}

.round-card-points {
  color: var(--muted);
  font-size: 0.9rem;
}

.round-card-standings,
.placements-list {
  display: grid;
  gap: 0.55rem;
}

.delete-round-button {
  display: none;
  width: 100%;
  margin-top: 0.9rem;
}

body.admin-mode .delete-round-button {
  display: inline-flex;
  justify-content: center;
}

.teams {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.3rem;
}

.leaderboard-secondary {
  width: min(360px, 100%);
  margin: 1.4rem auto 0;
  padding: 0.95rem 1.15rem 0.9rem;
}

.leaderboard-secondary .leaderboard-label {
  font-size: 0.76rem;
}

.leaderboard-secondary .leaderboard-value {
  margin-top: 0.25rem;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.team {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(10, 16, 31, 0.64);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 36px rgba(0, 0, 0, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.team::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, var(--team-glow), transparent 50%),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 40%);
  opacity: 0.34;
}

.team::after {
  content: "";
  position: absolute;
  inset: auto -10% -35% auto;
  width: 165px;
  height: 165px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--team-glow), transparent 70%);
  opacity: 0.26;
}

.page::before,
.page::after,
.team::before,
.team::after {
  will-change: transform, opacity;
}

.team:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 22px 42px rgba(0, 0, 0, 0.28);
}

.team h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(.8rem, 2.1vw, 1.25rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.score-label {
  position: relative;
  z-index: 1;
  margin: 0.75rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
}

.score-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.score-row .score {
  margin: 0;
}

.team-badge {
  flex-shrink: 0;
  width: clamp(2.25rem, 4vw, 3rem);
  height: auto;
  display: block;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--team-glow) 55%, transparent));
}

.score {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(3rem, 6vw, 4.7rem);
  line-height: 0.9;
  font-weight: 700;
  text-shadow: 0 0 18px color-mix(in srgb, var(--team-glow) 45%, transparent);
}

.carryover-note {
  position: relative;
  z-index: 1;
  margin: 0.55rem 0 0;
  color: rgba(243, 234, 210, 0.78);
  font-size: 0.92rem;
}

.placements,
.round-assignment {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
}

.placements-label {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
}

body.admin-mode .admin-actions {
  display: flex;
}

.round-assignment {
  display: none;
}

body.admin-mode .round-assignment {
  display: block;
}

.empty-pill,
.placement-pill {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.95rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
}

.empty-pill {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.placement-pill {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.placement-pill-label {
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.placement-pill-value {
  text-align: right;
  font-size: 0.95rem;
}

.place-1 {
  border-color: rgba(255, 222, 147, 0.28);
}

.place-2 {
  border-color: rgba(198, 220, 255, 0.24);
}

.place-3 {
  border-color: rgba(204, 164, 134, 0.24);
}

.place-4 {
  border-color: rgba(143, 214, 167, 0.22);
}

.place-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.place-button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
  padding: 0.7rem 0.8rem;
  background: linear-gradient(180deg, rgba(6, 11, 22, 0.7), rgba(6, 11, 22, 0.48));
  color: var(--text);
  font-family: "Cinzel", serif;
  font-size: 0.92rem;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.place-button:hover,
.place-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.place-button:focus-visible {
  outline: none;
}

.place-button.is-active {
  border-color: rgba(255, 225, 158, 0.5);
  background: linear-gradient(180deg, rgba(128, 90, 28, 0.46), rgba(72, 43, 8, 0.3));
  box-shadow: 0 0 0 3px rgba(212, 179, 111, 0.08);
}

.place-button.is-locked {
  opacity: 0.45;
}

.place-button:disabled,
.save-round-button:disabled,
.clear-draft-button:disabled,
.end-game-button:disabled,
.reset-button:disabled,
.logout-button:disabled,
.resume-game-button:disabled,
.restart-game-button:disabled,
.delete-round-button:disabled,
.modal-confirm-button:disabled,
.modal-cancel-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.winner-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top, rgba(236, 193, 108, 0.2), transparent 26%),
    radial-gradient(circle at center, rgba(13, 23, 48, 0.7), rgba(3, 6, 13, 0.96));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.winner-card {
  width: min(720px, 100%);
  padding: 2.3rem 2rem;
  border: 1px solid rgba(215, 178, 105, 0.3);
  border-radius: 1.75rem;
  background:
    linear-gradient(180deg, rgba(21, 31, 58, 0.96), rgba(8, 12, 24, 0.98)),
    rgba(10, 16, 31, 0.92);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(215, 178, 105, 0.12);
  text-align: center;
  transform: scale(0.92);
}

.winner-kicker {
  margin: 0;
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.winner-title {
  margin: 1rem 0 0;
  color: #f8dc97;
  font-family: "Cinzel", serif;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1;
  text-shadow: 0 0 26px rgba(215, 178, 105, 0.22);
}

.winner-subtitle {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1.2rem;
}

.winner-actions {
  display: none;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

body.admin-mode .winner-actions {
  display: flex;
}

.resume-game-button,
.restart-game-button {
  border: 1px solid rgba(215, 178, 105, 0.28);
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  color: var(--text);
  font-family: "Cinzel", serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.resume-game-button:hover,
.resume-game-button:focus-visible,
.restart-game-button:hover,
.restart-game-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(212, 179, 111, 0.48);
  box-shadow: 0 0 0 3px rgba(212, 179, 111, 0.08);
}

.resume-game-button:focus-visible,
.restart-game-button:focus-visible {
  outline: none;
}

.resume-game-button {
	background: linear-gradient(180deg, rgba(42, 139, 92, 0.28), rgba(12, 55, 36, 0.22));
	border-color: rgba(104, 214, 145, 0.34);
}

body.game-ended {
  overflow: hidden;
}

body.game-ended .winner-screen {
  visibility: visible;
  pointer-events: auto;
  animation: winnerFadeIn 420ms ease forwards;
}

body.game-ended .winner-card {
  animation: winnerScaleIn 480ms ease forwards;
}

@keyframes winnerFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes winnerScaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.team-gryffindor .place-button:hover,
.team-gryffindor .place-button:focus-visible {
  border-color: rgba(245, 200, 109, 0.45);
}

.team-hufflepuff .place-button:hover,
.team-hufflepuff .place-button:focus-visible {
  border-color: rgba(255, 226, 123, 0.45);
}

.team-ravenclaw .place-button:hover,
.team-ravenclaw .place-button:focus-visible {
  border-color: rgba(154, 195, 255, 0.45);
}

.team-slytherin .place-button:hover,
.team-slytherin .place-button:focus-visible {
  border-color: rgba(131, 224, 169, 0.45);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(2, 5, 11, 0.68);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  padding: 1.8rem;
  border: 1px solid rgba(215, 178, 105, 0.26);
  border-radius: 1.5rem;
  background:
    linear-gradient(180deg, rgba(21, 31, 58, 0.96), rgba(8, 12, 24, 0.98)),
    rgba(10, 16, 31, 0.92);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
}

.modal-kicker {
  margin: 0;
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.modal-title {
  margin: 0.9rem 0 0;
  font-family: "Cinzel", serif;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.modal-copy {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

body.modal-open {
  overflow: hidden;
}

.team-gryffindor {
  --team-glow: rgba(196, 53, 46, 0.88);
  border-color: rgba(214, 174, 78, 0.36);
  background-color: rgba(52, 10, 14, 0.4);
}

.team-gryffindor .score,
.team-gryffindor h2 {
  color: #f5c86d;
}

.team-hufflepuff {
  --team-glow: rgba(235, 194, 60, 0.92);
  border-color: rgba(255, 223, 103, 0.3);
  background-color: rgba(72, 53, 10, 0.38);
}

.team-hufflepuff .score,
.team-hufflepuff h2 {
  color: #ffe27b;
}

.team-ravenclaw {
  --team-glow: rgba(58, 116, 217, 0.9);
  border-color: rgba(102, 163, 255, 0.3);
  background-color: rgba(10, 29, 62, 0.4);
}

.team-ravenclaw .score,
.team-ravenclaw h2 {
  color: #9ac3ff;
}

.team-slytherin {
  --team-glow: rgba(45, 156, 90, 0.9);
  border-color: rgba(104, 214, 145, 0.3);
  background-color: rgba(8, 43, 28, 0.4);
}

.team-slytherin .score,
.team-slytherin h2 {
  color: #83e0a9;
}

@keyframes starlightDrift {
  0% {
    opacity: 0.74;
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, -22px, 0) scale(1.06);
  }
}

@keyframes auraShift {
  0% {
    opacity: 0.34;
    transform: translate3d(-2%, 0, 0) scale(1);
  }

  50% {
    opacity: 0.58;
    transform: translate3d(2%, -14px, 0) scale(1.05);
  }

  100% {
    opacity: 0.42;
    transform: translate3d(-1%, 18px, 0) scale(1.08);
  }
}

@keyframes castleDrift {
  0% {
    opacity: 0.46;
    transform: translate3d(-0.6%, 0.4%, 0) scale(1.02);
  }

  50% {
    opacity: 0.56;
    transform: translate3d(0.3%, -0.6%, 0) scale(1.04);
  }

  100% {
    opacity: 0.5;
    transform: translate3d(0.8%, -1%, 0) scale(1.06);
  }
}

@keyframes stellarTintShift {
  0% {
    opacity: 0.42;
    transform: translate3d(-1%, 0, 0) scale(1);
  }

  100% {
    opacity: 0.68;
    transform: translate3d(1.5%, -0.8%, 0) scale(1.04);
  }
}

@keyframes glowDrift {
  0% {
    transform: translate3d(-3%, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(2%, -3%, 0) scale(1.08);
  }

  100% {
    transform: translate3d(4%, 2%, 0) scale(1.12);
  }
}

@keyframes sparkRise {
  0% {
    opacity: 0.22;
    transform: translate3d(0, 6%, 0);
  }

  50% {
    opacity: 0.65;
    transform: translate3d(0, -2%, 0);
  }

  100% {
    opacity: 0.22;
    transform: translate3d(0, -10%, 0);
  }
}

@keyframes trailSweep {
  0% {
    opacity: 0.35;
    transform: translate3d(-2%, 1%, 0);
  }

  100% {
    opacity: 0.6;
    transform: translate3d(2%, -1%, 0);
  }
}

.page::after {
  inset: auto -8% -8% -8%;
  height: 42%;
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(circle at 22% 60%, rgba(117, 160, 255, 0.18), transparent 42%),
    radial-gradient(circle at 78% 52%, rgba(100, 224, 183, 0.15), transparent 38%),
    radial-gradient(circle at 50% 90%, rgba(255, 215, 132, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(18, 28, 46, 0), rgba(18, 28, 46, 0.34));
  opacity: 0.7;
}

@media (max-width: 1100px) {
  .rounds-panel-header {
    align-items: start;
    flex-direction: column;
  }

  .rounds-summary {
    text-align: left;
  }
}

@media (max-width: 820px) {
  .teams {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .rounds-panel {
    padding: 1rem;
  }

  .saved-rounds {
    grid-template-columns: 1fr;
  }

  .placement-pill {
    align-items: start;
    flex-direction: column;
  }

  .placement-pill-value {
    text-align: left;
  }

  .leaderboard {
    padding: 0.9rem 1rem;
  }

  .leaderboard-value {
    font-size: 1.8rem;
  }

  .admin-actions {
    flex-direction: column;
    align-items: center;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }

  .winner-card {
    padding: 1.7rem 1.3rem;
  }

  .winner-subtitle {
    font-size: 1.05rem;
  }
}

@media (max-width: 700px) {
  body {
    padding: 1rem;
  }

  .page {
    padding: 1.25rem;
  }

  .admin-login-button {
    top: 0.1rem;
    right: 0.1rem;
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.9rem;
  }

  .page-header h1 {
    font-size: 2.2rem;
  }

  .intro {
    font-size: 1.02rem;
  }

  .teams {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .team {
    padding: 1.15rem;
  }

  .team h2 {
    font-size: 0.92rem;
    letter-spacing: 0.04em;
  }

  .score {
    font-size: clamp(2.35rem, 10vw, 3.1rem);
  }

  .score-label {
    font-size: 0.68rem;
  }

  .team-badge {
    width: clamp(1.85rem, 8vw, 2.5rem);
  }

  .place-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-secondary {
    width: 100%;
    max-width: 320px;
  }

  .ambient-layer-castle {
    opacity: 0.42;
    filter: saturate(0.88) contrast(1.02) brightness(0.9);
  }

  .ambient-layer-sparks {
    opacity: 0.42;
  }

  .ambient-layer-trails {
    inset: 14% -24%;
    opacity: 0.46;
  }

  body::after {
    opacity: 0.36;
  }

  .page::after {
    height: 34%;
  }
}

@media (max-width: 700px) {
  .ambient-layer-sparks,
  .ambient-layer-trails,
  .ambient-layer-glow {
    display: none;
  }

  body::before,
  body::after,
  .ambient-layer-castle,
  .ambient-layer-castle::after {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .ambient-layer-sparks,
  .ambient-layer-trails,
  .ambient-layer-glow {
    display: none;
  }
}
