/* ═══════════════════════════════════════════════
   CourtNotes — Design System
   Dark/Light theme, Mobile-first, iOS safe area
═══════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────── */
:root[data-theme="dark"] {
  --bg:        #0F1115;
  --surface:   #1F2430;
  --surface2:  #262D3D;
  --border:    #2E3548;
  --accent:    #C8F04A;
  --accent-dim:#8AAF1E;
  --accent-bg: rgba(200,240,74,0.15);
  --red:       #F0564A;
  --red-bg:    rgba(240,86,74,0.15);
  --orange:    #F0A84A;
  --text:      #E6EAF0;
  --text-2:    #9AA3B8;
  --text-3:    #5A6278;
  --overlay:   rgba(0,0,0,0.7);
}

:root[data-theme="light"] {
  --bg:        #F0F2F5;
  --surface:   #FFFFFF;
  --surface2:  #E8EBF0;
  --border:    #D0D5E0;
  --accent:    #5A8A00;
  --accent-dim:#3D6400;
  --accent-bg: rgba(90,138,0,0.12);
  --red:       #D93830;
  --red-bg:    rgba(217,56,48,0.12);
  --orange:    #D47C00;
  --text:      #1A1E2E;
  --text-2:    #5A6278;
  --text-3:    #9AA3B8;
  --overlay:   rgba(0,0,0,0.4);
}

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

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

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Layout ─────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

.page-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

/* ── Topbar ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #0F1115;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 14px;
  border-radius: 8px;
}

.logo-text {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.topbar-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  flex: 1;
  text-align: center;
  truncate: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

/* ── Icon Button ────────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--surface2);
  color: var(--text);
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn span { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 13px; }

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #0F1115;
}
.btn-primary:hover { opacity: 0.9; }

.btn-whatsapp {
  background: #25D366;
  color: #fff;
}
.btn-whatsapp:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

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

.btn-full { width: 100%; }

/* ── Section ────────────────────────────────── */
.section { margin-top: 24px; }

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* ── Players List ───────────────────────────── */
.players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.player-card:hover, .player-card:active {
  background: var(--surface2);
  border-color: var(--accent);
}

.player-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
  text-transform: uppercase;
}

.player-info { flex: 1; min-width: 0; }

.player-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.player-arrow { color: var(--text-3); }
.player-arrow svg { width: 16px; height: 16px; }

/* ── Empty / Loading State ──────────────────── */
.empty-state, .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-3);
  text-align: center;
  font-size: 14px;
}

.empty-state svg, .loading-state svg {
  width: 40px;
  height: 40px;
  opacity: 0.4;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── Player Hero ────────────────────────────── */
.player-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px 20px;
  text-align: center;
}

.hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 8px;
  border: 2px solid var(--accent);
}

.hero-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--text);
  line-height: 1;
}

.hero-club {
  font-size: 14px;
  color: var(--text-2);
}

.hero-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface2);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-2);
}

/* ── Quick Actions ──────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.quick-btn:hover, .quick-btn:active {
  background: var(--surface2);
  border-color: var(--accent);
}

.quick-btn.primary { background: var(--accent); color: #0F1115; border-color: var(--accent); }
.quick-btn.primary:hover { opacity: 0.9; }

.quick-btn svg { width: 24px; height: 24px; }

/* ── Summary Strip ──────────────────────────── */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Insights ──────────────────────────────── */
.insights-section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  margin-bottom: 16px;
}

.insight-icon { color: var(--accent); flex-shrink: 0; }
.insight-icon svg { width: 18px; height: 18px; }

.insight-text {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Key Stats Grid ─────────────────────────── */
.key-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.key-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.key-stat-label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.key-stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.key-stat-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── W/L Timeline ───────────────────────────── */
.wl-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wl-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
}

.wl-dot.win  { background: rgba(200, 240, 74, 0.2); color: var(--accent); }
.wl-dot.loss { background: rgba(240, 86, 74, 0.15); color: var(--red); }

