:root {
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: var(--font-body);
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f1f6f3;
  --ink: #171a1f;
  --muted: #69707a;
  --line: #d9ded7;
  --line-strong: #a8b9ae;
  --accent: #226b54;
  --accent-ink: #ffffff;
  --accent-border: #86a99c;
  --accent-soft: #dff3e8;
  --accent-soft-ink: #174b3a;
  --accent-shadow: rgba(34, 107, 84, 0.18);
  --warn: #9a3e26;
  --focus-ring: rgba(34, 107, 84, 0.22);
  --nav-bg: rgba(245, 247, 248, 0.94);
  --panel-tint: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --input-line: #c9d1cb;
  --complete-mark: #1f7a56;
  --complete-ring: rgba(31, 122, 86, 0.22);
  --complete-border: #8fc0a8;
  --complete-bg: #eff9f3;
  --open-border: #d5d9de;
  --danger-bg: #fff5f2;
  --danger-line: #efc1b4;
  --row-shadow: 0 8px 18px rgba(31, 35, 40, 0.04);
  --tab-shadow: 0 8px 18px rgba(31, 35, 40, 0.06);
  --dialog-backdrop: rgba(23, 26, 31, 0.48);
  --dialog-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  --toast-bg: var(--ink);
  --toast-ink: #ffffff;
  --gold-bg: #fff8df;
  --gold-line: #dec46a;
  --gold-mark: #c89b1f;
  --gold-text: #8a6500;
  --silver-bg: #f4f6f8;
  --silver-line: #b9c1c9;
  --silver-mark: #96a0aa;
  --silver-text: #5f6870;
  --bronze-bg: #fff0e5;
  --bronze-line: #d4a07d;
  --bronze-mark: #b87545;
  --bronze-text: #8c4f27;
  --shadow: 0 18px 40px rgba(31, 35, 40, 0.08);
}

html[data-theme="roman"] {
  --font-body: "Marcellus", Georgia, serif;
  --font-display: "Cinzel", Georgia, serif;
  --bg: #f2e3cf;
  --surface: #fff8ed;
  --surface-soft: #ead3b8;
  --ink: #2f2118;
  --muted: #756052;
  --line: #d4b28e;
  --line-strong: #a97955;
  --accent: #a54f2e;
  --accent-ink: #fff8ed;
  --accent-border: #c57b55;
  --accent-soft: #f0c8a8;
  --accent-soft-ink: #5b2d1b;
  --accent-shadow: rgba(165, 79, 46, 0.22);
  --warn: #8a3426;
  --focus-ring: rgba(165, 79, 46, 0.25);
  --nav-bg: rgba(242, 227, 207, 0.94);
  --panel-tint: rgba(255, 248, 237, 0.8);
  --input-bg: #fffaf2;
  --input-line: #caa783;
  --complete-mark: #637a43;
  --complete-ring: rgba(99, 122, 67, 0.22);
  --complete-border: #9fad79;
  --complete-bg: #edf0d8;
  --open-border: #cdb89e;
  --danger-bg: #f9e0d5;
  --danger-line: #cf927b;
  --row-shadow: 0 10px 20px rgba(74, 47, 28, 0.08);
  --tab-shadow: 0 10px 20px rgba(74, 47, 28, 0.1);
  --dialog-backdrop: rgba(47, 33, 24, 0.54);
  --dialog-shadow: 0 24px 80px rgba(74, 47, 28, 0.3);
  --toast-bg: #3b2419;
  --toast-ink: #fff8ed;
  --gold-bg: #fff2c8;
  --gold-line: #c59a3a;
  --gold-mark: #a87921;
  --gold-text: #735218;
  --silver-bg: #eee6dd;
  --silver-line: #b3aaa0;
  --silver-mark: #8e877e;
  --silver-text: #5e554d;
  --bronze-bg: #f5d9c7;
  --bronze-line: #bb7f5c;
  --bronze-mark: #9a5d39;
  --bronze-text: #724125;
  --shadow: 0 18px 42px rgba(74, 47, 28, 0.12);
}

html[data-theme="rally"] {
  --bg: #f7f6f1;
  --surface: #fffdf8;
  --surface-soft: #eef3e7;
  --ink: #1c1b18;
  --muted: #6d6b61;
  --line: #d8d7cc;
  --line-strong: #aaafa0;
  --accent: #b3263b;
  --accent-ink: #ffffff;
  --accent-border: #cd6c79;
  --accent-soft: #f8dfe4;
  --accent-soft-ink: #6d1020;
  --accent-shadow: rgba(179, 38, 59, 0.18);
  --warn: #8d2f25;
  --focus-ring: rgba(179, 38, 59, 0.22);
  --nav-bg: rgba(247, 246, 241, 0.94);
  --panel-tint: rgba(255, 253, 248, 0.78);
  --input-bg: #fffdf8;
  --input-line: #cbc9bc;
  --complete-mark: #2f7d4d;
  --complete-ring: rgba(47, 125, 77, 0.2);
  --complete-border: #85b996;
  --complete-bg: #edf6ed;
  --danger-bg: #fff1f2;
  --danger-line: #e5a7ae;
}

