/* ============================================
   Tabernacle - cEDH Tournament Manager
   Dark theme with gold accents
   ============================================ */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161820;
  --bg-card: #1c1e28;
  --bg-input: #12141c;
  --bg-hover: #24262f;
  --bg-elevated: #22242e;
  --text-primary: #ececf1;
  --text-secondary: #8e8ea0;
  --text-muted: #55556a;
  --accent: #e5b83a;
  --accent-hover: #f0c94a;
  --accent-dark: #b8922a;
  --accent-glow: rgba(229, 184, 58, 0.12);
  --border: #2a2a3a;
  --border-light: #35354a;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.10);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.10);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.10);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.10);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --secondary: #3a3a4a;
  --secondary-hover: #4a4a5a;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --transition: 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- NAV BAR ---- */

.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 0 var(--border), 0 4px 24px rgba(0, 0, 0, 0.35);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  text-shadow: 0 0 24px rgba(229, 184, 58, 0.15);
}

.navbar-brand:hover {
  color: var(--accent-hover);
}

.navbar-brand .brand-icon {
  font-size: 1.35rem;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
}

.navbar-links a {
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }
  .navbar-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    gap: 0.15rem;
  }
  .navbar-links.open {
    display: flex;
  }
  .navbar-links a {
    display: block;
    padding: 0.65rem 0.85rem;
  }
}

/* ---- LAYOUT ---- */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.page-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb .sep::after {
  content: '/';
  margin: 0 0.15rem;
}

/* ---- FLASH MESSAGES ---- */

.flash-messages {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid;
  animation: flashIn 0.3s ease;
}

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

.flash-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.flash-error {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.flash-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

.flash-info {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--info);
}

/* ---- CARDS ---- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-link {
  display: block;
  color: inherit;
}

.card-link:hover {
  color: inherit;
}

.card-link:hover .card {
  border-color: var(--accent-dark);
  box-shadow: var(--shadow), var(--shadow-glow);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-centered {
  max-width: 28rem;
  margin: 0 auto 2rem;
}

.card-centered-lg {
  max-width: 32rem;
  margin: 0 auto;
}

/* ---- BADGES ---- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.badge-green {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-gray {
  background: rgba(156, 163, 175, 0.12);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.25);
}

.badge-gold {
  background: rgba(229, 184, 58, 0.12);
  color: var(--accent);
  border: 1px solid rgba(229, 184, 58, 0.25);
}

.badge-red {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.badge-lg {
  font-size: 1rem;
  padding: 0.25rem 0.75rem;
}

/* ---- BUTTONS ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0f1117;
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: #0f1117;
  box-shadow: var(--shadow-glow);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-success-outline {
  background: transparent;
  border: 1px solid var(--success);
  color: var(--success);
}

.btn-success-outline:hover {
  background: var(--success-bg);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-block {
  width: 100%;
}

/* ---- FORMS ---- */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238e8ea0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-card {
  max-width: 520px;
}

.form-row {
  display: flex;
  gap: 0.5rem;
}

.form-row .form-control { flex: 1; }

.input-compact {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.input-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  width: 7rem;
}

.inline-edit-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.toggle-option input { accent-color: var(--accent); }

.toggle-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.seat-config-panel {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.seat-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.seat-config-label {
  font-size: 0.8rem;
}

/* ---- TABLES ---- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:nth-child(even):hover {
  background: var(--bg-hover);
}

.table .text-right {
  text-align: right;
}

.table .text-center {
  text-align: center;
}

.table .rank-gold {
  font-weight: 700;
  color: var(--accent);
}

.table .rank-default {
  font-weight: 700;
  color: var(--text-primary);
}

.table .rank-muted {
  font-weight: 700;
  color: var(--text-muted);
}

.table .rank-1 td {
  background: rgba(229, 184, 58, 0.08);
}

.table .rank-2 td,
.table .rank-3 td {
  background: rgba(229, 184, 58, 0.04);
}

.table .col-bold {
  font-weight: 700;
}

.table tbody tr.rank-1 {
  background: rgba(229, 184, 58, 0.04);
}

.table tbody tr.rank-1:hover {
  background: rgba(229, 184, 58, 0.08);
}

.player-dropped {
  opacity: 0.5;
}

.player-dropped .player-name {
  text-decoration: line-through;
}

/* ---- EMPTY STATE ---- */

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

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- STATS ROW ---- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

/* ---- POD CARDS ---- */

.pod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.pod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.pod-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.pod-header {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.pod-body {
  padding: 0.5rem 0;
}

.pod-body-padded {
  padding: 0.75rem 1rem;
}

.pod-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1.15rem;
  transition: background var(--transition);
}

.pod-player:hover {
  background: rgba(255, 255, 255, 0.02);
}

.pod-player .seat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.6rem;
  flex-shrink: 0;
}