/* ── Match History List ─────────────────────── */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.match-row:hover, .match-row:active { background: var(--surface2); }

.match-type-badge {
  padding: 3px 7px;
  border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.match-type-badge.training { background: rgba(200,240,74,0.15); color: var(--accent); }
.match-type-badge.tournament { background: rgba(240,168,74,0.15); color: var(--orange); }

.match-opponent { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-score { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-2); flex-shrink: 0; }

.result-badge {
  padding: 3px 7px;
  border-radius: 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.result-badge.win  { background: var(--accent-bg); color: var(--accent); }
.result-badge.loss { background: var(--red-bg); color: var(--red); }

.match-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

.match-share-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.match-share-btn i, .match-share-btn svg { width: 14px; height: 14px; }
.match-share-btn:active { opacity: 0.7; }

/* ── Setup Page ─────────────────────────────── */
.setup-step { display: none; }
.setup-step.active { display: block; }

.step-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 20px;
}

.session-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.session-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.session-type-card.selected {
  border-color: var(--accent);
  background: rgba(200,240,74,0.08);
}

.session-type-card svg { width: 32px; height: 32px; color: var(--text-2); }
.session-type-card.selected svg { color: var(--accent); }

.session-type-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.session-type-card.selected .session-type-label { color: var(--accent); }

.format-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.format-group-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill:hover { border-color: var(--text-2); color: var(--text); }
.pill.selected { border-color: var(--accent); background: rgba(200,240,74,0.1); color: var(--accent); }

/* ── Form ───────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-3); }

/* ── Dropdown ───────────────────────────────── */
.dropdown-list {
  position: absolute;
  width: calc(100% - 32px);
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  z-index: 200;
}

.dropdown-item {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--surface2); }
.dropdown-item.create-new { color: var(--accent); font-weight: 600; }

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(200,240,74,0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 14px;
  color: var(--accent);
  margin-top: 6px;
}