html[data-theme="coastal"] {
  --bg: #edf7f8;
  --surface: #ffffff;
  --surface-soft: #e4f0ec;
  --ink: #14212a;
  --muted: #63747b;
  --line: #cbdfe1;
  --line-strong: #96b7ba;
  --accent: #0f6f78;
  --accent-ink: #ffffff;
  --accent-border: #65aeb5;
  --accent-soft: #d8f0f2;
  --accent-soft-ink: #10464d;
  --accent-shadow: rgba(15, 111, 120, 0.18);
  --warn: #aa4a36;
  --focus-ring: rgba(15, 111, 120, 0.22);
  --nav-bg: rgba(237, 247, 248, 0.94);
  --panel-tint: rgba(255, 255, 255, 0.76);
  --input-bg: #ffffff;
  --input-line: #bfd2d6;
  --complete-mark: #21735e;
  --complete-ring: rgba(33, 115, 94, 0.2);
  --complete-border: #87bcae;
  --complete-bg: #e6f6ef;
  --danger-bg: #fff2ee;
  --danger-line: #e4afa1;
}

html[data-theme="night"] {
  --bg: #101513;
  --surface: #18201d;
  --surface-soft: #202b26;
  --ink: #f3f7f4;
  --muted: #a9b6ae;
  --line: #33423d;
  --line-strong: #5b746b;
  --accent: #8fd7b3;
  --accent-ink: #102018;
  --accent-border: #6dbf98;
  --accent-soft: #203c31;
  --accent-soft-ink: #d5f4e5;
  --accent-shadow: rgba(143, 215, 179, 0.2);
  --warn: #ff9a85;
  --focus-ring: rgba(143, 215, 179, 0.28);
  --nav-bg: rgba(16, 21, 19, 0.94);
  --panel-tint: rgba(24, 32, 29, 0.78);
  --input-bg: #121a17;
  --input-line: #40534d;
  --complete-mark: #8fd7b3;
  --complete-ring: rgba(143, 215, 179, 0.24);
  --complete-border: #507b68;
  --complete-bg: #19382d;
  --open-border: #47544f;
  --danger-bg: #361f1c;
  --danger-line: #865044;
  --row-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  --tab-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  --dialog-backdrop: rgba(0, 0, 0, 0.64);
  --dialog-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --toast-bg: #f3f7f4;
  --toast-ink: #101513;
  --gold-bg: #352b12;
  --gold-line: #9e7b25;
  --gold-mark: #d4a63a;
  --gold-text: #f2d57a;
  --silver-bg: #242a2d;
  --silver-line: #6d7881;
  --silver-mark: #aeb6be;
  --silver-text: #dce3e8;
  --bronze-bg: #38261e;
  --bronze-line: #986349;
  --bronze-mark: #c0835e;
  --bronze-text: #f0bb99;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 48px;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 16px;
}

.header-title {
  flex: 1 1 220px;
  min-width: 0;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.header-actions .button.is-active {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

h3 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

html[data-theme="roman"] h1 {
  font-size: 2.05rem;
}

.updated-at,
.meta,
.form-message {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.view-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 -14px 20px;
  padding: 8px 14px;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.view-tab {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
}

.view-tab.is-active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--tab-shadow);
}

.about-content {
  max-width: 72ch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  line-height: 1.6;
}

.about-content p {
  margin-bottom: 1em;
}

.about-content p:last-child {
  margin-bottom: 0;
}

.rainbow-text {
  display: inline;
  background: linear-gradient(
    90deg,
    #e53935,
    #f57c00,
    #fbc02d,
    #43a047,
    #1e88e5,
    #7b1fa2,
    #e53935
  );
  background-size: 220% 100%;
  color: transparent;
  font-weight: 900;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-cycle 3.2s linear infinite;
}

@keyframes rainbow-cycle {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 220% 50%;
  }
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

#overallView {
  position: relative;
  isolation: isolate;
}

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

#overallView .section-heading,
#overallBoard {
  position: relative;
  z-index: 2;
}

