/* ==========================================================================
   GTA 6 — LEONIDA COMPANION · APPLE-GRADE DESIGN SYSTEM & 3 GTA THEMES
   Themes: vice-sunset (dark default), ocean-day (light), grove-night (dark)
   ========================================================================== */

:root,
[data-theme="vice-sunset"] {
  color-scheme: dark;
  --map-bg: #08090C;
  --bg-canvas: #0B0C0F;
  --surface-base: #12141A;
  --surface-elevated: #191C24;
  --surface-glass: rgba(18, 20, 26, 0.80);
  --surface-glass-strong: rgba(20, 22, 29, 0.92);
  --surface-card: rgba(255, 255, 255, 0.045);
  --surface-card-hover: rgba(255, 255, 255, 0.082);
  --surface-input: rgba(255, 255, 255, 0.06);
  --surface-pill: rgba(255, 255, 255, 0.065);
  --surface-pill-active: rgba(255, 55, 95, 0.16);
  --surface-scrim: rgba(0, 0, 0, 0.52);

  --border-hairline: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --highlight-inset: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --text-primary: #F5F5F7;
  --text-secondary: #A1A6B3;
  --text-tertiary: #6E7485;
  --text-on-accent: #FFFFFF;

  --accent-primary: #FF375F;
  --accent-primary-hover: #FF4F73;
  --accent-primary-soft: rgba(255, 55, 95, 0.15);
  --accent-secondary: #FF9F0A;
  --accent-secondary-soft: rgba(255, 159, 10, 0.15);
  --accent-info: #32ADE6;
  --accent-info-soft: rgba(50, 173, 230, 0.15);
  --accent-cash: #30D158;
  --accent-cash-soft: rgba(48, 209, 88, 0.15);
  --accent-amber: #FF9F0A;
  --accent-amber-soft: rgba(255, 159, 10, 0.15);
  --accent-danger: #FF453A;
  --accent-danger-soft: rgba(255, 69, 58, 0.16);
  --accent-violet: #BF5AF2;
  --accent-violet-soft: rgba(191, 90, 242, 0.15);

  --hero-gradient: linear-gradient(135deg, #FF375F 0%, #FF6B4A 100%);
  --brand-gradient: linear-gradient(135deg, #FF375F 0%, #FF9F0A 100%);
  --ambient-glow: radial-gradient(ellipse 65% 40% at 15% 0%, rgba(255, 55, 95, 0.08), transparent),
                  radial-gradient(ellipse 55% 35% at 85% 0%, rgba(255, 159, 10, 0.06), transparent);

  --pin-ring: #FFFFFF;
  --pin-bg: #161820;
  --cluster-bg: #1D1F28;
  --cluster-text: #F5F5F7;
  --cluster-border: rgba(255, 255, 255, 0.35);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36);
  --shadow-sheet: 0 18px 48px rgba(0, 0, 0, 0.52);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.64);
}

[data-theme="ocean-day"] {
  color-scheme: light;
  --map-bg: #E6EAF0;
  --bg-canvas: #F5F5F7;
  --surface-base: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.84);
  --surface-glass-strong: rgba(255, 255, 255, 0.94);
  --surface-card: rgba(0, 0, 0, 0.032);
  --surface-card-hover: rgba(0, 0, 0, 0.058);
  --surface-input: rgba(0, 0, 0, 0.048);
  --surface-pill: rgba(0, 0, 0, 0.05);
  --surface-pill-active: rgba(0, 113, 227, 0.12);
  --surface-scrim: rgba(15, 23, 42, 0.34);

  --border-hairline: rgba(0, 0, 0, 0.085);
  --border-strong: rgba(0, 0, 0, 0.16);
  --highlight-inset: inset 0 1px 0 rgba(255, 255, 255, 0.85);

  --text-primary: #1D1D1F;
  --text-secondary: #515154;
  --text-tertiary: #86868B;
  --text-on-accent: #FFFFFF;

  --accent-primary: #0071E3;
  --accent-primary-hover: #0077ED;
  --accent-primary-soft: rgba(0, 113, 227, 0.11);
  --accent-secondary: #FF2D55;
  --accent-secondary-soft: rgba(255, 45, 85, 0.11);
  --accent-info: #0071E3;
  --accent-info-soft: rgba(0, 113, 227, 0.11);
  --accent-cash: #178038;
  --accent-cash-soft: rgba(23, 128, 56, 0.11);
  --accent-amber: #B25E00;
  --accent-amber-soft: rgba(178, 94, 0, 0.11);
  --accent-danger: #D70015;
  --accent-danger-soft: rgba(215, 0, 21, 0.11);
  --accent-violet: #8944AB;
  --accent-violet-soft: rgba(137, 68, 171, 0.11);

  --hero-gradient: linear-gradient(135deg, #0071E3 0%, #248AF3 100%);
  --brand-gradient: linear-gradient(135deg, #0071E3 0%, #FF2D55 100%);
  --ambient-glow: radial-gradient(ellipse 65% 40% at 15% 0%, rgba(0, 113, 227, 0.05), transparent),
                  radial-gradient(ellipse 55% 35% at 85% 0%, rgba(255, 45, 85, 0.04), transparent);

  --pin-ring: #FFFFFF;
  --pin-bg: #FFFFFF;
  --cluster-bg: #1D1D1F;
  --cluster-text: #FFFFFF;
  --cluster-border: rgba(255, 255, 255, 0.9);

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-sheet: 0 16px 44px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.20);
}

