/* ============================================================
   KERVOR — kervor.css
   Sunny Orange High-Contrast Theme | Glove-Friendly UI
   ============================================================ */

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --orange:      #FF8C00;
  --orange-lite: #FFA533;
  --orange-dark: #CC6E00;
  --dark-bg:     #1A1A1A;
  --panel-bg:    #222222;
  --panel-bg2:   #2C2C2C;
  --border:      #3A3A3A;
  --text:        #FFFFFF;
  --text-dim:    #AAAAAA;
  --danger:      #E53935;
  --success:     #43A047;
  --warn:        #FFB300;
  --gravel-red:  #FF2222;

  --btn-min:     64px;    /* glove-friendly minimum tap target */
  --btn-radius:  12px;
  --font-body:   18px;
  --font-head:   24px;
  --font-nav:    28px;
  --font-xl:     36px;
  --panel-z:     1000;
  --hud-z:       1001;
  --modal-z:     2000;
  --toast-z:     3000;
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--dark-bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: var(--font-body); }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; font-size: var(--font-body); color: var(--text); background: var(--panel-bg2); border: 2px solid var(--border); border-radius: 8px; padding: 12px 16px; }
input:focus, select:focus { border-color: var(--orange); outline: none; }
a { color: var(--orange); text-decoration: none; }

/* ── Map container ──────────────────────────────────────────── */
#map { position: fixed; inset: 0; z-index: 1; }

