/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;
    --blue-700: #1d4ed8;
    --green-400: #4ade80;
    --green-800: #166534;

    --dark-950: #0a0a0a;
    --dark-900: #0f0f0f;
    --dark-800: #171717;
    --dark-700: #1f1f1f;
    --dark-600: #2a2a2a;
    --dark-500: #3a3a3a;
    --dark-400: #555;
    --dark-300: #777;
    --dark-200: #999;
    --dark-100: #bbb;
    --white: #f0f0f0;

    --panel-bg: rgba(15, 15, 15, 0.85);
    --panel-blur: 20px;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-panel: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255,255,255,0.05) inset;
    --shadow-btn: 0 2px 12px rgba(249, 115, 22, 0.4);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
}

body {
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    color: var(--white);
    background: var(--dark-950);
}

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

/* ══════════════════════════════════════════════════════════════
   HERO — "Night Highway" theme
   ══════════════════════════════════════════════════════════════ */
#hero {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 80% 60% at 50% 110%, rgba(249, 115, 22, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, var(--dark-950) 0%, #111 50%, var(--dark-900) 100%);
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    pointer-events: none;
    z-index: 1;
}

#hero.hero-exit {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Speed streaks */
.hero-streaks {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.streak {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.15), transparent);
    transform: rotate(-25deg);
    animation: streakSlide 8s linear infinite;
}

.streak-1 { top: 15%; left: -20%; width: 60%; animation-delay: 0s; animation-duration: 7s; }
.streak-2 { top: 35%; left: -30%; width: 80%; animation-delay: 1.5s; animation-duration: 9s; opacity: 0.7; }
.streak-3 { top: 55%; left: -10%; width: 50%; animation-delay: 3s; animation-duration: 6s; }
.streak-4 { top: 72%; left: -25%; width: 70%; animation-delay: 4.5s; animation-duration: 10s; opacity: 0.5; }
.streak-5 { top: 88%; left: -15%; width: 40%; animation-delay: 2s; animation-duration: 8s; opacity: 0.6; }

@keyframes streakSlide {
    0%   { transform: rotate(-25deg) translateX(-10%); opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: rotate(-25deg) translateX(120vw); opacity: 0; }
}

/* Animated circular route SVG */
.hero-route-svg {
    position: absolute;
    width: min(500px, 80vw);
    height: min(500px, 80vw);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    opacity: 0.12;
}

.route-circle {
    fill: none;
    stroke: var(--orange-500);
    stroke-width: 2;
    stroke-dasharray: 880;
    stroke-dashoffset: 880;
    animation: drawCircle 2.5s ease-out 0.5s forwards;
}

.route-circle-glow {
    fill: none;
    stroke: var(--orange-400);
    stroke-width: 6;
    stroke-dasharray: 880;
    stroke-dashoffset: 880;
    filter: blur(8px);
    animation: drawCircle 2.5s ease-out 0.5s forwards;
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

.route-dot {
    fill: var(--orange-500);
    opacity: 0;
    animation: dotAppear 0.3s ease forwards;
}

.route-dot-1  { animation-delay: 0.7s; }
.route-dot-2  { animation-delay: 0.9s; }
.route-dot-3  { animation-delay: 1.1s; }
.route-dot-4  { animation-delay: 1.3s; }
.route-dot-5  { animation-delay: 1.5s; }
.route-dot-6  { animation-delay: 1.7s; }
.route-dot-7  { animation-delay: 1.9s; }
.route-dot-8  { animation-delay: 2.1s; }
.route-dot-9  { animation-delay: 2.3s; }
.route-dot-10 { animation-delay: 2.5s; }
.route-dot-11 { animation-delay: 2.7s; }
.route-dot-12 { animation-delay: 2.9s; }

@keyframes dotAppear {
    from { opacity: 0; r: 0; }
    to   { opacity: 1; r: 5; }
}

.route-origin {
    fill: none;
    stroke: var(--orange-500);
    stroke-width: 2;
    opacity: 0;
    animation: originPulse 2s ease-in-out 3.2s infinite, dotAppear 0.4s ease 3s forwards;
}

@keyframes originPulse {
    0%, 100% { r: 9; opacity: 0.8; }
    50%      { r: 13; opacity: 0.3; }
}

/* Hero content */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 480px;
    padding: 40px 28px;
    animation: heroFadeIn 0.8s ease-out;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero-top-bar {
    margin-bottom: 24px;
}

.hero-badge {
    display: inline-block;
    background: transparent;
    color: var(--orange-500);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    padding: 4px 14px;
    border: 1.5px solid rgba(249, 115, 22, 0.4);
    border-radius: 2px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.hero-sun {
    font-size: 2.8rem;
    display: inline-block;
    margin-bottom: 4px;
    animation: sunGlow 4s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(249, 115, 22, 0.4));
}

@keyframes sunGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(249, 115, 22, 0.3)); transform: scale(1); }
    50%      { filter: drop-shadow(0 0 35px rgba(249, 115, 22, 0.6)); transform: scale(1.08); }
}