.selected-tag button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.selected-tag button svg { width: 14px; height: 14px; }

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.modal-body { padding: 16px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

.modal-footer .btn { flex: 1; }

/* ── MATCH PAGE ─────────────────────────────── */
.match-page {
  background: var(--bg);
}

.match-topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.score-board {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.score-sets {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.score-game {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.score-game-val {
  font-family: 'DM Mono', monospace;
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}

.score-sep {
  font-family: 'DM Mono', monospace;
  font-size: 32px;
  color: var(--text-3);
}

.score-set-history {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.08em;
}

.player-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  flex: 1;
}

.player-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.1s;
  min-height: 140px;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.player-panel:active {
  transform: scale(0.97);
  border-color: var(--accent);
  background: rgba(200,240,74,0.08);
}

.player-panel.serving::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.panel-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-2);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-score {
  font-family: 'DM Mono', monospace;
  font-size: 40px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.panel-sets {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* ── Tags Bar ───────────────────────────────── */
.tags-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.tags-bar::-webkit-scrollbar { display: none; }

.tag-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tag-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(200,240,74,0.1); }

/* ── Rally Bar ──────────────────────────────── */
.rally-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  align-items: center;
  -webkit-overflow-scrolling: touch;
}

.rally-bar::-webkit-scrollbar { display: none; }

.rally-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.rally-btn {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.rally-btn.active { border-color: var(--orange); color: var(--orange); background: rgba(240,168,74,0.1); }

/* ── Game Breakdown ─────────────────────────── */
.game-breakdown {
  padding: 12px;
}

.breakdown-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 8px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Set Groups ─────────────────────────────── */
.set-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.set-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.set-group-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.set-group-score {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.set-group-games {
  display: flex;
  flex-direction: column;
}

/* ── Breakdown Cards ────────────────────────── */
.breakdown-card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid transparent;
}

.breakdown-card:last-child { border-bottom: none; }

.breakdown-card.game-won {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.breakdown-card.game-won .bh-label { color: var(--accent); }

.breakdown-card.game-lost {
  border-left-color: var(--red);
  background: color-mix(in srgb, var(--red) 4%, var(--surface));
}
.breakdown-card.game-lost .bh-label { color: var(--red); }

.breakdown-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.breakdown-header:hover { background: var(--surface2); }

.bh-left { display: flex; gap: 6px; align-items: center; }
.bh-label {
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  min-width: 28px;
}
.bh-result {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bh-center { text-align: center; }
.bh-score {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.bh-right { display: flex; gap: 6px; align-items: center; }
.bh-server {
  font-size: 11px;
  color: var(--text-3);
}

.breakdown-chevron { color: var(--text-3); transition: transform 0.2s; }
.breakdown-chevron svg { width: 16px; height: 16px; }
.breakdown-card.open .breakdown-chevron { transform: rotate(180deg); }

.breakdown-body {
  display: none;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.breakdown-card.open .breakdown-body { display: block; }

/* ── Point Flow (visual sequence) ───────────── */
.point-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.pt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text-2);
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.pt.p1 {
  border-left-color: var(--accent);
  color: var(--accent);
}

.pt.p2 {
  border-left-color: var(--red);
  color: var(--red);
}

.pt.deuce {
  border-left-color: var(--text-3);
  color: var(--text-3);
}

.pt.tagged {
  background: color-mix(in srgb, var(--surface2) 60%, var(--bg));
}

.pt small {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  font-weight: 600;
}

/* ── Point List (vertical, one point per line) ── */
.point-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 8px;
}

.pt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  font-size: 13px;
}

.pt-row:last-child { border-bottom: none; }
.pt-row.p1 { border-left-color: var(--accent); }
.pt-row.p2 { border-left-color: var(--red); }
.pt-row.deuce { border-left-color: var(--text-3); }
.pt-row.tagged { background: color-mix(in srgb, var(--surface2) 60%, var(--bg)); }

.pt-score {
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  min-width: 50px;
  color: var(--text);
}

.pt-row.p1 .pt-score { color: var(--accent); }
.pt-row.p2 .pt-score { color: var(--red); }
.pt-row.deuce .pt-score { color: var(--text-3); }

.pt-tag {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

/* ── Note-Match link ─────────────────────────── */
.my-note-match {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.02em;
}

/* ── Set analysis tag ────────────────────────── */
.set-tag {
  font-size: 10px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
  margin-left: 8px;
}

/* ── Game Note ──────────────────────────────── */
.game-note-area { margin-top: 8px; }

.game-note-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
}

.game-note-input::placeholder { color: var(--text-3); }
.game-note-input:focus { border-color: var(--accent); outline: none; }

.breakdown-insight {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 10px; margin-bottom: 6px;
}
.insight-dominant { background: rgba(200,240,74,0.15); color: var(--accent); }
.insight-comeback { background: rgba(74,160,240,0.15); color: #4AA0F0; }
.insight-squandered { background: var(--red-bg); color: var(--red); }

/* ── Match End ──────────────────────────────── */
.match-end-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.match-end-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  max-height: 80dvh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

.match-end-winner {
  text-align: center;
  margin-bottom: 20px;
}

.winner-emoji { font-size: 48px; }

.winner-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--text);
  margin-top: 8px;
}

.winner-score {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  color: var(--accent);
  margin-top: 4px;
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.end-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.end-stat-label { font-size: 13px; color: var(--text-3); }
.end-stat-vals { display: flex; gap: 16px; }
.end-stat-val { font-family: 'DM Mono', monospace; font-size: 14px; color: var(--text); }

.end-actions {
  display: flex;
  gap: 10px;
}

.end-actions .btn { flex: 1; }

/* ── View Page ──────────────────────────────── */
.view-match-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.view-players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.view-player-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.view-vs {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
}

.view-score {
  font-family: 'DM Mono', monospace;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}

.view-meta {
  font-size: 13px;
  color: var(--text-3);
}

.view-share {
  padding: 0 16px 8px;
}

.view-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-3);
}

.view-footer span { color: var(--accent); }

/* ── Toast ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 14px;
  z-index: 500;
  white-space: nowrap;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Divider ────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── Servis indicator ───────────────────────── */
.servis-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.servis-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Demo Badge ─────────────────────────────── */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  margin-bottom: 12px;
  background: rgba(240,168,74,0.12);
  border: 1px solid rgba(240,168,74,0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: 0.04em;
}

.demo-badge svg { width: 14px; height: 14px; }

/* ── Coach Profile ──────────────────────────── */
.coach-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.coach-profile .hero-avatar {
  width: 56px;
  height: 56px;
  font-size: 22px;
  flex-shrink: 0;
}

.coach-profile .hero-name { line-height: 1.2; }

/* ── Player Card Stats ─────────────────────── */
.player-card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
}

/* ── Add Player Flow ───────────────────────── */
.ap-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ap-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.ap-choice-card:hover,
.ap-choice-card:active {
  border-color: var(--accent);
  background: rgba(200,240,74,0.06);
}

.ap-choice-card svg { width: 28px; height: 28px; color: var(--text-2); }
.ap-choice-card:hover svg { color: var(--accent); }

.ap-choice-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text);
}