/* ── Glove-friendly button ──────────────────────────────────── */
.glove-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--btn-min); min-height: var(--btn-min);
  padding: 10px 16px; border-radius: var(--btn-radius);
  background: var(--panel-bg2); color: var(--text);
  font-size: var(--font-body); font-weight: 600;
  touch-action: manipulation; user-select: none;
  border: 2px solid var(--border);
  transition: background 0.15s, transform 0.1s;
  gap: 8px;
}
.glove-btn:active { transform: scale(0.95); background: var(--panel-bg); }
.glove-btn.primary { background: var(--orange); color: #000; border-color: var(--orange-dark); }
.glove-btn.primary:active { background: var(--orange-dark); }
.glove-btn.danger { background: var(--danger); color: #fff; border-color: #b71c1c; }
.glove-btn.success { background: var(--success); color: #fff; border-color: #2e7d32; }
.glove-btn.icon-only { padding: 0; width: var(--btn-min); height: var(--btn-min); font-size: 26px; flex-shrink: 0; }
.glove-btn.large { min-width: 80px; min-height: 80px; font-size: 22px; }
.glove-btn.small { min-width: 48px; min-height: 48px; font-size: 16px; padding: 6px 10px; }
.glove-btn.active { background: var(--orange); color: #000; border-color: var(--orange-dark); }
.glove-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Toggle / pill button ──────────────────────────────────── */
.toggle-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-bg2); border: 2px solid var(--border);
  border-radius: 32px; padding: 8px 18px;
  min-height: 48px; font-size: 16px; font-weight: 600;
  touch-action: manipulation; cursor: pointer; transition: all 0.15s;
  color: var(--text-dim);
}
.toggle-pill.active { background: var(--orange); color: #000; border-color: var(--orange-dark); }
.toggle-pill .pill-icon { font-size: 20px; }

/* ── Panels — base ─────────────────────────────────────────── */
.panel {
  position: fixed; z-index: var(--panel-z);
  background: var(--panel-bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.panel.hidden { pointer-events: none; opacity: 0; }

/* ── TOP BAR ────────────────────────────────────────────────── */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 60px; background: rgba(26,26,26,0.92); backdrop-filter: blur(6px);
  z-index: var(--hud-z);
  display: flex; align-items: center; padding: 0 12px; gap: 12px;
  border-bottom: 2px solid var(--orange);
}
#top-bar .logo { height: 40px; width: auto; }
#top-bar .app-title { font-size: 20px; font-weight: 700; color: var(--orange); letter-spacing: 1px; flex: 1; }
#top-bar .trip-strip { font-size: 14px; color: var(--text-dim); text-align: right; line-height: 1.3; }

/* ── SETUP PANEL ────────────────────────────────────────────── */
#setup-panel {
  top: 60px; left: 0; bottom: 0; width: 360px;
  max-width: 100vw; padding: 16px 14px 80px;
  border-right: 2px solid var(--border);
  background: rgba(26,26,26,0.96); backdrop-filter: blur(8px);
}
#setup-panel.hidden { transform: translateX(-100%); }

.section-label {
  font-size: 12px; font-weight: 700; color: var(--orange);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin: 16px 0 8px;
}

/* address input group */
.address-group { position: relative; margin-bottom: 8px; }
.address-group input { width: 100%; padding-right: 48px; }
.address-group .addr-drag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 20px; cursor: grab; }
.address-group .addr-clear { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 18px; cursor: pointer; }

/* autocomplete dropdown */
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--panel-bg2); border: 2px solid var(--orange);
  border-top: none; border-radius: 0 0 8px 8px;
  z-index: 5000; max-height: 280px; overflow-y: auto;
}
.autocomplete-item {
  padding: 14px 16px; font-size: 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; min-height: 56px; display: flex; align-items: center; gap: 10px;
}
.autocomplete-item:hover, .autocomplete-item:focus, .autocomplete-item.ac-focused { background: var(--orange); color: #000; }
.autocomplete-item:hover .ac-sub, .autocomplete-item.ac-focused .ac-sub { color: #333; }
.autocomplete-item .ac-icon { font-size: 20px; flex-shrink: 0; }
.autocomplete-item .ac-main { font-weight: 600; }
.autocomplete-item .ac-sub { font-size: 13px; color: var(--text-dim); }
.autocomplete-item:hover .ac-sub { color: #333; }

/* waypoints list */
#waypoints-container { display: flex; flex-direction: column; gap: 8px; }
#add-waypoint-btn { width: 100%; margin-top: 4px; font-size: 16px; }

/* avoidance grid */
.avoid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.avoid-grid .toggle-pill { font-size: 14px; padding: 8px 12px; min-height: 44px; }

/* curves slider */
#curves-row { display: flex; align-items: center; gap: 12px; }
#curves-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 8px; border-radius: 4px;
  background: linear-gradient(to right, var(--orange) 0%, var(--orange) var(--val,60%), var(--border) var(--val,60%), var(--border) 100%);
  outline: none;
}
#curves-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 32px; height: 32px;
  border-radius: 50%; background: var(--orange); cursor: pointer;
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
#curves-label { font-size: 14px; color: var(--orange); font-weight: 700; min-width: 80px; text-align: right; }

/* POI row */
.poi-row { display: flex; flex-wrap: wrap; gap: 8px; }
.poi-row .toggle-pill { font-size: 14px; padding: 6px 12px; min-height: 40px; }

/* action buttons */
#plan-btn { width: 100%; margin-top: 16px; font-size: 20px; min-height: 72px; }
#quick-ride-btn { width: 100%; margin-top: 8px; font-size: 18px; min-height: 64px; }
.fav-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.fav-item { display: flex; align-items: center; gap: 8px; background: var(--panel-bg2); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--border); cursor: pointer; }
.fav-item:hover { border-color: var(--orange); }
.fav-item .fav-name { flex: 1; font-size: 15px; }
.fav-item .fav-del { color: var(--danger); font-size: 18px; padding: 4px; }

/* ── ROUTE SELECT PANEL ─────────────────────────────────────── */
#route-panel {
  top: 60px; left: 0; right: 0; bottom: 0;
  background: rgba(26,26,26,0.96); backdrop-filter: blur(8px);
  padding: 16px 14px 80px;
  display: flex; flex-direction: column;
}
#route-panel.hidden { transform: translateY(100%); }

.weather-alert-banner {
  background: var(--warn); color: #000; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 16px;
}
.weather-alert-banner.hidden { display: none; }

.routes-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }

