/* Rotation Manager — styles.css */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700&family=JetBrains+Mono:wght@400;600&display=swap');

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

:root {
  --bg: #0f1923;
  --bg2: #172a3a;
  --bg3: #1e3a4f;
  --fg: #e8eff5;
  --fg2: #8fa3b3;
  --accent: #00e676;
  --accent2: #00c853;
  --warn: #ff6e40;
  --danger: #ff5252;
  --gk: #fdd835;
  --check-fg: #0f1923;
  --clr-good: #00e676;
  --clr-warn: #fdd835;
  --clr-bad: #ff5252;
  --border: rgba(255,255,255,0.1);
  --border-subtle: rgba(255,255,255,0.06);
  --border-faint: rgba(255,255,255,0.04);
  --hover: rgba(255,255,255,0.03);
  --hover-strong: rgba(255,255,255,0.06);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-strong: 0 8px 24px rgba(0,0,0,0.5);
  --overlay: rgba(0,0,0,0.7);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* -- Light Theme -------------------------------- */
.theme-light {
  --bg: #f5f7fa;
  --bg2: #ffffff;
  --bg3: #e8ecf0;
  --fg: #1a2332;
  --fg2: #5a6b7a;
  --accent: #00b34a;
  --accent2: #009e42;
  --check-fg: #ffffff;
  --border: rgba(0,0,0,0.1);
  --border-subtle: rgba(0,0,0,0.06);
  --border-faint: rgba(0,0,0,0.04);
  --hover: rgba(0,0,0,0.03);
  --hover-strong: rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-strong: 0 8px 24px rgba(0,0,0,0.15);
  --overlay: rgba(0,0,0,0.5);
}

.colorblind {
  --clr-good: #42a5f5;
  --clr-warn: #ff9800;
  --clr-bad: #e53935;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

/* -- App Shell -------------------------------- */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
}

header {
  padding: calc(16px + var(--safe-top)) calc(20px + var(--safe-right)) 8px calc(20px + var(--safe-left));
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
}
header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
header .context-label {
  font-size: 12px;
  color: var(--fg2);
  background: var(--bg2);
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: auto;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
header .context-label:active { border-color: var(--accent); }

.donate-btn,
.donate-btn:link,
.donate-btn:visited {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.donate-btn:active {
  background: rgba(0,230,118,0.1);
}
.donate-menu {
  position: absolute; top: calc(100% + 2px); left: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 0;
  min-width: 110px; z-index: 50;
  box-shadow: var(--shadow);
  animation: fadeIn 0.12s ease-out;
}
.donate-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--fg);
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 9px 14px; cursor: pointer; text-decoration: none;
  transition: background 0.1s;
}
.donate-menu-item:active { background: var(--border-subtle); }

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

nav {
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
}
nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--fg2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s;
  position: relative;
}
nav button.active { color: var(--accent); }
nav button.active::after {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
nav button svg { width: 22px; height: 22px; }

/* -- Shared Components ------------------------ */
.card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg2);
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--check-fg); width: 100%; }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }
#generateBtn {
  position: sticky; bottom: 0; z-index: 10;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}
.btn-sm { font-size: 13px; padding: 8px 14px; }
.btn-outline { background: transparent; border: 1.5px solid var(--fg2); color: var(--fg); }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost {
  background: none; border: none; color: var(--fg2);
  padding: 6px 10px; font-family: inherit; cursor: pointer;
}

input, select {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* Safari iOS: date inputs use inline-flex with internal shadow DOM that ignores
   flex container constraints. -webkit-appearance:none strips Safari's special
   sizing. The native date picker still works (triggered by type="date"). */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-width: 0;
  box-sizing: border-box;
}
input[type="date"]::-webkit-datetime-edit {
  padding: 0;
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

/* Contain any remaining Safari date overflow at the flex child level */
.field-row > * {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--fg2); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}

.field-row { display: flex; gap: 10px; margin-bottom: 12px; }
.field-row > * { flex: 1; min-width: 0; }

.toggle-row {
  display: flex; align-items: center;
  justify-content: space-between; padding: 10px 0;
}
.toggle-row span { font-size: 14px; }
.toggle {
  width: 46px; height: 26px;
  background: var(--bg3); border-radius: 13px;
  position: relative; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0;
}
.toggle.on { background: var(--accent2); }
.toggle::after {
  content: ''; width: 20px; height: 20px;
  background: white; border-radius: 50%;
  position: absolute; top: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(20px); }

/* -- Roster Tab ------------------------------- */
.player-list { list-style: none; }
.player-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
}
.player-item:last-child { border-bottom: none; }
.player-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600;
  color: var(--fg2); width: 24px; text-align: center;
}
.player-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  color: var(--fg2); margin-left: 4px;
}
.player-name { flex: 1; font-weight: 500; }
.player-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg3); color: var(--fg2);
}
.badge.prefer { background: rgba(66,165,245,0.15); color: #42a5f5; }
.badge.strong { background: rgba(0,230,118,0.15); color: var(--accent); }
.badge.exclude { background: rgba(255,82,82,0.15); color: var(--danger); }

/* Backup indicator — amber dot on menu button */
.header-menu-btn.has-unsaved { position: relative; }
.header-menu-btn.has-unsaved::after {
  content: '';
  position: absolute; top: 2px; right: 4px;
  width: 7px; height: 7px;
  background: #ffc107; border-radius: 50%;
  pointer-events: none;
}
.backup-dot-inline {
  display: inline-block; width: 7px; height: 7px;
  background: #ffc107; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
}

.player-item .edit-btn {
  background: none; border: none; color: var(--fg2);
  cursor: pointer; padding: 6px; font-size: 16px; opacity: 0.6;
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--fg2); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* -- Archived & Unknown Players --------------- */
.player-unknown {
  color: var(--fg2); font-style: italic; opacity: 0.6;
}
.archived-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px; cursor: pointer;
  border-top: 1px solid var(--border-subtle);
  color: var(--fg2); font-size: 13px; font-weight: 600;
  user-select: none;
}
.archived-section-header:active { background: var(--bg3); }
.archived-chevron {
  font-size: 14px; transition: transform 0.15s;
  display: inline-block; width: 16px; text-align: center;
}
.archived-section-label { flex: 1; }
.archived-players-list {
  border-top: 1px solid var(--border-subtle);
}
.archived-player-item {
  opacity: 0.6;
}
.archived-player-item .archived-name {
  font-style: italic;
}
.archived-badge {
  font-size: 9px; font-style: italic; color: var(--fg2);
  margin-left: 4px; opacity: 0.7;
}
.archived-row { opacity: 0.55; }