.ap-choice-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.3;
}

.ap-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.ap-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ap-result-info { flex: 1; min-width: 0; }
.ap-result-name { font-weight: 600; font-size: 15px; color: var(--text); }
.ap-result-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ap-result-action { flex-shrink: 0; }

.pending-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(240,168,74,0.12);
  border: 1px solid rgba(240,168,74,0.25);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: 0.03em;
}

.u18-badge {
  display: inline-flex;
  padding: 1px 5px;
  background: rgba(96,165,250,0.15);
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #60A5FA;
  vertical-align: middle;
  margin-left: 4px;
}

.cancel-link-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--red);
  cursor: pointer;
  font-family: inherit;
}
.cancel-link-btn:active { opacity: 0.6; }

.ap-locked-club {
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-2);
}

.ap-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
}

.ap-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ── Coming soon badge ──────────────────────── */
.coming-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-3);
  font-size: 14px;
}

/* ── Utilities ──────────────────────────────── */
.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-muted { color: var(--text-3); }
.font-mono { font-family: 'DM Mono', monospace; }
.font-condensed { font-family: 'Barlow Condensed', sans-serif; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ── Auth Page ─────────────────────────────── */
.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 24px;
  gap: 32px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.auth-logo-mark {
  font-size: 32px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.auth-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.auth-tagline {
  color: var(--text-2);
  font-size: 15px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.auth-field {
  position: relative;
}

.auth-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.auth-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: 'Barlow', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-input::placeholder {
  color: var(--text-3);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  margin-top: 4px;
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  padding: 8px;
  background: var(--red-bg);
  border-radius: 8px;
}

.auth-success {
  color: var(--accent);
  font-size: 13px;
  text-align: center;
  padding: 8px;
  background: var(--accent-bg);
  border-radius: 8px;
}

.auth-footer {
  display: flex;
  gap: 6px;
  font-size: 14px;
  color: var(--text-2);
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover {
  text-decoration: underline;
}

/* ── Auth Steps ────────────────────────────── */
.auth-steps {
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-steps .step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-3);
}

.auth-steps .step.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.auth-steps .step.done {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: var(--bg);
}

.auth-steps .step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
}

/* ── Auth Roles ────────────────────────────── */
.auth-roles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
}

.role-btn:hover, .role-btn:active {
  border-color: var(--accent);
  background: var(--surface2);
}

.role-btn i {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

.role-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 600;
  display: block;
}

.role-desc {
  font-size: 13px;
  color: var(--text-2);
  display: block;
  margin-top: 2px;
}

/* ── Register Player Page ─────────────────── */
.rp-container {
  max-width: 480px;
  margin: 0 auto;
}

.rp-header {
  text-align: center;
  margin-bottom: 20px;
}

.rp-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.rp-subtitle {
  font-size: 14px;
  color: var(--text-2);
}

.rp-results {
  max-height: 300px;
  overflow-y: auto;
}

.rp-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 6px;
  cursor: pointer;
}