.overall-apparition {
  position: absolute;
  top: 42px;
  right: clamp(-20px, 2vw, 18px);
  z-index: 3;
  width: clamp(152px, 48vw, 260px);
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: multiply;
  filter: saturate(0.88) contrast(1.2) drop-shadow(0 20px 24px rgba(0, 0, 0, 0.22));
  transform: translate3d(6px, 8px, 0) scale(0.82) rotate(-4deg);
  transform-origin: 56% 48%;
  animation: apparition-pulse 18s ease-in-out infinite;
}

.overall-apparition img {
  display: block;
  width: 100%;
  height: auto;
  animation: apparition-drift 18s ease-in-out infinite;
}

@keyframes apparition-pulse {
  0%,
  9%,
  31%,
  58%,
  70%,
  100% {
    opacity: 0;
    transform: translate3d(12px, 18px, 0) scale(0.78) rotate(-7deg);
  }

  13% {
    opacity: 0.72;
    transform: translate3d(0, 0, 0) scale(1.05) rotate(-3deg);
  }

  18% {
    opacity: 0.36;
    transform: translate3d(-4px, 2px, 0) scale(0.98) rotate(-2deg);
  }

  22% {
    opacity: 0.82;
    transform: translate3d(1px, -2px, 0) scale(1.1) rotate(-4deg);
  }

  27% {
    opacity: 0;
    transform: translate3d(-8px, 14px, 0) scale(0.9) rotate(-1deg);
  }

  62% {
    opacity: 0.54;
    transform: translate3d(4px, 0, 0) scale(0.98) rotate(-5deg);
  }

  66% {
    opacity: 0;
    transform: translate3d(14px, 12px, 0) scale(0.82) rotate(-8deg);
  }
}

@keyframes apparition-drift {
  0%,
  100% {
    transform: translateX(0) skewX(0deg);
  }

  15% {
    transform: translateX(-4px) skewX(-2deg);
  }

  22% {
    transform: translateX(3px) skewX(2deg);
  }

  63% {
    transform: translateX(-2px) skewX(-1deg);
  }
}

.event-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.event-link {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  text-align: center;
}

.event-link:hover,
.event-link:focus-visible {
  border-color: var(--line-strong);
}

.event-link.is-active {
  border-color: var(--accent-border);
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 8px 18px var(--accent-shadow);
}

.event-link.is-complete:not(.is-active) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

.event-link.is-complete::after {
  content: "✓";
  position: absolute;
  top: -7px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--complete-mark);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.event-link.is-complete.is-active {
  border-color: var(--accent-soft-ink);
  box-shadow: 0 0 0 3px var(--complete-ring), 0 8px 18px var(--accent-shadow);
}

.event-detail {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 4px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.event-detail h3 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 1.7rem;
  line-height: 1.05;
}

.event-status {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.event-status.is-complete {
  border: 1px solid var(--complete-border);
  background: var(--complete-bg);
  color: var(--accent);
}

.event-status.is-open {
  border: 1px solid var(--open-border);
  background: var(--surface);
  color: var(--muted);
}

.event-description {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--row-shadow);
}

.leaderboard-row:hover,
.leaderboard-row:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

.leaderboard-row.medal-gold,
tr.medal-gold {
  background: var(--gold-bg);
}

.leaderboard-row.medal-gold {
  border-color: var(--gold-line);
  box-shadow: inset 5px 0 0 var(--gold-mark), var(--row-shadow);
}

.leaderboard-row.medal-silver,
tr.medal-silver {
  background: var(--silver-bg);
}

.leaderboard-row.medal-silver {
  border-color: var(--silver-line);
  box-shadow: inset 5px 0 0 var(--silver-mark), var(--row-shadow);
}

.leaderboard-row.medal-bronze,
tr.medal-bronze {
  background: var(--bronze-bg);
}

.leaderboard-row.medal-bronze {
  border-color: var(--bronze-line);
  box-shadow: inset 5px 0 0 var(--bronze-mark), var(--row-shadow);
}

.rank {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 900;
}

.medal-gold .rank {
  background: var(--gold-mark);
  color: var(--accent-ink);
}

.medal-silver .rank {
  background: var(--silver-mark);
  color: var(--accent-ink);
}

.medal-bronze .rank {
  background: var(--bronze-mark);
  color: var(--accent-ink);
}

.competitor-name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.competitor-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
}

.player-medals {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 1.05rem;
  line-height: 1;
}