.route-card {
  background: var(--panel-bg2); border: 2px solid var(--border);
  border-radius: 14px; padding: 16px; cursor: pointer;
  transition: border-color 0.2s;
}
.route-card.selected { border-color: var(--orange); }
.route-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.route-card-name { font-size: 18px; font-weight: 700; }
.fun-score-badge {
  display: flex; align-items: center; gap: 4px;
  background: var(--orange); color: #000;
  border-radius: 20px; padding: 4px 12px; font-size: 14px; font-weight: 700;
}
.route-card-meta { display: flex; gap: 16px; font-size: 15px; color: var(--text-dim); margin-bottom: 10px; }
.route-card-meta span { display: flex; align-items: center; gap: 4px; }
.fun-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.fun-bar-fill { height: 100%; background: linear-gradient(90deg, var(--orange), #FF4500); border-radius: 4px; transition: width 0.5s; }
.route-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.route-tag { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: var(--panel-bg); border: 1px solid var(--border); color: var(--text-dim); }
.route-tag.warn { border-color: var(--warn); color: var(--warn); }
.route-card-actions { display: flex; gap: 10px; }
.use-btn { flex: 1; min-height: 64px; font-size: 20px; }
.save-route-btn { min-height: 64px; font-size: 16px; }

/* ── NAVIGATION HUD ────────────────────────────────────────── */
#nav-instruction {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--orange); color: #000;
  padding: 14px 16px 14px 80px;
  min-height: 90px; z-index: var(--hud-z);
  display: flex; align-items: center; gap: 16px;
}
#nav-instruction.hidden { transform: translateY(-100%); }
#nav-turn-icon { font-size: 44px; flex-shrink: 0; }
#nav-text-wrap { flex: 1; }
#nav-street { font-size: 16px; opacity: 0.7; }
#nav-instruction-text { font-size: var(--font-nav); font-weight: 700; line-height: 1.2; }
#nav-distance { font-size: 20px; font-weight: 700; white-space: nowrap; }

/* bottom HUD bar */
#nav-hud-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 70px; background: rgba(26,26,26,0.95); backdrop-filter: blur(6px);
  z-index: var(--hud-z); display: flex; align-items: center;
  padding: 0 12px; gap: 8px; border-top: 2px solid var(--border);
}
#nav-hud-bar.hidden { display: none; }
#nav-speed { font-size: var(--font-xl); font-weight: 700; color: var(--orange); min-width: 70px; }
#nav-speed-limit {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid var(--danger); background: #fff; color: var(--danger);
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
#nav-hud-spacer { flex: 1; }
#nav-eta { font-size: 16px; color: var(--text-dim); text-align: center; line-height: 1.3; }
#nav-fuel-hud { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#fuel-bar-wrap { display: flex; align-items: center; gap: 6px; }
#fuel-icon { font-size: 20px; }
#fuel-bar { width: 80px; height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; }
#fuel-bar-fill { height: 100%; background: var(--success); border-radius: 6px; transition: width 0.5s, background 0.5s; }
#fuel-remaining-text { font-size: 13px; color: var(--text-dim); }

/* ── PERIMETER NAV BUTTONS ──────────────────────────────────── */
/* All nav buttons are around the edges, total area < 10% screen */
#nav-buttons {
  position: fixed; z-index: var(--hud-z);
  pointer-events: none; inset: 0;
}
#nav-buttons > * { pointer-events: all; }

#btn-exit-nav  { position: fixed; top: 100px; left: 12px; }
#btn-recenter  { position: fixed; top: 100px; right: 12px; }
#btn-settings-nav { position: fixed; top: 174px; right: 12px; }
#btn-voice-nav { position: fixed; top: 174px; left: 12px; }
#btn-zoom-in   { position: fixed; bottom: 80px; right: 12px; }
#btn-zoom-out  { position: fixed; bottom: 152px; right: 12px; }
#btn-fuel-reset{ position: fixed; bottom: 80px; left: 12px; }

/* ── OFF-ROUTE SHEET ────────────────────────────────────────── */
#off-route-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--panel-bg); border-top: 3px solid var(--danger);
  padding: 20px 16px; z-index: var(--modal-z);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%); transition: transform 0.3s;
}
#off-route-sheet.visible { transform: translateY(0); }
#off-route-title { font-size: 22px; font-weight: 700; color: var(--danger); margin-bottom: 16px; }
#off-route-actions { display: flex; gap: 12px; }
#off-route-actions .glove-btn { flex: 1; font-size: 18px; min-height: 72px; }

