:root {
  color-scheme: dark;
  --bg: #050713;
  --bg-deep: #02030a;
  --surface: rgba(12, 17, 37, 0.88);
  --surface-strong: #0e142c;
  --surface-soft: rgba(18, 25, 52, 0.72);
  --line: rgba(139, 153, 206, 0.18);
  --line-bright: rgba(63, 224, 255, 0.44);
  --text: #f7f8ff;
  --muted: #99a4c7;
  --muted-strong: #bbc5e5;
  --cyan: #36e3ff;
  --cyan-soft: #16b7db;
  --purple: #7c4dff;
  --magenta: #f126e8;
  --green: #43f5a0;
  --danger: #ff5f82;
  --gold: #ffd65a;
  --silver: #d4dcf5;
  --bronze: #f0a46b;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  --transition: 180ms ease;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Base document and accessible interaction defaults */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 72px 72px;
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

img,
canvas {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* A full-page rules gate uses natural scrolling on phones, with no dismiss path. */
.rules-gate {
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(16px, 4vw, 48px) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 85% 0%, rgba(124, 77, 255, 0.16), transparent 50%),
    radial-gradient(ellipse at 0% 50%, rgba(54, 227, 255, 0.06), transparent 55%);
}

.rules-card {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, #111831, #080b1c 78%);
  box-shadow: var(--shadow);
}

.rules-logo {
  width: 180px;
  height: 64px;
  margin-bottom: 24px;
  object-fit: contain;
  object-position: left center;
}

.rules-heading .eyebrow {
  font-size: 0.875rem;
}

.rules-heading h1 {
  margin-bottom: 16px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.rules-heading > p:last-child,
.rules-list,
.rules-checkbox {
  color: var(--muted-strong);
  font-size: 1rem;
  line-height: 1.65;
}

.rules-list {
  margin: 24px 0;
  padding-left: 1.8rem;
}

.rules-list li {
  padding: 14px 0 14px 8px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.rules-list li::marker {
  color: var(--cyan);
  font-weight: 800;
}

.rules-list strong {
  color: var(--text);
}

.rules-agreement {
  display: grid;
  gap: 20px;
}

.rules-agreement .rules-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 48px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(124, 77, 255, 0.08);
  cursor: pointer;
}

.rules-checkbox input {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.rules-checkbox > span {
  font-size: 1rem;
  font-weight: 500;
}

.rules-agreement .primary-button {
  min-height: 52px;
  white-space: normal;
  font-size: 1rem;
}

.rules-agreement .primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--cyan);
  color: #041017;
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform var(--transition);
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  opacity: 0.13;
  filter: blur(110px);
  pointer-events: none;
}

.ambient-one {
  top: -18rem;
  right: -8rem;
  background: var(--purple);
}

.ambient-two {
  bottom: -20rem;
  left: -10rem;
  background: var(--cyan-soft);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  min-height: 82px;
  padding: 10px clamp(18px, 3vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 19, 0.86);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px);
}

/* Sticky brand navigation and mode controls */

.brand {
  display: inline-flex;
  width: 190px;
  border-radius: 10px;
}

.brand img {
  width: 100%;
  height: 54px;
  object-fit: contain;
  object-position: left center;
}

.main-tabs {
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(11, 15, 33, 0.82);
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 750;
  transition:
    color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.is-active {
  background: linear-gradient(120deg, rgba(41, 199, 241, 0.2), rgba(124, 77, 255, 0.25));
  box-shadow: inset 0 0 0 1px rgba(54, 227, 255, 0.27);
  color: var(--text);
}

.tab-icon {
  color: var(--cyan);
  font-size: 1.08rem;
}

.admin-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(17, 23, 48, 0.72);
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 750;
  transition: all var(--transition);
}

.admin-toggle:hover {
  border-color: rgba(54, 227, 255, 0.42);
  color: var(--text);
}

