:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3347;
  --text: #e4e6f0;
  --text-dim: #8b8fa3;
  --accent: #6c5ce7;
  --accent-hover: #7c6df7;
  --success: #00b894;
  --error: #d63031;
  --warning: #fdcb6e;
  --selected-bg: rgba(108, 92, 231, 0.15);
  --selected-border: rgba(108, 92, 231, 0.4);
  --radius: 8px;
}

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

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

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 20;
}
.header h1 { font-size: 23px; font-weight: 600; letter-spacing: -0.3px; }
.header .subtitle { color: var(--text-dim); font-size: 15px; }
.header .app-version {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--border);
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.3px;
}
.header-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.header-right { display: flex; align-items: center; gap: 10px; }

/* Shown when the SSE ``ready`` frame reports a newer APP_VERSION than
   the one this page was rendered with. One-click reload — the bar
   closes itself on reload so there's no dismiss affordance. */
.update-available-bar {
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: center;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--accent-hover);
  transition: background 0.12s ease;
}
.update-available-bar:hover { background: var(--accent-hover); }
.update-available-bar:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }

/* Full-screen sync buffer overlay — blocks the whole UI while the
   initial data sync is in progress so partial content isn't rendered
   behind loading text. */
.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sync-fade-in 0.15s ease-out;
}
@keyframes sync-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.sync-overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 40px;
  min-width: 280px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.sync-overlay-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 18px;
  border: 3px solid rgba(108, 92, 231, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.sync-overlay-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.sync-overlay-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.sync-overlay-version {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 8px;
  display: inline-block;
  letter-spacing: 0.3px;
  opacity: 0.85;
}
.sync-error-card {
  border-color: #e74c3c;
}
.sync-error-card .sync-overlay-title {
  color: #e74c3c;
}
.sync-error-phase-row {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.sync-error-phase-row #sync-error-phase {
  color: var(--text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.sync-error-actions {
  margin-top: 18px;
}

/* Startup sync indicator */
.startup-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--accent);
  font-weight: 500;
}
.startup-sync .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* Session bar */
.session-id {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 15px;
  color: var(--accent);
  background: rgba(108,92,231,0.12);
  padding: 4px 10px;
  border-radius: var(--radius);
  letter-spacing: 1px;
  font-weight: 600;
  user-select: all;
}
/* Top-bar menu button + dropdown */
.app-menu-wrapper {
  position: relative;
}
.menu-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-btn:hover { border-color: var(--accent); color: var(--text); }
.menu-btn svg { fill: currentColor; }
.app-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 180px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  flex-direction: column;
}
.app-menu.visible { display: flex; }
.app-menu-item {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.app-menu-item:hover { background: rgba(108,92,231,0.15); color: var(--text); }
.app-menu-item.danger { color: #e74c3c; }
.app-menu-item.danger:hover { background: rgba(231,76,60,0.12); color: #ff6b5d; }

/* Admin menu trigger — labelled pill button so it reads as a separate
   entry point from the hamburger menu. Hidden by default; shown only
   when the session is flagged admin. */
.menu-btn.admin-menu-btn {
  width: auto;
  padding: 0 10px;
  height: 32px;
  background: rgba(108,92,231,0.14);
  border: 1px solid rgba(108,92,231,0.45);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.menu-btn.admin-menu-btn:hover { background: rgba(108,92,231,0.25); }
.admin-menu-label { font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }

/* GW periodic-tick status badge inside the Admin dropdown. Sits in a
 * divider row above the Stop/Resume buttons; left label is muted, right
 * badge color-codes the live state (green = running, amber = paused). */
.app-menu .app-menu-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted, #9aa0a6);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  cursor: default;
}
.app-menu .app-menu-divider .admin-menu-label {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted, #9aa0a6);
}
.admin-gw-tick-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.admin-gw-tick-badge.running {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}
.admin-gw-tick-badge.paused {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.4);
}

/* Help modal layout */
.help-layout {
  display: flex;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.help-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  min-width: 130px;
  max-width: 130px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px 0 0 8px;
  overflow-y: auto;
  flex-shrink: 0;
}
.help-nav a {
  font-size: 12.5px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.3;
}
.help-nav a:hover {
  color: var(--accent);
  background: rgba(108,92,231,0.1);
}
.help-nav a.active {
  color: var(--accent);
  background: rgba(108,92,231,0.15);
  font-weight: 600;
}
.help-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 0;
}
.modal-wide > .modal-actions {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
  flex-shrink: 0;
}

/* Help modal content */
.help-section { margin-bottom: 16px; scroll-margin-top: 8px; }
.help-section:last-child { margin-bottom: 0; }
.help-section h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.help-section p, .help-section li {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.6;
}
.help-section ul {
  list-style: none;
  padding: 0;
}
.help-section li::before {
  content: "\2022";
  color: var(--accent);
  font-weight: 700;
  display: inline-block;
  width: 14px;
}
.help-section kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--text);
}

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  min-width: 340px;
  max-width: 420px;
}
.modal.modal-wide {
  max-width: 720px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal.modal-wide > h3 {
  flex-shrink: 0;
  margin-bottom: 10px;
}
.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal p {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal input[type="text"],
.modal input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}
.modal input:focus { border-color: var(--accent); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}
.modal-btn.primary {
  background: var(--accent);
  color: white;
}
.modal-btn.primary:hover { background: var(--accent-hover); }
.modal-btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.modal-btn.secondary:hover { border-color: var(--accent); color: var(--text); }
.modal-btn.danger {
  background: #c0392b;
  color: white;
}
.modal-btn.danger:hover { background: #e74c3c; }
.modal-btn.danger:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-status {
  font-size: 14px;
  margin-top: 10px;
  min-height: 18px;
}
.modal-status.success { color: var(--success); }
.modal-status.error { color: var(--error); }
.modal .session-display {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 21px;
  color: var(--accent);
  background: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  text-align: center;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 14px;
  user-select: all;
}

/* Layout — 3 columns: config | output | selection */
.container-wrapper {
  margin: 0;
  padding: 24px max(24px, calc((100vw - 1800px) / 2));
  padding-bottom: 0;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}
.container {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 400px;
}
.container > .config-panel {
  width: 300px;
  min-width: 250px;
  flex-shrink: 0;
}
.container > .output-panel {
  flex: 1;
  min-width: 350px;
  width: 1000px;
  flex-shrink: 0
}
.container > .selection-panel {
  width: 350px;
  min-width: 280px;
  flex-shrink: 0;
}

/* Bottom resize handle for height */
.resize-handle-bottom {
  height: 6px;
  cursor: row-resize;
  background: transparent;
  position: relative;
  flex-shrink: 0;
  z-index: 5;
  transition: background 0.15s;
}
.resize-handle-bottom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 2px;
  width: 32px;
  border-radius: 1px;
  background: var(--border);
  opacity: 0;
  transition: opacity 0.2s, width 0.2s;
}
.resize-handle-bottom:hover::after,
.resize-handle-bottom.dragging::after {
  opacity: 1;
  width: 48px;
}
.resize-handle-bottom:hover {
  background: rgba(108, 92, 231, 0.08);
}
.resize-handle-bottom.dragging {
  background: rgba(108, 92, 231, 0.15);
}

/* Drag handles between panels */
.resize-handle {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  flex-shrink: 0;
  z-index: 5;
  transition: background 0.15s;
}
.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: var(--border);
  opacity: 0;
  transition: opacity 0.2s, height 0.2s;
}
.resize-handle:hover::after,
.resize-handle.dragging::after {
  opacity: 1;
  height: 48px;
}
.resize-handle:hover {
  background: rgba(108, 92, 231, 0.08);
}
.resize-handle.dragging {
  background: rgba(108, 92, 231, 0.15);
}

