: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; }

/* 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;
}
.session-btn {
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.session-btn:hover { border-color: var(--accent); color: var(--text); }

/* Help button */
.help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-btn:hover { border-color: var(--accent); color: var(--text); }

/* 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-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;
}
.confidence-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 0.3px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: none;
}
.confidence-badge:empty { display: none; }
.confidence-badge.conf-ehc { background: #1a8a4a; color: #fff; }
.confidence-badge.conf-hc  { background: #27ae60; color: #fff; }
.confidence-badge.conf-mc  { background: #f39c12; color: #fff; }
.confidence-badge.conf-lc  { background: #e74c3c; color: #fff; }
.confidence-badge.conf-elc { background: #a93226; color: #fff; }
.player-star { color: #f1c40f; margin-left: 4px; font-size: 14px; line-height: 1; }
.player-star.loading { color: var(--text-dim); font-size: 12px; }
.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; }

.run-row {
  display: flex;
  gap: 8px;
}
.run-row .run-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); }
.jackpot-types-panel {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.jackpot-types-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.jackpot-types-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.jackpot-type-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.jackpot-type-item input[type="checkbox"] {
  accent-color: #fa8602;
  cursor: pointer;
}

/* Trust Parlay Maker */
.trust-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.trust-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  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;
}
.trust-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #219a52, #27ae60);
  box-shadow: 0 2px 12px rgba(46, 204, 113, 0.35);
}
.trust-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.trust-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
  text-align: center;
}
.trust-settings { margin-top: 10px; }
.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 {
  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;
}
.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;
}

/* Generate Data button */
.data-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 4px;
}
.data-btn:hover:not(:disabled) {
  background: rgba(108, 92, 231, 0.1);
}
.data-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 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);
}

/* Delete / Confirm buttons in Output panel title */
.delete-btn {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: none;
}
.delete-btn.visible { display: inline; }
.delete-btn:hover { color: #dc2626; }
.delete-btn.active { color: #dc2626; }
.confirm-delete-btn {
  font-size: 13px;
  color: #fff;
  background: #dc2626;
  border: none;
  border-radius: var(--radius);
  padding: 2px 8px;
  cursor: pointer;
  margin-left: 8px;
  display: none;
}
.confirm-delete-btn.visible { display: inline; }
.confirm-delete-btn:hover { background: #b91c1c; }
.cancel-delete-btn {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 8px;
  display: none;
}
.cancel-delete-btn.visible { display: inline; }
.cancel-delete-btn:hover { color: var(--text); }

/* 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;
}

/* Game block */
.game-block {
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.25s;
}
.game-block:last-child { border-bottom: none; }
.game-block.game-conf-high {
  box-shadow: inset 3px 0 0 #f5a623;
}
.game-block.game-conf-high > .game-header {
  border-left: 3px solid #f5a623;
  padding-left: 11px;
}
.game-block.game-conf-low {
  box-shadow: inset 3px 0 0 #e74c3c;
}
.game-block.game-conf-low > .game-header {
  border-left: 3px solid #e74c3c;
  padding-left: 11px;
}

/* Game status: ended — greyed out, not selectable */
.game-block.game-ended > .game-header {
  opacity: 0.45;
  cursor: default;
}
.game-block.game-ended > .game-header .game-check {
  opacity: 0.3;
  cursor: not-allowed;
}
.game-block.game-ended .game-players {
  opacity: 0.35;
}
.game-block.game-ended .player-row {
  cursor: default;
}
.game-block.game-ended > .game-header:hover {
  opacity: 0.55;
}
/* Game status: past halfway — yellow tint */
.game-block.game-halfway > .game-header .game-label {
  color: #f39c12;
}

/* Status tags inside game headers */
.game-status-tag {
  margin-left: 8px;
  font-weight: 500;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
}
.game-status-tag.ended {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}
.game-status-tag.halfway {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}

/* 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;
  margin-left: auto;
}
.panel-title-row {
  display: flex;
  align-items: center;
  padding: 14px 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-row .title-text { flex: 1; }

/* Clear selections button */
.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 8px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.15s;
}
.clear-link.visible { opacity: 1; }
.clear-link:hover { color: var(--error); background: var(--surface); }

/* 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 8px;
  border-radius: var(--radius);
  margin-right: 10px;
  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);
}
.team-section-label::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}

/* 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.conf-high-btn { border-color: #f5a623; color: #f5a623; }
.quick-pick-btn.conf-high-btn:hover { background: rgba(245,166,35,0.15); }
.quick-pick-btn.conf-low-btn { border-color: #e74c3c; color: #e74c3c; }
.quick-pick-btn.conf-low-btn:hover { background: rgba(231,76,60,0.15); }
.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-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}

/* Calendar */
.calendar-wrapper {
  position: relative;
}
.calendar-btn {
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.calendar-btn:hover { border-color: var(--accent); color: var(--text); }
.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 {
  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 { width: auto; min-width: 0; max-width: none; }
  .container > .selection-panel { width: auto; min-width: 0; max-width: none; }
  .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; }
  .session-btn { font-size: 12px; padding: 4px 8px; }
  .calendar-btn { font-size: 12px; padding: 4px 8px; }

  /* ---- Layout: single column, no fixed height ---- */
  .container-wrapper {
    padding: 10px;
    padding-bottom: 0;
    min-height: auto;
  }
  .container {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    gap: 12px;
    max-width: 100%;
  }
  .container > .config-panel,
  .container > .selection-panel {
    width: auto !important;
    min-width: 0;
    max-width: 100%;
  }
  .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: auto;
    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, .trust-btn { font-size: 15px; padding: 11px; }
  .data-btn { font-size: 14px; padding: 9px; }
  .jackpot-warning, .trust-desc { font-size: 12px; }
  .jackpot-types-panel { padding: 8px 10px; }
  .jackpot-types-list { gap: 4px 10px; }
  .jackpot-type-item { font-size: 12px; }

  /* ---- Output panel ---- */
  .output-panel .panel-body {
    display: block;          /* Kill the flex column that collapses children */
    overflow-y: auto;
    max-height: none;
  }
  /* Stack result panes vertically; use auto height, not flex-basis: 0 */
  #result-wrapper {
    display: block;          /* Block layout — children stack and size to content */
    max-width: 100%;
  }
  #result-wrapper > .result-pane + .result-pane {
    margin-top: 10px;       /* Gap between panes since we're in block layout */
  }
  .result-pane {
    min-height: 250px;
    max-height: 70vh;
    overflow-y: auto;
    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: 150px;
    overflow-x: hidden;
    word-break: break-word;
  }
  .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);
  }
}