/* ── FUEL ALERT BANNER ──────────────────────────────────────── */
#fuel-alert-banner {
  position: fixed; top: 90px; left: 50%; transform: translateX(-50%);
  background: var(--warn); color: #000; border-radius: 12px;
  padding: 14px 24px; z-index: var(--modal-z);
  font-size: 18px; font-weight: 700; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); min-width: 300px;
  animation: slideDown 0.3s ease;
}
#fuel-alert-banner.hidden { display: none; }

/* ── WEATHER ALERT BANNER ────────────────────────────────────── */
#weather-alert-banner {
  position: fixed; top: 90px; left: 50%; transform: translateX(-50%);
  background: #1565C0; color: #fff; border-radius: 12px;
  padding: 14px 24px; z-index: var(--modal-z);
  font-size: 18px; font-weight: 700; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); min-width: 300px;
  animation: slideDown 0.3s ease;
}
#weather-alert-banner.hidden { display: none; }

/* ── SETTINGS PANEL ─────────────────────────────────────────── */
#settings-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px;
  max-width: 100vw; background: var(--panel-bg);
  z-index: var(--modal-z); padding: 20px 16px 80px;
  overflow-y: auto; border-left: 2px solid var(--border);
  transform: translateX(100%); transition: transform 0.3s;
}
#settings-panel.visible { transform: translateX(0); }
.settings-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.settings-header h2 { font-size: 24px; font-weight: 700; flex: 1; }
.settings-section { margin-bottom: 24px; }
.settings-section h3 { font-size: 16px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); min-height: 60px; }
.setting-label { flex: 1; font-size: 16px; }
.setting-label small { display: block; color: var(--text-dim); font-size: 13px; margin-top: 2px; }
/* iOS-style toggle switch */
.switch { position: relative; width: 56px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 30px;
  cursor: pointer; transition: background 0.2s;
}
.switch-slider:before {
  content: ''; position: absolute;
  width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.switch input:checked + .switch-slider { background: var(--orange); }
.switch input:checked + .switch-slider:before { transform: translateX(26px); }

.setting-input { width: 100px; text-align: right; }
.units-toggle { display: flex; border-radius: 8px; overflow: hidden; border: 2px solid var(--border); }
.units-btn { flex: 1; min-height: 44px; border-radius: 0; border: none; background: var(--panel-bg2); color: var(--text); font-size: 16px; font-weight: 600; }
.units-btn.active { background: var(--orange); color: #000; }

/* Checklist */
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist-item label { flex: 1; font-size: 17px; cursor: pointer; }
.checklist-item input[type=checkbox] { width: 28px; height: 28px; accent-color: var(--orange); cursor: pointer; }

/* ── QUICK RIDE DIALOG ──────────────────────────────────────── */
#quick-ride-dialog {
  position: fixed; inset: 0; z-index: var(--modal-z);
  background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
}
#quick-ride-dialog.hidden { display: none; }
.dialog-box { background: var(--panel-bg); border-radius: 16px; padding: 28px 24px; width: 340px; max-width: 92vw; border: 2px solid var(--orange); }
.dialog-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.dialog-box p { color: var(--text-dim); font-size: 15px; margin-bottom: 20px; }
.ride-time-input-row { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.ride-time-input-row input[type=number] { flex: 1; font-size: 28px; text-align: center; padding: 12px; }
.ride-time-input-row .unit-label { font-size: 18px; color: var(--text-dim); }
.dialog-actions { display: flex; gap: 12px; }
.dialog-actions .glove-btn { flex: 1; min-height: 64px; font-size: 18px; }

/* ── POI CARD (bottom sheet) ────────────────────────────────── */
#poi-card {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--panel-bg); border-top: 3px solid var(--orange);
  padding: 20px 16px; z-index: var(--modal-z);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%); transition: transform 0.3s;
}
#poi-card.visible { transform: translateY(0); }
#poi-card-name { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
#poi-card-meta { color: var(--text-dim); font-size: 16px; margin-bottom: 16px; }
#poi-card-actions { display: flex; gap: 10px; }
#poi-card-actions .glove-btn { flex: 1; min-height: 64px; font-size: 16px; }