.rp-result-row:hover { background: var(--surface2); }

.rp-result-info { flex: 1; min-width: 0; }

.rp-result-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-result-meta {
  font-size: 12px;
  color: var(--text-2);
}

.rp-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 13px;
}

.rp-divider::before,
.rp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.rp-form { display: flex; flex-direction: column; gap: 4px; }

.rp-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.rp-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}

.rp-section-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
}

.rp-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.rp-actions .btn { flex: 1; }

.rp-done {
  text-align: center;
  padding: 48px 16px;
}

.rp-done-icon {
  width: 64px;
  height: 64px;
  color: var(--accent);
  margin-bottom: 16px;
}

.rp-clear-club {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

/* ── My Page (Player Dashboard) ──────────── */
.my-wrapper {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.my-new-match {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

/* Pending coach request banner */
.my-pending-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  animation: bannerPulse 2s ease-in-out 1;
}
.my-pending-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}
.my-pending-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.my-pending-banner-names {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
}
@keyframes bannerPulse {
  0%,100% { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
  50% { border-color: var(--accent); }
}

.my-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.my-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.my-info h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.my-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.my-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.my-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.my-stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.my-stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.my-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.my-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.my-match-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.my-match-item:last-child { border-bottom: none; }

.my-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.my-dot.win { background: var(--accent); }
.my-dot.loss { background: var(--red); }

.my-match-details { flex: 1; min-width: 0; }

.my-match-opponent {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-match-date {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

.my-match-score {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-2);
  flex-shrink: 0;
}

.my-note-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.my-note-item:last-child { border-bottom: none; }

.my-note-text {
  font-size: 14px;
  color: var(--text);
  font-style: italic;
  line-height: 1.4;
}

.my-note-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.my-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-3);
  font-size: 14px;
}

.my-empty i {
  width: 32px;
  height: 32px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── iKort Loading ─────────────────────────── */
.ikort-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-2);
  font-size: 14px;
}

.ikort-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── iKort Verification Card ──────────────── */
.ikort-verify-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  transition: border-color 0.3s;
}

.ikort-verify-card.verified {
  border-color: var(--accent);
}

.ikort-verify-header {
  margin-bottom: 12px;
}

.ikort-verify-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.ikort-verify-subtitle {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.ikort-verify-data {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.verify-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

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

.verify-label {
  font-size: 13px;
  color: var(--text-2);
  flex-shrink: 0;
  min-width: 80px;
}

.verify-label::after {
  content: ':';
}

.verify-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.ikort-verify-actions {
  display: flex;
  gap: 8px;
}

.ikort-verify-actions .btn { flex: 1; }

/* ── iKort Verified Badge ─────────────────── */
.ikort-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.ikort-verified-badge i {
  width: 16px;
  height: 16px;
}

/* ── U18 PIN Gate ──────────────────────────── */
.pin-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px 16px;
}
.pin-gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}
.pin-gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.pin-gate-desc {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 8px;
  line-height: 1.5;
}
.pin-input {
  text-align: center;
  font-size: 24px;
  letter-spacing: 10px;
  font-family: 'DM Mono', monospace;
  font-weight: 600;
}
.pin-error {
  color: var(--red);
  font-size: 13px;
  margin: 8px 0;
  text-align: center;
}