.admin-toggle.is-admin {
  border-color: rgba(67, 245, 160, 0.42);
  background: rgba(67, 245, 160, 0.08);
  color: var(--green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6f7898;
  box-shadow: 0 0 0 4px rgba(111, 120, 152, 0.1);
}

.is-admin .status-dot {
  background: var(--green);
  box-shadow: 0 0 14px rgba(67, 245, 160, 0.8);
}

main {
  width: min(1840px, 100%);
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  padding: clamp(26px, 3vw, 54px) clamp(16px, 3vw, 52px) 70px;
}

.view {
  animation: view-in 420ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 0;
  font-size: clamp(2.1rem, 4.8vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.event-meta span,
.placement-badge,
.lock-chip,
.save-indicator {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 21, 44, 0.7);
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 740;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.registration-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(500px, 1.14fr);
  align-items: center;
  gap: 30px;
  margin-bottom: 26px;
  padding: clamp(20px, 2.5vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(54, 227, 255, 0.24);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(105deg, rgba(21, 31, 64, 0.94), rgba(11, 14, 32, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
}

/* Tournament bracket: seven columns on desktop, sequential rounds on mobile */

.registration-panel::after {
  position: absolute;
  top: -170px;
  right: 8%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(124, 77, 255, 0.22);
  filter: blur(65px);
  content: "";
  pointer-events: none;
}

.registration-copy,
.quick-registration {
  position: relative;
  z-index: 1;
}

.registration-copy {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.panel-number {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(54, 227, 255, 0.32);
  border-radius: 12px;
  background: rgba(54, 227, 255, 0.08);
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 850;
}

.registration-copy p,
.section-description,
.editor-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.quick-registration {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label > span,
.add-entry-form > label {
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(139, 153, 206, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(3, 6, 18, 0.62);
  color: var(--text);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

input::placeholder {
  color: #697493;
}

input:hover:not(:disabled),
input:focus {
  border-color: rgba(54, 227, 255, 0.55);
  background: rgba(5, 9, 24, 0.92);
  box-shadow: 0 0 0 3px rgba(54, 227, 255, 0.08);
}

input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-button,
.spin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(125deg, var(--cyan), #58b5ff 52%, #8f67ff);
  box-shadow: 0 12px 28px rgba(30, 190, 239, 0.18);
  color: #040815;
  font-size: 0.86rem;
  font-weight: 900;
  transition:
    transform var(--transition),
    filter var(--transition),
    box-shadow var(--transition);
}

.primary-button:hover,
.spin-button:hover {
  box-shadow: 0 15px 35px rgba(30, 190, 239, 0.27);
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.primary-button:active,
.spin-button:active {
  transform: translateY(0);
}

.primary-button.compact {
  min-height: 44px;
  padding: 0 16px;
}

.full-width {
  width: 100%;
}

.bracket-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 2px 14px;
}

.bracket-toolbar > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bracket-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.live-pill > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(67, 245, 160, 0.8);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
    transform: scale(0.84);
  }
}

.save-indicator {
  border-color: transparent;
  background: transparent;
  color: #7783a5;
}

.bracket-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.danger-button,
.secondary-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 95, 130, 0.32);
  border-radius: 10px;
  background: rgba(255, 95, 130, 0.08);
  color: #ff8ba5;
  font-size: 0.78rem;
  font-weight: 820;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition),
    transform var(--transition);
}

.danger-button:hover {
  border-color: rgba(255, 95, 130, 0.7);
  background: rgba(255, 95, 130, 0.15);
  color: #ffd4de;
  transform: translateY(-1px);
}

.danger-button.solid {
  border-color: transparent;
  background: linear-gradient(130deg, #ff5f82, #d93675);
  box-shadow: 0 12px 28px rgba(255, 49, 103, 0.2);
  color: white;
}

.secondary-button {
  border-color: var(--line);
  background: rgba(139, 153, 206, 0.06);
  color: var(--muted-strong);
}

#shufflePlayersButton {
  min-height: 44px;
  border-color: rgba(54, 227, 255, 0.3);
  color: var(--cyan);
  font-size: 0.875rem;
}

#shufflePlayersButton:disabled {
  opacity: 0.5;
}

#shuffleDialog {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

#shuffleDialog p:not(.eyebrow):not(.form-error) {
  font-size: 1rem;
}

#shuffleDialog .dialog-actions > button {
  min-height: 48px;
  padding: 10px;
  font-size: 0.875rem;
  white-space: normal;
}

.secondary-button:hover {
  border-color: rgba(139, 153, 206, 0.4);
  background: rgba(139, 153, 206, 0.12);
  color: var(--text);
}

.bracket-frame {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 46%, rgba(124, 77, 255, 0.15), transparent 25%),
    linear-gradient(180deg, rgba(10, 14, 32, 0.93), rgba(6, 9, 22, 0.96));
  box-shadow: var(--shadow);
  scrollbar-color: rgba(54, 227, 255, 0.38) rgba(8, 11, 27, 0.8);
}

