/* ── Fonts & Reset ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --primary:    #1a1a2e;
  --secondary:  #16213e;
  --accent:     #0f3460;
  --highlight:  #e94560;
  --success:    #00d9ff;
  --warning:    #ffc107;
  --boulder:    #ff6b6b;
  --lead:       #4ecdc4;
  --speed:      #ffe66d;
  --text:       #f8f9fa;
  --text-muted: #adb5bd;
  --bg-dark:    #0f0f1e;
  --card-bg:    rgba(255, 255, 255, 0.05);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
}

/* ── CONFIG PAGE ─────────────────────────────────────────────────────────────── */

.config-hero {
  background: linear-gradient(to bottom, rgba(15,15,30,0.55) 0%, rgba(26,26,46,0.85) 100%),
              url('/static/img/climging_hero.jpg') center/cover no-repeat;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden; /* clips the ::before radial animation */
}

.config-hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(233, 69, 96, 0.1) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}

.mountain-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(233, 69, 96, 0.5));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.config-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.config-hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.config-form {
  max-width: 800px;
  margin: -2rem auto 0;
  padding: 0 2rem 4rem;
  position: relative;
  z-index: 2;
}

.form-section {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-number {
  width: 40px; height: 40px;
  background: var(--highlight);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.input-field {
  width: 100%;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--highlight);
  background: rgba(255, 255, 255, 0.08);
}

.discipline-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.discipline-btn {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.discipline-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.discipline-btn.active { border-width: 3px; }

.discipline-btn.boulder.active {
  border-color: var(--boulder);
  background: rgba(255, 107, 107, 0.1);
}

.discipline-btn.lead.active {
  border-color: var(--lead);
  background: rgba(78, 205, 196, 0.1);
}

.discipline-btn.speed.active {
  border-color: var(--speed);
  background: rgba(255, 230, 109, 0.1);
  color: var(--speed);
}

.discipline-icon { font-size: 2rem; }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tag-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
}

.tag-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  width: 80px;
}
.tag-input:focus { outline: none; }

.tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tag-remove:hover { color: var(--highlight); }

.add-btn {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}
.add-btn:hover {
  border-color: var(--highlight);
  color: var(--highlight);
}

.climber-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.climber-setup-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 40px;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.climber-setup-row input {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.5rem;
  font-size: 0.95rem;
}
.climber-setup-row input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.submit-btn {
  width: 100%;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--highlight) 0%, #ff6b6b 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  box-shadow: 0 10px 30px rgba(233, 69, 96, 0.3);
}
.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(233, 69, 96, 0.4);
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── PLAY PAGE ───────────────────────────────────────────────────────────────── */