/* ── Coach Setup Screen ────────────────────── */
.coach-setup {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px 16px;
}
.coach-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  overflow: visible;
}
.coach-setup-card .form-group {
  position: relative;
}
.coach-setup-card .dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.coach-setup-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.coach-setup-card p {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ── Settings Page ────────────────────────── */
.settings-page,
.settings-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card,
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.settings-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.settings-avatar-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.settings-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 28px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-form .form-group {
  position: relative;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-toggle-group {
  display: flex;
  gap: 8px;
}

.settings-toggle {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.settings-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.settings-relation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-relation-item:last-child {
  border-bottom: none;
}

.settings-relation-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.settings-relation-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-relation-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.settings-relation-status.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.settings-relation-status.pending {
  color: var(--orange);
  background: rgba(240, 168, 74, 0.15);
}

.settings-request-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.settings-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 8px 0;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.settings-logout-btn {
  color: var(--red) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.settings-row-label {
  font-size: 14px;
  color: var(--text);
}

.settings-row-value {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-danger-outline {
  border: 1.5px solid var(--red);
  color: var(--red);
  background: transparent;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-danger-outline:hover {
  background: var(--red-bg);
}

.settings-value-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.settings-list-item:last-child { border-bottom: none; }

.settings-list {
  display: flex;
  flex-direction: column;
}

.settings-list-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.settings-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-2);
  flex-shrink: 0;
}

.settings-list-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-list-sub {
  font-size: 12px;
  color: var(--text-3);
}

.settings-list-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.status-active {
  color: var(--accent);
  background: var(--accent-bg);
}

.status-pending {
  color: var(--orange);
  background: rgba(240, 168, 74, 0.15);
}

.status-pending_parent {
  color: var(--orange);
  background: rgba(240, 168, 74, 0.15);
}

/* ── Avatar Upload ────────────────────────── */
.avatar-clickable {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.2s;
}
.avatar-clickable:hover .avatar-overlay,
.avatar-clickable:active .avatar-overlay {
  opacity: 1;
}
.avatar-uploading {
  opacity: 0.5;
  pointer-events: none;
}
.avatar-uploading .avatar-overlay {
  opacity: 1;
}

/* ── Club Badge ──────────────────────────── */
.club-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(200, 240, 74, 0.1);
  border: 1px solid rgba(200, 240, 74, 0.2);
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════
   SEARCH PAGE
═══════════════════════════════════════════ */

.search-page {
  padding: 0 16px;
}

.search-box {
  margin-bottom: 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  padding-left: 40px !important;
  padding-right: 40px !important;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
}

.search-clear-btn:hover {
  background: var(--border);
}

.search-section {
  margin-bottom: 20px;
}

.search-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 12px;
}

.search-section-title i {
  width: 16px;
  height: 16px;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.15s;
}

.search-player-card:hover {
  background: var(--surface2);
}

.search-player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.search-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-player-info {
  flex: 1;
  min-width: 0;
}

.search-player-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-player-meta {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-player-action {
  flex-shrink: 0;
}

.search-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.search-status-badge.status-active {
  background: var(--accent-bg);
  color: var(--accent);
}

.search-status-badge.status-pending {
  background: rgba(240, 168, 74, 0.15);
  color: var(--orange);
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  text-align: center;
  color: var(--text-3);
}

.search-empty-state p {
  font-size: 14px;
  max-width: 280px;
}

.search-loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}

.search-no-results {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-3);
  font-size: 14px;
}

.search-no-results i {
  width: 18px;
  height: 18px;
}

.search-send-btn {
  white-space: nowrap;
}

.btn-accent {
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-accent:hover {
  opacity: 0.9;
}

/* ═══════════════════════════════════════════
   SERVE STATE BAR
═══════════════════════════════════════════ */

.serve-state-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  margin: 0 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.serve-state-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.serve-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background 0.2s;
}

.serve-state-dot.serve-first {
  background: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}

.serve-state-dot.serve-second {
  background: #ff9800;
  box-shadow: 0 0 6px rgba(255, 152, 0, 0.4);
}

.btn-fault {
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Barlow Condensed', sans-serif;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-fault:hover:not(:disabled) {
  background: rgba(255, 152, 0, 0.15);
  border-color: #ff9800;
  color: #ff9800;
}

.btn-fault:disabled {
  cursor: not-allowed;
}

.tag-btn.tag-ace {
  border-color: #4caf50;
  color: #4caf50;
}

.tag-btn.tag-ace.active {
  background: #4caf50;
  color: #fff;
}

/* ═══ Match Analysis ═══════════════════════════ */
#match-analysis {
  margin-top: 24px;
}

.analysis-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.analysis-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 0 0 12px 0;
}