.bracket-grid {
  display: grid;
  grid-template-columns:
    minmax(198px, 1fr) minmax(198px, 1fr) minmax(198px, 1fr)
    minmax(238px, 1.18fr)
    minmax(198px, 1fr) minmax(198px, 1fr) minmax(198px, 1fr);
  gap: 24px;
  min-width: var(--bracket-min-width, 1550px);
  min-height: calc(var(--bracket-height, 650px) + 90px);
  padding: 24px;
}

.bracket-column {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.bracket-column > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-height: 37px;
  padding: 0 3px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 840;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bracket-column > header small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.match-stack {
  display: flex;
  min-height: var(--bracket-height, 650px);
  flex: 1;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
  padding-block: 8px;
}

.match-stack.one {
  justify-content: center;
}

.match-stack.two {
  justify-content: space-around;
}

.match-card {
  position: relative;
  z-index: 1;
  overflow: visible;
  border: 1px solid rgba(139, 153, 206, 0.18);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(19, 26, 55, 0.97), rgba(9, 13, 31, 0.97));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  transition:
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}

.match-card:hover {
  border-color: rgba(54, 227, 255, 0.32);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.27);
  transform: translateY(-2px);
}

.left-flow .match-card::after,
.right-flow .match-card::before {
  position: absolute;
  top: 50%;
  width: 25px;
  height: 1px;
  background: linear-gradient(90deg, rgba(54, 227, 255, 0.55), rgba(124, 77, 255, 0.24));
  content: "";
}

.left-flow .match-card::after {
  right: -25px;
}

.right-flow .match-card::before {
  left: -25px;
  transform: rotate(180deg);
}

.match-card.is-complete {
  border-color: rgba(67, 245, 160, 0.34);
}

.match-card.is-bye {
  border-color: rgba(54, 227, 255, 0.24);
}

.match-card.final-match {
  border-color: rgba(241, 38, 232, 0.5);
  box-shadow:
    0 0 0 1px rgba(54, 227, 255, 0.15),
    0 0 45px rgba(124, 77, 255, 0.22);
}

.match-card.third-match {
  width: min(100%, 620px);
  margin-top: 22px;
}

.match-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 7px 10px 5px;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 830;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.match-status {
  color: #7480a0;
  font-size: 0.69rem;
  letter-spacing: 0;
  text-transform: none;
}

.match-status.complete {
  color: var(--green);
}

.player-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 39px 28px;
  align-items: center;
  min-height: 50px;
  border-top: 1px solid rgba(139, 153, 206, 0.13);
  transition:
    background var(--transition),
    color var(--transition);
}

.player-row.is-winner {
  background: linear-gradient(90deg, rgba(67, 245, 160, 0.11), rgba(54, 227, 255, 0.04));
}

.player-row.is-winner::before {
  position: absolute;
  inset-block: 7px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 10px rgba(67, 245, 160, 0.65);
  content: "";
}

.player-row.is-bye-row {
  background: rgba(139, 153, 206, 0.035);
}

.bye-label {
  color: var(--muted-strong);
  font-style: italic;
}

.player-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 7px 7px 7px 10px;
}

.seed {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(139, 153, 206, 0.18);
  border-radius: 7px;
  color: #7783a5;
  font-size: 0.68rem;
  font-weight: 800;
}

.player-copy {
  min-width: 0;
}