.hero-title-text {
    color: var(--white);
}

.hero-title-accent {
    color: var(--orange-500);
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--dark-200);
    margin-bottom: 0;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.hero-divider {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--orange-500), transparent);
    margin: 28px auto;
    opacity: 0.6;
}

/* Steps — vertical timeline style */
.hero-steps {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 32px;
}

.hero-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
}

.step-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--dark-700);
    color: var(--orange-500);
    border: 1.5px solid var(--dark-500);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-line {
    display: block;
    width: 1px;
    height: 20px;
    background: linear-gradient(180deg, var(--dark-500), transparent);
    margin-top: 4px;
}

.step-text strong {
    display: block;
    color: var(--white);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.step-text span {
    font-size: 0.8rem;
    color: var(--dark-200);
    line-height: 1.4;
}

/* CTA */
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: var(--orange-500);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: var(--shadow-btn), 0 0 40px rgba(249, 115, 22, 0.15);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.hero-cta::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.hero-cta:hover {
    background: var(--orange-600);
    box-shadow: 0 4px 24px rgba(249, 115, 22, 0.5), 0 0 60px rgba(249, 115, 22, 0.2);
    transform: translateY(-2px);
}

.hero-cta:hover::after {
    transform: translateX(100%);
}

.hero-cta:active {
    transform: translateY(0);
}

.hero-note {
    margin-top: 24px;
    font-size: 0.7rem;
    color: var(--dark-400);
    letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════════
   CONTROL PANEL — Dark glass
   ══════════════════════════════════════════════════════════════ */
#panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--panel-blur));
    -webkit-backdrop-filter: blur(var(--panel-blur));
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    width: 300px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#panel.panel-hidden {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

.panel-header {
    padding: 20px 20px 0;
}

.panel-logo {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.logo-sun {
    font-size: 1rem;
}

.logo-accent {
    color: var(--orange-500);
}

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lang-toggle {
    display: flex;
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lang-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--dark-300);
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all var(--transition);
}

.lang-btn:hover {
    color: var(--white);
}

.lang-btn.lang-active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.panel-subtitle {
    font-size: 0.75rem;
    color: var(--dark-300);
    margin-top: 3px;
    font-weight: 400;
}

.panel-body {
    padding: 18px 20px 8px;
}

.panel-footer {
    padding: 4px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.osrm-indicator {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 99px;
    border: 1px solid;
}

.osrm-local {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.25);
    background: rgba(74, 222, 128, 0.07);
}

.osrm-public {
    color: #fb923c;
    border-color: rgba(251, 146, 60, 0.25);
    background: rgba(251, 146, 60, 0.07);
}

.sunride-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 1500;
    width: calc(100% - 32px);
    max-width: 320px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(20, 12, 4, 0.93);
    border: 1px solid rgba(251, 146, 60, 0.35);
    color: #fb923c;
    font-family: var(--font-body);
    font-size: 0.8rem;
    line-height: 1.5;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sunride-toast.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Labels */
label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dark-200);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    color: var(--dark-400);
}