/* Insights — BUG1 fix: target i/svg directly */
.analysis-insight-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  position: relative;
  padding-left: 18px;
}
.analysis-insight-row:last-child { border-bottom: none; }

.analysis-insight-row i,
.analysis-insight-row svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.analysis-insight-row.strength {
  border-left: 3px solid var(--accent);
  background: rgba(200, 240, 74, 0.04);
}
.analysis-insight-row.strength i,
.analysis-insight-row.strength svg { color: var(--accent); }

.analysis-insight-row.warning {
  border-left: 3px solid var(--red);
  background: rgba(240, 86, 74, 0.04);
}
.analysis-insight-row.warning i,
.analysis-insight-row.warning svg { color: var(--red); }

.analysis-insight-row.info {
  border-left: 3px solid transparent;
}
.analysis-insight-row.info i,
.analysis-insight-row.info svg { color: var(--text-2); }

/* Personality badge */
.analysis-personality-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  color: var(--accent);
  margin-bottom: 12px;
}

/* Overview caption */
.analysis-overview-caption {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  padding: 0 8px 12px;
  line-height: 1.4;
}

/* Bar track & fill */
.analysis-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface2);
  overflow: hidden;
  margin: 6px 0;
}
.analysis-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Stat grid (3 col) — BUG2 fix: analysis- prefixed selectors */
.analysis-stat-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.analysis-stat-row:first-child { border-top: none; }

.analysis-stat-left {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
}
.analysis-stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.analysis-stat-right {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  text-align: right;
}

/* Edge tag */
.analysis-edge-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-top: 3px;
  background: var(--accent);
  color: var(--bg);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.analysis-edge-tag.equal {
  background: var(--surface2);
  color: var(--text-3);
}

/* Momentum SVG */
.analysis-momentum-svg {
  width: 100%;
  height: auto;
  display: block;
}
.analysis-momentum-caption {
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
  padding: 0 8px;
}

/* Rally rows — BUG3 fix: analysis- prefixed selectors */
.analysis-rally-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.analysis-rally-label {
  width: 80px;
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}
.analysis-rally-bar {
  flex: 1;
}
.analysis-rally-value {
  width: 64px;
  text-align: right;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
}
.analysis-rally-summary {
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}
.analysis-rally-row.dominant .analysis-rally-label {
  color: var(--text);
  font-weight: 600;
}
.analysis-rally-row.dominant .analysis-rally-value {
  color: var(--text);
  font-weight: 600;
}

/* Mini chart row */
.analysis-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.analysis-chart-row svg {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 8px;
}
.analysis-chart-title {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
  text-align: center;
}

/* Aggression profile */
.aggression-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.aggression-row:last-child { border-bottom: none; }
.aggression-name {
  font-size: 12px;
  font-weight: 700;
  width: 50px;
}
.aggression-label {
  font-size: 11px;
  color: var(--text-2);
  flex: 1;
  text-align: center;
}
.aggression-nums {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  width: 60px;
  text-align: right;
}

/* Overview grid — BUG4 fix: analysis- prefixed selectors */
.analysis-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 0;
}
.analysis-overview-cell {
  text-align: center;
}
.analysis-overview-value {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
}
.analysis-overview-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 2px;
  letter-spacing: .04em;
}