/* -- Modal / Overlay -------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg2);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px; max-height: 85vh; max-height: 85dvh;
  overflow-y: auto; padding: 20px;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h2 {
  font-size: 18px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.modal .close-btn {
  background: none; border: none; color: var(--fg2);
  cursor: pointer; padding: 4px 8px;
  display: inline-flex; align-items: center;
}

/* Custom confirm/alert modal */
.modal-message {
  font-size: 14px;
  color: var(--fg2);
  line-height: 1.55;
  margin-bottom: 20px;
  white-space: pre-line;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-actions .btn {
  width: auto;
  min-width: 90px;
  text-align: center;
}

/* Edit Roster modal tabs */
.edit-roster-tabs {
  display: flex; gap: 0; margin-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.edit-roster-tab {
  flex: 1; background: none; border: none;
  color: var(--fg2); font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 10px 8px; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.edit-roster-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.weight-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 16px;
}
.weight-item {
  text-align: center; padding: 10px 4px;
  background: var(--bg); border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
  border: 1.5px solid transparent;
}
.weight-item.active { border-color: var(--accent); }
.weight-item .pos-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 600; color: var(--fg2); margin-bottom: 4px;
}
.weight-item select { width: 100%; font-size: 12px; padding: 4px; text-align: center; }

/* -- Game Day Tab ----------------------------- */
/* -- Pickup Columns (Game Day) -------------- */
.pickup-columns {
  display: flex; gap: 0;
  min-height: 200px;
}
.pickup-col {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pickup-col-left {
  flex: 0 0 38%; max-width: 38%;
  border-right: 1px solid var(--border-subtle);
}
.pickup-col-right {
  flex: 1; min-width: 0;
}
.pickup-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0;
  background: var(--bg2); z-index: 1;
}
.pickup-col-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--fg2);
}
.pickup-col-title-wrap {
  display: flex; flex-direction: column; gap: 1px;
}
.pickup-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600; margin-left: 4px;
}
.pickup-count.accent { color: var(--accent); }
.pickup-action {
  font-size: 11px; padding: 2px 6px;
  color: var(--accent); text-transform: none;
  letter-spacing: 0; font-weight: 600;
}
.pickup-list {
  list-style: none; overflow-y: auto;
  flex: 1;
}
.pickup-item {
  padding: 9px 10px;
  font-size: 13px; font-weight: 500;
  color: var(--fg);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background 0.1s;
  -webkit-user-select: none; user-select: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pickup-item:active { background: var(--hover); }
.pickup-item:last-child { border-bottom: none; }

.pickup-empty {
  font-size: 12px; color: var(--fg2); opacity: 0.5;
  text-align: center; padding: 20px 8px;
  font-style: italic;
}
.pickup-remove {
  background: none; border: none;
  color: var(--fg2); opacity: 0.4;
  font-size: 16px; line-height: 1;
  padding: 2px 4px; cursor: pointer;
  flex-shrink: 0; transition: opacity 0.1s;
}
.pickup-remove:active { opacity: 1; color: var(--danger); }

.available-list { list-style: none; overflow-y: auto; flex: 1; }
.available-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background 0.1s;
  -webkit-user-select: none; user-select: none;
}
.available-item:active { background: var(--hover); }
.available-item:last-child { border-bottom: none; }
.available-item.dragging { opacity: 0.3; }
.available-item.drag-over {
  border-top: 2px solid var(--accent);
  margin-top: -1px;
}
.available-item.swap-flash { animation: swapPulse 1.2s ease-out; }

.drag-handle {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 4px; margin-left: auto;
  color: var(--fg2); opacity: 0.4; cursor: grab;
  touch-action: none; flex-shrink: 0;
}
.drag-handle:active { opacity: 0.8; cursor: grabbing; }
.drag-handle svg { display: block; }

.drag-ghost {
  position: fixed; z-index: 150;
  pointer-events: none;
  background: var(--bg2);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  opacity: 0.9;
  box-shadow: var(--shadow-strong);
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
}

.pin-hint {
  font-size: 11px; color: var(--fg2); font-style: italic;
  padding: 0 4px 8px; opacity: 0.7;
}

.check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--fg2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.check.checked { background: var(--accent); border-color: var(--accent); }
.check.checked::after { content: '\2713'; color: var(--check-fg); font-size: 14px; font-weight: 700; }

.starter-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  border-radius: 4px; background: rgba(0,230,118,0.15); color: var(--accent);
}

.available-count { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--fg2); }
.available-count strong { color: var(--accent); font-size: 15px; }

/* -- Lock & Constraint Controls --------------- */
.lock-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 4px; background: rgba(255,193,7,0.15); color: #fdd835;
  border-left: 2px solid #fdd835;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.12s;
}
.lock-badge:active { background: rgba(255,193,7,0.3); }