input[type="datetime-local"] {
    color-scheme: dark;
}

select {
    color-scheme: dark;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

input:focus {
    outline: none;
    border-color: var(--orange-500);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

/* Toggle row */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 2px;
}

.toggle-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dark-200);
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--dark-600);
    border-radius: 20px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: var(--dark-200);
    border-radius: 50%;
    transition: transform var(--transition), background var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--orange-500);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Primary button */
#create-btn {
    width: 100%;
    padding: 11px;
    background: var(--orange-500);
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-btn);
    transition: all var(--transition);
}

#create-btn:hover {
    background: var(--orange-600);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.45);
    transform: translateY(-1px);
}

#create-btn:active {
    transform: translateY(0);
}

#create-btn:disabled {
    background: var(--dark-600);
    color: var(--dark-400);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

/* Status / result */
#status {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--dark-200);
    padding: 0 2px;
    line-height: 1.5;
}

#status.error {
    color: #f87171;
}

#result {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--green-400);
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Weather section (wraps mode toggle + bar) */
.weather-section {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.weather-section.weather-visible {
    max-height: 200px;
    opacity: 1;
}

/* Weather mode toggle (Panel / Map) */
.weather-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px 4px;
}

.weather-mode-label {
    font-size: 0.65rem;
    font-family: var(--font-body);
    color: var(--dark-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 2px;
    white-space: nowrap;
}

.weather-mode-btn {
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: var(--dark-300);
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: var(--transition);
}

.weather-mode-btn:hover {
    color: var(--dark-100);
    border-color: rgba(255, 255, 255, 0.15);
}

.weather-mode-btn.weather-mode-active {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.4);
    color: var(--orange-400);
}

/* Weather bar */
.weather-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 4px 20px 12px;
}

.weather-bar::-webkit-scrollbar { display: none; }

.weather-chip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 100px;
    font-size: 0.7rem;
    color: var(--dark-100);
    white-space: nowrap;
}

.weather-chip-icon {
    font-size: 0.85rem;
}

.weather-chip-temp {
    font-weight: 700;
    color: var(--white);
}

.weather-chip-time {
    font-size: 0.65rem;
    color: var(--dark-300);
    font-family: var(--font-body);
}

.weather-chip-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Sun info (sunrise/sunset) */
.sun-info {
    padding: 4px 20px 8px;
    font-size: 0.7rem;
    color: var(--dark-300);
    font-family: var(--font-body);
    display: none;
}

/* Secondary button (GPX export etc.) */
.btn-secondary {
    width: 100%;
    padding: 8px 14px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--dark-100);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Help toggle */
.help-toggle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--dark-300);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.help-toggle:hover {
    color: var(--orange-500);
    border-color: rgba(249, 115, 22, 0.3);
}

/* Help panel */
.panel-help {
    padding: 0 20px 16px;
    font-size: 0.75rem;
    color: var(--dark-200);
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4px;
    padding-top: 12px;
}

.panel-help p {
    margin-bottom: 5px;
    color: var(--dark-100);
}

.panel-help ul {
    padding-left: 16px;
}

.panel-help li {
    margin-bottom: 3px;
}

/* ── Waypoint markers ────────────────────────────────────── */
.waypoint-icon {
    background: none;
    border: none;
}

.wp-dot {
    width: 26px;
    height: 26px;
    background: var(--blue-700);
    color: #fff;
    border: 2.5px solid #fff;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wp-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.wp-dot:active {
    cursor: grabbing;
    transform: scale(1.05);
}

/* Weather-mode waypoint dot */
.wp-dot-weather {
    width: 34px;
    height: 38px;
    border-radius: 10px;
    flex-direction: column;
    gap: 1px;
    font-size: 1rem;
    line-height: 1;
}