.pod-player .player-info {
  flex: 1;
  display: flex;
  align-items: center;
}

.pod-player .placement {
  font-weight: 700;
  font-size: 0.85rem;
}

.pod-player .placement.first { color: var(--accent); }
.pod-player .placement.second { color: #c0c0c0; }
.pod-player .placement.third { color: #cd7f32; }
.pod-player .placement.fourth { color: var(--text-muted); }

.pod-bye {
  border-color: rgba(229, 184, 58, 0.15);
}

.pod-bye .pod-header {
  background: rgba(229, 184, 58, 0.06);
}

.pod-player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.pod-player-row span:first-child {
  flex: 1;
  font-weight: 500;
}

/* ---- SECTION ---- */

.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ---- TOURNAMENT LIST HERO ---- */

.tournament-hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.tournament-hero h1 {
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.tournament-hero .btn {
  margin-top: 0.75rem;
}

/* ---- DASHBOARD ---- */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dashboard-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.dashboard-panel .section-title {
  margin-bottom: 0.85rem;
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-group-vertical .inline-form {
  display: block;
}

.join-link-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.join-link-code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  word-break: break-all;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.playoff-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.playoff-card p {
  margin-bottom: 0.75rem;
}

/* ---- ROUNDS LIST ---- */

.round-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.round-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.round-item:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.round-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.round-number {
  font-weight: 700;
  font-size: 0.95rem;
}

.round-meta {
  font-size: 0.85rem;
}

/* ---- RESULTS / PAIRINGS ---- */

.result-pod {
  margin-bottom: 1.5rem;
}

.result-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.15rem;
}

.result-player .player-name-label {
  flex: 1;
  font-weight: 500;
}

.result-player .form-control {
  width: auto;
  min-width: 120px;
}

.result-pick .pick-label { opacity: 0.15; transition: opacity 0.15s; }
.result-pick input[type="radio"]:checked ~ .pick-label { opacity: 1; }
.result-pick:hover { background: var(--bg-hover); border-radius: var(--radius); }
.result-pick { transition: background 0.15s; cursor: pointer; flex: 1; margin: 0; }

.draw-pick {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.result-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.result-option:hover { background: var(--bg-hover); }
.result-option input[type="radio"] { accent-color: var(--accent); }
.result-option .badge-green { opacity: 0.3; transition: opacity 0.15s; }
.result-option input[type="radio"]:checked ~ .badge-green { opacity: 1; }

.result-option-name {
  flex: 1;
  font-weight: 500;
}

.result-option.draw-pick {
  padding-top: 0.75rem;
}

.commander-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 0.4rem;
}

.bye-pts {
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.btn-clear:hover {
  color: var(--warning);
  background: var(--bg-hover);
}

/* ---- TIMER ---- */

.timer-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  margin-bottom: 1.5rem;
}

.timer-display {
  font-size: 2.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--success);
  min-width: 6rem;
  letter-spacing: -0.02em;
}

.timer-warning .timer-display { color: var(--warning); }
.timer-expired .timer-display { color: var(--error); animation: pulse 1s infinite; }

.timer-input {
  width: 4rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  text-align: center;
}

.timer-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- SWAP / EDIT MODE ---- */

.swap-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  background: var(--accent);
  color: #0f1117;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.swap-banner .btn-outline {
  color: #0f1117;
  border-color: rgba(0, 0, 0, 0.3);
}

.swappable { cursor: crosshair !important; }
.swappable:hover { background: var(--accent-glow) !important; }
.swap-selected { background: var(--accent) !important; color: #0f1117 !important; border-radius: var(--radius); }
.swap-selected .commander-tag { color: rgba(0, 0, 0, 0.5) !important; }
.swap-selected .pod-player { color: #0f1117 !important; }
.swap-selected .pick-label { display: none; }

.pod-player-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

.seat-controls {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  margin-right: 0.3rem;
}

.seat-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.55rem;
  line-height: 1;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.seat-btn:hover {
  color: var(--accent);
  background: var(--bg-hover);
}

/* ---- JUDGE QUEUE ---- */

.judge-call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.call-open { border-left: 3px solid var(--error); }
.call-claimed { border-left: 3px solid var(--warning); }
.call-resolved { opacity: 0.5; }

.call-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
}

.call-table {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 4rem;
}

.call-time { font-size: 0.75rem; }

.call-detail { font-size: 0.85rem; }

.judge-claim-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.judge-name-input {
  width: 7rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

/* ---- PLAYER JOIN PAGE ---- */

.join-header {
  text-align: center;
  margin-bottom: 2rem;
}

.join-header h1 {
  margin-bottom: 0.25rem;
  letter-spacing: -0.025em;
}

.join-timer {
  text-align: center;
  margin-bottom: 1.5rem;
}

.join-timer-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.join-timer-label {
  font-size: 0.85rem;
}

.join-card-heading {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.join-card-heading-sm {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.seat-card {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.seat-card-table {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.25rem 0;
  letter-spacing: -0.02em;
}

.seat-card-detail {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.seat-card-opponents {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.search-details {
  margin-top: 0.75rem;
}

.search-summary {
  cursor: pointer;
  font-size: 0.85rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.judge-call-section {
  text-align: center;
}

.judge-reason-box {
  display: none;
  margin-top: 0.75rem;
}

.judge-reason-input {
  margin-bottom: 0.5rem;
}

.round-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.round-history-opponents {
  font-size: 0.8rem;
}

/* Tabs */

.player-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}

.player-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.player-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.player-tab:hover { color: var(--text-primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-empty { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }

/* Player pod cards (join page) */

.player-pod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.player-pod-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.85rem;
  font-weight: 700;
  font-size: 0.875rem;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border-bottom: 1px solid var(--border);
}

.player-pod-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
  font-size: 0.875rem;
}

.player-pod-row:last-child { border-bottom: none; }

.player-pod-seat {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---- CONFIRM DELETE ---- */

.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.confirm-overlay.open {
  display: flex;
}

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
}

.confirm-dialog h3 {
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.confirm-dialog p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* ---- FOOTER ---- */

.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  opacity: 0.6;
}

.footer a {
  color: var(--text-secondary);
}

/* ---- UTILITIES ---- */

.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.8rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: 0.4rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.inline-form { display: inline; }
.hidden { display: none; }
.opacity-50 { opacity: 0.5; }

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-header h1 {
    font-size: 1.35rem;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .pod-grid {
    grid-template-columns: 1fr;
  }
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .table {
    font-size: 0.8rem;
  }
  .table th, .table td {
    padding: 0.5rem 0.65rem;
  }
  .btn-group {
    width: 100%;
  }
  .btn-group .btn {
    flex: 1;
  }
  .result-player {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .result-player .form-control {
    width: 100%;
  }
  .judge-call {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .call-info { gap: 0.5rem; }
}

@media (max-width: 640px) {
  .pod-player { padding: 0.55rem 0.85rem; }
  .pod-player .player-info { flex-wrap: wrap; gap: 0.25rem; }
  .commander-tag { display: block; margin-left: 0; font-size: 0.65rem; }
  .result-pick { min-height: 44px; }
  .timer-bar { flex-wrap: wrap; padding: 0.6rem 0.85rem; gap: 0.5rem; }
  .timer-display { font-size: 1.5rem; min-width: auto; }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .round-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .form-control {
    font-size: 16px;
  }
  .btn {
    min-height: 44px;
  }
  .pod-grid {
    gap: 0.75rem;
  }
}

/* Player join page mobile */
@media (max-width: 640px) {
  .join-header h1 { font-size: 1.3rem; }
  .card-centered, .card-centered-lg { margin-left: 0; margin-right: 0; }
  .card-centered .card, .card-centered-lg .card { padding: 1rem; }
}

/* ============================================
   League Feature
   ============================================ */

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.checkbox-item:hover { background: var(--bg-hover); }
.checkbox-item.checked-item { opacity: 0.6; }
.checkbox-item input[type="checkbox"] { accent-color: var(--accent); }

.detail-row td {
  padding: 0 !important;
  background: var(--bg-secondary);
}

.detail-content {
  padding: 0.75rem 1rem;
}

.data-table-nested {
  margin: 0;
  font-size: 0.85rem;
}

.data-table-nested th {
  background: var(--bg-primary);
}

.badge-gold {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(229, 184, 58, 0.3);
}

.nav-sep {
  border-left: 1px solid var(--border-light);
  height: 1.2rem;
  margin: 0 0.25rem;
  align-self: center;
  list-style: none;
}

.flash-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}