.row-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.player-title-list {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.player-title-list span {
  overflow-wrap: anywhere;
}

.points {
  min-width: 70px;
  text-align: right;
}

.points strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.points span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.table-wrap,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td:last-child,
th:last-child {
  text-align: right;
}

tr:last-child td {
  border-bottom: 0;
}

tr.medal-gold td:first-child {
  color: var(--gold-text);
  font-weight: 900;
}

tr.medal-silver td:first-child {
  color: var(--silver-text);
  font-weight: 900;
}

tr.medal-bronze td:first-child {
  color: var(--bronze-text);
  font-weight: 900;
}

.event-player-name {
  display: block;
  font-weight: 800;
}

.event-player-note {
  display: block;
  max-width: 48ch;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
}

select {
  min-height: 42px;
  padding: 0 36px 0 12px;
}

input {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 96px;
  padding: 10px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-family: var(--font-display);
  font-weight: 850;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button-danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--warn);
}

.admin-login {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.admin-editor {
  display: grid;
  gap: 12px;
}

.admin-subtabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-tint);
}

.admin-about-editor {
  padding: 14px;
}

.admin-visuals-editor {
  padding: 14px;
}

.overall-image-manager {
  display: grid;
  gap: 12px;
}

.overall-image-preview {
  width: min(220px, 100%);
  aspect-ratio: 103 / 91;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
}

.admin-subtab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 850;
}

.admin-subtab.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--tab-shadow);
}

.editor-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.toolbar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toolbar-actions .button-ghost {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.field span {
  font-family: var(--font-display);
  text-transform: uppercase;
}

.event-editor-list {
  display: grid;
  gap: 12px;
}

.player-editor-list {
  display: grid;
  gap: 12px;
}

.event-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.event-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.player-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.player-card-header h3 {
  margin-bottom: 0;
}

.player-image-manager {
  display: grid;
  gap: 10px;
}

.player-image-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.file-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.file-button.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.player-image-upload {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.player-image-upload:disabled {
  cursor: not-allowed;
}

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

.admin-image-item {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
}

.admin-image-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface);
}

.admin-image-item figcaption {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card-body {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.checkbox-field input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.score-editor {
  width: 100%;
}

.score-editor th:last-child,
.score-editor td:last-child {
  text-align: left;
}

.score-input {
  width: 96px;
  margin-left: auto;
  text-align: right;
}

.event-note-input {
  min-width: 220px;
  min-height: 58px;
}

.empty-state,
.error-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.error-state {
  border-color: var(--danger-line);
  color: var(--warn);
}

.competitor-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.competitor-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.dialog-card {
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--dialog-shadow);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
}

.dialog-medals {
  font-size: 1.18rem;
}

.dialog-title-list {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.dialog-title-list:empty {
  display: none;
}

.dialog-title-list span {
  overflow-wrap: anywhere;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.dialog-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-soft);
}

.summary-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.summary-stat strong {
  display: block;
  font-size: 1.45rem;
}

.summary-stat span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list {
  max-height: 54vh;
  overflow: auto;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: 0;
}

.dialog-gallery {
  border-top: 1px solid var(--line);
}

.dialog-gallery:empty {
  display: none;
}

.dialog-gallery-header {
  padding: 14px 16px 8px;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
}

.thumbnail-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.thumbnail-button:hover,
.thumbnail-button:focus-visible {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.thumbnail-button img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.gallery-preview {
  padding: 0 16px 16px;
}

.gallery-preview-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.gallery-preview img {
  display: block;
  width: 100%;
  max-height: min(56vh, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  object-fit: contain;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  max-width: min(420px, calc(100% - 28px));
  transform: translateY(12px);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.failed-login-video-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #000000;
}

.failed-login-video-overlay[hidden] {
  display: none;
}

.failed-login-video {
  display: block;
  width: 100vw;
  max-width: 100%;
  height: auto;
  max-height: 100dvh;
  background: #000000;
  object-fit: contain;
}

.failed-login-video-close {
  position: fixed;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.46);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
  backdrop-filter: blur(10px);
}

@media (min-width: 760px) {
  .app-shell {
    padding: 28px 28px 64px;
  }

  .view-tabs {
    width: fit-content;
    min-width: 420px;
    margin: 0 0 26px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-tint);
  }

  .app-header {
    align-items: center;
    padding-bottom: 26px;
  }

  h1 {
    font-size: 4.2rem;
  }

  html[data-theme="roman"] h1 {
    font-size: 3.6rem;
  }

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

  .overall-apparition {
    top: 18px;
    right: 22px;
    width: clamp(220px, 24vw, 340px);
  }

  .leaderboard-row:first-child {
    grid-column: 1 / -1;
  }

  .admin-image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .event-link {
    min-height: 52px;
  }

  .editor-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
    align-items: end;
  }

  .toolbar-actions {
    grid-template-columns: auto auto auto;
  }

  .toolbar-actions .button-ghost {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rainbow-text {
    animation: none;
  }

  .overall-apparition,
  .overall-apparition img {
    animation: none;
  }
}
