/* =========================================================
   STANDINGS TABLE
========================================================= */

.dt-group {
  margin-bottom: 50px;
}

.dt-group h3 {
  font-size: 24px;
  margin-bottom: 18px;
  font-weight: 600;
}

.dt-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.dt-table thead {
  background: #f4f6f9;
}

.dt-table th {
  padding: 14px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dt-table td {
  padding: 14px 16px;
  text-align: center;
  font-size: 15px;
  color: #333;
}

.dt-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.dt-table tbody tr:hover {
  background: #f0f7ff;
}

.dt-group-winner {
  background: #fff8dc;
  font-weight: 700;
}

.dt-positive { color: #1a8f3c; font-weight: 600; }
.dt-negative { color: #c0392b; font-weight: 600; }
.dt-neutral  { color: #777; }

.dt-avg-good {
  color: #0a7c2f;
  font-weight: 600;
}

/* =========================================================
   ADMIN CARD
========================================================= */

.dt-admin-card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.dt-admin-card button {
  display: block;
  margin-bottom: 10px;
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: white;
  cursor: pointer;
}

.dt-admin-card button.danger {
  background: #dc2626;
}

/* =========================================================
   MATCH INPUT CARD
========================================================= */

.dt-card {
  background: #ffffff;
  padding: 35px 40px;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.08);
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.dt-match-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 30px;
}

.dt-match-title span {
  font-weight: 400;
  opacity: 0.6;
  margin: 0 8px;
}

.dt-score-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 30px;
}

.dt-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dt-label {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
}

.dt-score-row {
  display: grid;
  grid-template-columns: 80px 30px 80px;
  gap: 12px;
  align-items: center;
}

.dt-score-row input {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.dt-score-row input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
  outline: none;
}

.dt-dash {
  font-weight: 700;
  font-size: 16px;
}

/* =========================================================
   BUTTONS
========================================================= */

.dt-button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dt-button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.dt-button-secondary {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.dt-button-secondary:hover {
  background: #e5e7eb;
}

.dt-button-danger {
  background: #dc2626;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.dt-button-danger:hover {
  background: #b91c1c;
}

/* =========================================================
   MATCH RESULT / CONFIRM CARDS
========================================================= */

.dt-match-result-card,
.dt-match-pending-card,
.dt-match-confirm-card {
  background: #ffffff;
  padding: 30px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.07);
  text-align: center;
  max-width: 600px;
  margin: 30px auto;
}

.dt-match-info {
  font-weight: 600;
  margin-bottom: 15px;
}

.dt-match-players,
.dt-match-players-confirm {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 20px;
}

.dt-player {
  font-size: 16px;
  font-weight: 600;
}

.dt-winner {
  color: #16a34a;
}

.dt-match-score,
.dt-match-score-large {
  font-size: 32px;
  font-weight: 800;
}

.dt-match-avg,
.dt-match-avg-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: #6b7280;
}

.dt-match-confirmed {
  background: #ecfdf5;
  color: #16a34a;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 20px;
}

.dt-match-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* =========================================================
   RECENT MATCHES
========================================================= */

.dt-recent-card {
  background: #ffffff;
  padding: 35px 40px;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.08);
  max-width: 650px;
  margin: 60px auto;
}

.dt-recent-card h3 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 22px;
  font-weight: 700;
}

.dt-recent-match {
  display: grid;
  grid-template-columns: 1fr 100px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}

.dt-recent-match:last-child {
  border-bottom: none;
}

.dt-edit-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* =========================================================
   SIGNUP
========================================================= */

.dt-signup-card {
  background: #ffffff;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  max-width: 520px;
  margin: 60px auto;
}

.dt-signup-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 20px;
}

.dt-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dt-open .dt-status-dot { background: #22c55e; }
.dt-closed .dt-status-dot { background: #ef4444; }

.dt-signup-action {
  margin-bottom: 25px;
}

#dt-signup-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dt-player-pill {
  background: #f3f4f6;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.dt-match-avg-centered {
  font-size: 16px;
  font-weight: 600;
  color: #6b7280;
  margin-top: -8px;
  margin-bottom: 20px;
}

.dt-avg-dash {
  margin: 0 8px;
  font-weight: 400;
  opacity: 0.6;
}

/* =========================================================
   LATEST TOURNAMENT + PLAYOFF BRACKET
========================================================= */

.dt-latest-card,
.dt-bracket-card {
  background: #ffffff;
  padding: 28px 32px;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.08);
  margin: 32px auto;
  max-width: 900px;
}

.dt-latest-card h3,
.dt-bracket-card h3 {
  margin-top: 0;
  margin-bottom: 14px;
}

.dt-latest-date {
  margin-bottom: 18px;
  color: #4b5563;
}

.dt-latest-section {
  margin-top: 18px;
}