[data-theme="grove-night"] {
  color-scheme: dark;
  --map-bg: #070A08;
  --bg-canvas: #090C0A;
  --surface-base: #101512;
  --surface-elevated: #161D19;
  --surface-glass: rgba(16, 21, 18, 0.82);
  --surface-glass-strong: rgba(18, 24, 20, 0.93);
  --surface-card: rgba(255, 255, 255, 0.045);
  --surface-card-hover: rgba(255, 255, 255, 0.08);
  --surface-input: rgba(255, 255, 255, 0.06);
  --surface-pill: rgba(255, 255, 255, 0.06);
  --surface-pill-active: rgba(48, 209, 88, 0.15);
  --surface-scrim: rgba(0, 0, 0, 0.56);

  --border-hairline: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.17);
  --highlight-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --text-primary: #F2F5F3;
  --text-secondary: #9CA8A0;
  --text-tertiary: #69756D;
  --text-on-accent: #07190C;

  --accent-primary: #30D158;
  --accent-primary-hover: #3FE067;
  --accent-primary-soft: rgba(48, 209, 88, 0.15);
  --accent-secondary: #D4AF37;
  --accent-secondary-soft: rgba(212, 175, 55, 0.15);
  --accent-info: #5AC8FA;
  --accent-info-soft: rgba(90, 200, 250, 0.14);
  --accent-cash: #30D158;
  --accent-cash-soft: rgba(48, 209, 88, 0.15);
  --accent-amber: #E5B946;
  --accent-amber-soft: rgba(229, 185, 70, 0.15);
  --accent-danger: #FF453A;
  --accent-danger-soft: rgba(255, 69, 58, 0.16);
  --accent-violet: #BF5AF2;
  --accent-violet-soft: rgba(191, 90, 242, 0.15);

  --hero-gradient: linear-gradient(135deg, #28B84C 0%, #30D158 100%);
  --brand-gradient: linear-gradient(135deg, #30D158 0%, #D4AF37 100%);
  --ambient-glow: radial-gradient(ellipse 65% 40% at 15% 0%, rgba(48, 209, 88, 0.07), transparent),
                  radial-gradient(ellipse 55% 35% at 85% 0%, rgba(212, 175, 55, 0.05), transparent);

  --pin-ring: #FFFFFF;
  --pin-bg: #131915;
  --cluster-bg: #18211B;
  --cluster-text: #F2F5F3;
  --cluster-border: rgba(255, 255, 255, 0.35);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.40);
  --shadow-sheet: 0 18px 48px rgba(0, 0, 0, 0.56);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.68);
}

:root {
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;

  --topbar-h: 56px;
  --sidebar-w: 364px;
  --drawer-w: 416px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.46;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }
.mobile-only { display: none !important; }
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   APP SHELL & TOPBAR
   ========================================================================== */

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--ambient-glow), var(--bg-canvas);
  transition: background-color 0.28s var(--ease-apple);
}

.topbar {
  width: 100%;
  max-width: 100%;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border-hairline);
  z-index: 42;
}

.topbar-left, .topbar-right, .topbar-modules {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.icon-btn:hover {
  background: var(--surface-card-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}
.accent-vice {
  color: var(--accent-primary);
  font-weight: 700;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Topbar Module Pills */
.module-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
}
.module-pill:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-0.5px);
}
.module-pill:active { transform: scale(0.98); }
.module-bank .pill-icon { color: var(--accent-amber); }
.module-drip .pill-icon { color: var(--accent-secondary); }
.module-cars .pill-icon { color: var(--accent-info); }
.module-tactical .pill-icon { color: var(--accent-danger); }

.pill-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

/* Global Progress Chip */
.progress-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 114px;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
}
.progress-chip-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
}
.progress-chip-label { color: var(--text-tertiary); font-weight: 500; }
.progress-chip-meta strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent-cash);
  white-space: nowrap;
}
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent-cash);
}
.progress-chip-bar {
  height: 3.5px;
  width: 100%;
  border-radius: 99px;
  background: var(--border-hairline);
  overflow: hidden;
}
.progress-chip-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent-cash);
  transition: width 0.35s var(--ease-apple);
}

/* Chapter Selector Pill */
.chapter-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  transition: all 0.18s;
}
.chapter-picker:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.chapter-picker.is-filtered {
  background: var(--accent-violet-soft);
  border-color: color-mix(in srgb, var(--accent-violet) 45%, transparent);
  color: var(--text-primary);
}
.chapter-ico { color: var(--text-tertiary); }
.chapter-picker.is-filtered .chapter-ico { color: var(--accent-violet); }
.chapter-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  padding-right: 4px;
}
.chapter-select option {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* Segmented Control (FR | EN) */
.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 9px;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
  height: 34px;
}
.seg-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Theme Picker Popover */
.theme-menu-wrap {
  position: relative;
}
.theme-trigger {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s;
}
.theme-trigger:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}
.theme-swatch-pair {
  display: inline-flex;
  align-items: center;
}
.swatch-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--surface-base);
}
.swatch-dot.sw-a { background: var(--accent-primary); }
.swatch-dot.sw-b { background: var(--accent-secondary); margin-left: -4px; }