.lock-picker {
  display: flex; flex-wrap: wrap; gap: 5px;
  width: 100%; padding: 8px 0 2px 4px;
}
.lock-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px;
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--fg2); cursor: pointer; transition: all 0.12s;
}
.lock-chip:active { transform: scale(0.95); }
.lock-chip.active {
  background: rgba(255,193,7,0.15); border-color: #fdd835; color: #fdd835;
}
.lock-chip.disabled {
  opacity: 0.25; pointer-events: none;
}
.available-item.picker-open {
  flex-wrap: wrap; background: var(--hover);
}
.available-item .player-name { cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.constraint-expand-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 2px; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.constraint-expand-row span { font-size: 14px; color: var(--fg2); }
.constraint-expand-row .caret {
  transition: transform 0.2s;
  display: inline-flex; align-items: center;
  margin-left: 4px;
}
.constraint-expand-row .caret svg { display: block; }
.constraint-expand-row.expanded .caret { transform: rotate(180deg); }
.constraint-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  background: var(--accent); color: var(--check-fg);
  padding: 1px 6px; border-radius: 10px;
  margin-left: 6px; min-width: 18px; text-align: center;
}

.constraint-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; gap: 10px;
}
.constraint-label {
  font-size: 13px; color: var(--fg); font-weight: 500;
  flex: 1; min-width: 0;
}
.constraint-sublabel {
  font-size: 11px; color: var(--fg2); font-weight: 400;
  margin-top: 1px;
}
.constraint-section-label {
  font-size: 13px; color: var(--fg); font-weight: 500;
  padding: 10px 0 4px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}
.constraint-pos-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 600; color: var(--fg2);
  min-width: 36px;
}
.constraint-hint {
  font-size: 11px; color: var(--fg2); font-style: italic;
  padding: 4px 0 2px; opacity: 0.7;
}

.tri-toggle {
  display: flex; border-radius: 6px; overflow: hidden;
  border: 1.5px solid var(--border);
}
.tri-opt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  padding: 6px 12px; background: var(--bg);
  color: var(--fg2); border: none; cursor: pointer;
  transition: all 0.12s; border-right: 1px solid var(--border-subtle);
}
.tri-opt:last-child { border-right: none; }
.tri-opt:active { background: var(--border-faint); }
.tri-opt.active {
  background: rgba(0,230,118,0.12); color: var(--accent);
}

/* -- Lineup Tab ------------------------------- */
.period-card { background: var(--bg2); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.period-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--hover);
  font-weight: 700; font-size: 14px;
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
.period-chevron {
  display: inline-block; margin-right: 6px;
  transition: transform 0.15s; font-size: 12px;
}
.period-chevron.collapsed { transform: rotate(-90deg); }
.period-body { padding: 8px 16px 12px; }
.rebalance-btn {
  background: none; border: none; color: var(--fg2);
  padding: 4px 6px; cursor: pointer; opacity: 0.4;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: opacity 0.15s, color 0.15s;
  margin-left: 8px; flex-shrink: 0;
}
.rebalance-btn:active { opacity: 1; color: var(--accent); }

.period-remove-btn {
  background: none; border: none; color: var(--fg2);
  padding: 4px 6px; cursor: pointer; opacity: 0.4;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: opacity 0.15s, color 0.15s;
  margin-left: 4px; flex-shrink: 0;
}
.period-remove-btn:active { opacity: 1; color: var(--danger); }

/* -- Stepper (reusable +/- control) -------------- */
.stepper {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px;
}
.stepper-btn {
  background: none; border: none; color: var(--fg);
  min-width: 36px; min-height: 36px;
  font-size: 18px; line-height: 1; cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.stepper-btn:active { background: var(--hover); color: var(--accent); }
.stepper-btn:disabled { opacity: 0.3; cursor: default; }
.stepper-label {
  min-width: 80px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--fg);
  padding: 0 4px; -webkit-user-select: none; user-select: none;
}

.add-period-btn {
  display: block; width: 100%;
  background: var(--bg2); border: 1.5px dashed var(--border);
  color: var(--fg2); font-size: 14px; font-weight: 600;
  padding: 12px; margin-top: 8px; margin-bottom: 16px; cursor: pointer;
  border-radius: var(--radius); font-family: 'DM Sans', sans-serif;
}
.add-period-btn:active { border-color: var(--accent); color: var(--accent); }

.summary-card.collapsed .summary-body { display: none; }
.summary-card .summary-header { cursor: pointer; }

/* -- Score Row (scrimmage + score) ---------------- */
.score-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; margin-bottom: 12px; min-height: 42px;
  background: var(--bg2); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.scrimmage-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px; color: var(--fg2);
  font-weight: 500;
  -webkit-user-select: none; user-select: none;
}
.score-nums {
  display: flex; align-items: center; gap: 10px;
}
.score-side {
  font-size: 14px; color: var(--fg2); font-weight: 500;
  display: inline-flex; align-items: center; gap: 3px;
  line-height: 1;
}
.score-side strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 700; color: var(--fg);
  line-height: 1;
}
.score-divider { color: var(--fg2); font-size: 14px; opacity: 0.5; }

/* -- Period Score (in header) --------------------- */
.period-score {
  font-size: 12px; font-weight: 500; color: var(--fg2);
  display: flex; align-items: center; gap: 5px;
}
.period-team-goals {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; color: var(--fg);
  min-width: 14px; text-align: center;
}
.period-score-sep { opacity: 0.4; }
.opp-counter {
  display: inline-flex; align-items: center; gap: 2px;
}
.opp-counter > span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; color: var(--fg);
  min-width: 14px; text-align: center;
}
.opp-btn {
  background: none; border: 1px solid var(--border);
  color: var(--fg2); font-size: 13px; font-weight: 700;
  width: 24px; height: 24px; border-radius: 4px;
  cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; transition: border-color 0.15s;
  -webkit-user-select: none; user-select: none;
}
.opp-btn:active { border-color: var(--accent); color: var(--accent); }