.dt-top3-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.dt-top3-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
}

.dt-top3-rank-1 {
  border-color: #f59e0b;
  background: #fffbeb;
}

.dt-top3-rank-2 {
  border-color: #9ca3af;
  background: #f9fafb;
}

.dt-top3-rank-3 {
  border-color: #b45309;
  background: #fffbeb;
}

.dt-top3-medal {
  font-size: 18px;
}

.dt-top3-rank {
  font-weight: 700;
  color: #374151;
}

.dt-latest-group ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.dt-latest-group li {
  margin-bottom: 6px;
}

.dt-latest-results-list {
  display: grid;
  gap: 10px;
}

.dt-latest-result-row {
  display: grid;
  grid-template-columns: 130px 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.dt-latest-result-row .dt-phase {
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.dt-bracket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.dt-bracket-round {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}

.dt-bracket-round h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

.dt-bracket-match {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.dt-bracket-score {
  text-align: center;
  font-weight: 700;
  margin: 4px 0;
}

/* =========================================================
   HUB LAYOUT + DARK THEME TOKENS
========================================================= */

:root {
  --dt-bg: #f3f6fb;
  --dt-surface: #ffffff;
  --dt-surface-soft: #f8fafc;
  --dt-border: #e2e8f0;
  --dt-text: #0f172a;
  --dt-text-muted: #475569;
  --dt-accent: #3b82f6;
  --dt-shadow: 0 14px 35px rgba(15, 23, 42, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --dt-bg: #0b1220;
    --dt-surface: #111a2e;
    --dt-surface-soft: #18233d;
    --dt-border: #243352;
    --dt-text: #eef4ff;
    --dt-text-muted: #c1cfe5;
    --dt-accent: #60a5fa;
    --dt-shadow: 0 16px 38px rgba(2, 6, 23, 0.5);
  }
}

body.dark-theme,
body.theme-dark,
body[data-theme='dark'] {
  --dt-bg: #0b1220;
  --dt-surface: #111a2e;
  --dt-surface-soft: #18233d;
  --dt-border: #243352;
  --dt-text: #eef4ff;
  --dt-text-muted: #c1cfe5;
  --dt-accent: #60a5fa;
  --dt-shadow: 0 16px 38px rgba(2, 6, 23, 0.5);
}

.dt-hub {
  color: var(--dt-text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--dt-bg) 96%, #000 4%), transparent);
  border: 1px solid var(--dt-border);
  border-radius: 24px;
  padding: 24px;
}

.dt-hub-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--dt-accent) 20%, var(--dt-surface) 80%), var(--dt-surface));
  border: 1px solid var(--dt-border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 20px;
}

.dt-hub-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dt-text-muted);
  font-size: 12px;
}

.dt-hub-hero h2 { margin: 8px 0 10px; }

.dt-hub-subtitle {
  margin: 0;
  color: var(--dt-text-muted);
}

.dt-hub-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.dt-hub-panel {
  grid-column: span 6;
}

.dt-hub-panel--wide {
  grid-column: span 12;
}

@media (max-width: 900px) {
  .dt-hub-panel,
  .dt-hub-panel--wide {
    grid-column: span 12;
  }
}

.dt-table,
.dt-admin-card,
.dt-card,
.dt-match-result-card,
.dt-match-pending-card,
.dt-match-confirm-card,
.dt-recent-card,
.dt-signup-card,
.dt-latest-card,
.dt-bracket-card,
.dt-bracket-round,
.dt-bracket-match,
#dt-my-matches.dt-card {
  background: var(--dt-surface);
  color: var(--dt-text);
  border: 1px solid var(--dt-border);
  box-shadow: var(--dt-shadow);
}

.dt-table thead,
.dt-button-secondary,
.dt-player-pill,
.dt-top3-item,
.dt-bracket-round {
  background: var(--dt-surface-soft);
}

.dt-table th,
.dt-table td,
.dt-latest-date,
.dt-match-avg,
.dt-match-avg-row,
.dt-latest-result-row .dt-phase,
.dt-top3-rank,
.dt-hub,
.dt-card p,
.dt-my-matches-list,
#dt-my-matches-list li {
  color: var(--dt-text);
}

.dt-table tbody tr:nth-child(even),
.dt-table tbody tr:hover {
  background: color-mix(in srgb, var(--dt-surface-soft) 88%, var(--dt-accent) 12%);
}

.dt-button {
  background: var(--dt-accent);
}

.dt-button:hover {
  filter: brightness(1.08);
}

.dt-card--compact {
  padding: 26px 28px;
  max-width: 100%;
  text-align: left;
}

.dt-my-matches-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.dt-my-matches-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--dt-border);
}

.dt-my-matches-list li:last-child {
  border-bottom: 0;
}

/* =========================================================
   HUB TABS
========================================================= */