.player-name,
.player-placeholder,
.claim-slot-button {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 780;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-username {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-placeholder {
  color: #687393;
  font-weight: 650;
}

.claim-slot-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
}

.claim-slot-button:hover {
  color: #a8f5ff;
}

.admin-name-input {
  min-height: 30px;
  padding: 0 7px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 760;
}

.score-input {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  text-align: center;
  appearance: textfield;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.advance-button,
.remove-player-button {
  display: grid;
  width: 26px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6c7898;
  font-size: 0.9rem;
  transition: color var(--transition), transform var(--transition);
}

.advance-button:hover {
  color: var(--green);
  transform: scale(1.12);
}

.advance-button.is-selected {
  color: var(--green);
  text-shadow: 0 0 12px rgba(67, 245, 160, 0.8);
}

.remove-player-button {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 25px;
  height: 25px;
  color: #7984a3;
  font-size: 0.88rem;
}

.remove-player-button:hover {
  color: var(--danger);
}

.championship {
  isolation: isolate;
}

.championship-halo {
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: -1;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(54, 227, 255, 0.12);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 38, 232, 0.13), rgba(124, 77, 255, 0.05) 48%, transparent 70%);
  box-shadow:
    0 0 0 22px rgba(124, 77, 255, 0.025),
    0 0 0 44px rgba(54, 227, 255, 0.018);
  transform: translate(-50%, -50%);
}

.champion-label {
  position: absolute;
  right: 10px;
  bottom: 74px;
  left: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.champion-label.has-champion {
  color: var(--gold);
}

.placement-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 20px;
  margin-top: 22px;
}

.placement-card,
.wheel-card,
.wheel-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.placement-card {
  min-width: 0;
  padding: clamp(20px, 2.6vw, 30px);
}

.placement-heading,
.wheel-card-topline,
.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.podium-table {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.podium-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(139, 153, 206, 0.13);
  border-radius: 12px;
  background: rgba(6, 10, 25, 0.48);
}

.podium-rank {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: rgba(139, 153, 206, 0.08);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 900;
}

.podium-row:nth-child(1) .podium-rank {
  background: rgba(255, 214, 90, 0.13);
  color: var(--gold);
}

.podium-row:nth-child(2) .podium-rank {
  background: rgba(212, 220, 245, 0.1);
  color: var(--silver);
}

.podium-row:nth-child(3) .podium-rank {
  background: rgba(240, 164, 107, 0.11);
  color: var(--bronze);
}

.podium-player {
  min-width: 0;
  padding-inline: 4px 10px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-player.is-empty {
  color: #677291;
  font-weight: 620;
}

.podium-input {
  min-height: 38px;
  font-size: 0.82rem;
}

.podium-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.text-button {
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 0.77rem;
  font-weight: 780;
}

.text-button:hover {
  color: #b5f8ff;
}

.wheel-heading {
  align-items: end;
}

/* Event wheel and admin entry editor */

.section-description {
  max-width: 420px;
  margin-bottom: 2px;
  text-align: right;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1.35fr) minmax(320px, 0.65fr);
  gap: 22px;
}

.wheel-card,
.wheel-editor {
  padding: clamp(22px, 3vw, 36px);
}

.wheel-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(67, 190, 255, 0.1), transparent 38%),
    linear-gradient(150deg, rgba(14, 20, 43, 0.96), rgba(7, 10, 25, 0.98));
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(6, 9, 23, 0.5);
  color: var(--cyan);
  font-size: 1.15rem;
  transition: all var(--transition);
}

.icon-button:hover {
  border-color: var(--line-bright);
  background: rgba(54, 227, 255, 0.08);
}

.icon-button[aria-pressed="false"] {
  color: #707b9a;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 540px);
  aspect-ratio: 1;
  margin: 18px auto 22px;
  padding: 18px;
}

.wheel-ring {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 8px solid #121a38;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(54, 227, 255, 0.38),
    0 0 0 13px rgba(6, 9, 23, 0.75),
    0 0 60px rgba(54, 227, 255, 0.2),
    inset 0 0 44px rgba(0, 0, 0, 0.42);
}

#wheelCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
}