.wp-temp {
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    color: rgba(255,255,255,0.9);
}

/* ── Leaflet overrides ───────────────────────────────────── */
.leaflet-control-attribution {
    font-size: 0.6rem !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: var(--dark-300) !important;
    backdrop-filter: blur(4px);
}

.leaflet-control-attribution a {
    color: var(--dark-200) !important;
}

/* ── Scrollbar for panel ─────────────────────────────────── */
#panel::-webkit-scrollbar {
    width: 4px;
}

#panel::-webkit-scrollbar-track {
    background: transparent;
}

#panel::-webkit-scrollbar-thumb {
    background: var(--dark-500);
    border-radius: 4px;
}

/* ── Responsive ──────────────────────────────────────────── */
.panel-collapse-btn {
    display: none;
}

@media (max-width: 520px) {
    #panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto;
        max-height: calc(100vh - 64px);
        border-radius: var(--radius) var(--radius) 0 0;
        border-bottom: none;
        transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.35s ease;
    }

    #panel.panel-hidden {
        transform: translateY(20px);
    }

    #panel.panel-collapsed {
        max-height: 64px;
        overflow: hidden;
    }

    .panel-collapse-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 28px;
        height: 28px;
        border: none;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.06);
        color: var(--dark-300);
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .panel-collapse-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--white);
    }

    .panel-collapse-btn svg {
        transition: transform 0.3s ease;
    }

    #panel.panel-collapsed .panel-collapse-btn svg {
        transform: rotate(180deg);
    }

    .hero-title {
        font-size: 3.2rem;
    }

    .hero-content {
        padding: 28px 20px;
    }

    .hero-route-svg {
        width: 90vw;
        height: 90vw;
    }
}

/* ══════════════════════════════════════════════════════════════
   NAVIGATOR — GPS turn-by-turn overlays
   ══════════════════════════════════════════════════════════════ */

/* Navigate This Route button */
.nav-btn {
    width: 100%;
    padding: 10px 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(249, 115, 22, 0.10);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 8px;
    color: var(--orange-400);
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: rgba(249, 115, 22, 0.18);
    border-color: rgba(249, 115, 22, 0.55);
    color: #fdba74;
}

