:root {
    --color-bg: #f4f7ff;
    --color-card: #ffffff;
    --color-ink: #1f2640;
    --color-soft: #61709b;
    --color-primary: #c21051;
    --color-secondary: #7c4dff;
    --color-green: #b6ef63;
    --color-orange: #ff7d1f;
    --color-yellow: #ffd447;
    --color-map-sky: #10c365;
    --radius: 24px;
    --shadow: 0 12px 30px rgba(26, 38, 74, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif; color: var(--color-ink); }
body { background: linear-gradient(180deg, #f3f6ff 0%, #e9f0ff 100%); }
.muted { color: var(--color-soft); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

.app-shell, .admin-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom));
}

.journey-header {
    background: linear-gradient(180deg, #d1105e, #bd0f54);
    color: #fff;
    border-radius: 24px 24px 14px 14px;
    padding: 14px 18px 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.journey-header h1 { margin: 0; font-size: clamp(2rem, 9vw, 3.2rem); line-height: 0.95; text-transform: uppercase; letter-spacing: 0.02em; }
.journey-header p { margin: 8px 0 0; color: rgba(255,255,255,0.9); font-size: 1rem; }

.overview-card {
    background: var(--color-map-sky);
    border-radius: 0 0 24px 24px;
    padding: 14px 12px 10px;
    box-shadow: var(--shadow);
    position: relative;
}
.overview-stage {
    position: relative;
    min-height: 280px;
    overflow: hidden;
    border-radius: 18px;
}
.overview-svg {
    width: 100%;
    height: 250px;
    display: block;
}
.overview-town {
    position: absolute;
    right: 8%;
    bottom: 20px;
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 900;
    color: #13203d;
    text-shadow: 0 2px 0 rgba(255,255,255,0.45);
}
.overview-badge {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}
.overview-badge--start { left: 20px; top: 185px; }
.overview-badge--goal { left: 76%; top: 118px; font-size: 1.6rem; padding: 0; width: 52px; }
.overview-badge--pause { left: 48%; top: 112px; font-size: 1.5rem; padding: 0; width: 52px; background: #fff9d9; }
.vehicle-sprite {
    position: absolute;
    left: 18%;
    top: 196px;
    font-size: clamp(2.2rem, 10vw, 3.6rem);
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.18));
}

.progress-card {
    margin-top: 12px;
    background: linear-gradient(180deg, #d1105e, #c01056);
    border-radius: 22px;
    padding: 14px 14px 10px;
    color: #fff;
    box-shadow: var(--shadow);
}
.progress-bar-wrap {
    position: relative;
    height: 70px;
    border-radius: 999px;
    border: 5px solid #28051a;
    background: #ef3d8d;
    overflow: hidden;
}
.progress-bar-bg, .progress-bar-fill {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 14px;
    height: 32px;
    border-radius: 999px;
}
.progress-bar-bg { background: repeating-linear-gradient(115deg, rgba(255,173,25,0.5) 0 22px, rgba(255,212,71,0.95) 22px 44px); opacity: 0.35; }
.progress-bar-fill {
    right: auto;
    width: 18%;
    background: repeating-linear-gradient(115deg, #ffad19 0 22px, #ffd447 22px 44px);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18);
}
.progress-tick, .progress-car {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}
.progress-tick {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 900;
    color: #181032;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 6px 10px rgba(0,0,0,0.18);
}
.progress-tick--start { left: 18px; }
.progress-tick--pause { left: 55%; background: #fff9d9; }
.progress-tick--goal { right: -12px; left: auto; }
.progress-car { left: 18%; font-size: 2rem; }
.progress-legend {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.95rem;
    flex-wrap: wrap;
}
#distance-pill {
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 10px;
    border-radius: 999px;
}

.time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.time-card {
    min-height: 118px;
    border-radius: 22px;
    color: #fff;
    display: grid;
    grid-template-columns: 58px 1fr;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    box-shadow: var(--shadow);
}
.time-card--goal { background: linear-gradient(135deg, #ff7d1f, #ff9f48); }
.time-card--pause { background: linear-gradient(135deg, #7c4dff, #9f78ff); }
.time-card__icon { font-size: 2rem; text-align: center; }
.time-card__value { margin: 0; font-size: clamp(1.9rem, 8vw, 3rem); font-weight: 900; line-height: 1; }
.time-card__label { margin: 6px 0 0; font-size: clamp(1rem, 4vw, 1.45rem); font-weight: 800; text-transform: uppercase; }

.detail-card {
    margin-top: 12px;
    background: linear-gradient(180deg, #b8ef63 0%, #b2ec5b 100%);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
}
.detail-card__topline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    font-weight: 700;
    color: #20344e;
    background: rgba(255,255,255,0.35);
}
.map-stage {
    height: 48vh;
    min-height: 320px;
    max-height: 560px;
}
.map-overlay {
    position: absolute;
    bottom: 16px;
    z-index: 500;
    background: rgba(255,255,255,0.92);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #24324a;
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    max-width: 42%;
}
.map-overlay--left { left: 12px; }
.map-overlay--right { right: 12px; text-align: right; }
.bottom-actions { margin-top: 12px; }

.floating-button {
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(90deg, var(--color-primary), #f04f8a);
    cursor: pointer;
    box-shadow: var(--shadow);
}
.status-banner {
    margin: 10px 4px 0;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 2px dashed #d6e2ff;
    color: #3e4f75;
    font-size: 0.95rem;
}
.highlight { box-shadow: 0 0 0 4px rgba(255, 243, 166, 0.45), var(--shadow); }

.card {
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
    background: var(--color-card);
    border: 3px solid #e4ebfb;
    box-shadow: var(--shadow);
}
.admin-page { padding: 16px; }
.admin-header { margin-bottom: 14px; }
.admin-form { display: grid; gap: 8px; }
.admin-form label { font-size: 0.95rem; font-weight: 600; }
.admin-form input, .admin-form select {
    width: 100%; border: 2px solid #d6e2fb; background: #f8fbff; border-radius: 12px; font-size: 1rem; padding: 12px;
}
.admin-form button, .button-link {
    margin-top: 8px; width: 100%; border: 0; border-radius: 14px; min-height: 52px; font-size: 1rem; font-weight: 700; color: #fff; background: linear-gradient(90deg, #74d1ff, #48c0ff); text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.admin-form .secondary, .admin-form .secondary:visited { background: linear-gradient(90deg, #9eaec9, #8899b8); }
.form-card { max-width: 420px; margin: 30px auto; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.message { margin: 10px 0; padding: 10px; border-radius: 10px; border: 2px solid #dce6ff; background: #f6f9ff; }
.message.error { border-color: #ffdddd; background: #fff2f2; }
#admin-message { margin-bottom: 30px; }
.vehicle-icon-preview { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; border: 1px solid #d6e2fb; background: #f7fbff; padding: 6px; }
.break-list { display: grid; gap: 14px; }
.break-list form { padding: 12px; border: 2px dashed #d6e2fb; border-radius: 16px; }
.leaflet-container { width: 100%; height: 100%; }
.destination-marker .marker-emoji { font-size: 30px; }
.vehicle-icon { filter: drop-shadow(0 4px 10px rgba(0,0,0,0.2)); }

@media (max-width: 640px) {
    .overview-stage { min-height: 230px; }
    .overview-svg { height: 208px; }
    .overview-badge--goal { left: 74%; top: 104px; }
    .overview-badge--pause { left: 47%; top: 100px; }
    .vehicle-sprite { top: 172px; }
    .map-overlay { max-width: calc(50% - 14px); font-size: 0.82rem; }
}