/* -- Goal Counter (on lineup rows) ---------------- */
.lineup-swap-target {
  display: flex; align-items: center; flex: 1; min-width: 0;
  cursor: pointer; padding: 2px 0; border-radius: 4px;
}
.lineup-swap-target:active { background: var(--border-faint); }
.goal-counter {
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0; margin-left: 4px;
}
.goal-btn {
  background: none; border: 1px solid var(--border);
  color: var(--fg2); font-size: 14px; font-weight: 700;
  width: 28px; height: 28px; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.12s;
  -webkit-user-select: none; user-select: none;
}
.goal-btn:active { border-color: var(--accent); color: var(--accent); background: rgba(0,230,118,0.08); }
.goal-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; color: var(--fg2);
  min-width: 20px; text-align: center;
}
.goal-count.has-goals { color: var(--accent); }

.lineup-row {
  display: flex; align-items: center; padding: 6px 4px;
  border-bottom: 1px solid var(--border-faint);
  transition: background 0.12s;
  border-radius: 4px;
  -webkit-user-select: none; user-select: none;
}
.lineup-row:last-child { border-bottom: none; }
.lineup-row.swap-selected {
  background: rgba(0,230,118,0.12);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.lineup-pos {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; width: 36px; color: var(--fg2);
}
.lineup-pos.gk { color: var(--gk); }
.lineup-name { font-weight: 500; flex: 1; }

.bench-row {
  padding: 8px 16px 10px; font-size: 13px; color: var(--fg2);
  background: var(--hover);
  border-top: 1px solid var(--border-faint);
}
.bench-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; margin-right: 8px;
}
.bench-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bench-chip {
  padding: 5px 10px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 6px;
  color: var(--fg2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.12s;
  -webkit-user-select: none; user-select: none;
}
.bench-chip:active { background: var(--border-subtle); }
.bench-chip.swap-selected { background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent); }
.bench-goal-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700; color: var(--accent);
  margin-left: 2px;
}

.swap-hint {
  text-align: center; font-size: 12px; color: var(--accent);
  padding: 6px 0 2px; font-weight: 600;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lineup-row.swap-flash { animation: swapPulse 1.2s ease-out; }
.bench-chip.swap-flash { animation: swapPulse 1.2s ease-out; }
@keyframes swapPulse {
  0%   { background: rgba(0,230,118,0.25); }
  40%  { background: rgba(0,230,118,0.15); }
  100% { background: transparent; }
}

.game-notes {
  width: 100%; min-height: 60px; max-height: 200px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--fg); font-family: 'DM Sans', sans-serif;
  font-size: 14px; line-height: 1.5; resize: vertical;
  outline: none; transition: border-color 0.15s;
}
.game-notes:focus { border-color: var(--accent); }
.game-notes::placeholder { color: var(--fg2); opacity: 0.5; }

.lineup-actions { display: flex; gap: 6px; position: relative; flex-shrink: 0; }
.lineup-header-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 12px;
}
.lineup-heading {
  min-width: 0; flex: 1;
}
.lineup-label-line {
  font-size: 13px; color: var(--fg2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.share-menu {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 0;
  min-width: 180px; z-index: 50;
  box-shadow: var(--shadow);
  animation: fadeIn 0.12s ease-out;
}
.share-menu.upward {
  top: auto; bottom: 100%;
  margin-top: 0; margin-bottom: 6px;
}
.share-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--fg);
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 16px; cursor: pointer; transition: background 0.1s;
}
.share-menu-item:active { background: var(--border-subtle); }
.share-menu-backdrop { position: fixed; inset: 0; z-index: 49; }

/* -- Lineup Heading & Game Navigation ------------- */
.lineup-heading.tappable {
  cursor: pointer; padding: 6px 10px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.lineup-heading.tappable:active { background: rgba(0,230,118,0.08); }

/* -- Game Picker Modal ----------------------------- */
.game-picker-list { display: flex; flex-direction: column; gap: 2px; }
.game-picker-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; background: none; border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; color: var(--fg);
  transition: background 0.1s; width: 100%;
}
.game-picker-row:active { background: var(--bg); }
.game-picker-active { background: var(--bg); }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat-card { background: var(--bg2); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat-num { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--fg2); margin-top: 2px; }

/* -- Season Tab ------------------------------- */
.season-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.season-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600; color: var(--fg2);
  text-align: center; padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2);
}
.season-table th:first-child { text-align: left; }
.season-table td {
  text-align: center; padding: 8px 4px;
  border-bottom: 1px solid var(--border-faint);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
}
.season-table td:first-child {
  text-align: left; font-family: 'DM Sans', sans-serif;
  font-weight: 500; font-size: 13px;
}

.game-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-subtle); gap: 6px;
}
.game-history-item:last-child { border-bottom: none; }
.game-history-item > div:first-child > div:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.fairness-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  border: 1.5px solid; flex-shrink: 0;
  background: rgba(0,0,0,0.15);
}
.wld-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  border: 1.5px solid; flex-shrink: 0;
  background: rgba(0,0,0,0.15);
  margin-right: 4px;
}

.chart-legend {
  display: flex; gap: 14px; margin: -4px 0 4px;
}
.chart-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--fg2); font-weight: 500;
}
.chart-legend-swatch {
  width: 10px; height: 10px; border-radius: 2px;
  flex-shrink: 0; opacity: 0.85;
}

.chart-subtitle {
  font-size: 11px; color: var(--fg2); opacity: 0.7;
  margin: -6px 0 10px; font-style: italic;
}