.theme-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 244px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet), var(--highlight-inset);
  z-index: 70;
  transform-origin: top right;
  animation: pop-menu 0.18s var(--ease-apple);
}
@keyframes pop-menu {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.theme-popover-title {
  padding: 4px 8px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.theme-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.16s;
}
.theme-option:hover { background: var(--surface-card-hover); }
.theme-option.active { background: var(--surface-pill-active); }
.theme-preview {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.tp-vice { background: #0B0C0F; }
.tp-vice .tp-a { width: 8px; height: 14px; border-radius: 3px; background: #FF375F; }
.tp-vice .tp-b { width: 8px; height: 14px; border-radius: 3px; background: #FF9F0A; }
.tp-ocean { background: #F5F5F7; }
.tp-ocean .tp-a { width: 8px; height: 14px; border-radius: 3px; background: #0071E3; }
.tp-ocean .tp-b { width: 8px; height: 14px; border-radius: 3px; background: #FF2D55; }
.tp-grove { background: #090C0A; }
.tp-grove .tp-a { width: 8px; height: 14px; border-radius: 3px; background: #30D158; }
.tp-grove .tp-b { width: 8px; height: 14px; border-radius: 3px; background: #D4AF37; }
.theme-option-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.theme-option-copy strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.theme-option-copy small {
  font-size: 11px;
  color: var(--text-tertiary);
}
.theme-check {
  color: var(--accent-primary);
  opacity: 0;
}
.theme-option.active .theme-check { opacity: 1; }

/* ==========================================================================
   WORKSPACE & SIDEBAR
   ========================================================================== */

.workspace {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: var(--surface-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 34;
  transition: opacity 0.25s ease;
}

.sheet-handle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 40px;
  padding: 8px 14px;
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
  z-index: 4;
}
.sheet-grabber {
  width: 38px;
  height: 4.5px;
  border-radius: 99px;
  background: var(--border-strong);
}
.sheet-close-btn,
.sheet-expand-btn {
  position: absolute;
  top: 5px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sheet-close-btn { right: 12px; }
.sheet-expand-btn { left: 12px; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border-hairline);
  z-index: 35;
  transition: margin-left 0.3s var(--ease-apple), transform 0.3s var(--ease-apple), opacity 0.22s;
}
.sidebar.collapsed {
  margin-left: calc(var(--sidebar-w) * -1);
  opacity: 0;
  pointer-events: none;
}

.sidebar-hero {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border-hairline);
}

/* HERO SURPRISE BUTTON (Tactile, restrained, zero sheen slop) */
.btn-surprise {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 13px;
  background: var(--hero-gradient);
  color: #FFFFFF;
  text-align: left;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.16s var(--ease-apple), filter 0.16s, box-shadow 0.18s;
}
.btn-surprise:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-surprise:active { transform: scale(0.985); }
.btn-surprise-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}
.btn-surprise-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.btn-surprise-copy strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.btn-surprise-copy small {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kbd-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Quick Presets */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 9px;
}
.preset-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border-radius: 9px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.preset-chip:hover {
  background: var(--surface-card-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.preset-chip.active {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.preset-wide {
  grid-column: 1 / -1;
  background: var(--accent-amber-soft);
  border-color: color-mix(in srgb, var(--accent-amber) 36%, transparent);
  color: var(--accent-amber);
}
.preset-wide:hover {
  background: color-mix(in srgb, var(--accent-amber) 22%, transparent);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

/* Sidebar Segmented Tabs */
.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 8px 12px 2px;
  padding: 3px;
  gap: 3px;
  border-radius: 10px;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
}
.stab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 29px;
  padding: 0 4px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.stab:hover { color: var(--text-primary); }
.stab.active {
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Tab Panels */
.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 20px;
}
.tab-panel.active { display: flex; }

/* Search & Filters */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 34px;
  border-radius: 10px;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.search-box input::placeholder { color: var(--text-tertiary); }
.search-box input:focus {
  border-color: var(--accent-primary);
  background: var(--surface-elevated);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}
.kbd-inline {
  position: absolute;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-pill);
  color: var(--text-tertiary);
  pointer-events: none;
}

.filters-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.filter-switches {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.filter-selects {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.filter-selects .mini-select {
  flex: 1;
  min-width: 0;
}

.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.16s;
}
.mini-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.mini-toggle .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.mini-toggle.active {
  background: var(--accent-cash-soft);
  border-color: var(--accent-cash);
  color: var(--accent-cash);
}
.mini-toggle.active .dot { background: var(--accent-cash); }
.mini-toggle.toggle-warn.active {
  background: var(--accent-danger-soft);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}
.mini-toggle.toggle-calm.active {
  background: var(--accent-info-soft);
  border-color: var(--accent-info);
  color: var(--accent-info);
}

.mini-select {
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}
.mini-select:focus { border-color: var(--accent-primary); }
.mini-select option {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* Category Chips */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-tertiary);
  transition: all 0.16s;
}
.cat-chip .cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent-primary));
  opacity: 0.45;
}
.cat-chip.active {
  background: color-mix(in srgb, var(--chip-color, var(--accent-primary)) 13%, var(--surface-base));
  border-color: color-mix(in srgb, var(--chip-color, var(--accent-primary)) 45%, transparent);
  color: var(--text-primary);
}
.cat-chip.active .cat-dot { opacity: 1; }
.cat-chip .cat-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  opacity: 0.78;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 2px 7px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.link-btn {
  color: var(--accent-primary);
  font-size: 11.5px;
  font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

/* Spots List Cards (Clean Apple-style rows) */
.spots-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.poi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px 12px;
  border-radius: 13px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.16s var(--ease-apple);
}
.poi-card:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}
.poi-card.is-selected {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
}
.poi-card.is-done { opacity: 0.62; }
.poi-card.is-done .poi-card-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.poi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.poi-card-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}
.poi-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--card-color, var(--accent-primary));
}
.poi-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.poi-fav-inline {
  color: var(--accent-amber);
  display: inline-flex;
  vertical-align: -1px;
  margin-right: 3px;
}
.poi-card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.poi-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poi-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-pill);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.meta-pill.profit { color: var(--accent-cash); background: var(--accent-cash-soft); }
.meta-pill.drip { color: var(--accent-secondary); background: var(--accent-secondary-soft); }
.meta-pill.ch { color: var(--accent-amber); background: var(--accent-amber-soft); }

.check-mini {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-tertiary);
  transition: all 0.16s;
}
.check-mini:hover { border-color: var(--accent-cash); color: var(--accent-cash); }
.check-mini.checked {
  background: var(--accent-cash);
  border-color: var(--accent-cash);
  color: #FFFFFF;
}

/* ==========================================================================
   ROUTES, REGIONS & CH.3 TABS
   ========================================================================== */

.routes-section { margin-bottom: 18px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.section-head h3 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.pill-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-info-soft);
  color: var(--accent-info);
}
.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.route-card, .region-card, .ch3-card {
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  transition: background 0.16s, border-color 0.16s;
}
.route-card:hover, .region-card:hover, .ch3-card:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}
.route-card.active-route {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}
.route-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
}
.route-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.route-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.btn-primary-sm, .btn-secondary, .btn-danger-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.16s;
}
.btn-primary-sm {
  width: 100%;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary-sm:hover {
  background: var(--accent-primary-hover);
}
.btn-secondary {
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}
.btn-danger-ghost {
  width: 100%;
  margin-top: 8px;
  color: var(--accent-danger);
  border: 1px solid color-mix(in srgb, var(--accent-danger) 30%, transparent);
  background: var(--accent-danger-soft);
}
.btn-danger-ghost:hover {
  background: color-mix(in srgb, var(--accent-danger) 24%, transparent);
}

/* Custom Route Builder */
.custom-route-box {
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-input);
  border: 1px dashed var(--border-strong);
}
.custom-route-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 6px;
}
.custom-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12px;
}
.custom-step-row:last-of-type { border-bottom: none; }
.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.custom-step-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.custom-step-name:hover { color: var(--accent-primary); }
.step-rm {
  color: var(--text-tertiary);
  padding: 3px 5px;
  display: inline-flex;
}
.step-rm:hover { color: var(--accent-danger); }
.custom-route-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