.wheel-pointer {
  position: absolute;
  top: 3px;
  left: 50%;
  z-index: 4;
  width: 0;
  height: 0;
  border-top: 34px solid var(--cyan);
  border-right: 17px solid transparent;
  border-left: 17px solid transparent;
  filter: drop-shadow(0 0 10px rgba(54, 227, 255, 0.7));
  transform: translateX(-50%);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 7px solid #111936;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #27325d, #080b1b 66%);
  box-shadow:
    0 0 0 2px rgba(54, 227, 255, 0.5),
    0 8px 28px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
}

.wheel-center span {
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.spin-button {
  width: min(100%, 540px);
  min-height: 58px;
  margin: 0 auto;
  border-radius: 14px;
  font-size: 1rem;
}

.spin-button:disabled {
  cursor: wait;
  filter: saturate(0.5);
  opacity: 0.75;
}

.spin-button small {
  padding-left: 15px;
  border-left: 1px solid rgba(4, 8, 21, 0.2);
  color: rgba(4, 8, 21, 0.72);
  font-size: 0.73rem;
  font-weight: 820;
}

.wheel-result {
  display: grid;
  min-height: 82px;
  place-items: center;
  align-content: center;
  gap: 5px;
  width: min(100%, 540px);
  margin: 14px auto 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 7, 19, 0.46);
  text-align: center;
}

.wheel-result.is-winner {
  border-color: rgba(255, 214, 90, 0.38);
  background: linear-gradient(120deg, rgba(255, 214, 90, 0.08), rgba(241, 38, 232, 0.08));
  animation: result-pop 520ms cubic-bezier(0.2, 0.9, 0.22, 1.2);
}

@keyframes result-pop {
  50% {
    transform: scale(1.025);
  }
}