/* -- Season Sub-Tabs ------------------------------ */
.season-sub-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
}
.season-sub-tab {
  flex: 1; background: var(--bg2);
  border: 1.5px solid var(--border);
  color: var(--fg2); font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600; padding: 8px 4px;
  border-radius: var(--radius-sm); text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.season-sub-tab.active {
  background: rgba(0,230,118,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* -- Season Record -------------------------------- */
.season-record {
  display: flex; align-items: center; gap: 16px;
}
.season-record-games {
  display: flex; flex-direction: column; align-items: center;
}
.season-record-sep {
  width: 1px; height: 32px; background: var(--border);
  flex-shrink: 0;
}
.season-record-wld {
  display: flex; gap: 16px; flex: 1; justify-content: center;
}
.season-record-stat {
  display: flex; flex-direction: column; align-items: center;
}
.season-record-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 700; color: var(--fg);
  line-height: 1;
}
.season-record-num.win { color: var(--clr-good); }
.season-record-num.loss { color: var(--clr-bad); }
.season-record-num.draw { color: var(--clr-warn); }
.season-record-label {
  font-size: 11px; color: var(--fg2); margin-top: 3px;
}
.season-extra-stats {
  display: flex; justify-content: center; gap: 20px;
  padding-top: 12px; margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.season-extra-stat {
  display: flex; flex-direction: column; align-items: center;
}
.season-extra-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px; font-weight: 700; color: var(--fg);
  line-height: 1;
}
.season-extra-label {
  font-size: 10px; color: var(--fg2); margin-top: 3px;
  white-space: nowrap;
}

/* -- Context Picker --------------------------- */
.ctx-section { margin-bottom: 16px; }
.ctx-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--fg2); margin-bottom: 8px;
}
.ctx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ctx-chip {
  padding: 8px 14px; background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.ctx-chip:active { transform: scale(0.97); }
.ctx-chip.selected { border-color: var(--accent); background: rgba(0,230,118,0.08); color: var(--accent); }
.ctx-chip.add-new { border-style: dashed; color: var(--fg2); font-weight: 600; }
.ctx-divider { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }
.ctx-manage-btns { display: flex; gap: 8px; margin-top: 12px; }
.ctx-manage-btns .btn { flex: 1; }

/* -- Utility ---------------------------------- */
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--fg2); }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); color: var(--fg);
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; z-index: 200;
  animation: toastIn 0.2s ease-out, toastOut 0.3s ease-in 2.2s forwards;
  pointer-events: none; border: 1px solid var(--border);
  max-width: 90%; text-align: center;
}
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* -- Field Tab -------------------------------- */
.field-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.field-controls select { flex: 1; font-size: 13px; padding: 8px 10px; }
.field-controls .btn-icon, .plays-controls .btn-icon {
  background: var(--bg2); border: 1.5px solid var(--border);
  color: var(--fg2); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 16px; cursor: pointer;
  flex-shrink: 0; transition: border-color 0.15s;
}
.field-controls .btn-icon:active, .plays-controls .btn-icon:active { border-color: var(--accent); }
.field-controls .btn-icon.active-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,230,118,0.1);
}

.period-pills { display: flex; gap: 4px; margin-bottom: 10px; }
.period-pill {
  flex: 1; background: var(--bg2);
  border: 1.5px solid var(--border);
  color: var(--fg2); font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 600; padding: 7px 4px;
  border-radius: var(--radius-sm); text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.period-pill.active { background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent); }

.field-container {
  position: relative; width: auto; margin: 0 10px;
  border-radius: var(--radius); overflow: hidden;
  touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none;
}
.field-container svg { display: block; width: 100%; height: auto; pointer-events: none; }
.field-container .dot-group { cursor: default; }
.field-container .dot-group:active { cursor: default; }
.field-container .dot-hit { fill: transparent; }
.field-container .dot-circle { stroke: rgba(0,0,0,0.3); stroke-width: 0.8; transition: r 0.15s; }
.field-container .dot-circle.gk-dot { fill: var(--gk); }
.field-container .dot-circle.player-dot { fill: var(--accent); }
.field-container .dot-circle.template-dot { fill: var(--fg2); }
.field-container .dot-label {
  fill: var(--check-fg); font-family: 'JetBrains Mono', monospace;
  font-weight: 700; text-anchor: middle; pointer-events: none;
}
.field-container .dot-name {
  fill: var(--fg); font-family: 'DM Sans', sans-serif;
  font-weight: 600; text-anchor: middle; pointer-events: none;
}

.plays-controls {
  display: flex; gap: 6px; align-items: center; margin-bottom: 10px;
}
.plays-controls select {
  flex: 1; font-size: 13px; padding: 8px 10px;
  min-width: 0;
}
.plays-filter {
  flex: 0 0 auto; width: 90px; font-size: 12px; padding: 7px 8px;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg);
  font-family: 'DM Sans', sans-serif;
}
.plays-filter::placeholder { color: var(--fg2); opacity: 0.6; }
.plays-filter:focus { outline: none; border-color: var(--accent); }
.plays-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); min-width: 180px;
  box-shadow: var(--shadow-strong); z-index: 90;
  overflow: hidden;
}
.plays-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--fg);
  font-size: 13px; padding: 11px 14px; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}
.plays-menu-item:last-child { border-bottom: none; }
.plays-menu-item:active { background: var(--border-subtle); }
.plays-menu-danger { color: var(--danger); }