/* Panel tabs (Plan / Saved) */
.panel-tabs {
    display: flex;
    padding: 0 20px;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-tab {
    background: none;
    border: none;
    color: var(--dark-300);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 12px 8px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.panel-tab:hover { color: var(--dark-100); }

.panel-tab.panel-tab-active {
    color: var(--orange-400);
    border-bottom-color: var(--orange-500);
}

.saved-count {
    background: var(--dark-600);
    color: var(--dark-100);
    border-radius: 999px;
    font-size: 0.65rem;
    padding: 1px 7px;
    font-family: var(--font-body);
}

.panel-tab.panel-tab-active .saved-count {
    background: var(--orange-700);
    color: #fff;
}

/* Saved routes list */
.saved-routes { display: none; padding: 14px 20px; }

#panel.showing-saved .saved-routes { display: block; }
#panel.showing-saved .panel-body,
#panel.showing-saved .sun-info,
#panel.showing-saved .weather-section { display: none; }

.saved-empty {
    color: var(--dark-300);
    font-size: 0.85rem;
    text-align: center;
    padding: 18px 8px;
    line-height: 1.5;
}

.saved-route-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dark-700);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.saved-route-item:hover {
    background: var(--dark-600);
    border-color: rgba(249, 115, 22, 0.35);
}

.saved-route-info { flex: 1; min-width: 0; }

.saved-route-name {
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-route-meta {
    color: var(--dark-300);
    font-size: 0.75rem;
    margin-top: 2px;
}

.saved-route-del {
    background: none;
    border: none;
    color: var(--dark-400);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    transition: color 0.15s ease, background 0.15s ease;
}

.saved-route-del:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* GPS permission bottom sheet */
.gps-sheet {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.gps-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gps-sheet-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    background: var(--dark-800);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 32px 28px 44px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.gps-sheet.sheet-open .gps-sheet-card {
    transform: translateY(0);
}

.gps-sheet-icon {
    font-size: 2.8rem;
    margin-bottom: 14px;
    display: block;
    filter: drop-shadow(0 0 16px rgba(249, 115, 22, 0.35));
    animation: sunGlow 4s ease-in-out infinite;
}

.gps-sheet-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.gps-sheet-card p {
    font-size: 0.875rem;
    color: var(--dark-200);
    line-height: 1.6;
    margin-bottom: 28px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.gps-sheet-card .hero-cta {
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 8px;
}

.gps-sheet-card .btn-secondary {
    margin-top: 0;
}

/* Top instruction bar */
.nav-bar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    align-items: stretch;
    min-height: 76px;
    background: var(--dark-900);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-bar-top.nav-visible {
    transform: translateY(0);
}

.nav-arrow-box {
    width: 76px;
    min-width: 76px;
    background: var(--orange-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-arrow-box svg {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.nav-instruction {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    overflow: hidden;
    min-width: 0;
}

.nav-dist-next {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--orange-400);
    line-height: 1;
}

.nav-maneuver {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.nav-street {
    font-size: 0.78rem;
    color: var(--dark-200);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "Then" strip */
.nav-bar-then {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    z-index: 1999;
    background: var(--dark-800);
    padding: 7px 16px;
    font-size: 0.75rem;
    color: var(--dark-200);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transform: translateY(-250%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.06s;
    display: flex;
    align-items: baseline;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nav-bar-then.nav-visible {
    transform: translateY(0);
}

#nav-then-label {
    color: var(--dark-400);
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

#nav-then-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Off-route banner */
.nav-offroute {
    position: fixed;
    top: 122px; /* below nav-bar-top (76px) + then strip (~32px) + gap */
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    z-index: 1999;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(127, 29, 29, 0.92);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 999px;
    padding: 8px 10px 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fecaca;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.nav-offroute.offroute-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-recalc-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--orange-500);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nav-recalc-btn:hover { background: var(--orange-600); }
.nav-recalc-btn:disabled { opacity: 0.7; cursor: wait; }

/* Bottom stats bar */
.nav-bar-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    align-items: stretch;
    background: var(--dark-900);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-bar-bottom.nav-visible {
    transform: translateY(0);
}

.nav-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-stat-val {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--white);
    line-height: 1;
}

.nav-stat-unit {
    font-family: var(--font-display);
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--dark-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 3px;
}

.nav-stop-btn {
    padding: 0 22px;
    background: #dc2626;
    color: #fff;
    border: none;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background var(--transition);
    flex-shrink: 0;
    min-width: 68px;
}

.nav-stop-btn:hover {
    background: #b91c1c;
}

/* Panel offset when navigator bars are covering the top/bottom edges */
body.nav-active #panel {
    top: 114px; /* nav-bar-top (76px) + nav-bar-then (~32px) + 6px gap */
    max-height: calc(100vh - 114px - 72px - 8px); /* clear both bars + small gap */
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease,
                transform 0.4s ease;
}

@media (max-width: 520px) {
    body.nav-active #panel {
        top: auto;
        bottom: 72px; /* lift collapsed panel header above nav-bar-bottom */
        max-height: 64px;
        transition: opacity 0.4s ease, transform 0.4s ease,
                    max-height 0.35s ease, bottom 0.4s ease;
    }
}

/* Rider position marker */
.rider-dot {
    width: 22px;
    height: 22px;
    background: var(--orange-500);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(249, 115, 22, 0.5);
    animation: riderPulse 2s ease-out infinite;
}

@keyframes riderPulse {
    0%   { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 0 rgba(249,115,22,0.6); }
    70%  { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 12px rgba(249,115,22,0); }
    100% { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 0 rgba(249,115,22,0); }
}