.result-kicker {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 840;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.wheel-result strong {
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.wheel-editor {
  align-self: start;
  background: linear-gradient(155deg, rgba(16, 21, 46, 0.94), rgba(9, 12, 29, 0.98));
}

.lock-chip.is-unlocked {
  border-color: rgba(67, 245, 160, 0.26);
  background: rgba(67, 245, 160, 0.08);
  color: var(--green);
}

.entry-list {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

.entry-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  min-height: 51px;
  padding: 7px 7px 7px 13px;
  border: 1px solid rgba(139, 153, 206, 0.14);
  border-radius: 12px;
  background: rgba(5, 8, 21, 0.5);
}

.entry-color {
  width: 8px;
  height: 28px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.entry-value {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 0.85rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-input {
  min-height: 36px;
  padding: 0 9px;
  font-size: 0.82rem;
}

.remove-entry {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #7681a0;
  font-size: 1rem;
}

.remove-entry:hover {
  border-color: rgba(255, 95, 130, 0.22);
  background: rgba(255, 95, 130, 0.08);
  color: var(--danger);
}

.add-entry-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.add-entry-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 110px;
  padding: 24px;
  border-top: 1px solid var(--line);
  background: rgba(2, 3, 10, 0.62);
  color: #73809f;
  text-align: center;
}

footer img {
  width: 106px;
  height: 40px;
  object-fit: contain;
}

footer p {
  margin: 0;
  font-size: 0.78rem;
}

.app-dialog {
  width: min(92vw, 460px);
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(54, 227, 255, 0.3);
  border-radius: 22px;
  background: linear-gradient(155deg, #121936, #080b1c 78%);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.7);
  color: var(--text);
}

/* Modal, toast, and celebration layers */

.app-dialog::backdrop {
  background: rgba(1, 2, 9, 0.78);
  backdrop-filter: blur(9px);
}

.app-dialog[open] {
  animation: dialog-in 220ms ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.app-dialog form {
  position: relative;
  display: grid;
  gap: 15px;
  padding: 30px;
}

.app-dialog h2 {
  font-size: 1.65rem;
}

.settings-dialog {
  width: min(92vw, 560px);
}

.settings-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-fields label {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 7, 19, 0.3);
}

.settings-fields small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.app-dialog .settings-summary {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(54, 227, 255, 0.18);
  border-radius: 11px;
  background: rgba(54, 227, 255, 0.055);
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.app-dialog p:not(.eyebrow):not(.form-error) {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 17px;
  right: 17px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(4, 7, 19, 0.45);
  color: var(--muted);
  font-size: 1.2rem;
}

.dialog-close:hover {
  color: var(--text);
}

.dialog-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(54, 227, 255, 0.3);
  border-radius: 13px;
  background: rgba(54, 227, 255, 0.08);
  color: var(--cyan);
  font-size: 1.3rem;
}

.danger-dialog {
  border-color: rgba(255, 95, 130, 0.35);
}

.danger-icon {
  border-color: rgba(255, 95, 130, 0.35);
  background: rgba(255, 95, 130, 0.1);
  color: var(--danger);
  font-weight: 950;
}

.danger-eyebrow {
  color: #ff7f9c;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  min-height: 18px;
  margin: -6px 0;
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 700;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  border: 1px solid rgba(54, 227, 255, 0.28);
  border-radius: 12px;
  background: rgba(13, 19, 41, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 720;
  animation: toast-in 220ms ease both;
}

.toast.is-error {
  border-color: rgba(255, 95, 130, 0.35);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}

.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 999;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -18px;
  width: 9px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall var(--fall-duration, 2.8s) linear var(--fall-delay, 0s) forwards;
}

@keyframes confetti-fall {
  to {
    opacity: 0.8;
    transform: translate3d(var(--drift, 0), var(--fall-distance, 600px), 0) rotate(var(--spin, 680deg));
  }
}

@media (max-width: 1050px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
  }

  .brand {
    width: 145px;
  }

  .main-tabs {
    justify-self: center;
  }

  .registration-panel {
    grid-template-columns: 1fr;
  }

  .placement-grid,
  .wheel-layout {
    grid-template-columns: 1fr;
  }

  .wheel-editor {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: relative;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 16px 14px;
  }

  .brand {
    width: 138px;
  }

  .brand img {
    height: 45px;
  }

  .admin-toggle {
    min-height: 38px;
    padding-inline: 12px;
  }

  #adminToggleLabel {
    display: none;
  }

  .main-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .tab-button {
    flex: 1;
    padding-inline: 10px;
  }

  main {
    padding: 28px 14px 54px;
  }

  .section-heading,
  .wheel-heading {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem);
  }

  .event-meta {
    justify-content: flex-start;
  }

  .section-description {
    text-align: left;
  }

  .quick-registration {
    grid-template-columns: 1fr;
  }

  .registration-copy {
    gap: 12px;
  }

  .bracket-toolbar {
    align-items: flex-start;
  }

  .bracket-toolbar > div {
    display: grid;
    gap: 7px;
  }

  .bracket-toolbar p {
    max-width: 245px;
    line-height: 1.45;
  }

  .save-indicator {
    display: none;
  }

  .bracket-actions {
    align-self: flex-end;
  }

  .bracket-frame {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .bracket-grid {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    gap: 16px;
    padding: 0;
  }

  .bracket-column {
    order: var(--mobile-order, 0);
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(9, 13, 31, 0.86);
  }

  .bracket-column > header {
    margin-bottom: 8px;
  }

  .match-stack,
  .match-stack.one,
  .match-stack.two {
    min-height: 0;
    justify-content: start;
    padding: 0;
  }

  .left-flow .match-card::after,
  .right-flow .match-card::before,
  .championship-halo {
    display: none;
  }

  .champion-label {
    position: static;
    margin-top: 11px;
  }

  .placement-grid {
    margin-top: 16px;
  }

  .placement-card,
  .wheel-card,
  .wheel-editor {
    padding: 20px 16px;
  }

  .placement-heading {
    display: grid;
  }

  .placement-badge {
    width: fit-content;
  }

  .wheel-wrap {
    width: min(100%, 360px);
    padding: 14px;
  }

  .wheel-ring {
    border-width: 6px;
  }

  .wheel-center {
    width: 68px;
    height: 68px;
    border-width: 5px;
  }

  .wheel-pointer {
    top: 1px;
    border-top-width: 28px;
    border-right-width: 14px;
    border-left-width: 14px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }

  .app-dialog form {
    padding: 26px 22px;
  }

  .settings-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .tab-button {
    min-height: 40px;
    font-size: 0.78rem;
  }

  .tab-icon {
    display: none;
  }

  .event-meta span {
    font-size: 0.7rem;
  }

  .podium-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .podium-title {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