.field-container.draw-mode { cursor: crosshair; touch-action: none; }
.field-container.draw-mode .dot-group { cursor: crosshair; pointer-events: none; }
.draw-toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
  padding: 8px 10px; background: rgba(0,230,118,0.08);
  border: 1.5px solid rgba(0,230,118,0.2); border-radius: var(--radius-sm);
}
.draw-toolbar-label {
  flex: 1; font-size: 12px; font-weight: 600; color: var(--accent);
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-sm-outline {
  background: none; border: 1.5px solid var(--border);
  color: var(--fg2); font-size: 12px; padding: 5px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.btn-sm-outline:active { border-color: var(--accent); color: var(--accent); }
.btn-sm-outline:disabled { opacity: 0.3; cursor: default; }
.btn-sm-danger { color: var(--danger); border-color: rgba(255,82,82,0.25); }
.btn-sm-danger:active { border-color: var(--danger); color: var(--danger); }

.def-toolbar { background: rgba(255,82,82,0.08); border-color: rgba(255,82,82,0.2); }
.def-label { color: var(--danger) !important; }
.field-controls .btn-icon.def-active {
  border-color: var(--danger); color: var(--danger);
  background: rgba(255,82,82,0.1);
}

.zone-toolbar { background: rgba(66,133,244,0.08); border-color: rgba(66,133,244,0.2); }
.zone-toolbar .draw-toolbar-label { color: rgba(66,133,244,0.9); }
.zone-color-chip {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color 0.15s; flex-shrink: 0;
}
.zone-color-chip.active { border-color: var(--fg); }
.field-container .def-group { cursor: default; }
.field-container .def-group:active { cursor: default; }
.field-container .route-hit { cursor: pointer; pointer-events: auto; }
.field-container .route-path { pointer-events: none; }
.field-container .zone-hit { cursor: pointer; pointer-events: auto; }
.field-container .zone-path { pointer-events: none; }

/* HTML touch overlays — CSS touch-action works reliably on HTML elements */
.dot-overlay, .def-overlay {
  position: absolute;
  width: 56px; height: 56px;
  touch-action: none;
  pointer-events: auto;
  cursor: grab;
  transform: translate(-50%, -50%);
  background: transparent;
  z-index: 2;
  border-radius: 50%;
}
.dot-overlay:active, .def-overlay:active { cursor: grabbing; }
.field-container.draw-mode .dot-overlay,
.field-container.draw-mode .def-overlay { display: none; }

.field-bench {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  padding: 10px 12px; background: var(--bg2); border-radius: var(--radius-sm);
}
.field-bench-label {
  width: 100%; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600; color: var(--fg2);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;
}

.field-mode-label {
  text-align: center; font-size: 11px; color: var(--fg2);
  margin-top: 8px; font-style: italic;
}

/* -- About Modal ------------------------------ */
.about-section { margin-bottom: 16px; }
.about-section h3 { font-size: 14px; font-weight: 700; color: var(--fg); margin-bottom: 6px; }
.about-section p { font-size: 13px; color: var(--fg2); line-height: 1.5; }
.about-section ol { font-size: 13px; color: var(--fg2); line-height: 1.7; padding-left: 20px; }
.about-links {
  display: flex; gap: 20px; justify-content: center;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.about-links a {
  font-size: 13px; color: var(--accent); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.about-links a:active { opacity: 0.7; }
.about-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--fg2);
  text-align: center; margin-top: 16px; opacity: 0.6;
}

/* -- Header Menu ------------------------------ */
.header-menu-btn {
  background: none; border: none; color: var(--fg2);
  font-size: 22px; cursor: pointer; padding: 4px 8px;
  opacity: 0.7; transition: opacity 0.15s;
  line-height: 1;
}
.header-menu-btn:active { opacity: 1; color: var(--accent); }

.header-menu {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 0;
  min-width: 200px; z-index: 50;
  box-shadow: var(--shadow);
  animation: fadeIn 0.12s ease-out;
}
.header-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--fg);
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 16px; cursor: pointer; transition: background 0.1s;
}
.header-menu-item:active { background: var(--border-subtle); }
.header-menu-divider {
  height: 1px; background: var(--border-subtle);
  margin: 4px 0;
}
.header-menu-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--fg2); padding: 8px 16px 4px;
}
/* Standalone field sport selector */
.standalone-sport-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 0 0 8px 0;
}
.standalone-sport-row select {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 8px 10px;
}
.custom-count-label {
  flex: 1;
  font-size: 13px;
  color: var(--fg2);
  display: flex;
  align-items: center;
  padding-left: 4px;
}
/* Data action modals (backup/restore/share) */
.data-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.data-action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.data-action-btn:active:not(:disabled) {
  border-color: var(--accent);
  background: rgba(0,230,118,0.04);
}
.data-action-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.data-action-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.data-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}
.data-action-text strong {
  font-weight: 600;
}
.data-action-sub {
  font-size: 12px;
  color: var(--fg2);
  font-weight: 400;
}
/* Tab hints (first-use contextual tips) */
.tab-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(0,230,118,0.06);
  border: 1px solid rgba(0,230,118,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg2);
  line-height: 1.45;
  animation: hintFadeIn 0.3s ease-out;
}
.tab-hint span { flex: 1; }
.tab-hint strong { color: var(--fg); font-weight: 600; }
.tab-hint-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--fg2);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
}
.tab-hint-dismiss:active { opacity: 1; }
@keyframes hintFadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Context label pulse (first launch) */
.pulse-hint {
  animation: ctxPulse 2s ease-in-out infinite;
}
@keyframes ctxPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 4px rgba(0,230,118,0.25); }
}
/* Help modal */
.help-modal {
  max-height: 85vh; display: flex; flex-direction: column;
}
.help-search {
  margin-bottom: 12px; flex-shrink: 0;
}
.help-body {
  overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.help-section { margin-bottom: 16px; }
.help-section-title {
  font-size: 13px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.help-item { margin-bottom: 10px; }
.help-item-title {
  font-size: 13px; font-weight: 600; color: var(--fg);
  margin-bottom: 2px;
}
.help-item-desc {
  font-size: 12px; color: var(--fg2); line-height: 1.5;
}

/* Settings modal */
.settings-section {
  margin-bottom: 20px;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg2);
  margin-bottom: 10px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 12px;
  border-bottom: 1px solid var(--border-faint);
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}
.settings-row select {
  width: auto;
  min-width: 130px;
  font-size: 13px;
  padding: 7px 10px;
}
.settings-link {
  font-size: 13px; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.settings-link:active { opacity: 0.7; }

/* Update banner */
.update-banner {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 440px;
  background: var(--bg2); border: 1.5px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-strong);
  z-index: 200;
  display: flex; align-items: center; gap: 12px;
  animation: fadeIn 0.2s ease-out;
}
.update-banner-text {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.update-banner-text strong { font-size: 14px; font-weight: 700; color: var(--fg); }
.update-banner-text span { font-size: 12px; color: var(--fg2); }
.update-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.update-banner-actions .btn { padding: 6px 12px; font-size: 12px; }

/* Install banner */
.install-banner {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 440px;
  background: var(--bg2); border: 1.5px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-strong);
  z-index: 200;
  display: flex; align-items: center; gap: 12px;
  animation: fadeIn 0.2s ease-out;
}
.install-banner-text {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.install-banner-text strong { font-size: 14px; font-weight: 700; color: var(--fg); }
.install-banner-text span { font-size: 12px; color: var(--fg2); }
.install-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.install-banner-actions .btn { padding: 6px 12px; font-size: 12px; }

/* -- Lineup Header (lu- prefix) ----------------------- */
.lu-row1 {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.lu-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 6px;
  padding: 6px 10px; white-space: nowrap; flex-shrink: 0;
}
.lu-date.tappable { cursor: pointer; }
.lu-date.tappable:active { background: rgba(0,230,118,0.08); }
.lu-label {
  flex: 1; min-width: 0; width: auto;
  font-size: 14px; font-weight: 600; padding: 6px 10px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--fg);
  font-family: 'DM Sans', sans-serif;
}
.lu-label::placeholder { color: var(--fg2); font-weight: 400; }
.lu-row-even {
  display: flex; gap: 6px; margin-bottom: 8px;
}
.lu-row-even > * { flex: 1; }
.lu-btn-row {
  display: flex; gap: 6px; margin-bottom: 8px;
  justify-content: space-between;
}
.lu-btn-row .lu-btn-left { flex: 0 0 auto; }
.lu-btn-row .lu-btn-right { display: flex; gap: 6px; }
.lu-btn {
  padding: 7px 4px; font-size: 12px; font-weight: 600;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 6px; color: var(--fg2); cursor: pointer;
  text-align: center; transition: all 0.12s;
  font-family: 'DM Sans', sans-serif;
}
.lu-btn:active { border-color: var(--accent); color: var(--accent); }
.lu-btn.lu-btn-on {
  background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent);
}
.lu-mode {
  padding: 7px 4px; font-size: 12px; font-weight: 600;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 6px; color: var(--fg2); cursor: pointer;
  text-align: center; transition: all 0.12s;
  font-family: 'JetBrains Mono', monospace;
}
.lu-mode.active {
  background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent);
}
.lu-mode:not(.active):active { background: var(--hover-strong); }