/* Regions HUD */
.regions-list { display: flex; flex-direction: column; gap: 8px; }
.region-card { cursor: pointer; }
.region-card.selected {
  border-color: var(--reg-color, var(--accent-primary));
  background: color-mix(in srgb, var(--reg-color, var(--accent-primary)) 12%, var(--surface-base));
}
.region-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.region-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
}
.region-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--reg-color, var(--accent-primary));
}
.region-pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.region-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--border-hairline);
  overflow: hidden;
  margin: 6px 0;
}
.region-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--reg-color, var(--accent-primary));
  transition: width 0.35s var(--ease-apple);
}
.region-desc { font-size: 11.5px; color: var(--text-tertiary); }

/* Ch3 & Backup Card */
.ch3-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.ch3-card-detail { font-size: 12px; color: var(--text-secondary); }
.backup-card {
  margin-top: 16px;
  padding: 13px;
  border-radius: 13px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.backup-card h4 {
  margin: 0 0 5px;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.file-label { cursor: pointer; }

/* ==========================================================================
   INTERACTIVE MAP STAGE
   ========================================================================== */

.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--map-bg);
  overflow: hidden;
  user-select: none;
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  outline: none;
  touch-action: none;
}
.map-viewport.is-dragging { cursor: grabbing; }

.map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.map-world {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
}
.map-world.canvas-active .map-image { display: none; }

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.map-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

/* Route Overlay */
.route-line-glow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.28;
}
.route-line-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1.4 0.9;
  animation: dash-flow 1.4s linear infinite;
}
@keyframes dash-flow {
  from { stroke-dashoffset: 4.6; }
  to { stroke-dashoffset: 0; }
}

.region-poly {
  transition: opacity 0.25s;
}
.region-label-text {
  font-family: var(--font-display);
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.72);
  stroke-width: 0.32;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ==========================================================================
   MAP PINS & CLUSTERS (Apple Maps precision)
   ========================================================================== */

.map-pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-left: -17px;
  margin-top: -17px;
  border: 0;
  line-height: 0;
  display: block;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  will-change: transform;
}
.map-pin:hover { z-index: 25; }
.map-pin.is-active { z-index: 30; }
.map-pin.is-route-stop { z-index: 28; }

.pin-body {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(-45deg);
  background: var(--pin-color, var(--accent-primary));
  border: 2px solid var(--pin-ring);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s;
}
.map-pin:hover .pin-body,
.map-pin.is-active .pin-body {
  transform: rotate(-45deg) scale(1.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.pin-icon {
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  width: 15px;
  height: 15px;
}

.pin-pulse {
  display: none;
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--pin-color, var(--accent-primary));
  animation: radar-pulse 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}
.map-pin.is-active .pin-pulse { display: block; }
@keyframes radar-pulse {
  0% { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(2.0); opacity: 0; }
}

.map-pin.is-done .pin-body {
  opacity: 0.55;
  filter: saturate(0.45);
}
.pin-badge-done {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cash);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--pin-ring);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.pin-badge-fav {
  position: absolute;
  bottom: -3px;
  right: -4px;
  color: var(--accent-amber);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}
.pin-badge-route {
  position: absolute;
  top: -10px;
  left: -9px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--route-badge-bg, var(--accent-primary));
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: var(--shadow-sm);
}

/* Cluster Marker */
.map-cluster {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  margin-left: -20px;
  margin-top: -20px;
  pointer-events: auto;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cluster-bg);
  border: 2px solid var(--cluster-border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--cluster-text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 12.5px;
  will-change: transform;
  transition: transform 0.16s var(--ease-apple), border-color 0.16s;
}
.map-cluster:hover {
  z-index: 25;
  border-color: var(--accent-primary);
}
.map-cluster small {
  font-family: var(--font-body);
  font-size: 8px;
  opacity: 0.75;
  margin-top: -2px;
}

/* Floating Tooltip (Desktop hover only) */
.map-tooltip {
  position: absolute;
  z-index: 38;
  pointer-events: none;
  max-width: 268px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet);
  transform: translate(-50%, calc(-100% - 14px));
}
.tt-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.tt-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}
.tt-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.tt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

/* ==========================================================================
   FLOATING MAP HUD
   ========================================================================== */

.data-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 32;
  max-width: min(620px, calc(100% - 28px));
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--accent-amber);
  color: var(--text-primary);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
}
.data-banner button {
  margin-left: auto;
  color: var(--text-secondary);
  padding: 2px 6px;
}

.route-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 33;
  width: min(660px, calc(100% - 28px));
  padding: 10px 13px;
  border-radius: 15px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet), var(--highlight-inset);
  transition: left 0.28s var(--ease-apple), right 0.28s var(--ease-apple), width 0.28s var(--ease-apple);
}
.map-stage.has-drawer-open .route-banner,
.map-stage.has-drawer-open .data-banner {
  left: 14px;
  right: calc(var(--drawer-w) + 26px);
  transform: none;
  width: auto;
  max-width: 660px;
}
.route-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.route-banner-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.route-banner-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-primary);
  color: #FFFFFF;
  letter-spacing: 0.04em;
}
.route-banner-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.route-banner-actions { display: flex; gap: 6px; }
.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  transition: background 0.16s, border-color 0.16s;
}
.mini-btn:hover { background: var(--surface-card-hover); border-color: var(--border-strong); }
.mini-btn-close:hover { background: var(--accent-danger-soft); color: var(--accent-danger); }

.route-banner-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  margin-top: 8px;
  padding-bottom: 2px;
}
.rstep-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--text-primary);
  transition: all 0.16s;
}
.rstep-pill:hover { border-color: var(--accent-primary); background: var(--accent-primary-soft); }
.rstep-pill.done { opacity: 0.6; text-decoration: line-through; }
.rstep-arrow { color: var(--text-tertiary); font-size: 11px; }

/* Bottom-Left HUD */
.map-hud-bl {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 10px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.hud-pill-btn { cursor: pointer; font-weight: 600; transition: all 0.16s; }
.hud-pill-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.hud-pill-btn.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}
.quality-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cash);
}
.quality-dot.uhd {
  background: var(--accent-primary);
}

/* Bottom-Right Minimap & Zoom */
.map-hud-br {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 26;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transition: right 0.3s var(--ease-apple);
}
.map-stage.has-drawer-open .map-hud-br {
  right: calc(var(--drawer-w) + 26px);
}