/* Edge resize handles (outer edges of config & selection panels) */
.resize-handle-edge {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  flex-shrink: 0;
  z-index: 5;
  transition: background 0.15s;
}
.resize-handle-edge::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: var(--border);
  opacity: 0;
  transition: opacity 0.2s, height 0.2s;
}
.resize-handle-edge:hover::after,
.resize-handle-edge.dragging::after {
  opacity: 1;
  height: 48px;
}
.resize-handle-edge:hover {
  background: rgba(108, 92, 231, 0.08);
}
.resize-handle-edge.dragging {
  background: rgba(108, 92, 231, 0.15);
}

/* Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 250px;
  width: 350px;
  flex-shrink: 0
}
.panel-title {
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.panel-body {
  padding: 18px;
  flex: 1;
  overflow-y: auto;
}

/* Form controls */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.kelly-toggle {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  vertical-align: middle;
  transition: border-color 0.15s, color 0.15s;
}
.kelly-toggle:hover { color: var(--text); border-color: var(--text-dim); }
.kelly-toggle.active { color: var(--accent, #27ae60); border-color: var(--accent, #27ae60); }

.kelly-panel {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.kelly-panel .kelly-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.kelly-panel .kelly-row label {
  flex: 1;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.kelly-panel input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
}
.kelly-panel .kelly-result {
  padding: 8px 10px;
  background: rgba(39, 174, 96, 0.08);
  border-left: 3px solid #27ae60;
  border-radius: 3px;
  font-size: 13px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--text);
  margin-bottom: 4px;
}
.kelly-panel .kelly-result.kelly-neg {
  background: rgba(231, 76, 60, 0.08);
  border-left-color: #e74c3c;
}
.kelly-panel .kelly-hint { font-size: 11px; margin-top: 4px; }

/* Odds Converter — three live-linked inputs (American / Decimal / Implied %).
   Sits between the config selectors and the Generate button so users can
   convert any sportsbook number on the fly without leaving the form. */
.odds-converter {
  margin-top: 10px;
}
.odds-converter-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.odds-converter-row label {
  flex: 1;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.odds-converter-row input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
}
.field select,
.field input[type="text"],
.field input[type="date"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}
.field input[type="date"] {
  color-scheme: dark;
}
.field select:focus,
.field input:focus { border-color: var(--accent); }
.field select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238b8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.field input::placeholder { color: var(--text-dim); opacity: 0.6; }

/* Checkbox */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.checkbox-field input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-field label { font-size: 15px; color: var(--text); cursor: pointer; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Run button */
.run-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.run-btn:hover:not(:disabled) { background: var(--accent-hover); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cancel-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.cancel-row .cancel-btn { flex: 1; }
.cancel-btn {
  padding: 12px 18px;
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cancel-btn:hover:not(:disabled) { background: rgba(214,48,49,0.12); }
.cancel-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.jackpot-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.jackpot-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.jackpot-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #e67e22, #d35400);
  box-shadow: 0 2px 12px rgba(243, 156, 18, 0.35);
}
.jackpot-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.jackpot-warning {
  font-size: 13px;
  color: var(--warning);
  margin-top: 6px;
  line-height: 1.4;
  text-align: center;
}
.jackpot-settings { margin-top: 10px; }
.jackpot-settings-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.jackpot-settings-toggle:hover { color: var(--text); }
.jackpot-settings-toggle .toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.jackpot-settings-toggle.open .toggle-arrow { transform: rotate(180deg); }

/* Strategy generation block. One Generate button + global
   line-style/legs/auto-pick controls feed Strategies + Jackpot. */
.parlay-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.parlay-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  text-align: center;
  padding: 4px 0 2px;
}
.parlay-btn {
  width: 100%;
  padding: 12px;
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
  background: linear-gradient(135deg, #6f42c1, #8e44ad);
}
.parlay-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a32a3, #6f42c1);
  box-shadow: 0 2px 12px rgba(142, 68, 173, 0.35);
}
.parlay-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.parlay-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
  text-align: center;
  padding: 0 4px;
}
/* Keep the explicit summary lines without clipping text or shrinking the type. */
#parlay-desc, #jackpot-warning { white-space: pre-line; }
/* Line Style selector fixed width — visual unification per the
   rebuild spec. */
.parlay-selector-row select.parlay-selector {
  min-width: 180px;
  width: 180px;
}
/* Centered settings dropdown — toggle button and expanded panel both
   pin to the column center for a balanced look. Applies to BOTH the
   Strategy settings AND the Jackpot settings dropdown via the
   shared ``.centered-settings`` class. */
.centered-settings {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.centered-settings > .trust-settings-toggle,
.centered-settings > .jackpot-settings-toggle {
  justify-content: center;
}
.centered-settings > .trust-settings-panel,
.centered-settings > .jackpot-settings-panel {
  width: 100%;
}
.trust-settings-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.trust-settings-toggle:hover { color: var(--text); }
.trust-settings-toggle .toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.trust-settings-toggle.open .toggle-arrow { transform: rotate(180deg); }
.trust-settings-panel,
.jackpot-settings-panel {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trust-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.trust-setting-row label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.trust-setting-row select {
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.trust-setting-row select option {
  background: #000;
  color: #fff;
}
.trust-setting-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
/* Bookmaker pool (7.7.0, REDO_PLAN §7 G5). Multi-select of the books
   observed on the board + an "All bookmakers" master. Wraps rather than
   scrolls: the whole set is small (3 today) and a hidden checkbox in a
   scroll region is a selection the user cannot see they made. */
.book-pool-row {
  align-items: flex-start;
}
.book-pool-row > label {
  padding-top: 4px;
}
.book-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 10px;
  min-width: 0;
  flex: 1;
}
.book-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.book-chip input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
/* The master reads as the default state, so it is de-emphasised rather
   than highlighted — ALL is not a setting the user has to defend. */
.book-chip-all {
  color: var(--muted);
  font-weight: 500;
}
.trust-prob-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
/* Custom range slider */
.trust-prob-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}
.trust-prob-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #27ae60;
  border: 2px solid var(--surface);
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.5);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.trust-prob-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(39, 174, 96, 0.7);
}
.trust-prob-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #27ae60;
  border: 2px solid var(--surface);
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.5);
  cursor: pointer;
}
.trust-prob-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}
/* Probability badge */
.trust-prob-value {
  font-size: 13px;
  font-weight: 600;
  min-width: 42px;
  flex-shrink: 0;
  text-align: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(39, 174, 96, 0.15);
  color: #2ecc71;
  transition: background 0.2s, color 0.2s;
}
.trust-prob-value.prob-low {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}
.trust-prob-value.prob-high {
  background: rgba(39, 174, 96, 0.2);
  color: #2ecc71;
}