/* -- Game Clock --------------------------------------- */
.lu-clock {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 12px; padding: 10px 14px;
  background: var(--bg2); border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.lu-clock-time {
  font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 600;
  color: var(--fg); min-width: 76px; text-align: center;
}
.lu-clock-time.running { color: var(--accent); }
.lu-clock-time.done { animation: clockPulse 1s ease-in-out infinite; }
@keyframes clockPulse {
  0%, 100% { color: var(--danger); }
  50% { color: var(--fg); }
}
.lu-clock-sep {
  font-size: 20px; color: var(--fg2); margin: 0 2px;
}
.lu-clock-dur {
  font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600;
  color: var(--accent); background: transparent; border: 1px solid var(--accent);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.lu-clock-dur:active { background: rgba(0,230,118,0.1); }
.lu-clock-btn {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--fg2); font-size: 20px;
  width: 48px; height: 48px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; text-align: center;
}
.lu-clock-btn:active { border-color: var(--accent); color: var(--accent); }

/* -- Lineup Section Header ---------------------------- */
.lu-lineup-hdr {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 8px; padding: 0 2px;
}

/* -- Position Color Bar & Slot Timeline --------------- */
.pos-color-bar {
  width: 3px; align-self: stretch; min-height: 24px;
  border-radius: 2px; margin-right: 4px;
  flex-shrink: 0; flex-grow: 0;
}
.slot-timeline {
  display: flex; height: 12px; border-radius: 3px; overflow: hidden;
  flex: 0 0 60px; align-self: center; margin: 0 8px;
  background: var(--bg); border: 1px solid var(--border-faint);
}
.tl-seg { display: block; min-width: 1px; opacity: 0.7; }
.tl-gap { background: transparent !important; opacity: 1; }

.slot-timeline { cursor: pointer; }
.slot-timeline:active { opacity: 0.7; }

/* -- Player Time Detail Popup --------------------- */
.ptp-popup {
  max-width: 380px; width: calc(100% - 32px);
  padding: 16px 14px 12px;
  max-height: 85vh; overflow-y: auto;
}
.ptp-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.ptp-name { font-size: 15px; font-weight: 700; color: var(--fg); }
.ptp-time-toggle {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  color: var(--accent); background: transparent; border: 1px solid var(--accent);
  border-radius: 4px; padding: 2px 6px; cursor: pointer;
}
.ptp-time-toggle:active { background: rgba(0,230,118,0.1); }
.ptp-period-block {
  margin-bottom: 10px; padding: 8px; border-radius: 6px;
  background: var(--bg);
}
.ptp-period-block.ptp-current {
  border: 1.5px solid var(--accent);
}
.ptp-period-hdr {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--fg);
}
.ptp-period-stat {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  font-weight: 600; color: var(--fg2);
}
.ptp-bar-wrap {
  position: relative; margin-bottom: 4px;
}
.ptp-bar {
  display: flex; height: 16px; border-radius: 3px; overflow: hidden;
  background: var(--bg3); border: 1px solid var(--border-faint);
  position: relative;
}
.ptp-ticks {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.ptp-tick {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--bg2); transform: translateX(-0.5px);
}
.ptp-seg { display: block; min-width: 1px; opacity: 0.75; }
.ptp-gap { background: transparent !important; opacity: 1; }
.ptp-markers {
  position: relative; height: 14px; margin-top: 1px;
}
.ptp-marker {
  position: absolute; transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace; font-size: 8px;
  color: var(--fg2); white-space: nowrap;
}
.ptp-details { margin-top: 4px; }
.ptp-detail-row {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 0; font-size: 12px;
}
.ptp-swatch {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.ptp-pos {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  font-weight: 600; color: var(--fg2); width: 24px;
}
.ptp-range {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--fg); flex: 1;
}
.ptp-pct {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); font-weight: 600;
}
.ptp-bench-note {
  font-size: 11px; color: var(--fg2); font-style: italic; padding: 2px 0;
}
.ptp-game-total {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--fg); text-align: center;
  padding: 8px 0 4px; border-top: 1px solid var(--border);
  margin-top: 4px;
}
.ptp-reset-btn {
  display: block; margin: 4px 0 0 auto; font-size: 10px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; color: var(--fg2); padding: 3px 8px;
  cursor: pointer;
}
.ptp-reset-btn:active { border-color: var(--danger); color: var(--danger); }
.ptp-reset-all {
  width: 100%; font-size: 12px; padding: 8px;
  background: transparent; border: 1px solid var(--danger);
  border-radius: 6px; color: var(--danger); cursor: pointer;
  margin: 8px 0 4px;
}
.ptp-reset-all:active { background: rgba(255,82,82,0.1); }