.dt-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.dt-hub-tab {
  border: 1px solid var(--dt-border);
  background: var(--dt-surface-soft);
  color: var(--dt-text);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}

.dt-hub-tab:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--dt-accent) 60%, var(--dt-border) 40%);
}

.dt-hub-tab.is-active {
  background: var(--dt-accent);
  border-color: var(--dt-accent);
  color: #fff;
}

.dt-hub-tab-panel {
  margin-top: 8px;
}

.dt-hub-tab-panel .dt-signup-card,
.dt-hub-tab-panel .dt-recent-card,
.dt-hub-tab-panel .dt-latest-card,
.dt-hub-tab-panel .dt-bracket-card {
  margin: 0;
  max-width: 100%;
}

.dt-hub-tab-panel #dt-standings-container,
.dt-hub-tab-panel #dt-recent-matches,
.dt-hub-tab-panel #dt-latest-tournament,
.dt-hub-tab-panel #dt-playoff-bracket {
  width: 100%;
}


/* =========================================================
   HUB TYPOGRAPHY / CONTRAST TUNING
========================================================= */

.dt-hub h1,
.dt-hub h2,
.dt-hub h3,
.dt-hub h4,
.dt-hub strong {
  color: var(--dt-text);
  letter-spacing: 0.01em;
}

.dt-hub p,
.dt-hub li,
.dt-hub .dt-label,
.dt-hub .dt-latest-date,
.dt-hub .dt-match-avg,
.dt-hub .dt-match-avg-row,
.dt-hub .dt-match-avg-centered,
.dt-hub .dt-hub-subtitle,
.dt-hub .dt-hub-kicker {
  color: var(--dt-text-muted);
}

.dt-hub .dt-card p,
.dt-hub #dt-my-matches-list li,
.dt-hub .dt-table td,
.dt-hub .dt-latest-result-row .dt-phase,
.dt-hub .dt-top3-rank {
  color: var(--dt-text);
}

.dt-hub-kicker {
  font-weight: 700;
  opacity: 0.92;
}

.dt-hub-subtitle {
  font-size: 1.08rem;
  line-height: 1.6;
}

.dt-hub-tab {
  font-weight: 700;
}

.dt-hub-tab-panel {
  border: 1px solid var(--dt-border);
  border-radius: 14px;
  padding: 10px;
  background: color-mix(in srgb, var(--dt-surface) 94%, #000 6%);
}

/* =========================================================
   GROUP MATCHES UNDER STANDINGS
========================================================= */

.dt-group-matches {
  margin-top: 14px;
  border: 1px solid var(--dt-border);
  border-radius: 12px;
  background: var(--dt-surface-soft);
  padding: 12px 14px;
}

.dt-group-matches h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--dt-text);
}

.dt-group-matches-list {
  display: grid;
  gap: 8px;
}

.dt-group-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--dt-border);
  padding-bottom: 8px;
}

.dt-group-match-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dt-group-match-row strong {
  color: var(--dt-text);
  font-weight: 700;
}

.dt-group-match-row span:last-child {
  text-align: right;
}

.dt-group-matches-empty {
  margin: 10px 0 0;
  color: var(--dt-text-muted);
}

/* =========================================================
   MOBILE FRIENDLY IMPROVEMENTS
========================================================= */

@media (max-width: 768px) {
  .dt-hub {
    padding: 14px;
    border-radius: 16px;
  }

  .dt-hub-hero {
    padding: 16px;
    border-radius: 14px;
  }

  .dt-hub-hero h2 {
    font-size: 1.7rem;
    line-height: 1.2;
  }

  .dt-hub-subtitle {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .dt-hub-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dt-hub-tab {
    width: 100%;
    padding: 10px 10px;
    border-radius: 10px;
    font-size: 0.95rem;
  }

  .dt-hub-tab-panel {
    padding: 8px;
    border-radius: 12px;
  }

  .dt-card,
  .dt-signup-card,
  .dt-recent-card,
  .dt-latest-card,
  .dt-bracket-card,
  .dt-match-result-card,
  .dt-match-pending-card,
  .dt-match-confirm-card,
  .dt-admin-card {
    padding: 16px;
    border-radius: 12px;
    margin: 0;
  }

  .dt-group {
    margin-bottom: 26px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dt-group h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .dt-table {
    min-width: 640px;
  }

  .dt-table th,
  .dt-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .dt-group-match-row,
  .dt-latest-result-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .dt-group-match-row span:last-child,
  .dt-latest-result-row {
    text-align: left;
  }

  .dt-bracket-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .dt-hub-tabs {
    grid-template-columns: 1fr;
  }

  .dt-hub-hero h2 {
    font-size: 1.5rem;
  }

  .dt-button,
  .dt-button-secondary,
  .dt-button-danger {
    width: 100%;
  }
}