.minimap-wrap {
  width: 144px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-md);
}
.minimap-wrap.collapsed .minimap-body { display: none; }
.minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-hairline);
}
.minimap-collapse { color: var(--text-secondary); font-size: 14px; padding: 0 4px; }
.minimap-body {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--map-bg);
  cursor: crosshair;
  overflow: hidden;
}
.minimap-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.85;
  pointer-events: none;
}
.minimap-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mm-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.minimap-rect {
  position: absolute;
  border: 1.5px solid var(--accent-primary);
  background: var(--accent-primary-soft);
  pointer-events: none;
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.zoom-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s;
}
.zoom-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
  color: var(--accent-primary);
}
.zoom-btn:active { transform: scale(0.95); }

/* Map Loader */
.map-loader {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: opacity 0.3s;
}
.map-loader.fade-out { opacity: 0; pointer-events: none; }
.loader-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid var(--border-hairline);
  border-top-color: var(--accent-primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   POI DETAIL DRAWER (Desktop Right / Mobile 2-Stage Bottom Sheet)
   ========================================================================== */

.poi-drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(var(--drawer-w), calc(100vw - 24px));
  z-index: 36;
  border-radius: var(--radius-xl);
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sheet), var(--highlight-inset);
  transform: translateX(calc(100% + 28px));
  transition: transform 0.32s var(--ease-apple);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.poi-drawer.open { transform: translateX(0); }

.poi-drawer-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.drawer-hero {
  position: relative;
  padding: 18px 18px 14px;
  background: linear-gradient(155deg, color-mix(in srgb, var(--drawer-color, var(--accent-primary)) 12%, var(--surface-base)), var(--surface-base));
  border-bottom: 1px solid var(--border-hairline);
}
.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, color 0.16s;
}
.drawer-close:hover {
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
}

.drawer-kicker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-right: 36px;
}
.badge-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--drawer-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--drawer-color) 42%, transparent);
  color: var(--text-primary);
}
.badge-cat .ico { color: var(--drawer-color); }
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-pill);
  color: var(--text-secondary);
}
.badge-soft.confirmed { background: var(--accent-cash-soft); color: var(--accent-cash); }
.badge-soft.spoiler-warn { background: var(--accent-danger-soft); color: var(--accent-danger); }

.drawer-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.24;
  color: var(--text-primary);
}
.drawer-original {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 3px;
}
.drawer-short {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.drawer-actions-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--surface-card);
}
.btn-done-lg {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--surface-pill);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.16s;
}
.btn-done-lg:hover {
  border-color: var(--accent-cash);
  background: var(--accent-cash-soft);
}
.btn-done-lg.is-done {
  background: var(--accent-cash);
  border-color: var(--accent-cash);
  color: #FFFFFF;
}
.btn-action-sq {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.16s;
}
.btn-action-sq:hover { color: var(--text-primary); background: var(--surface-card-hover); }
.btn-action-sq.active-fav {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  background: var(--accent-amber-soft);
}
.btn-action-sq.active-route {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

.drawer-body {
  padding: 14px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.metric-box {
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric-val {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.metric-val.cash { color: var(--accent-cash); }
.metric-val.drip { color: var(--accent-secondary); }
.metric-val.diff { color: var(--accent-amber); letter-spacing: 1px; }

.drawer-block h4 {
  margin: 0 0 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.location-box {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--accent-info-soft);
  border: 1px solid color-mix(in srgb, var(--accent-info) 28%, transparent);
  font-size: 12.5px;
  color: var(--text-primary);
}
.location-box-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.steps-list, .tips-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.steps-list li {
  display: flex;
  gap: 9px;
  font-size: 12.8px;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.step-phase-title {
  color: var(--text-primary);
  font-weight: 700;
}
.step-detail-copy { margin-top: 2px; }
.step-idx {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tips-list li {
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--accent-amber-soft);
  border-left: 3px solid var(--accent-amber);
  font-size: 12.5px;
  color: var(--text-primary);
}

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag-pill {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-pill);
  font-size: 11px;
  color: var(--text-secondary);
}

.note-textarea {
  width: 100%;
  min-height: 68px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
  resize: vertical;
  font-size: 12.5px;
  outline: none;
}
.note-textarea:focus { border-color: var(--accent-primary); }

.btn-similar {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--accent-primary-soft);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 42%, transparent);
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.16s;
}
.btn-similar:hover {
  background: color-mix(in srgb, var(--accent-primary) 22%, transparent);
}

.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--accent-info);
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--accent-info-soft);
  text-decoration: none;
}
.source-link:hover { text-decoration: underline; }

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--surface-scrim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade-in 0.18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--surface-base);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal), var(--highlight-inset);
  overflow: hidden;
  animation: pop-up 0.24s var(--ease-apple);
}
@keyframes pop-up {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-xl { max-width: 960px; }
.modal-md { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--surface-card);
  flex-shrink: 0;
}
.modal-header-bank { border-bottom-color: color-mix(in srgb, var(--accent-amber) 32%, var(--border-hairline)); }
.modal-header-drip { border-bottom-color: color-mix(in srgb, var(--accent-secondary) 32%, var(--border-hairline)); }
.modal-header-cars { border-bottom-color: color-mix(in srgb, var(--accent-info) 32%, var(--border-hairline)); }
.modal-header-tactical { border-bottom-color: color-mix(in srgb, var(--accent-danger) 32%, var(--border-hairline)); }

.modal-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}
.modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
}

.modal-body {
  padding: 18px 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-lead {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13.5px;
}
.modal-stack { display: flex; flex-direction: column; gap: 14px; }
.modal-grid-2 {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 16px;
}
.panel-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.panel-box h3 {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-box-success {
  border-color: color-mix(in srgb, var(--accent-cash) 42%, transparent);
  background: var(--accent-cash-soft);
}
.panel-box-success strong { color: var(--accent-cash); }

/* Bank Checklist */
.readiness-bar-wrap {
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--accent-amber-soft);
  border: 1px solid color-mix(in srgb, var(--accent-amber) 34%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.readiness-progress { flex: 1; min-width: 0; }
.readiness-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.readiness-status { font-size: 13px; color: var(--text-primary); }
.readiness-pct { color: var(--accent-amber); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.readiness-track {
  height: 7px;
  border-radius: 99px;
  background: var(--border-hairline);
  overflow: hidden;
  margin-top: 6px;
}
.readiness-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-cash);
  transition: width 0.35s var(--ease-apple);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s;
}
.check-row:hover { background: var(--surface-card-hover); }
.check-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent-cash);
  cursor: pointer;
  flex-shrink: 0;
}
.check-row-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.check-row.done strong { text-decoration: line-through; color: var(--text-tertiary); }