/* -- Bench Chip with External Bar --------------------- */
.bench-chip-wrap {
  display: flex; flex-direction: column; align-items: stretch;
}
.bench-bar-wrap {
  height: 4px; margin-top: 3px; border-radius: 2px;
  background: var(--bg3); cursor: pointer; overflow: hidden;
}
.bench-bar-wrap:active { opacity: 0.7; }
.bench-time-bar-ext {
  display: block; height: 100%; background: var(--accent); opacity: 0.6;
  border-radius: 2px;
}

/* -- Sub Popup ---------------------------------------- */
.sub-popup {
  max-width: 340px; width: calc(100% - 32px);
  padding: 18px 16px 14px;
}
.sub-header {
  font-size: 14px; font-weight: 600; color: var(--fg);
  margin-bottom: 12px; text-align: center; line-height: 1.4;
}
.sub-arrow { color: var(--fg2); margin: 0 2px; }
.sub-pos-label {
  display: inline-block; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--fg2); background: var(--bg3);
  border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle;
}
.sub-time-options {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.sub-exact-swap-btn {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  padding: 8px 12px; font-size: 13px;
}
.sub-time-opt {
  flex: 1; padding: 10px 2px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg);
  font-size: 15px; font-weight: 600; cursor: pointer;
  text-align: center; transition: all 0.12s;
  font-family: 'DM Sans', sans-serif;
}
.sub-time-opt.active {
  background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent);
}
.sub-time-opt:active { background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent); }
.sub-time-opt:disabled { opacity: 0.2; cursor: default; pointer-events: none; }
.sub-confirm-main {
  width: 100%; padding: 10px; margin-bottom: 4px;
}
.sub-reset-link {
  display: block; width: 100%; padding: 6px;
  background: none; border: none; color: var(--fg2);
  font-size: 11px; cursor: pointer; text-align: center;
  font-family: 'DM Sans', sans-serif; opacity: 0.7;
}
.sub-reset-link:active { color: var(--accent); opacity: 1; }
.frac-time {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 400; color: var(--accent);
  margin-top: 2px; opacity: 0.8;
}
.sub-divider {
  text-align: center; font-size: 11px; color: var(--fg2);
  margin: 8px 0; position: relative; display: none;
}
.sub-stepper {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; margin-bottom: 8px;
  position: relative;
}
.sub-step-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--fg); font-size: 18px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; transition: all 0.12s;
}
.sub-step-btn:active { border-color: var(--accent); color: var(--accent); }
.sub-time-display {
  font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600;
  color: var(--fg); min-width: 64px; text-align: center;
}
.sub-inc-row {
  display: flex; gap: 4px; justify-content: center; margin-bottom: 10px;
}
.sub-inc {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 3px 8px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--fg2); cursor: pointer; transition: all 0.12s;
}
.sub-inc.active { background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent); }
.sub-time-label {
  text-align: center; font-size: 11px; color: var(--fg2); margin-bottom: 6px;
}
.sub-time-toggle {
  background: none; border: 1px solid var(--border); border-radius: 3px;
  color: var(--fg2); font-size: 11px; padding: 1px 4px; cursor: pointer;
  margin-left: 4px; vertical-align: middle;
}

/* -- Duration Input Fields ----------------------------- */
.dur-input-row {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin: 16px 0;
}
.dur-field {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dur-step {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  color: var(--fg2); font-size: 10px; width: 48px; height: 24px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.dur-step:active { border-color: var(--accent); color: var(--accent); }
.dur-num {
  font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700;
  text-align: center; width: 48px; padding: 4px;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 6px;
  color: var(--fg); -moz-appearance: textfield;
}
.dur-num::-webkit-outer-spin-button,
.dur-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dur-label { font-size: 10px; color: var(--fg2); }
.dur-colon {
  font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700;
  color: var(--fg2); margin: 0 2px; align-self: center;
}
.dur-compact {
  display: flex; align-items: center; gap: 2px;
}
.dur-compact span {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--fg2);
}
.dur-num-sm {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
  text-align: center; width: 36px; padding: 5px 2px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  color: var(--fg); -moz-appearance: textfield;
}
.dur-num-sm::-webkit-outer-spin-button,
.dur-num-sm::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sub-cancel {
  display: block; width: 100%; margin-top: 8px; padding: 8px;
  background: none; border: none; color: var(--fg2);
  font-size: 13px; cursor: pointer; text-align: center;
  font-family: 'DM Sans', sans-serif;
}
.sub-precision-row {
  display: flex; gap: 4px; justify-content: center; margin-bottom: 10px;
}
.sub-precision-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
  padding: 4px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--fg2); cursor: pointer; transition: all 0.12s;
}
.sub-precision-btn.active {
  background: rgba(0,230,118,0.12); border-color: var(--accent); color: var(--accent);
}

/* -- Required Field Validation ------------------------- */
.field-required::after {
  content: ' *'; color: var(--danger); font-weight: 400;
}
@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.field-invalid {
  border-color: var(--danger) !important;
  animation: fieldShake 0.3s ease-out;
}
