:root {
  --bg-0: #040915;
  --bg-1: #0a1833;
  --bg-2: #14274d;
  --panel: rgba(8, 17, 40, 0.86);
  --panel-soft: rgba(10, 22, 52, 0.7);
  --panel-border: rgba(110, 207, 255, 0.3);
  --text: #edf7ff;
  --muted: #9ac0df;
  --blue-neon: #5ddcff;
  --orange-neon: #ff8e42;
  --green-ok: #7fffbc;
  --danger: #ff637d;
  --warning: #ffc870;
  --podium-gold: rgba(255, 201, 75, 0.2);
  --podium-silver: rgba(194, 205, 224, 0.19);
  --podium-bronze: rgba(206, 131, 86, 0.2);
  --shadow: 0 16px 38px rgba(1, 3, 12, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  line-height: 1.45;
  background:
    radial-gradient(circle at 12% 8%, rgba(91, 193, 255, 0.24), transparent 35%),
    radial-gradient(circle at 88% 18%, rgba(255, 121, 47, 0.18), transparent 33%),
    radial-gradient(circle at 72% 82%, rgba(85, 148, 255, 0.16), transparent 37%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  display: flex;
  flex-direction: column;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(34px);
  pointer-events: none;
  opacity: 0.7;
}

.ambient-blue {
  width: 300px;
  height: 300px;
  top: -110px;
  left: -80px;
  background: rgba(80, 221, 255, 0.35);
}

.ambient-fire {
  width: 290px;
  height: 290px;
  right: -70px;
  bottom: -95px;
  background: rgba(255, 130, 48, 0.3);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  font-family: "Oxanium", sans-serif;
  letter-spacing: 0.02em;
}

h2,
h3 {
  color: #d8eeff;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  padding: 0.72rem 1rem;
  background: rgba(4, 11, 28, 0.8);
  border-bottom: 1px solid rgba(104, 201, 255, 0.24);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(80, 221, 255, 0.26));
}

.brand span {
  color: #e5f5ff;
  font-family: "Oxanium", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.44rem;
}

.top-nav a,
.link-btn {
  border: 1px solid rgba(110, 207, 255, 0.3);
  border-radius: 0.56rem;
  background: rgba(9, 24, 56, 0.84);
  color: var(--text);
  text-decoration: none;
  padding: 0.42rem 0.64rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.top-nav a:hover,
.link-btn:hover {
  border-color: rgba(255, 142, 66, 0.62);
  box-shadow: 0 0 0 1px rgba(255, 142, 66, 0.2);
}

.top-nav form {
  margin: 0;
}

.link-btn {
  font-family: inherit;
  cursor: pointer;
}

.page-wrap {
  width: min(1180px, 100% - 1.1rem);
  margin: 1rem auto;
  display: grid;
  gap: 1rem;
  flex: 1;
}

.flash-stack {
  display: grid;
  gap: 0.45rem;
}

.flash {
  border-radius: 0.66rem;
  border: 1px solid transparent;
  padding: 0.68rem 0.82rem;
  font-weight: 700;
}

.flash-success {
  background: rgba(9, 69, 34, 0.78);
  border-color: rgba(128, 255, 181, 0.44);
}

.flash-error {
  background: rgba(96, 13, 33, 0.78);
  border-color: rgba(255, 99, 125, 0.48);
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.card.nested {
  background: rgba(10, 24, 53, 0.72);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  background:
    linear-gradient(125deg, rgba(10, 26, 58, 0.95), rgba(8, 27, 62, 0.74)),
    radial-gradient(circle at 92% 12%, rgba(255, 142, 66, 0.2), transparent 34%);
  border: 1px solid rgba(110, 207, 255, 0.38);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.hero-panel.compact {
  gap: 0.7rem;
}

.hero-copy {
  display: grid;
  gap: 0.42rem;
}

.hero-label {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.78rem;
  color: var(--orange-neon);
  font-weight: 800;
}

.hero-copy h1 {
  font-size: clamp(1.55rem, 6vw, 2.45rem);
  color: #e5f4ff;
  text-shadow: 0 0 20px rgba(93, 220, 255, 0.16);
}

.hero-meta {
  color: #cae6ff;
  font-weight: 700;
}

.hero-note {
  color: var(--muted);
  max-width: 72ch;
}

.hero-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-logo img {
  width: min(170px, 44vw);
  filter: drop-shadow(0 0 20px rgba(93, 220, 255, 0.25));
}

.home-hero {
  border-color: rgba(124, 214, 255, 0.44);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.stat-box {
  background: rgba(7, 21, 50, 0.78);
  border: 1px solid rgba(110, 207, 255, 0.24);
  border-radius: 0.72rem;
  padding: 0.56rem;
  display: grid;
  text-align: center;
  gap: 0.14rem;
}

.stat-box strong {
  font-size: 1.28rem;
  color: #f3fbff;
  font-family: "Oxanium", sans-serif;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.results-grid {
  display: grid;
  gap: 0.9rem;
}

.result-card {
  border-radius: 1rem;
  border-color: rgba(117, 212, 255, 0.34);
  background:
    linear-gradient(160deg, rgba(9, 22, 52, 0.9), rgba(8, 18, 42, 0.84)),
    radial-gradient(circle at 92% 10%, rgba(255, 150, 83, 0.16), transparent 34%);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.badge {
  border: 1px solid rgba(110, 207, 255, 0.34);
  border-radius: 999px;
  padding: 0.27rem 0.54rem;
  font-size: 0.79rem;
  color: #cbe9ff;
  background: rgba(11, 28, 63, 0.72);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0.72rem;
  border: 1px solid rgba(110, 207, 255, 0.22);
  background: rgba(5, 13, 33, 0.5);
}

.public-page .results-grid {
  gap: 1.05rem;
}

.public-page .result-card {
  position: relative;
  overflow: hidden;
}

.public-page .result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(93, 220, 255, 0.05), transparent 34%);
}

.public-page .public-table-wrap {
  overflow-x: hidden;
}

.public-page .public-results-table {
  min-width: 0;
  table-layout: fixed;
}

.public-page .public-results-table th,
.public-page .public-results-table td {
  white-space: nowrap;
  padding: 0.56rem 0.52rem;
}

.public-page .public-results-table th:nth-child(1),
.public-page .public-results-table td:nth-child(1) {
  width: 58px;
  text-align: center;
}

.public-page .public-results-table th:nth-child(2),
.public-page .public-results-table td:nth-child(2) {
  width: auto;
}

.public-page .public-results-table th:nth-child(3),
.public-page .public-results-table th:nth-child(4),
.public-page .public-results-table td:nth-child(3),
.public-page .public-results-table td:nth-child(4) {
  width: 78px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.public-page .public-results-table .team-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.22;
}

.public-page .public-results-table .lane-cell {
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.inline-table table {
  min-width: 560px;
}

th,
td {
  white-space: nowrap;
  text-align: left;
  padding: 0.52rem 0.6rem;
  border-bottom: 1px solid rgba(137, 178, 226, 0.16);
}

th {
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b8daff;
  font-family: "Oxanium", sans-serif;
  font-weight: 700;
  background: rgba(10, 26, 58, 0.86);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  background: rgba(8, 19, 45, 0.62);
}

tbody tr:nth-child(even) {
  background: rgba(10, 26, 58, 0.72);
}

tbody tr:hover {
  background: rgba(37, 96, 166, 0.24);
}

.result-row.podium-1 {
  background: linear-gradient(90deg, var(--podium-gold), rgba(16, 29, 59, 0.72));
  box-shadow: inset 3px 0 0 rgba(255, 213, 108, 0.62);
}

.result-row.podium-2 {
  background: linear-gradient(90deg, var(--podium-silver), rgba(16, 29, 59, 0.72));
  box-shadow: inset 3px 0 0 rgba(211, 223, 239, 0.54);
}

.result-row.podium-3 {
  background: linear-gradient(90deg, var(--podium-bronze), rgba(16, 29, 59, 0.72));
  box-shadow: inset 3px 0 0 rgba(226, 174, 133, 0.52);
}

.result-row.podium-1 .rank-cell,
.result-row.podium-2 .rank-cell,
.result-row.podium-3 .rank-cell {
  font-weight: 800;
}

.result-row.podium-1 .rank-cell {
  color: #ffd56c;
}

.result-row.podium-2 .rank-cell {
  color: #d4dfef;
}

.result-row.podium-3 .rank-cell {
  color: #e2ae85;
}

.row-pending {
  background: rgba(68, 54, 20, 0.35);
}

.rank-cell {
  width: 68px;
}

td.counted {
  color: var(--green-ok);
  font-weight: 800;
  text-shadow: 0 0 12px rgba(127, 255, 188, 0.22);
}

td.np {
  color: var(--danger);
  font-weight: 800;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
}

.empty-state {
  text-align: center;
  display: grid;
  gap: 0.5rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.tab-btn {
  border: 1px solid rgba(110, 207, 255, 0.3);
  border-radius: 0.64rem;
  background: rgba(9, 22, 50, 0.84);
  color: var(--text);
  cursor: pointer;
  padding: 0.56rem 0.65rem;
  font-family: "Oxanium", sans-serif;
  font-weight: 700;
}

.tab-btn.active {
  border-color: rgba(255, 142, 66, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 142, 66, 0.22);
}

.tab-panel {
  display: none;
  gap: 0.7rem;
}

.tab-panel.active {
  display: grid;
}

.form-grid {
  display: grid;
  gap: 0.58rem;
  max-width: 760px;
}

label {
  color: #d0e9ff;
  font-weight: 700;
  font-size: 0.96rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 0.62rem;
  border: 1px solid rgba(127, 181, 233, 0.35);
  background: rgba(4, 14, 36, 0.9);
  color: var(--text);
  padding: 0.58rem 0.64rem;
}

input::placeholder {
  color: rgba(169, 201, 231, 0.7);
}

input:focus,
select:focus,
button:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid rgba(93, 220, 255, 0.8);
  outline-offset: 1px;
}

.inline-inputs {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.5rem;
}

.filter-row {
  display: grid;
  gap: 0.42rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.table-actions form {
  margin: 0;
}

.btn {
  width: fit-content;
  border-radius: 0.64rem;
  border: 1px solid rgba(255, 142, 66, 0.68);
  background: linear-gradient(135deg, #ff9a52, #ff6d2e);
  color: #fff;
  font-family: "Oxanium", sans-serif;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  padding: 0.55rem 0.9rem;
}

.btn:hover {
  box-shadow: 0 0 0 1px rgba(255, 180, 137, 0.34), 0 8px 18px rgba(255, 109, 46, 0.25);
}

.btn-small {
  padding: 0.42rem 0.68rem;
  font-size: 0.86rem;
}

.btn-secondary {
  border-color: rgba(110, 207, 255, 0.58);
  background: linear-gradient(135deg, rgba(23, 89, 179, 0.92), rgba(24, 63, 136, 0.92));
}

.btn-secondary:hover {
  box-shadow: 0 0 0 1px rgba(131, 209, 255, 0.26), 0 8px 18px rgba(33, 87, 184, 0.28);
}

.btn-danger {
  border-color: rgba(255, 99, 125, 0.64);
  background: linear-gradient(135deg, rgba(202, 47, 77, 0.96), rgba(166, 23, 60, 0.96));
}

.btn-danger:hover {
  box-shadow: 0 0 0 1px rgba(255, 124, 146, 0.26), 0 8px 18px rgba(180, 35, 63, 0.28);
}

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

#toggle-unfinished.is-active {
  border-color: rgba(255, 142, 66, 0.8);
}

.login-shell {
  min-height: 62vh;
  display: grid;
  align-items: center;
  justify-items: center;
}

.login-card {
  width: min(560px, 100%);
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem;
  border-color: rgba(125, 216, 255, 0.4);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.login-brand img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(93, 220, 255, 0.22));
}

.login-note {
  color: var(--muted);
}

.site-footer {
  text-align: center;
  display: grid;
  gap: 0.2rem;
  color: rgba(190, 223, 248, 0.86);
  font-size: 0.88rem;
  padding: 0.9rem 0.8rem 1.3rem;
}

@media (min-width: 760px) {
  .site-header {
    padding: 0.78rem 1.4rem;
  }

  .brand span {
    font-size: 1.08rem;
  }

  .hero-panel {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    padding: 1.15rem 1.2rem;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .filter-row {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
}

@media (max-width: 640px) {
  .page-wrap {
    width: min(1180px, 100% - 0.8rem);
    margin: 0.75rem auto;
  }

  .site-header {
    padding: 0.62rem 0.75rem;
  }

  .brand span {
    font-size: 0.93rem;
    max-width: 168px;
  }

  .top-nav a,
  .link-btn {
    padding: 0.38rem 0.54rem;
    font-size: 0.84rem;
  }

  .hero-panel,
  .card {
    border-radius: 0.86rem;
    padding: 0.82rem;
  }

  .inline-table table {
    min-width: 520px;
  }

  .inline-inputs {
    grid-template-columns: 105px 1fr;
  }

  .public-page .result-card {
    border-radius: 0.92rem;
  }

  .public-page .public-results-table th,
  .public-page .public-results-table td {
    padding: 0.5rem 0.42rem;
    font-size: 0.9rem;
  }

  .public-page .public-results-table th:nth-child(1),
  .public-page .public-results-table td:nth-child(1) {
    width: 48px;
  }

  .public-page .public-results-table th:nth-child(3),
  .public-page .public-results-table th:nth-child(4),
  .public-page .public-results-table td:nth-child(3),
  .public-page .public-results-table td:nth-child(4) {
    width: 66px;
  }
}