.loadout-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.loadout-tab {
  padding: 6px 12px;
  border-radius: 9px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.loadout-tab.active {
  background: var(--accent-amber-soft);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.cta-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  background: var(--hero-gradient);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, filter 0.16s;
}
.cta-hero:hover { filter: brightness(1.06); transform: translateY(-1px); }
.cta-hero-cash {
  width: 100%;
  background: var(--accent-cash);
  color: #FFFFFF;
}

/* Drip Lookbooks Grid */
.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}
.fpill-divider {
  width: 1px;
  height: 18px;
  background: var(--border-hairline);
  margin: 0 2px;
}
.fpill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-pill);
  border: 1px solid var(--border-hairline);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.16s;
}
.fpill:hover { color: var(--text-primary); border-color: var(--border-strong); }
.fpill.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.lookbooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.lookbook-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  border-radius: 15px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.lookbook-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.lookbook-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.lookbook-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.lookbook-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cash);
  white-space: nowrap;
}
.lookbook-pieces { display: flex; flex-direction: column; gap: 5px; }
.piece-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--surface-input);
  font-size: 12px;
}
.piece-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.piece-check-label input { accent-color: var(--accent-secondary); }
.piece-name-owned { text-decoration: line-through; opacity: 0.55; }
.piece-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.piece-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.piece-slot {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent-secondary);
  font-weight: 700;
  min-width: 68px;
}
.piece-store {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-info);
  font-size: 11px;
  cursor: pointer;
}
.piece-store:hover { text-decoration: underline; }
.piece-store-muted { font-size: 11px; color: var(--text-tertiary); }
.piece-price { font-size: 11px; color: var(--accent-cash); }

/* Car Goals & Cash Calculator */
.cash-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--accent-info-soft);
  border: 1px solid color-mix(in srgb, var(--accent-info) 28%, transparent);
  margin-bottom: 14px;
}
.cash-bar-title { font-size: 13.5px; color: var(--text-primary); }
.cash-bar-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.cash-input-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.cash-input {
  width: 140px;
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  background: var(--surface-base);
  border: 1px solid var(--accent-cash);
  color: var(--accent-cash);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

.cars-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 16px;
}
.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 10px;
  align-content: start;
}
.car-card {
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: all 0.16s;
}
.car-card:hover { background: var(--surface-card-hover); border-color: var(--border-strong); }
.car-card.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-soft);
}
.car-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.car-stars { color: var(--accent-amber); font-size: 11px; }
.car-name { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.car-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.car-price-free { color: var(--accent-cash); font-family: var(--font-mono); font-weight: 700; font-size: 12px; }
.car-price-paid { color: var(--accent-amber); font-family: var(--font-mono); font-weight: 700; font-size: 12px; }

.car-calc-panel {
  padding: 15px;
  border-radius: 15px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.car-calc-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.car-calc-price {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.car-calc-price.is-free { color: var(--accent-cash); }
.car-calc-price.is-paid { color: var(--accent-amber); }
.car-missing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.car-missing-val { color: var(--accent-amber); font-size: 15px; }
.car-run-row { cursor: pointer; }
.car-run-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.car-run-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-run-sub { font-size: 11px; color: var(--text-tertiary); }
.car-run-profit { color: var(--accent-cash); font-weight: 700; flex-shrink: 0; }

/* Help & Verification Notes */
.kbd-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--surface-input);
  font-size: 12px;
}
.kbd-key {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-primary-soft);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 34%, transparent);
  color: var(--accent-primary);
  white-space: nowrap;
}
.help-meta-line {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.help-meta-muted {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.help-note-box {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--accent-amber-soft);
  border: 1px solid color-mix(in srgb, var(--accent-amber) 30%, transparent);
  font-size: 12px;
  color: var(--text-primary);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 28px);
}
.toast {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sheet);
  animation: toast-in 0.22s var(--ease-apple);
}
.toast.toast-pink { border-color: var(--accent-primary); }
.toast.toast-cash { border-color: var(--accent-cash); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.empty-state {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12.5px;
  border-radius: 12px;
  background: var(--surface-card);
  border: 1px dashed var(--border-hairline);
  white-space: pre-line;
}

/* ==========================================================================
   TACTICAL UI: BADGES, MISSABLE ALERT, SAFE CODES, TOOLS & FENCES
   ========================================================================== */

.badge-uid {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-info-soft);
  color: var(--accent-info);
}

.badge-missable {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
}

.badge-code {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

.badge-nocombat {
  background: var(--accent-info-soft);
  color: var(--accent-info);
}

.missable-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-danger-soft);
  border: 1px solid color-mix(in srgb, var(--accent-danger) 42%, transparent);
  color: var(--text-primary);
  font-size: 12.2px;
  line-height: 1.4;
}
.missable-alert-banner strong {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent-danger);
  margin-bottom: 2px;
}
.missable-alert-icon {
  color: var(--accent-danger);
  margin-top: 1px;
  flex-shrink: 0;
}

.safe-code-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--accent-amber-soft);
  border: 1px solid color-mix(in srgb, var(--accent-amber) 32%, transparent);
}
.safe-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-base);
  border: 1px solid var(--border-hairline);
}
.safe-code-meta { min-width: 0; }
.safe-code-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.safe-code-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.safe-code-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.safe-code-value,
.safe-code-chip {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--accent-amber);
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--accent-amber-soft);
}
.safe-code-chip {
  font-size: 13px;
  letter-spacing: 1.1px;
  padding: 2px 8px;
}
.btn-copy-code {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--accent-info-soft);
  color: var(--accent-info);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s;
}
.btn-copy-code:hover {
  background: var(--accent-info);
  color: #FFFFFF;
}
.btn-copy-code.copied {
  background: var(--accent-cash-soft);
  color: var(--accent-cash);
}