/* ── MIC INDICATOR ──────────────────────────────────────────── */
#mic-indicator {
  position: fixed; top: 70px; right: 12px;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--orange); color: #000; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  z-index: var(--hud-z); box-shadow: 0 0 0 0 rgba(255,140,0,0.6);
}
#mic-indicator.listening { animation: micPulse 1s infinite; }
#mic-indicator.hidden { display: none; }

/* ── TOAST NOTIFICATIONS ────────────────────────────────────── */
#toast-container {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: var(--toast-z); display: flex; flex-direction: column; gap: 8px;
  width: min(380px, 92vw); pointer-events: none;
}
.toast {
  background: var(--panel-bg2); color: var(--text);
  border-radius: 12px; padding: 14px 18px;
  border-left: 4px solid var(--orange);
  font-size: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease; pointer-events: all;
}
.toast.warn { border-left-color: var(--warn); }
.toast.danger { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* ── REROUTE BANNER ─────────────────────────────────────────── */
#reroute-banner {
  position: fixed; top: 95px; left: 12px; right: 12px;
  background: var(--danger); color: #fff; border-radius: 12px;
  padding: 14px 16px; z-index: var(--modal-z);
  display: flex; align-items: center; gap: 12px;
  font-size: 17px; font-weight: 700; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#reroute-banner.hidden { display: none; }
#reroute-banner .glove-btn { background: #fff; color: var(--danger); flex-shrink: 0; }

/* ── RIDE LOGBOOK ────────────────────────────────────────────── */
#ride-log-panel {
  position: fixed; top: 0; left: 0; bottom: 0; width: 420px;
  max-width: 100vw; background: var(--panel-bg);
  z-index: var(--modal-z); padding: 20px 16px 80px; overflow-y: auto;
  transform: translateX(-100%); transition: transform 0.3s;
}
#ride-log-panel.visible { transform: translateX(0); }
.log-entry { background: var(--panel-bg2); border-radius: 12px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); cursor: pointer; }
.log-entry:hover { border-color: var(--orange); }
.log-date { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.log-route { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.log-meta { display: flex; gap: 12px; font-size: 14px; color: var(--text-dim); }

/* ── GROUP RIDE PANEL ────────────────────────────────────────── */
#group-panel {
  position: fixed; top: 60px; right: 0; width: 320px;
  background: var(--panel-bg); border-left: 2px solid var(--border);
  z-index: var(--modal-z); padding: 16px; height: calc(100vh - 60px);
  transform: translateX(100%); transition: transform 0.3s; overflow-y: auto;
}
#group-panel.visible { transform: translateX(0); }
.group-rider { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rider-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.rider-name { flex: 1; font-size: 16px; }
.rider-dist { font-size: 14px; color: var(--text-dim); }

/* ── MORNING BRIEFING MODAL ────────────────────────────────── */
#morning-briefing {
  position: fixed; inset: 0; z-index: var(--modal-z);
  background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center;
}
#morning-briefing.hidden { display: none; }
.briefing-box { background: var(--panel-bg); border-radius: 16px; padding: 28px 24px; width: 380px; max-width: 92vw; border: 2px solid var(--orange); }
.briefing-box h2 { font-size: 24px; font-weight: 700; color: var(--orange); margin-bottom: 16px; }
.briefing-section { margin-bottom: 14px; display: flex; align-items: flex-start; gap: 12px; }
.briefing-icon { font-size: 28px; width: 36px; flex-shrink: 0; }
.briefing-text { font-size: 16px; line-height: 1.5; }

/* ── HAZARD REPORT BUTTON ────────────────────────────────────── */
#btn-report-hazard { position: fixed; bottom: 152px; left: 12px; }

/* ── SETUP PERIMETER BUTTONS ────────────────────────────────── */
#btn-settings-setup { position: fixed; top: 70px; right: 12px; z-index: var(--hud-z); }
#btn-locate-setup   { position: fixed; bottom: 12px; right: 12px; z-index: var(--hud-z); }
#btn-fullscreen     { position: fixed; bottom: 12px; left: 12px; z-index: var(--hud-z); }
#btn-morning-brief  { position: fixed; top: 70px; left: 12px; z-index: var(--hud-z); }
#btn-group-ride     { position: fixed; top: 144px; right: 12px; z-index: var(--hud-z); }
#btn-ride-log       { position: fixed; top: 144px; left: 12px; z-index: var(--hud-z); }

/* ── LOADING OVERLAY ────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--dark-bg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 24px;
}
#loading-overlay.hidden { display: none; }
.loader-logo { height: 100px; animation: pulse 2s infinite; }
.loader-title { font-size: 32px; font-weight: 800; color: var(--orange); letter-spacing: 2px; }
.loader-tagline { color: var(--text-dim); font-size: 16px; }
.spinner { width: 48px; height: 48px; border: 5px solid var(--border); border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ── SPEED WARNING ─────────────────────────────────────────── */
#speed-warning { position: fixed; top: 95px; right: 12px; background: var(--danger); color: #fff; border-radius: 12px; padding: 8px 16px; z-index: var(--hud-z); font-weight: 700; font-size: 16px; }
#speed-warning.hidden { display: none; }

/* ── HEADLIGHT REMINDER ─────────────────────────────────────── */
#headlight-reminder {
  position: fixed; top: 95px; left: 50%; transform: translateX(-50%);
  background: #FFF176; color: #000; border-radius: 12px;
  padding: 12px 20px; z-index: var(--modal-z); font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
#headlight-reminder.hidden { display: none; }

/* ── FATIGUE REMINDER ─────────────────────────────────────────── */
#fatigue-reminder {
  position: fixed; inset: 0; z-index: var(--modal-z);
  background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center;
}
#fatigue-reminder.hidden { display: none; }
.fatigue-box { background: var(--panel-bg); border-radius: 16px; padding: 32px 24px; width: 340px; max-width: 92vw; border: 3px solid var(--warn); text-align: center; }
.fatigue-icon { font-size: 60px; margin-bottom: 16px; }
.fatigue-box h2 { font-size: 26px; font-weight: 700; color: var(--warn); margin-bottom: 12px; }
.fatigue-box p { font-size: 17px; color: var(--text-dim); margin-bottom: 24px; }

