body {
  background: #08090d;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.38);
}
.container, .card, .table, .alert, .form-control, .form-select, .form-check-label, .nav-link, .navbar-brand, h1, h2, h3, h4, h5, h6, p, span, li, th, td, label, small, strong {
  color: #ffffff !important;
}
.form-control, .form-select {
  background-color: #f9fbff;
  border-color: #2f3a57;
  color: #000000 !important;
  text-shadow: none;
  caret-color: #000000;
}
.form-control::placeholder { color: #5f5f5f !important; }
.form-control:focus,
.form-select:focus {
  color: #000000 !important;
  background-color: #ffffff;
}
.table-dark { --bs-table-color: #fff; }

.nav-main-link {
  color: #dfe9ff !important;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, text-shadow 0.15s ease;
}

.nav-main-link:hover,
.nav-main-link:focus-visible {
  color: #ffffff !important;
  border-bottom-color: #00b7ff;
  text-shadow: 0 0 10px rgba(0, 183, 255, 0.75);
}


.list-group-item { color: #fff !important; }
.neon-border-blue { border: 1px solid #00b7ff !important; box-shadow: 0 0 8px #00b7ff66; }
.neon-border-red { border: 1px solid #ff2d55 !important; box-shadow: 0 0 8px #ff2d5566; }
.card { border-radius: 12px; }
.chat-box { max-height: 260px; overflow-y: auto; border-top: 1px dashed #555; padding-top: 8px; color: #f5f8ff; }
.chat-box strong { color: #ffffff; }
.neon-text-outline {
  color: #ffffff !important;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.95),
    0 0 6px rgba(0, 183, 255, 0.8),
    0 0 14px rgba(0, 183, 255, 0.55);
}

/* Semantic helpers for highly readable text on dark backgrounds */
.text-contrast-high { color: #f5f8ff !important; }
.text-contrast-neon { color: #f7fbff !important; text-shadow: 0 0 10px rgba(255, 255, 255, 0.24); }
.text-contrast-muted { color: #d0d8e8 !important; }

/* Bootstrap text-secondary is too dim on pure black cards. */
.bg-black .text-secondary {
  color: #d0d8e8 !important;
}

/* High-contrast alert/badge overrides for dark theme (WCAG AA friendly). */
.alert-info {
  background-color: #122f42 !important;
  border-color: #3d8cb8 !important;
  color: #f1f9ff !important;
}

.alert-contrast {
  background-color: #122f42 !important;
  border-color: #3d8cb8 !important;
  color: #f1f9ff !important;
}

.alert-info .alert-link,
.alert-contrast .alert-link {
  color: #ffffff !important;
}

.alert-success {
  background-color: #123322 !important;
  border-color: #2f9c66 !important;
  color: #effff4 !important;
}

.alert-secondary {
  background-color: #1d2330 !important;
  border-color: #465168 !important;
  color: #f4f7ff !important;
}

.alert-warning {
  background-color: #f5d64a !important;
  border-color: #e3b506 !important;
  color: #1b1b1b !important;
  text-shadow: none !important;
}

.alert-warning * {
  color: #1b1b1b !important;
}

.bg-warning,
.bg-warning *,
.bg-white,
.bg-white *,
.text-bg-warning,
.text-bg-warning *,
.text-bg-light,
.text-bg-light *,
.alert-light,
.alert-light * {
  color: #000000 !important;
  text-shadow: none !important;
}

.chat-nick {
  color: var(--nick-color, #66d9ff) !important;
}

.chat-nick-admin {
  color: #ff79d1 !important;
  font-style: italic;
}


.chat-cooldown-timer {
  max-width: 260px;
}

.chat-cooldown-timer__label {
  font-size: 0.85rem;
  color: #d8e7ff;
}

.chat-cooldown-timer__track {
  width: 100%;
  height: 6px;
  background: rgba(88, 106, 143, 0.45);
  border-radius: 999px;
  overflow: hidden;
}

.chat-cooldown-timer__bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #00c2ff, #7f8fff);
  transition: width 0.2s linear;
}

.admin-content-page .tox,
.admin-content-page .tox * {
  text-shadow: none;
}

.admin-content-page .tox .tox-edit-area__iframe,
.admin-content-page .tox .tox-toolbar,
.admin-content-page .tox .tox-statusbar {
  background-color: #ffffff;
}


.chat-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-color-swatch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.chat-color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chat-color-swatch span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #44506a;
  background: var(--swatch-color, #00d4ff);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.chat-color-swatch:hover span {
  transform: scale(1.08);
  border-color: #8fa7d4;
}

.chat-color-swatch input:focus-visible + span {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.chat-color-swatch input:checked + span {
  transform: scale(1.08);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.35);
}

.badge.bg-success {
  background-color: #1b7448 !important;
  color: #f6fff9 !important;
}

.badge.bg-secondary {
  background-color: #4a546d !important;
  color: #ffffff !important;
}

.tournament_playoff_title {
  letter-spacing: 0.04em;
}

.playoff-bracket {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.playoff-round {
  background: rgba(10, 12, 20, 0.9);
  border: 1px solid #2b3f67;
  border-radius: 12px;
  padding: 12px;
}

.playoff-round-title {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #92dcff !important;
}

.playoff-round-matches {
  display: grid;
  gap: 10px;
}

.playoff-match-card {
  position: relative;
  border: 1px solid #405781;
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(17, 23, 34, 0.95), rgba(9, 13, 20, 0.95));
}

.playoff-match-card::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 50%;
  width: 12px;
  border-top: 1px solid #5e79ab;
}

.playoff-round:last-child .playoff-match-card::after {
  display: none;
}

.playoff-status-finished {
  border-color: #2bb673;
}

.playoff-status-in_progress {
  border-color: #f5b500;
}

.playoff-status-pending {
  border-color: #5e79ab;
}

.playoff-match-header,
.playoff-match-footer,
.playoff-next-link {
  font-size: 0.85rem;
  color: #dce8ff !important;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.playoff-participants li {
  font-size: 0.92rem;
  border-left: 2px solid #00b7ff;
  padding-left: 8px;
  margin-bottom: 2px;
}


.playoff-participants li.playoff-participant-promoted {
  border-left-color: #4adf8b;
  background: rgba(26, 111, 63, 0.45);
  border-radius: 8px;
  color: #eafff2;
}

.playoff-next-link {
  margin-top: 8px;
  color: #9ed9ff !important;
}


.table-row-promoted td,
.table-row-promoted th {
  background-color: #123f2f !important;
}

.table-row-eliminated td,
.table-row-eliminated th {
  background-color: #4a1e24 !important;
}

.admin-wide-section {
  width: 100%;
}

.admin-group-grid {
  width: 100%;
}

.admin-password-form {
  justify-content: flex-start;
}

@media (min-width: 992px) {
  .admin-password-form {
    width: auto !important;
    justify-content: flex-end;
  }
}

.tournament-stage-card {
  border: 1px solid #2b3f67 !important;
  box-shadow: inset 0 0 0 1px rgba(0, 183, 255, 0.12), 0 0 16px rgba(0, 183, 255, 0.08);
}

.tournament-stage-table thead th {
  color: #d9edff !important;
}

.neon-border-stage {
  border: 1px solid #3f5f95 !important;
  box-shadow: 0 0 12px rgba(0, 183, 255, 0.18);
}

.playoff-accent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.neon-accent-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-shadow: none;
  font-weight: 600;
}

.neon-accent-badge-time {
  color: #ecfbff !important;
  border-color: #39d8ff;
  background: rgba(11, 83, 106, 0.52);
  box-shadow: 0 0 10px rgba(57, 216, 255, 0.35);
}

.neon-accent-badge-password {
  color: #fff0fb !important;
  border-color: #ff62cc;
  background: rgba(110, 18, 84, 0.48);
  box-shadow: 0 0 10px rgba(255, 98, 204, 0.35);
}

.neon-accent-badge-winner {
  color: #fff6dc !important;
  border-color: #ffca69;
  background: linear-gradient(90deg, rgba(142, 86, 10, 0.62), rgba(224, 128, 13, 0.45));
  box-shadow: 0 0 12px rgba(255, 171, 64, 0.45);
}

.playoff-participants li.tournament-winner-highlight {
  border-left-color: #ffb347;
  color: #fff5de;
  background: linear-gradient(90deg, rgba(255, 170, 64, 0.32), rgba(255, 123, 0, 0.18));
  border: 1px solid rgba(255, 191, 90, 0.55);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(255, 153, 0, 0.35);
  padding: 4px 8px;
}

.tournament-winner-badge {
  background: linear-gradient(180deg, #ffd36f, #ff9d2e);
  color: #2d1200;
  border: 1px solid #ffe7a6;
  box-shadow: 0 0 8px rgba(255, 179, 66, 0.45);
  font-weight: 700;
}

.archive-bracket {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 300px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.archive-bracket-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.archive-bracket-column-title {
  margin: 0;
  font-size: 1rem;
  color: var(--bs-info);
}

.archive-bracket-matches {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.archive-bracket-match-card {
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.archive-bracket-match-label {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0.5rem;
}

.archive-bracket-participants li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.1rem 0;
}

.archive-bracket-participants li.archive-winner {
  color: #8dff91;
  font-weight: 700;
}

.archive-bracket-winner {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: #8dff91;
}

.archive-match-status-finished {
  border-color: rgba(141, 255, 145, 0.4);
}

.archive-match-status-in_progress {
  border-color: rgba(255, 209, 102, 0.55);
}

.archive-bracket-summary {
  color: var(--bs-secondary-color);
}


.tournament-tree,
.archive-tree {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 1.25rem;
  overflow-x: auto;
  padding: 0.5rem 0.5rem 1rem;
}

.tournament-tree-stage,
.archive-tree-stage {
  position: relative;
  min-width: 220px;
  border: 1px solid rgba(95, 168, 255, 0.4);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(12, 18, 31, 0.92), rgba(7, 11, 19, 0.96));
  box-shadow: inset 0 0 0 1px rgba(92, 209, 255, 0.12), 0 0 16px rgba(0, 166, 255, 0.16);
  padding: 0.75rem;
}

.tournament-tree-stage:not(:last-child)::after,
.archive-tree-stage:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1rem;
  width: 1rem;
  border-top: 2px solid rgba(90, 223, 255, 0.65);
  filter: drop-shadow(0 0 6px rgba(90, 223, 255, 0.6));
}

.tournament-tree-stage-title,
.archive-tree-stage-title {
  margin: 0 0 0.75rem;
  color: #d9f6ff;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 9px rgba(0, 214, 255, 0.5);
}

.tournament-tree-matches,
.archive-tree-matches {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tournament-tree-match,
.archive-tree-match {
  border: 1px solid rgba(95, 196, 255, 0.35);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: linear-gradient(180deg, rgba(10, 19, 35, 0.95), rgba(8, 13, 24, 0.96));
  box-shadow: inset 0 0 0 1px rgba(76, 176, 255, 0.12), 0 0 14px rgba(18, 145, 255, 0.15);
}

.tournament-tree-match-head,
.archive-tree-match-head {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.4rem;
  border: 1px solid rgba(0, 221, 255, 0.4);
  background: rgba(0, 124, 185, 0.24);
  color: #d1f4ff !important;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tournament-tree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tournament-tree-badge,
.archive-tree-badge {
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.tournament-tree-badge-schedule,
.archive-tree-badge-schedule {
  color: #ecfbff;
  border: 1px solid #39d8ff;
  background: rgba(11, 83, 106, 0.52);
  box-shadow: 0 0 10px rgba(57, 216, 255, 0.35);
}

.tournament-tree-badge-password,
.archive-tree-badge-password {
  color: #fff0d9;
  border: 1px solid #ff9f43;
  background: rgba(106, 54, 11, 0.55);
  box-shadow: 0 0 10px rgba(255, 159, 67, 0.35);
}

.tournament-tree-sources,
.archive-tree-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.tournament-tree-source,
.archive-tree-source {
  font-size: 0.75rem;
  color: #caf0ff;
  background: rgba(37, 159, 255, 0.28);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  border: 1px solid rgba(126, 213, 255, 0.45);
}

.tournament-tree-participants li,
.archive-tree-participants li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
}

.tournament-tree-participant,
.archive-tree-participant {
  border-radius: 10px;
  border-left: 2px solid rgba(67, 197, 255, 0.7);
  background: rgba(18, 36, 60, 0.75);
}

.tournament-tree-participant-name,
.archive-tree-participant-name {
  overflow-wrap: anywhere;
}

.tournament-tree-participant-promoted .tournament-tree-participant-name,
.archive-tree-participant-promoted .archive-tree-participant-name {
  color: #8dff91;
}

.tournament-tree-participant-eliminated .tournament-tree-participant-name,
.archive-tree-participant-eliminated .archive-tree-participant-name {
  color: #ff6b7f;
}

.tournament-tree-participant-final-qualified .tournament-tree-participant-name,
.archive-tree-participant-final-qualified .archive-tree-participant-name {
  color: #ffd166;
}

.tournament-tree-participant-normal .tournament-tree-participant-name,
.archive-tree-participant-normal .archive-tree-participant-name {
  color: #ffffff;
}


.tournament-tree-participant.tournament-winner-highlight .tournament-tree-participant-name,
.archive-tree-participant.tournament-winner-highlight .archive-tree-participant-name {
  color: #8dff91;
  font-weight: 700;
}

.archive-champion {
  color: #8dff91;
  font-weight: 700;
}

.tournament-tree-participant-points {
  min-width: 1.9rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-weight: 700;
  border: 1px solid rgba(74, 220, 255, 0.6);
  background: rgba(0, 167, 204, 0.2);
  box-shadow: 0 0 8px rgba(46, 213, 255, 0.35);
}

.tournament-tree .playoff-status-finished {
  border-color: rgba(95, 196, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(76, 176, 255, 0.12), 0 0 14px rgba(18, 145, 255, 0.15);
}

.tournament-tree .playoff-status-in_progress {
  border-color: rgba(255, 212, 71, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 195, 56, 0.2), 0 0 16px rgba(255, 197, 70, 0.22);
}

.tournament-tree .playoff-status-pending {
  border-color: rgba(96, 181, 255, 0.45);
}

.tournament-tree-stage-active .tournament-tree-match-active {
  border-color: rgba(89, 249, 159, 0.75);
  box-shadow: inset 0 0 0 1px rgba(64, 208, 133, 0.2), 0 0 16px rgba(80, 255, 154, 0.2);
}