.drawer-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.drawer-block-head h4 { margin: 0; }
.tools-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
  font-size: 12px;
  font-weight: 600;
}
.tool-pill small {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.85;
}

/* Modal Tactical */
.tactical-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 10px;
  max-width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tactical-tabs::-webkit-scrollbar { display: none; }
.tactical-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 10px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s;
}
.tactical-tab:hover { color: var(--text-primary); background: var(--surface-card-hover); }
.tactical-tab.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.tab-pill-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-input);
  color: var(--text-secondary);
}
.tactical-tab.active .tab-pill-count {
  color: var(--accent-primary);
}

.tactical-search-bar { margin-bottom: 12px; }
.tactical-search-bar input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
  font-size: 13px;
  outline: none;
}
.tactical-search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.tactical-spoiler-note {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-violet-soft);
  color: var(--accent-violet);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.codes-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
}
.codes-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.8px;
}
.codes-table th {
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  background: var(--surface-input);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}
.codes-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: middle;
}
.codes-table tbody tr:last-child td { border-bottom: none; }
.codes-table tbody tr:hover { background: var(--surface-card-hover); }

.code-cell-item + .code-cell-item { margin-top: 6px; }
.code-cell-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.code-sub-label { font-size: 11px; color: var(--text-secondary); }
.code-sub-note { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.place-title { font-family: var(--font-display); font-weight: 700; color: var(--text-primary); }
.place-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.col-loot { color: var(--accent-cash); font-size: 12px; }
.btn-locate-tac { white-space: nowrap; }

.tactical-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}
.tactical-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.tactical-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tactical-card-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.tactical-card-role {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.tactical-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

/* ==========================================================================
   MOBILE BOTTOM DOCK & TOOLS ACTION SHEET
   ========================================================================== */

.mobile-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  height: 58px;
  padding: 4px;
  border-radius: 20px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(26px);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet), var(--highlight-inset);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 44;
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 15px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 600;
  min-height: 44px;
  transition: background 0.16s, color 0.16s;
}
.dock-btn.active {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}
.dock-btn-accent {
  color: var(--accent-primary);
}

.mobile-tools-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 84dvh;
  border-radius: 22px 22px 0 0;
  background: var(--surface-base);
  border-top: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  z-index: 48;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 0.3s var(--ease-apple);
}
.mobile-tools-sheet.open { transform: translateY(0); }
.mobile-tools-body {
  padding: 6px 16px 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.mobile-tools-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mobile-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--accent-cash-soft);
  color: var(--accent-cash);
  font-size: 11.5px;
  font-weight: 600;
}
.mobile-tools-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin: 12px 0 8px;
}
.mobile-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.mobile-module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 13px;
  min-height: 76px;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  text-align: left;
  position: relative;
}
.mobile-module-card:active { transform: scale(0.98); background: var(--surface-card-hover); }
.mobile-module-card .mm-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.mobile-module-card .pill-badge { position: absolute; top: 10px; right: 10px; }
.mod-bank .mm-ico { color: var(--accent-amber); }
.mod-drip .mm-ico { color: var(--accent-secondary); }
.mod-cars .mm-ico { color: var(--accent-info); }
.mod-tactical .mm-ico { color: var(--accent-danger); }

.mobile-prefs-list {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}
.mobile-pref-row {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.mobile-pref-row:last-child { border-bottom: none; }
.mobile-pref-left {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
}
.mobile-pref-action { font-size: 12px; color: var(--accent-primary); font-weight: 600; }
.mobile-pref-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-pill);
  color: var(--text-tertiary);
}
.mobile-pref-pill.on {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}
.ios-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.ios-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s var(--ease-apple);
}
.ios-switch:checked { background: var(--accent-violet); }
.ios-switch:checked::after { transform: translateX(18px); }

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Laptop, iPad, iPhone, Samsung)
   ========================================================================== */

/* Wide Laptops & 125%/150% DPI Desktops (1380px - 1539px) */
@media (max-width: 1539px) {
  .topbar { padding: env(safe-area-inset-top) 12px 0; gap: 8px; }
  .topbar-left, .topbar-right, .topbar-modules { gap: 6px; }
  .brand-sub { display: none; }
  .hide-compact { display: none !important; }
}

/* Standard Laptops & Scaled Viewports (1121px - 1379px) */
@media (max-width: 1379px) {
  :root {
    --sidebar-w: 332px;
    --drawer-w: 388px;
  }
  .progress-chip { display: none; }
  .module-pill { padding: 0 9px; font-size: 12px; gap: 5px; }
  .chapter-picker { padding: 0 6px 0 8px; }
  .chapter-select { font-size: 11.5px; }
}

/* Compact Laptops & iPad Landscape (1024px - 1120px) */
@media (max-width: 1120px) {
  :root {
    --sidebar-w: 316px;
    --drawer-w: 372px;
  }
  .topbar { padding: env(safe-area-inset-top) 10px 0; gap: 6px; }
  .topbar-left, .topbar-right, .topbar-modules { gap: 5px; }
  .brand-title { font-size: 12px; }
  .module-pill { padding: 0 8px; font-size: 11.5px; }
}