.play-header {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.discipline-pill {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.discipline-pill.boulder { background: var(--boulder); color: white; }
.discipline-pill.lead    { background: var(--lead);    color: var(--primary); }
.discipline-pill.speed   { background: var(--speed);   color: var(--primary); }

.comp-name {
  font-size: 1.25rem;
  font-weight: 600;
}

.status-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-badge.live {
  background: #ff4444;
  color: white;
  animation: blink 2s infinite;
}
.status-badge.completed {
  background: var(--success);
  color: var(--primary);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.broadcast-link {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.broadcast-link:hover { background: rgba(255, 255, 255, 0.2); }

.end-btn {
  padding: 0.5rem 1rem;
  background: var(--highlight);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}
.end-btn:hover { background: #ff6b6b; }

.play-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.panel {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Add-climber bar */
.add-climber-bar {
  background: var(--card-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 2rem;
}

.add-climber-form {
  display: flex;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.field-input-sm {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  min-width: 120px;
}
.field-input-num { max-width: 100px; }

.btn-primary-sm {
  padding: 0.75rem 1.5rem;
  background: var(--highlight);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 500;
}

.btn-ghost-sm {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.btn-add-climber {
  display: block;
  padding: 0.75rem;
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  margin: 1rem 2rem;
  width: calc(100% - 4rem);
  transition: all 0.3s;
  font-size: 0.95rem;
}
.btn-add-climber:hover {
  border-color: var(--highlight);
  color: var(--highlight);
}

/* ── SCORING TABLE ───────────────────────────────────────────────────────────── */

.scroll-container {
  position: relative;
}

/* right-edge fade overlay — sits on top, doesn't scroll */
.scroll-container::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4rem; height: 100%;
  background: linear-gradient(to right, transparent, rgba(22,33,62,0.9));
  pointer-events: none;
  transition: opacity 0.25s;
  border-radius: 0 8px 8px 0;
}
.scroll-container.at-end::after { opacity: 0; }

.scroll-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  transition: opacity 0.3s;
}
.scroll-hint svg { opacity: 0.6; }
.scroll-container.at-end .scroll-hint { opacity: 0; pointer-events: none; }

.score-table-wrap {
  max-width: 50vw;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.score-table-wrap::-webkit-scrollbar { height: 4px; }
.score-table-wrap::-webkit-scrollbar-track { background: transparent; }
.score-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 2px; }

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

.score-table th {
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.th-climber {
  text-align: left !important;
  position: sticky;
  left: 0;
  background: var(--secondary);
  z-index: 2;
  box-shadow: 2px 0 6px rgba(0,0,0,0.3);
}

.score-table td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.td-climber {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--primary);
  z-index: 1;
  box-shadow: 2px 0 6px rgba(0,0,0,0.3);
}
.score-table tr:hover .td-climber { background: rgba(22,33,62,0.95); }
.score-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

.cell-bib {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.5rem;
}
.cell-name { font-weight: 500; }

.td-score.clickable { cursor: pointer; }
.td-score.clickable:hover { background: rgba(255, 255, 255, 0.07) !important; }

.score-top  { color: var(--success); }
.score-zone { color: var(--warning); }
.score-label { font-weight: 700; }
.score-att { font-size: 0.75rem; color: var(--text-muted); margin-left: 2px; }
.score-dash { color: rgba(255,255,255,0.2); }
.hold-val { font-weight: 700; color: var(--lead); }
.panel-empty { text-align: center; color: var(--text-muted); padding: 2rem; }

/* ── BOULDER MODAL ──────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--secondary);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 2rem;
  width: 360px;
  max-width: 90vw;
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-fields { display: flex; flex-direction: column; gap: 1rem; }

.modal-field {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 1rem;
}

.modal-check-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.modal-check-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

.modal-att {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.att-input {
  width: 80px;
  padding: 0.5rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text);
  text-align: center;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-modal-save {
  flex: 1;
  padding: 0.75rem;
  background: var(--highlight);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.btn-modal-save:hover { background: #ff6b6b; }

.btn-modal-cancel {
  flex: 1;
  padding: 0.75rem;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}
.btn-modal-cancel:hover { background: rgba(255,255,255,0.15); }

/* ── RANKINGS PANEL (JS-rendered) ───────────────────────────────────────────── */

.rankings-list { display: flex; flex-direction: column; gap: 0.5rem; }

.rank-row {
  display: grid;
  grid-template-columns: 40px 60px 1fr 80px;
  align-items: center;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s;
}
.rank-row:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(5px);
}
.rank-row.gold   { border-color: rgba(255,215,0,0.3);   background: rgba(255,215,0,0.05); }
.rank-row.silver { border-color: rgba(192,192,192,0.3); background: rgba(192,192,192,0.05); }
.rank-row.bronze { border-color: rgba(205,127,50,0.3);  background: rgba(205,127,50,0.05); }

.rank-pos {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-muted);
  text-align: center;
}
.rank-row.gold .rank-pos,
.rank-row.silver .rank-pos,
.rank-row.bronze .rank-pos { color: var(--warning); }

.rank-bib {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.rank-name {
  font-weight: 500;
  padding: 0 1rem;
}

.rank-detail {
  text-align: right;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

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

/* ── SPEED SCORING ──────────────────────────────────────────────────────────── */

.speed-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.speed-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.speed-setup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.speed-lane { display: flex; flex-direction: column; gap: 0.75rem; }

.lane-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.lane-a .lane-label { color: var(--lead); }
.lane-b .lane-label { color: var(--boulder); }

.lane-select {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.lane-time {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--speed);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.speed-vs {
  align-self: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-muted);
  padding-top: 2rem;
}

.speed-timer-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.timer-display {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--speed);
  text-shadow: 0 0 20px rgba(255, 230, 109, 0.3);
  min-width: 100px;
}

.btn-timer {
  padding: 0.75rem 1.5rem;
  background: #28a745;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-timer.running { background: #dc3545; }

.btn-timer-reset {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.speed-winner-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-winner {
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-winner-a { background: linear-gradient(135deg, var(--lead) 0%, #38b2ac 100%); color: var(--primary); }
.btn-winner-b { background: linear-gradient(135deg, var(--boulder) 0%, #e53e3e 100%); color: white; }
.btn-winner:hover { transform: scale(1.02); }

/* ── MATCH HISTORY ──────────────────────────────────────────────────────────── */

.speed-history { margin-top: 0.5rem; }

.history-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.history-empty { color: var(--text-muted); font-size: 0.9rem; }

.history-list { display: flex; flex-direction: column; gap: 0.5rem; }

.history-match {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  font-size: 0.9rem;
}

.hm-lane {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  flex: 1;
  justify-content: flex-end;
}
.hm-lane em { font-style: normal; font-family: monospace; font-size: 0.85rem; }
.hm-winner  { color: var(--speed); font-weight: 700; }
.hm-vs      { font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.hm-result  { flex: 1; font-weight: 600; color: var(--success); }

/* ── BROADCAST PAGE ─────────────────────────────────────────────────────────── */

.broadcast-page {
  background: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.broadcast-header {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 2rem;
  text-align: center;
  border-bottom: 3px solid;
}
.broadcast-header.boulder { border-color: var(--boulder); }
.broadcast-header.lead    { border-color: var(--lead); }
.broadcast-header.speed   { border-color: var(--speed); }

.broadcast-discipline {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}
.broadcast-header.boulder .broadcast-discipline { background: var(--boulder); }
.broadcast-header.lead    .broadcast-discipline { background: var(--lead);    color: var(--primary); }
.broadcast-header.speed   .broadcast-discipline { background: var(--speed);   color: var(--primary); }

.broadcast-status {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.broadcast-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
}

.broadcast-rankings {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.br-row {
  display: grid;
  grid-template-columns: 100px 150px 1fr 200px;
  align-items: center;
  padding: clamp(1rem, 3vh, 2rem);
  margin-bottom: clamp(0.5rem, 2vh, 1rem);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s;
  animation: br-enter 0.4s ease both;
}

@keyframes br-enter {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.br-row.gold   { background: linear-gradient(135deg, rgba(255,215,0,0.2) 0%, rgba(255,215,0,0.05) 100%);   border-color: #ffd700; }
.br-row.silver { background: linear-gradient(135deg, rgba(192,192,192,0.2) 0%, rgba(192,192,192,0.05) 100%); border-color: #c0c0c0; }
.br-row.bronze { background: linear-gradient(135deg, rgba(205,127,50,0.2) 0%, rgba(205,127,50,0.05) 100%);  border-color: #cd7f32; }

.br-rank {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  text-align: center;
}

.br-bib {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 12px;
}

.br-cat {
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 500;
  padding: 0 2rem;
  color: var(--text-muted);
}

.br-detail {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 800;
  text-align: right;
  font-family: 'Courier New', monospace;
}

.broadcast-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.5rem;
  padding: 4rem;
}

/* ── ANIMATIONS ─────────────────────────────────────────────────────────────── */

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 0.5; }
  50%       { transform: scale(1.1); opacity: 0.8; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .play-content { grid-template-columns: 1fr; }
  .speed-setup  { grid-template-columns: 1fr; }
  .speed-vs     { display: none; }
}

@media (max-width: 768px) {
  .discipline-toggle { grid-template-columns: 1fr; }
  .climber-setup-row { grid-template-columns: 60px 1fr 80px 40px; }
  .br-row            { grid-template-columns: 60px 80px 1fr 100px; }
  .play-header       { flex-direction: column; gap: 1rem; align-items: flex-start; }
}

/* ── CUSTOM MODAL DIALOGS ───────────────────────────────────────────────────── */

.climb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(4px);
}

.climb-modal-box {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 2rem;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.2s ease;
}

.climb-modal-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--highlight);
  margin-bottom: 0.75rem;
}

.climb-modal-msg {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.climb-modal-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}
.climb-modal-input:focus {
  outline: none;
  border-color: var(--highlight);
}

.climb-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.climb-modal-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.climb-modal-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.climb-modal-btn-cancel:hover { background: rgba(255, 255, 255, 0.14); }

.climb-modal-btn-confirm {
  background: var(--highlight);
  color: white;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.35);
}
.climb-modal-btn-confirm:hover {
  background: #ff6b6b;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.45);
}

/* ── BROADCAST POPUP OVERRIDES (climbing theme) ─────────────────────────────── */

#broadcast-popup.bsp-overlay {
  backdrop-filter: blur(6px);
}

#broadcast-popup .bsp-panel {
  background: linear-gradient(145deg, #1e2a4a 0%, #16213e 60%, #1a1a2e 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(233,69,96,0.15);
  overflow: hidden;
}

#broadcast-popup .bsp-rail {
  background: linear-gradient(to bottom, var(--highlight), #ff6b6b);
  border-radius: 24px 0 0 24px;
}

#broadcast-popup .bsp-texture { display: none; }

#broadcast-popup .bsp-header {
  background: rgba(233, 69, 96, 0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
}

#broadcast-popup .bsp-onair-dot { background: var(--highlight); }
#broadcast-popup .bsp-onair-badge {
  background: rgba(233, 69, 96, 0.15);
  border: 1px solid rgba(233,69,96,0.3);
  border-radius: 20px;
}

#broadcast-popup .bsp-title { color: var(--text); }
#broadcast-popup .bsp-subtitle { color: var(--text-muted); }

#broadcast-popup .bsp-close,
#broadcast-popup .bsp-minimize {
  color: var(--text-muted);
  border-radius: 8px;
}
#broadcast-popup .bsp-close:hover,
#broadcast-popup .bsp-minimize:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

#broadcast-popup .bsp-qr-section { background: transparent; }

#broadcast-popup .bsp-qr-frame {
  background: #f2f4f8;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

#broadcast-popup .bsp-corner { border-color: var(--highlight); }

#broadcast-popup .bsp-qr-label { color: var(--text-muted); }

#broadcast-popup .bsp-url-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  transition: all 0.2s;
}
#broadcast-popup .bsp-url-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

#broadcast-popup .bsp-copy-badge {
  background: var(--highlight);
  border-radius: 6px;
  color: white;
}

#broadcast-popup .bsp-footer {
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.06);
}

#broadcast-popup .bsp-footer-text { color: var(--text-muted); }
#broadcast-popup .bsp-bar { background: var(--highlight); }

/* Mini widget */
#bsp-mini-widget {
  background: linear-gradient(135deg, #1e2a4a, #16213e);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#bsp-mini-widget .bsp-mini-expand {
  background: var(--highlight);
  color: white;
  border-radius: 8px;
}

/* ============================================================
   HOME PAGE
   ============================================================ */

.climbing-home { min-height: 100vh; }

.home-hero {
  background: linear-gradient(to bottom, rgba(15,15,30,0.55) 0%, rgba(26,26,46,0.85) 100%),
              url('/static/img/climging_hero.jpg') center/cover no-repeat;
  padding: 48px 24px 40px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
/* Help tooltip — shared by home + config heroes */
.hero-help {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 20;
}
.hero-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.hero-help-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.hero-help-popup {
  display: none;
  position: absolute;
  top: 36px;
  right: 0;
  width: 290px;
  background: rgba(15,15,30,0.97);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  line-height: 1.6;
}
.hero-help-popup.open { display: block; }
.hero-help-title { color: #fff; font-weight: 700; font-size: 13px; margin: 0 0 6px; }
.hero-help-popup p { margin: 0 0 8px; }
.hero-help-popup ul { margin: 0; padding-left: 16px; }
.hero-help-popup li { margin-bottom: 5px; }
.hero-help-popup strong { color: rgba(255,255,255,0.9); }
.hero-help-note { margin: 8px 0 0; color: rgba(255,255,255,0.5); font-size: 11px; font-style: italic; }

.home-hero .mountain-icon { font-size: 48px; margin-bottom: 12px; }
.home-hero h1 { font-size: 28px; font-weight: 700; color: #fff; margin: 0 0 8px; }
.home-hero p  { color: rgba(255,255,255,0.5); font-size: 14px; margin: 0 0 24px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .submit-btn,
.hero-actions .btn-ghost { width: 250px; text-align: center; text-decoration: none; }

.btn-ghost {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); }

/* List section */
.home-list-section { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; }

/* Tab bar */
.list-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.filter-icon-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 7px 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  margin-right: 8px;
  color: rgba(255,255,255,0.6);
  transition: background 0.15s, color 0.15s;
}
.filter-icon-btn:hover,
.filter-icon-btn.active { background: rgba(233,69,96,0.15); color: var(--highlight); border-color: rgba(233,69,96,0.3); }
.list-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  padding: 14px 16px 12px;
  cursor: pointer;
  transition: color 0.15s;
}
.list-tab.active { color: var(--highlight); border-bottom-color: var(--highlight); }
.list-tab:hover:not(.active) { color: rgba(255,255,255,0.7); }

/* Filter panel */
.filter-panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.filter-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row:last-child { margin-bottom: 0; }
.filter-label {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 70px;
  padding-top: 4px;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-chip.active { background: rgba(233,69,96,0.15); color: var(--highlight); border-color: rgba(233,69,96,0.4); }
.filter-chip:hover:not(.active) { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.8); }
.filter-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: var(--highlight); }
.filter-date { width: 130px; }
.filter-date-range { display: flex; align-items: center; gap: 8px; }

/* Comp list cards */
.comp-list { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.comp-list-loading,
.comp-empty { color: rgba(255,255,255,0.3); font-size: 13px; text-align: center; padding: 32px 0; }

.comp-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.comp-card:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.comp-card.live { border-color: rgba(233,69,96,0.2); }
.comp-card-left { flex: 1; min-width: 0; }
.comp-card-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comp-card-name { color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-card-live { background: rgba(233,69,96,0.15); color: var(--highlight); font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.comp-card-completed { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.3); font-size: 9px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.comp-card-meta { color: rgba(255,255,255,0.35); font-size: 11px; display: flex; gap: 6px; align-items: center; }
.comp-card-action { color: #4ecdc4; font-size: 12px; font-weight: 500; white-space: nowrap; margin-left: 12px; }
.comp-card-action.view { color: rgba(255,255,255,0.3); }

/* ============================================================
   CONFIG FORM — public visibility toggle
   ============================================================ */

.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle-checkbox { display: none; }
.toggle-track {
  width: 40px; height: 22px;
  background: rgba(255,255,255,0.1);
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.15);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-checkbox:checked + .toggle-track { background: var(--highlight); border-color: var(--highlight); }
.toggle-checkbox:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: #fff; }
.toggle-hint { color: rgba(255,255,255,0.5); font-size: 13px; }

/* ============================================================
   CO-HOST SECTION (play page header)
   ============================================================ */

.cohost-section { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cohost-list { display: flex; flex-direction: column; gap: 4px; max-width: 220px; }
.cohost-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
}
.cohost-name { color: rgba(255,255,255,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cohost-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  transition: color 0.15s;
}
.cohost-remove:hover { color: var(--highlight); }
#bsp-mini-widget .bsp-mini-expand:hover { background: #ff6b6b; }