/* Turning point card */
.analysis-turning-point {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--surface2);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.analysis-turning-point i,
.analysis-turning-point svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.analysis-turning-point span {
  font-size: 13px;
  color: var(--text);
  font-style: italic;
}

/* ── Top Summary ───────────────────────── */
.analysis-top-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  font-family: 'Barlow', sans-serif;
}

.analysis-top-summary i,
.analysis-top-summary svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.analysis-top-summary.win {
  background: rgba(200, 240, 74, 0.08);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.analysis-top-summary.win i,
.analysis-top-summary.win svg {
  color: var(--accent);
}

.analysis-top-summary.loss {
  background: rgba(240, 86, 74, 0.08);
  border: 1px solid var(--red);
  color: var(--red);
}

.analysis-top-summary.loss i,
.analysis-top-summary.loss svg {
  color: var(--red);
}

/* ── Insight Expand/Collapse ───────────── */
.analysis-insights-container .hidden-insight {
  display: none;
}

.analysis-insights-container.expanded .hidden-insight {
  display: flex;
}

.analysis-insight-toggle {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-top: 1px solid var(--border);
}

.analysis-insight-toggle:active {
  opacity: 0.7;
}

/* ── Serve Contextual Hint ──────────────── */
.analysis-serve-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
  border-top: 1px solid var(--border);
}

/* ── Set Insight Badge ──────────────────── */
.set-insight-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface2);
  color: var(--text-2);
  font-family: 'Barlow Condensed', sans-serif;
}

/* ── Charts reduced visual weight ───────── */
#match-analysis .analysis-section:last-child {
  opacity: 0.85;
}

/* ═══ Match Flow Chart ════════════════════════ */
.flow-chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.flow-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.flow-chart-svg .flow-zero-line {
  stroke: var(--border);
  stroke-dasharray: 4 3;
  stroke-width: 1;
}

.flow-chart-svg .flow-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.flow-chart-svg .flow-area-pos { fill: var(--accent); opacity: 0.1; }
.flow-chart-svg .flow-area-neg { fill: var(--red); opacity: 0.1; }

.flow-chart-svg .flow-set-line {
  stroke: var(--border);
  stroke-dasharray: 3 3;
  stroke-width: 1;
}

.flow-chart-svg .flow-set-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  fill: var(--text-3);
}

.flow-chart-svg .flow-dot {
  r: 3.5;
  stroke-width: 1.5;
  stroke: var(--surface);
}

.flow-chart-svg .flow-dot-player { fill: var(--accent); }
.flow-chart-svg .flow-dot-opponent { fill: var(--red); }

/* Flow Insight Cards */
.flow-insights-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.flow-insight-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
}

.flow-insight-card i,
.flow-insight-card svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.flow-insight-card.strength {
  border-left-color: var(--accent);
  background: rgba(200, 240, 74, 0.04);
}
.flow-insight-card.strength i,
.flow-insight-card.strength svg {
  color: var(--accent);
}

.flow-insight-card.warning {
  border-left-color: var(--red);
  background: rgba(240, 86, 74, 0.04);
}
.flow-insight-card.warning i,
.flow-insight-card.warning svg {
  color: var(--red);
}

.flow-insight-card.info {
  border-left-color: var(--border);
}
.flow-insight-card.info i,
.flow-insight-card.info svg {
  color: var(--text-2);
}

/* ═══ Scoring Flow Steps ══════════════════════ */
.tags-bar.flow-active,
.rally-bar.flow-active {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  animation: flow-pulse 0.3s ease;
}

@keyframes flow-pulse {
  0% { transform: scale(0.98); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.player-panel.flow-disabled {
  pointer-events: none;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

.skip-btn {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-3) !important;
  font-size: 12px;
}

.flow-step-label {
  text-align: center;
  font-size: 11px;
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0;
  animation: flow-pulse 0.3s ease;
}