/* iPad Portrait & Narrow Tablets (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 356px;
    box-shadow: var(--shadow-modal);
  }
  .sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-105%);
  }
  .module-pill { height: 34px; padding: 0 9px; }
  .module-pill .pill-label { display: none; }
  .modal-grid-2, .cars-layout { grid-template-columns: 1fr; }
}

/* Mobile (iPhone SE/15/16/Pro Max & Samsung Galaxy S/A/Fold <= 767px) */
@media (max-width: 767px) {
  .mobile-only { display: flex !important; }
  .hide-mobile { display: none !important; }

  .topbar {
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
  }
  .brand-badge { width: 29px; height: 29px; font-size: 12.5px; }
  .brand-title { font-size: 12px; white-space: nowrap; }
  .topbar-modules { display: none; }
  .segmented-control { height: 32px; }
  .seg-btn { height: 26px; padding: 0 8px; font-size: 11px; }
  .theme-trigger { height: 32px; padding: 0 8px; }
  .icon-btn { width: 32px; height: 32px; }

  /* Sidebar as Mobile Bottom Sheet */
  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 83dvh;
    max-height: calc(100dvh - 54px - env(safe-area-inset-top));
    border-right: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-modal);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(0);
    z-index: 46;
  }
  .sidebar.collapsed {
    margin-left: 0;
    transform: translateY(105%);
    opacity: 1;
    pointer-events: none;
  }

  /* POI Drawer as 2-State Bottom Sheet (peek 48dvh / expanded 88dvh) */
  .poi-drawer {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 48dvh;
    max-height: calc(100dvh - 54px - env(safe-area-inset-top));
    border-radius: 22px 22px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%);
    transition: transform 0.32s var(--ease-apple), height 0.28s var(--ease-apple);
    z-index: 46;
  }
  .poi-drawer.open { transform: translateY(0); }
  .poi-drawer.open.expanded { height: 87dvh; }
  .poi-drawer.open.expanded .sheet-expand-btn .ico { transform: rotate(180deg); }
  .poi-drawer .drawer-close { top: 10px; right: 12px; }
  .poi-drawer .drawer-hero { padding: 12px 16px; }
  .poi-drawer .drawer-title { font-size: 17px; }
  .poi-drawer .drawer-actions-bar { padding: 10px 14px; }

  /* Map HUD Positioning above Mobile Dock */
  .minimap-wrap { display: none; }
  .map-hud-bl {
    left: 10px;
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .map-hud-br {
    right: 10px;
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .map-stage.has-drawer-open .map-hud-br { right: 10px; }
  .zoom-btn { width: 42px; height: 42px; border-radius: 12px; }

  .route-banner {
    top: 8px;
    width: calc(100% - 16px);
    padding: 9px 11px;
  }
  .map-stage.has-drawer-open .route-banner,
  .map-stage.has-drawer-open .data-banner {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 16px);
  }

  /* Modals as Full-Height Bottom Sheets */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-card {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-header { padding: 14px 16px; }
  .modal-header h2 { font-size: 17px; }
  .modal-body { padding: 14px 16px 24px; }

  .modal-grid-2, .cars-layout, .lookbooks-grid, .kbd-grid, .tactical-cards-grid {
    grid-template-columns: 1fr;
  }
  .piece-row { flex-wrap: wrap; }
  .tactical-tabs { flex-wrap: wrap; overflow-x: visible; gap: 6px; padding-bottom: 10px; }
  .tactical-tab { padding: 7px 10px; font-size: 11.5px; gap: 5px; }
  .safe-code-row { flex-direction: column; align-items: flex-start; }

  /* Toast above bottom dock */
  .toast-container {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* Codes Table -> Stacked Cards under 640px (zero horizontal overflow) */
@media (max-width: 640px) {
  .codes-table-wrap { border: none; background: transparent; overflow-x: visible; }
  .codes-table thead { display: none; }
  .codes-table, .codes-table tbody, .codes-table tr, .codes-table td {
    display: block;
    width: 100%;
  }
  .codes-table tr {
    margin-bottom: 10px;
    padding: 11px 12px;
    border-radius: 13px;
    background: var(--surface-card);
    border: 1px solid var(--border-hairline);
  }
  .codes-table td {
    padding: 4px 0;
    border-bottom: none;
  }
  .codes-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 2px;
  }
  .codes-table td.col-action { margin-top: 6px; }
  .btn-locate-tac { width: 100%; justify-content: center; height: 34px; }
}

/* Very small phones (iPhone SE / Samsung 360px) */
@media (max-width: 380px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .drawer-actions-bar { grid-template-columns: 1fr auto; }
  .btn-done-lg { grid-column: 1 / -1; }
  .mobile-modules-grid { grid-template-columns: 1fr; }
  .brand-title { font-size: 12px; }
}

/* Touch devices: disable sticky hover tooltips */
@media (hover: none), (pointer: coarse) {
  .map-tooltip { display: none !important; }
  .kbd-hint, .kbd-inline { display: none; }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   INTERACTIVE ONBOARDING TUTORIAL (SPOTLIGHT + APPLE POPOVER)
   ========================================================================== */

:root,
[data-theme="vice-sunset"],
[data-theme="grove-night"] {
  --tour-scrim: rgba(4, 6, 12, 0.72);
}
[data-theme="ocean-day"] {
  --tour-scrim: rgba(15, 23, 42, 0.42);
}

.help-tutorial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 15px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--accent-primary-soft);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 34%, transparent);
}
.help-tutorial-copy {
  flex: 1;
  min-width: 200px;
}
.help-tutorial-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.help-tutorial-copy div {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: auto;
  transition: background-color 0.25s ease;
}
.tour-overlay.has-full-scrim {
  background: var(--tour-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tour-spotlight {
  position: fixed;
  border-radius: 14px;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 0 9999px var(--tour-scrim), 0 0 0 4px var(--accent-primary-soft);
  pointer-events: none;
  transition: top 0.3s var(--ease-apple), left 0.3s var(--ease-apple), width 0.3s var(--ease-apple), height 0.3s var(--ease-apple);
}

.tour-card {
  position: fixed;
  width: min(376px, calc(100vw - 24px));
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal), var(--highlight-inset);
  display: flex;
  flex-direction: column;
  gap: 13px;
  z-index: 92;
  animation: pop-up 0.22s var(--ease-apple);
}
.tour-card.is-centered {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.tour-card.is-mobile-top {
  left: 12px;
  right: 12px;
  width: auto;
  top: calc(62px + env(safe-area-inset-top));
}
.tour-card.is-mobile-bottom {
  left: 12px;
  right: 12px;
  width: auto;
  bottom: calc(80px + env(safe-area-inset-bottom));
}

.tour-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tour-kicker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tour-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
}
.tour-counter {
  font-size: 10.5px;
  color: var(--text-tertiary);
}
.tour-skip-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 4px 8px;
  border-radius: 7px;
  transition: background 0.16s, color 0.16s;
}
.tour-skip-btn:hover {
  background: var(--surface-pill);
  color: var(--text-primary);
}

.tour-card-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.tour-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tour-copy h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.tour-copy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.48;
  color: var(--text-secondary);
}

.tour-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}
.tour-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tour-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 99px;
  background: var(--border-strong);
  transition: width 0.2s var(--ease-apple), background 0.2s;
}
.tour-dot.active {
  width: 18px;
  background: var(--accent-primary);
}
.tour-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tour-btn-sm {
  height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
}
.tour-btn-primary {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  border-radius: 9px;
}