/* Hidden sections */
.options-section { display: none; }
.options-section.visible { display: block; }

/* Collapsible section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
  margin-bottom: 12px;
}
.section-header .section-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.section-header .section-arrow {
  display: flex;
  align-items: center;
}
.section-header .section-arrow svg {
  width: 10px; height: 10px;
  fill: var(--text-dim);
  transition: transform 0.15s;
}
.section-header.collapsed .section-arrow svg {
  transform: rotate(-90deg);
}
.section-content {
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.section-header.collapsed + .section-content {
  max-height: 0 !important;
}

/* Status log */
#status-log {
  flex: 0 0 auto;
  min-height: 48px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: var(--text-dim);
}
#status-log:empty::before {
  content: "Output log...";
  color: var(--text-dim);
  opacity: 0.35;
  font-style: italic;
}
.log-entry { margin-bottom: 2px; display: flex; gap: 8px; }
.log-entry .log-time {
  color: var(--text-dim);
  opacity: 0.5;
  flex-shrink: 0;
  user-select: none;
}
.log-entry .log-msg { flex: 1; }
.log-entry.error .log-msg { color: var(--error); }
.log-entry.success .log-msg { color: var(--success); font-weight: 600; }
.log-entry.info .log-msg { color: var(--accent); }
.log-entry.phase {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.log-entry.phase .log-msg {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
}
.log-entry.summary {
  margin-top: 4px;
  padding: 6px 8px;
  background: rgba(108, 92, 231, 0.08);
  border-radius: 4px;
  border-left: 3px solid var(--success);
}
.log-entry.summary .log-msg { color: var(--text); }

/* Output panel body — flex column so #result-area fills remaining space */
.output-panel .panel-body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Parlay history list */
#parlay-list {
  display: none;
  margin-bottom: 14px;
  flex-shrink: 0;
}
#parlay-list.visible { display: block; }
.parlay-list-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.parlay-list-items {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}
/* Scrollbar styling — always visible when content overflows */
.parlay-list-items::-webkit-scrollbar {
  height: 6px;
}
.parlay-list-items::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 3px;
}
.parlay-list-items::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.parlay-list-items::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}
/* Firefox scrollbar */
.parlay-list-items {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface2);
}
.parlay-chip {
  padding: 5px 10px;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.parlay-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.parlay-chip.active {
  background: var(--selected-bg);
  border-color: var(--accent);
  color: var(--text);
}
.parlay-chip.delete-selected {
  background: rgba(220, 38, 38, 0.15);
  border-color: #dc2626;
  color: #dc2626;
}
.delete-mode .parlay-chip:hover {
  border-color: #dc2626;
  color: #dc2626;
}
.delete-mode .parlay-chip.active {
  background: var(--selected-bg);
  border-color: var(--accent);
  color: var(--text);
}
/* Download-mode mirror: accent-tinted selection + hover. */
.parlay-chip.download-selected {
  background: rgba(108, 92, 231, 0.18);
  border-color: var(--accent);
  color: #c4b5fd;
}
.download-mode .parlay-chip:hover {
  border-color: var(--accent);
  color: #c4b5fd;
}
.download-mode .parlay-chip.active {
  background: var(--selected-bg);
  border-color: var(--accent);
  color: var(--text);
}
/* Risk-tier pill inside a parlay chip (6.32.0) — small translucent
 * badge appended by ``applyParlayChipDisplay`` when the parlay has a
 * known risk tier (doc ``risk`` field or filename tag). Neutral
 * translucent grey + ``color: inherit`` so it stays readable over the
 * default, won (green), lost (red), unresolvable (amber), and split
 * chip backgrounds without competing with the grading colors. */
.parlay-chip .risk-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 16px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.25);
  color: inherit;
  vertical-align: 1px;
}
/* Parlay-grading outcome styling — auto-applied after all games end. */
.parlay-chip.parlay-won {
  background: #1b5e20;
  border-color: #2e7d32;
  color: #e8f5e9;
}
.parlay-chip.parlay-won:hover { border-color: #66bb6a; }
.parlay-chip.parlay-lost {
  background: #b71c1c;
  border-color: #c62828;
  color: #ffebee;
}
.parlay-chip.parlay-lost:hover { border-color: #ef5350; }
.parlay-chip.parlay-legacy {
  border-color: #9e9e9e;
  opacity: 0.85;
}
/* Graded but unresolvable — has a parlay-meta block (v2 parlay) but the
 * grader couldn't confirm every leg (missing player stats, rankings with
 * no concrete legs, etc.). Yellow signals "check this manually". */
.parlay-chip.parlay-unresolvable {
  background: #5d4e00;
  border-color: #f9a825;
  color: #fff8e1;
}
.parlay-chip.parlay-unresolvable:hover { border-color: #ffd54f; }
/* Keep .active visually distinct even over won/lost/unresolvable backgrounds. */
.parlay-chip.parlay-won.active,
.parlay-chip.parlay-lost.active,
.parlay-chip.parlay-unresolvable.active {
  border-color: var(--accent);
  color: var(--text);
}

/* Split-color chip — paired good/hedge with independent grades.
 * Uses a hard-stop linear-gradient so the left half shows the good
 * leg's outcome and the right half shows the hedge's. Each side gets
 * a class like ``parlay-won-left`` / ``parlay-lost-right`` which sets
 * its own gradient stop color; the base ``parlay-split`` class just
 * wires up the gradient plumbing. */
.parlay-chip.parlay-split {
  --split-left: transparent;
  --split-right: transparent;
  background: linear-gradient(
    to right,
    var(--split-left) 0%,
    var(--split-left) 50%,
    var(--split-right) 50%,
    var(--split-right) 100%
  );
  color: #f5f5f5;
}
.parlay-chip.parlay-won-left   { --split-left:  #1b5e20; }
.parlay-chip.parlay-lost-left  { --split-left:  #b71c1c; }
.parlay-chip.parlay-unresolvable-left { --split-left: #5d4e00; }
.parlay-chip.parlay-legacy-left { --split-left: #4a4a4a; }
.parlay-chip.parlay-won-right  { --split-right: #1b5e20; }
.parlay-chip.parlay-lost-right { --split-right: #b71c1c; }
.parlay-chip.parlay-unresolvable-right { --split-right: #5d4e00; }
.parlay-chip.parlay-legacy-right { --split-right: #4a4a4a; }
.parlay-chip.parlay-split.active {
  border-color: var(--accent);
  color: var(--text);
}

/* Selection-mode override (Phase E): while a multi-select mode is
 * active, the parlay-grading tints are hidden so the only highlight
 * the user sees is the selection state. Without this, a green
 * ``parlay-won`` chip + a red ``delete-selected`` ring would clash and
 * make it ambiguous which chips are actually checked.
 *
 * Specificity is the load-bearing detail here:
 *   - ``.parlay-chip.parlay-won`` etc. = 2 class selectors.
 *   - ``.delete-mode .parlay-chip.parlay-won`` = 3 class selectors,
 *     beats the grade rule.
 *   - The selection rule below is also 3 classes
 *     (``.delete-mode .parlay-chip.delete-selected``) AND is written
 *     last, so it wins the specificity tie against the reset block. */
.delete-mode .parlay-chip.parlay-won,
.delete-mode .parlay-chip.parlay-lost,
.delete-mode .parlay-chip.parlay-unresolvable,
.delete-mode .parlay-chip.parlay-legacy,
.delete-mode .parlay-chip.parlay-split,
.download-mode .parlay-chip.parlay-won,
.download-mode .parlay-chip.parlay-lost,
.download-mode .parlay-chip.parlay-unresolvable,
.download-mode .parlay-chip.parlay-legacy,
.download-mode .parlay-chip.parlay-split {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-dim);
  opacity: 1;
}
/* Hover variants — match the base chip hover (no red/yellow/green
 * tint while in selection mode; the mode-specific hover rules higher
 * up paint the accent / red border instead). Specificity 4 because
 * of the ``:hover`` pseudo-class — high enough to beat the 2-class
 * grade-hover rules above. ``!important`` is intentionally NOT used
 * here so the selection rule below (with !important) wins on a
 * hovered+selected chip. */
.delete-mode .parlay-chip.parlay-won:hover,
.delete-mode .parlay-chip.parlay-lost:hover,
.delete-mode .parlay-chip.parlay-unresolvable:hover,
.delete-mode .parlay-chip.parlay-split:hover,
.download-mode .parlay-chip.parlay-won:hover,
.download-mode .parlay-chip.parlay-lost:hover,
.download-mode .parlay-chip.parlay-unresolvable:hover,
.download-mode .parlay-chip.parlay-split:hover {
  background: var(--bg);
}
/* Selection highlight — ``!important`` forces it to win against the
 * grade rules (especially ``parlay-unresolvable`` whose yellow was
 * persisting on selected chips because the hover override above is
 * 4-class specificity, beating the selection rule's 3-class default
 * even though the selection rule comes later in the file). With
 * !important the selected state is unambiguously the highest priority
 * regardless of hover state or grade class. */
.delete-mode .parlay-chip.delete-selected {
  background: rgba(220, 38, 38, 0.15) !important;
  border-color: #dc2626 !important;
  color: #dc2626 !important;
}
.download-mode .parlay-chip.download-selected {
  background: rgba(108, 92, 231, 0.18) !important;
  border-color: var(--accent) !important;
  color: #c4b5fd !important;
}

/* Parlay action buttons in the Output panel title row.
 *
 * The action group is pushed to the right end of the title row via
 * ``.parlay-actions { margin-left: auto }``. Geometry / typography
 * mirror the Admin button (``.menu-btn.admin-menu-btn``): 30px height,
 * ``0 12px`` padding, inline-flex centered, full-strength text color.
 * Each button carries the shared ``.parlay-action-btn`` base style plus
 * one of the role classes below (delete / download / confirm / cancel)
 * which adds a role-tinted background + border so the button reads as
 * a button even at rest. */
.parlay-actions { margin-left: auto; }
.parlay-action-btn {
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  height: 30px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  display: none;
  align-items: center;
}
.parlay-action-btn.visible { display: inline-flex; }
/* ``always-visible`` is a sibling of ``.visible`` that survives
 * exit/hideParlayList paths. Used by the Import / Download / Delete
 * entry buttons so the user can import a parlay even when the parlay
 * list is empty. Mode-dependent confirm/cancel buttons keep the
 * regular ``.visible`` toggle. */
.parlay-action-btn.always-visible { display: inline-flex; }

/* Transient toast notification — used by the Import flow to surface
 * success / failure of a parlay file import. Lives at the bottom-
 * right corner; fades in/out via the ``.visible`` class which the
 * showToast JS toggles. ``-success`` / ``-error`` variants carry the
 * role colors. */
.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #1f2937;
  border: 1px solid #374151;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.app-toast-success {
  background: rgba(34, 197, 94, 0.95);
  border-color: #16a34a;
}
.app-toast-error {
  background: rgba(220, 38, 38, 0.95);
  border-color: #b91c1c;
}

/* Import — neutral cyan tint to distinguish from delete (red) and
 * download (purple). Both color and bg follow the same alpha pattern
 * the other action buttons use. */
.import-btn {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.45);
}
.import-btn:hover { background: rgba(59, 130, 246, 0.25); border-color: #3b82f6; color: #fff; }

/* Download format selector — shares geometry/typography with the
 * action buttons so the row reads as one coherent control cluster.
 * Only visible while download-mode is active (toggled via .visible). */
.parlay-action-select {
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  height: 30px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  display: none;
}
.parlay-action-select.visible { display: inline-flex; align-items: center; }
.parlay-action-select:hover { border-color: var(--accent); color: #c4b5fd; }
.parlay-action-select:focus { outline: none; border-color: var(--accent); }

/* Delete — red-tinted at rest, solid red when in delete-mode (.active). */
.delete-btn {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.45);
}
.delete-btn:hover { background: rgba(220, 38, 38, 0.25); border-color: #dc2626; color: #fff; }
.delete-btn.active {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

/* Download — accent-tinted at rest (matches the Admin button hue),
 * solid accent when in download-mode (.active, wired in Phase C). */
.download-btn {
  color: #c4b5fd;
  background: rgba(108, 92, 231, 0.14);
  border-color: rgba(108, 92, 231, 0.45);
}
.download-btn:hover { background: rgba(108, 92, 231, 0.25); border-color: var(--accent); color: #fff; }
.download-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Confirm (delete) — solid red. Only visible while delete-mode has a selection. */
.confirm-delete-btn {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}
.confirm-delete-btn:hover { background: #b91c1c; border-color: #b91c1c; }

/* Confirm (download) — solid accent purple. Only visible while download-mode has a selection. */
.confirm-download-btn {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.confirm-download-btn:hover { background: #5a4ec0; border-color: #5a4ec0; }

/* Cancel — neutral. Only visible while a multi-select mode is active. */
.cancel-delete-btn:hover { color: var(--text); background: var(--surface); border-color: var(--text-dim); }

/* Result display — dual-pane wrapper */
#result-wrapper {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  gap: 10px;
}
.result-pane {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  font-size: 16px;
  line-height: 1.7;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-wrap: break-word;
}
/* When only one pane is visible, it takes full width */
#result-wrapper.single-pane #result-area-hedge { display: none; }
#result-wrapper.single-pane #result-area { flex: 1 1 100%; }
#result-area:empty::before {
  content: "Results will appear here after generation...";
  color: var(--text-dim);
  opacity: 0.5;
  font-style: italic;
}
#result-area-hedge:empty::before {
  content: "Waiting for results...";
  color: var(--text-dim);
  opacity: 0.5;
  font-style: italic;
}
/* Markdown rendered styles (shared across both panes) */
.result-pane h1 { font-size: 25px; font-weight: 700; margin: 0 0 12px 0; color: var(--text); }
.result-pane h2 { font-size: 21px; font-weight: 600; margin: 20px 0 8px 0; color: var(--text); }
.result-pane h3 { font-size: 17px; font-weight: 600; margin: 16px 0 6px 0; color: var(--text); }
.result-pane h4 { font-size: 16px; font-weight: 600; margin: 12px 0 4px 0; color: var(--text-dim); }
.result-pane p { margin: 0 0 10px 0; }
.result-pane strong { color: var(--text); font-weight: 600; }
.result-pane em { font-style: italic; }
.result-pane p:first-child em {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--surface2);
  padding: 6px 10px;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.result-pane hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.result-pane ul, .result-pane ol { margin: 0 0 10px 0; padding-left: 24px; }
.result-pane li { margin-bottom: 10px; line-height: 1.7; }
.result-pane li.sub-item {
  margin-bottom: 4px;
  margin-left: 18px;
  font-size: 15px;
  color: var(--text-dim);
  list-style-type: circle;
}
.result-pane code {
  background: var(--surface2);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 15px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  opacity: 0.7;
}

/* ===== Selection panel (right column) ===== */
.selection-panel .panel-body {
  padding: 0;
  overflow-y: auto;
}

.selection-empty {
  padding: 24px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  font-style: italic;
  opacity: 0.6;
}
.selection-empty .sel-spinner {
  width: 18px; height: 18px;
  border-color: rgba(255,255,255,0.15);
  border-top-color: var(--accent);
}

.selection-loading {
  padding: 24px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
}

.parlay-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-dim);
  font-size: 14px;
  font-style: italic;
  opacity: 0.75;
}

/* Game block */
.game-block {
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.25s;
}
.game-block:last-child { border-bottom: none; }
/* Game status colors (4.15.x rebuild). Five visual states; only
   ``.game-no-props`` gates selection — the rest are pure tinting.
   ``.game-no-props`` is added to games that have ZERO bettable
   players (rendered in a separate "No Props Yet" section) and is
   the only state that hides the click target.
     - default       → white  (no extra class)
     - missing data  → orange (game-missing-data)
     - started, H1   → green  (game-started without halfway)
     - past halfway  → yellow (game-halfway)
     - ended         → grey   (game-ended)  */
.game-block.game-ended > .game-header,
.game-block.game-ended .game-players {
  opacity: 0.45;
}
.game-block.game-ended > .game-header:hover {
  opacity: 0.6;
}
.game-block.game-ended > .game-header .game-label {
  color: var(--text-dim, #888);
}
/* Past halfway → yellow. Wins over .game-started below because of
   source order. */
.game-block.game-halfway:not(.game-ended) > .game-header .game-label {
  color: #f1c40f;
}
/* Started + first half → green. */
.game-block.game-started:not(.game-halfway):not(.game-ended) > .game-header .game-label {
  color: #2ecc71;
}
/* Missing data → orange. Only applies to games that aren't
   already tinted by a game-status class — incomplete data on a
   live game still surfaces the live-state color. */
.game-block.game-missing-data:not(.game-started):not(.game-halfway):not(.game-ended) > .game-header .game-label {
  color: #f39c12;
}
/* No-props → unselectable. Hides the click affordance + cursor. */
.game-block.game-no-props > .game-header,
.game-block.game-no-props > .game-header .game-check {
  cursor: not-allowed;
}

/* Canceled / postponed / suspended / forfeited games. Books void
   these so any pick is dead on submission — selection is blocked
   in JS (``toggleGame`` / ``togglePlayer`` short-circuit on the
   ``game-canceled`` class). Visually treat the block the same as
   ``game-no-props``: dimmed header + ``not-allowed`` cursor so the
   user reads it as unpickable at a glance. */
.game-block.game-canceled > .game-header,
.game-block.game-canceled .game-players {
  opacity: 0.45;
}
.game-block.game-canceled > .game-header,
.game-block.game-canceled > .game-header .game-check,
.game-block.game-canceled .player-row {
  cursor: not-allowed;
}
.game-block.game-canceled > .game-header .game-label {
  text-decoration: line-through;
}

/* Per-player + per-team missing-data tints. Independent of the
   game-block state — a player with no IDB history is always
   orange; a team with no IDB team_history is always orange even
   if all the team's players have data. */
.player-row.player-missing-data .player-name {
  color: #f39c12;
}
.team-section-label.team-missing-data .team-section-name {
  color: #f39c12;
}

/* Roster-unavailable players. Set by the G&P panel worker when the
   current roster no longer lists a player who's still rendered on
   the panel (e.g., scratched / off depth chart mid-day). The row is
   greyed out and click-blocked; selection paths skip it. */
.player-row.player-unavailable {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.player-row.player-unavailable .player-name {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* Status tags inside game headers. ``white-space: nowrap`` keeps
   the status text + score together as one unit (e.g. "IN1 7-2"
   never splits across lines). ``display: inline-block`` lets the
   whole tag wrap to the next line as a single chunk when the line
   runs out of room — the user-visible rule is "the whole pill moves
   together, never half on one line and half on the next". */
.game-status-tag {
  display: inline-block;
  margin-left: 8px;
  font-weight: 500;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
  white-space: nowrap;
}
.game-status-tag.ended {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}
.game-status-tag.halfway,
.game-status-tag.halftime {
  background: rgba(241, 196, 15, 0.18);
  color: #f1c40f;
}
.game-status-tag.started {
  background: rgba(39, 174, 96, 0.18);
  color: #27ae60;
}
.game-status-tag.no-props {
  background: rgba(139, 143, 163, 0.18);
  color: var(--text-dim);
  font-style: italic;
}
.game-player-count {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  vertical-align: middle;
}

/* Game header — clickable to select the game */
.game-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.game-header:hover { background: #2c3040; }
.game-header.selected {
  background: var(--selected-bg);
  border-left: 3px solid var(--accent) !important;
  padding-left: 11px;
}
.game-header .game-label { flex: 1; }
.game-header .game-time {
  margin-left: 8px;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-dim);
}
.game-header .collapse-arrow {
  width: 22px; height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b4c0;
  font-size: 10px;
  transition: transform 0.15s;
}
.game-header .collapse-arrow svg {
  width: 12px; height: 12px;
  fill: #b0b4c0;
  transition: transform 0.15s;
}
.game-block.collapsed .collapse-arrow svg {
  transform: rotate(-90deg);
}
.game-players {
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.game-block.collapsed .game-players {
  max-height: 0 !important;
}
.game-header .game-check {
  width: 16px; height: 16px;
  border: 2px solid #5a5e6b;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.game-header.selected .game-check {
  background: var(--accent);
  border-color: var(--accent);
}
.game-header.selected .game-check::after {
  content: '';
  width: 6px; height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Player row */
.player-row {
  display: flex;
  align-items: center;
  padding: 6px 14px 6px 22px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
  gap: 8px;
  font-size: 15px;
}
.player-row:hover { background: rgba(255,255,255,0.03); }
.player-row.selected {
  background: var(--selected-bg);
}
.player-row .player-check {
  width: 14px; height: 14px;
  border: 2px solid #5a5e6b;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.player-row.selected .player-check {
  background: var(--accent);
  border-color: var(--accent);
}
.player-row.selected .player-check::after {
  content: '';
  width: 5px; height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 1px;
}
.player-team-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.player-name { flex: 1; }

/* Selection count badge */
.selection-count {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(108,92,231,0.15);
  border-radius: 10px;
}
.panel-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.panel-title-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.panel-title-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title-row .title-text { white-space: nowrap; }
.panel-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* "Updated X min ago" freshness indicator in Games & Players panel */
.data-freshness {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clear selections button — always visible; disabled when nothing selected. */
.clear-link {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
  font-family: inherit;
}
.clear-link:hover:not(:disabled) { color: var(--error); background: var(--surface); border-color: var(--error); }
.clear-link:disabled,
.clear-link[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--text-dim);
}

/* Collapse all button */
.collapse-all-btn {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  display: none;
}
.collapse-all-btn.visible { display: inline; }
.collapse-all-btn:hover { color: var(--text); background: var(--surface); }

/* Players sub-section header — team grouping label */
.team-section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  opacity: 0.85;
  padding: 8px 14px 3px 14px;
  margin-top: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}
.team-section-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-section-team-btn {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.12s, border-color 0.12s;
}
/* "Team" button — selects every player on the team, which flags
   the team as fully-selected and unlocks team over/under in the
   prediction pool. */
.team-section-team-btn {
  margin-left: auto;
  margin-right: 6px;
  color: #4cc4d8;
  background: rgba(76, 196, 216, 0.08);
  border: 1px solid rgba(76, 196, 216, 0.25);
}
.team-section-team-btn:hover {
  background: rgba(76, 196, 216, 0.18);
  border-color: rgba(76, 196, 216, 0.5);
}
.team-section-team-btn .team-glyph {
  margin-right: 2px;
}
.team-section-label::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}
.team-section-count {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 7px;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: middle;
}

/* "No Props Yet" divider — separates games awaiting lines at the
   bottom of the selection panel. Spans full width, more prominent
   than team section labels. */
.no-props-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 10px 14px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.025);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: help;
}
.game-players-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 10px 14px;
  opacity: 0.8;
}

/* Quick pick button bar */
.quick-pick-section {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  padding: 6px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.quick-pick-btn {
  font-size: 11px; font-weight: 500;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.quick-pick-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(108,92,231,0.1);
}
.quick-pick-btn.reselect-btn { border-color: var(--accent); color: var(--accent); }
.quick-pick-btn.reselect-btn:hover { background: rgba(108,92,231,0.2); }
.quick-pick-btn.reselect-btn:disabled,
.quick-pick-btn.reselect-btn[disabled] {
  border-color: var(--border);
  color: var(--text-dim);
  background: var(--surface2);
  cursor: not-allowed;
  opacity: 0.55;
}
.quick-pick-btn.reselect-btn:disabled:hover,
.quick-pick-btn.reselect-btn[disabled]:hover {
  background: var(--surface2);
  color: var(--text-dim);
  border-color: var(--border);
}

/* Reselect row — single full-width button, no label. */
.quick-pick-section.reselect-row {
  padding: 8px 14px;
}
.quick-pick-section.reselect-row .reselect-btn {
  flex: 1;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  text-align: center;
}
.quick-pick-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}

/* Calendar */
.calendar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 280px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.calendar-dropdown.visible { display: block; }
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.calendar-nav button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 4px;
}
.calendar-nav button:hover { background: var(--surface2); color: var(--text); }
.calendar-nav .cal-month-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 14px;
}
.calendar-grid .cal-dow {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  padding: 4px 0;
}
.calendar-grid .cal-day {
  font: inherit;
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 2px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-dim);
  position: relative;
  transition: background 0.1s;
}
.calendar-grid .cal-day:hover { background: var(--surface2); }
.calendar-grid .cal-day.today {
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--accent);
}
.calendar-grid .cal-day.selected {
  background: var(--accent);
  color: white;
  font-weight: 600;
}
.calendar-grid .cal-day.empty {
  cursor: default;
}
.calendar-grid .cal-day.empty:hover { background: transparent; }
/* Indicator dots */
.cal-indicators {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
  height: 5px;
}
.cal-indicator-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
}
.cal-indicator-dot.local-data { background: var(--text-dim); }
.cal-indicator-dot.local-parlay { background: var(--success); }
.cal-indicator-dot.firestore { background: var(--accent); }
.calendar-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =============================================================
   Responsive — tablet
   ============================================================= */
@media (max-width: 1100px) {
  .container-wrapper { padding: 16px; }
  .container {
    display: grid;
    grid-template-columns: 310px 1fr;
  }
  .container > .config-panel,
  .container > .output-panel,
  .container > .selection-panel {
    width: auto;
    min-width: 0;
    max-width: none;
    flex-shrink: 1;
  }
  .resize-handle, .resize-handle-edge, .resize-handle-bottom { display: none; }
  .selection-panel { grid-column: 1 / -1; max-height: 400px; }
}

/* =============================================================
   Responsive — mobile  (≤ 700px)
   ============================================================= */
@media (max-width: 700px) {
  /* ---- Viewport containment — prevent ANY horizontal scroll ---- */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* ---- Header ---- */
  .header {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .header h1 { font-size: 19px; }
  .header .subtitle { display: none; }
  .header-left { flex: 1 1 auto; min-width: 0; }
  .header-right {
    flex: 1 1 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
  .session-id { font-size: 12px; padding: 3px 6px; letter-spacing: 0.5px; }
  .menu-btn { width: 30px; height: 30px; }

  /* ---- Layout: single column, no fixed height. Drop the desktop
     ``height: calc(100vh - 60px)`` + ``overflow-y: auto`` because the
     mobile header wraps to 2+ rows (taller than 60px), and combining a
     fixed wrapper height with mobile browser chrome eating the last
     ~50-100px makes the bottom of the last panel unreachable. Let the
     page grow naturally and use the document scroller instead. ---- */
  .container-wrapper {
    padding: 10px 10px 24px;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  .container {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    gap: 12px;
    max-width: 100%;
  }
  .container > .config-panel,
  .container > .output-panel,
  .container > .selection-panel {
    width: auto !important;
    min-width: 0;
    max-width: 100%;
    flex-shrink: 1;
  }
  .resize-handle, .resize-handle-edge, .resize-handle-bottom { display: none; }

  /* ---- Panel order: Config → Selection → Output ---- */
  .panel            { order: 0; }  /* Config is first by default (DOM order) */
  .selection-panel  { order: 1; }  /* Selection moves to second */
  .output-panel     { order: 2; }  /* Output moves to last */

  /* ---- Panels: block layout, no flex-shrink collapse ---- */
  .panel {
    max-height: none;
    overflow: hidden;       /* contain horizontal overflow from children */
    min-height: auto;
    max-width: 100%;
  }
  .panel-body {
    padding: 12px;
    overflow-y: visible;    /* document scroller owns vertical scroll on
                               mobile (see container-wrapper override) */
    overflow-x: hidden;     /* prevent wide content from pushing panel */
    /* No max-height here — let each panel type set its own */
  }

  /* ---- Configuration panel ---- */
  .field label { font-size: 12px; }
  .field select,
  .field input[type="text"],
  .field input[type="date"] {
    font-size: 15px;
    padding: 8px 10px;
  }
  .run-btn, .jackpot-btn, .parlay-btn { font-size: 15px; padding: 11px; }
  .jackpot-warning, .parlay-desc { font-size: 12px; }

  /* ---- Output panel ---- */
  .output-panel .panel-body {
    display: block;          /* Kill the flex column that collapses children */
    overflow-y: visible;     /* Let the document scroller handle vertical
                                scroll on mobile — nested overflow:auto
                                inside a fixed-height ancestor was eating
                                the bottom of the panel. */
    max-height: none;
  }
  /* Stack result panes vertically; use auto height, not flex-basis: 0.
     Document scroller owns vertical scroll — the per-pane ``max-height:
     70vh; overflow-y: auto`` from desktop traps content past the visible
     viewport and makes the bottom unreachable on mobile. Force each
     pane into block flow. */
  #result-wrapper {
    display: block;
    max-width: 100%;
    flex: none;
    height: auto;
  }
  #result-wrapper > .result-pane + .result-pane {
    margin-top: 10px;
  }
  .result-pane {
    min-height: auto;
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;     /* clip wide AI-generated content */
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  /* AI-generated markdown can produce wide elements — constrain them */
  .result-pane pre,
  .result-pane code {
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 100%;
  }
  .result-pane table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  .result-pane img {
    max-width: 100%;
    height: auto;
  }
  .result-pane h1 { font-size: 20px; }
  .result-pane h2 { font-size: 18px; }
  .result-pane h3 { font-size: 15px; }
  .result-pane li { margin-bottom: 6px; font-size: 14px; }
  #status-log {
    font-size: 12px;
    max-height: none;       /* document scroller owns vertical scroll */
    overflow-y: visible;
    overflow-x: hidden;
    word-break: break-word;
    flex: 0 0 auto;
  }
  .log-entry .log-msg { min-width: 0; word-break: break-word; }

  /* Parlay history chips — scroll horizontally */
  .parlay-list-items { gap: 4px; }
  .parlay-chip { font-size: 12px; padding: 4px 8px; }

  /* Panel title rows */
  .panel-title { padding: 10px 12px; font-size: 14px; }
  .panel-title-row { padding: 10px 12px; font-size: 13px; }

  /* ---- Selection panel ---- */
  .selection-panel { max-height: none; }
  .selection-panel .panel-body {
    max-height: 50vh;
    overflow-y: auto;
  }
  .game-header {
    padding: 8px 10px;
    font-size: 14px;
    max-width: 100%;
  }
  .game-header .game-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-row {
    padding: 5px 10px 5px 16px;
    font-size: 14px;
    max-width: 100%;
  }
  .player-row .player-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-team-tag { font-size: 11px; }

  /* Quick pick buttons */
  .quick-pick-section { padding: 5px 10px; gap: 4px; }
  .quick-pick-btn { font-size: 10px; padding: 3px 7px; }
  .quick-pick-label { font-size: 9px; }

  /* ---- Modals — full-width on mobile ---- */
  .modal {
    min-width: 0;
    max-width: calc(100vw - 24px);
    width: 100%;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal.modal-wide {
    max-width: calc(100vw - 24px);
    max-height: 85vh;
  }
  /* Help modal: stack nav above content on mobile */
  .help-layout { flex-direction: column; }
  .help-nav {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 8px;
    gap: 4px;
  }
  .help-nav a { font-size: 11px; padding: 4px 8px; }
  .help-content { padding: 12px; }
  .help-section p, .help-section li { font-size: 13px; }

  /* ---- Calendar dropdown ---- */
  .calendar-dropdown {
    right: 0;
    left: auto;
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: 300px;
    padding: 10px;
  }

  /* ---- Safe area insets for notched phones ---- */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

.calendar-actions { display: flex; justify-content: flex-end; margin: 10px 0 14px; }
.calendar-today-btn { border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: white; font: inherit; font-size: 13px; font-weight: 650; padding: 8px 16px; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,.18); }
.calendar-today-btn:hover { filter: brightness(1.12); }
.calendar-today-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