/* ── PRE-RIDE CHECKLIST MODAL ────────────────────────────────── */
#checklist-modal {
  position: fixed; inset: 0; z-index: var(--modal-z);
  background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center;
}
#checklist-modal.hidden { display: none; }
.checklist-box { background: var(--panel-bg); border-radius: 16px; padding: 24px; width: 380px; max-width: 92vw; border: 2px solid var(--orange); max-height: 90vh; overflow-y: auto; }
.checklist-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: var(--orange); }

/* ── LEAN ANGLE DISPLAY ─────────────────────────────────────── */
#lean-indicator {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(26,26,26,0.9); border-radius: 12px; padding: 8px 16px;
  z-index: var(--hud-z); display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--orange); border: 2px solid var(--orange);
}
#lean-indicator.hidden { display: none; }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,140,0,0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(255,140,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,140,0,0); }
}
@keyframes slideDown { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ── ROUTE HIGHLIGHT on map (Leaflet) ───────────────────────── */
.leaflet-pane .route-line { stroke-linecap: round; stroke-linejoin: round; }
.leaflet-pane .gravel-line { stroke: var(--gravel-red); stroke-dasharray: 8,6; stroke-width: 4; fill: none; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 400px) {
  #setup-panel { width: 100vw; }
  :root { --font-body: 16px; --font-head: 21px; --font-nav: 24px; }
}
@media (max-height: 600px) {
  #nav-instruction { min-height: 70px; }
  :root { --font-nav: 22px; }
}

/* ── Leaflet overrides ──────────────────────────────────────── */
.leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 22px !important; }
.leaflet-popup-content-wrapper { background: var(--panel-bg); color: var(--text); border: 2px solid var(--orange); border-radius: 12px; }
.leaflet-popup-tip { background: var(--panel-bg); }
