/* ========================================
   Krabice Cestovatelka — Frontend Styles
   Design system from HTML prototypes
   ======================================== */

:root {
    --orange: #D2843D;
    --orange-light: #F5E6D4;
    --green: #7FB069;
    --green-light: #E8F3E3;
    --dark: #1A1A1A;
    --gray-900: #2D2D2D;
    --gray-600: #6B6B6B;
    --gray-400: #A0A0A0;
    --gray-200: #E5E5E5;
    --gray-100: #F5F5F5;
    --white: #FFFFFF;
    --radius: 16px;
    --radius-sm: 10px;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    font-size: 15px;
    color: var(--dark);
    line-height: 1.5;
    background: var(--gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100dvh;
}

/* ---- App Shell ---- */
.app {
    max-width: 480px;
    width: 100%;
    min-height: 100dvh;
    background: var(--white);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* ---- Steps ---- */
.kc-step {
    display: flex;
    flex-direction: column;
    /* Fixed viewport height so .content can scroll internally
       while the header, btn-row and app-footer stay pinned. */
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}
.kc-step > .hero,
.kc-step > .compact-header,
.kc-step > .welcome-header,
.kc-step > .success-hero,
.kc-step > .progress-bar,
.kc-step > .progress-label,
.kc-step > .btn-row,
.kc-step > .app-footer,
.kc-step > .confetti-container {
    flex-shrink: 0;
}
.kc-step > .content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Hero (Step 1) ---- */
.hero {
    background: var(--dark);
    padding: 48px 24px 40px;
    text-align: center;
    position: relative;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--white);
    border-radius: 24px 24px 0 0;
    z-index: 1;
}
.box-icon {
    width: 72px;
    height: 72px;
    background: var(--orange);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 24px rgba(210, 132, 61, 0.3);
}
.hero-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.hero-code {
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--gray-400);
    letter-spacing: 3px;
}

/* ---- Compact Header (Steps 2-3) ---- */
.compact-header {
    background: var(--dark);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.compact-icon {
    width: 44px;
    height: 44px;
    background: var(--orange);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.compact-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--white);
    display: block;
}
.compact-subtitle {
    font-size: 12px;
    color: var(--gray-400);
    display: block;
}

/* ---- Welcome Header (Step 5) ---- */
.welcome-header {
    background: var(--dark);
    padding: 48px 24px 40px;
    text-align: center;
    position: relative;
}
.welcome-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--white);
    border-radius: 24px 24px 0 0;
    z-index: 1;
}
.welcome-wave {
    font-size: 40px;
    display: inline-block;
    animation: wave 1.5s ease-in-out;
}
.welcome-header h1 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--white);
    margin: 12px 0 8px;
}
.welcome-header .highlight { color: var(--orange); }
.welcome-header p {
    font-size: 14px;
    color: var(--gray-400);
}

/* ---- Content ---- */
.content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
/* Prevent flex children from shrinking below their natural size.
   Without this, .content (flex column with overflow-y:auto) would squash
   items like .more-fields — and because .more-fields has overflow:hidden,
   the content would silently clip instead of triggering the scroll. */
.content > * { flex-shrink: 0; }
.content.no-padding { padding: 0; }
.content.no-padding > .section { padding: 24px; }
.spacer { flex: 1; }

/* ---- Sections ---- */
.section {
    padding: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--gray-100);
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.section:last-child { border-bottom: none; margin-bottom: 0; }
.section-label {
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

/* ---- Speech Bubble ---- */
.speech-bubble {
    background: var(--white);
    border-left: 4px solid var(--orange);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.speech-bubble p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-900);
}

/* ---- Stats ---- */
.stats-strip, .stats-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.stats-grid { gap: 12px; }
.stat-item {
    flex: 1;
    text-align: center;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
}
.stat-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--dark);
    display: block;
}
.stat-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
}

/* ---- Input ---- */
.input-group { margin-bottom: 16px; position: relative; z-index: 50; }
.input-label {
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray-600);
    display: block;
    margin-bottom: 8px;
}
.input-wrapper { position: relative; z-index: 50; }
.input-wrapper input[type="text"],
.input-wrapper input[type="email"],
input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    color: var(--dark);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s;
}
input:focus, textarea:focus {
    border-color: var(--orange);
}
.input-wrapper input { padding-right: 48px; }

/* GPS button */
.gps-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.2s;
}
.gps-btn:hover { background: var(--orange-light); color: var(--orange); }
.gps-btn:active { transform: translateY(-50%) scale(0.92); }
.gps-btn:disabled { cursor: wait; opacity: 0.6; }
/* While resolving GPS + reverse geocode — spin the crosshair icon so the
   user sees something happening instead of a dead-looking button. */
.gps-btn--loading svg {
    animation: kc-gps-spin 0.9s linear infinite;
}
@keyframes kc-gps-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Autocomplete */
.autocomplete-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    /* Force own compositor layer so iOS Safari can't slip the sticky
       submit button above us via its promoted layer. */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}
.autocomplete-list.visible { display: block; }
/* When the dropdown is open, the sticky submit must not cover it.
   Addresses an iOS Safari quirk where position:sticky gets a promoted
   layer and outranks z-index stacking once the sticky becomes active. */
.content.autocomplete-open .btn-sticky {
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}
.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    transition: background 0.15s;
}
.autocomplete-item:hover { background: var(--orange-light); }
.autocomplete-item .city-name {
    font-weight: 500;
    color: var(--dark);
    font-size: 15px;
    line-height: 1.2;
}
.autocomplete-item .country-name {
    font-size: 12px;
    color: var(--gray-400);
    line-height: 1.2;
    /* region+country can be long ("Moravskoslezský kraj (Ostrava) · Česko")
       — allow wrapping but cap at 2 lines so the dropdown stays compact. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Buttons ---- */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--orange);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(210,132,61,0.3);
}
.btn-primary:hover { background: #C47835; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
    background: var(--gray-200);
    color: var(--gray-400);
    box-shadow: none;
    cursor: not-allowed;
}
.btn-secondary {
    padding: 16px 24px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-ghost {
    width: 100%;
    padding: 16px;
    background: transparent;
    color: var(--gray-600);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}
.btn-outline {
    display: block;
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--gray-600);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.btn-block { display: block; width: 100%; margin-bottom: 12px; }
.btn-sticky { position: sticky; bottom: 0; padding: 16px 0; background: var(--white); z-index: 1; }
.btn-row {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--white);
}
.btn-row .btn-primary { flex: 1; }

/* ---- Message Reveal (Step 2) ---- */
.message-reveal {
    background: linear-gradient(135deg, var(--orange-light) 0%, var(--white) 100%);
    padding: 24px;
}
.message-envelope {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: relative;
}
.message-envelope::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--orange);
    border-radius: var(--radius) var(--radius) 0 0;
}
.message-from {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-bottom: 8px;
}
.message-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-900);
    font-style: italic;
}
.message-text::before { content: '\201E'; }
.message-text::after { content: '\201C'; }

/* ---- Route List (Step 2) ---- */
.route-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 16px; }
.route-stop {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.route-dot-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 24px;
    flex-shrink: 0;
    padding-top: 4px;
}
.route-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--orange);
    flex-shrink: 0;
}
.route-dot.origin { background: var(--green); }
.route-dot.current {
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 4px rgba(210,132,61,0.2);
}
.route-line {
    width: 2px;
    flex: 1;
    min-height: 24px;
    background: var(--gray-200);
}
.route-info {
    padding: 4px 0 16px;
    flex: 1;
}
.route-city {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}
.route-meta {
    font-size: 12px;
    color: var(--gray-400);
}

/* ---- Map ---- */
.kc-map { border-radius: var(--radius-sm); overflow: hidden; }

/* ---- Coupon Card ---- */
.coupon-card {
    background: var(--green-light);
    border: 2px dashed var(--green);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.coupon-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 8px;
}
.coupon-discount {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 36px;
    color: var(--green);
    margin-bottom: 4px;
}
.coupon-code {
    font-family: monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    background: var(--white);
    padding: 6px 16px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 8px;
}
.coupon-info {
    font-size: 12px;
    color: var(--gray-400);
}
.coupon-inline {
    background: var(--green-light);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    font-size: 13px;
}
.coupon-inline code {
    font-weight: 700;
    font-size: 15px;
    color: var(--green);
}

/* ---- Eco Badge / Banner ---- */
.eco-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-light);
    color: var(--green);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}
.eco-badge strong { font-weight: 700; }
.eco-card {
    background: var(--green-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.eco-card p { font-size: 14px; color: var(--gray-900); }
.eco-banner {
    background: var(--green-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--gray-900);
}

/* ---- Explanation text ---- */
.explanation-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-600);
}

/* ---- Progress Bar (Step 3-4) ---- */
.progress-bar {
    display: flex;
    gap: 4px;
    padding: 16px 24px 0;
}
.progress-step {
    flex: 1;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
}
.progress-step.done { background: var(--orange); }
.progress-step.current { background: var(--orange); opacity: 0.5; }
.progress-label {
    font-size: 12px;
    color: var(--gray-400);
    text-align: center;
    padding: 8px 24px 16px;
}

/* ---- Form (Step 3) ---- */
.form-group { margin-bottom: 16px; }
.form-label {
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray-600);
    display: block;
    margin-bottom: 6px;
}
.textarea-wrapper { position: relative; }
.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--gray-400);
}
.char-count.warn { color: var(--orange); }
.divider {
    height: 1px;
    background: var(--gray-100);
    margin: 20px 0;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 8px;
}
.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    margin-top: 1px;
    transition: all 0.2s;
}
.checkbox-label input[type="checkbox"]:checked {
    background: var(--orange);
    border-color: var(--orange);
}
.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
}
.checkbox-small { font-size: 12px; color: var(--gray-600); }
.gdpr-link { color: var(--orange); font-size: 12px; }

/* Email section (collapsible) */
.email-section {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}
.email-section.open {
    max-height: 200px;
    opacity: 1;
    margin-top: 12px;
}
.email-section input[type="email"] { margin-bottom: 8px; }
.no-email-hint {
    font-size: 12px;
    color: var(--orange);
    margin-top: 4px;
}

/* More toggle */
.more-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
}
.toggle-arrow { transition: transform 0.3s; }
.more-toggle.open .toggle-arrow { transform: rotate(180deg); }
.more-fields {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.more-fields.open { max-height: 500px; }

/* Photo upload */
.photo-upload {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.photo-upload:hover {
    border-color: var(--orange);
    background: var(--orange-light);
}
.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-400);
    font-size: 13px;
}
.photo-upload img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
}
.terms-note {
    font-size: 12px;
    color: var(--gray-400);
    text-align: center;
    margin-top: 16px;
}
.terms-note a {
    color: var(--orange);
    text-decoration: underline;
}
.terms-note a:hover { opacity: 0.85; }
.dashboard-inline-link {
    color: var(--orange);
    text-decoration: underline;
    font-weight: 500;
}
.dashboard-inline-link:hover { opacity: 0.85; }

/* ---- Success (Step 4) ---- */
.confetti-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiFall 3s ease-in forwards;
}
.success-hero {
    text-align: center;
    padding: 40px 24px 24px;
}
.success-icon {
    width: 88px;
    height: 88px;
    background: var(--green-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.success-hero h1 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 8px;
}
.success-hero p {
    font-size: 14px;
    color: var(--gray-600);
}

/* Link card */
.link-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}
.link-card:hover { background: var(--gray-200); }
.link-icon {
    width: 44px;
    height: 44px;
    background: var(--orange-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.link-text { flex: 1; }
.link-text strong { display: block; font-size: 14px; }
.link-url {
    font-family: monospace;
    font-size: 11px;
    color: var(--gray-400);
    word-break: break-all;
}
.link-arrow { font-size: 18px; color: var(--gray-400); }
.email-note {
    background: var(--orange-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--gray-600);
}

/* Share */
.share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.85; }
.share-ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); color: white; }
.share-fb { background: #1877F2; color: white; }
.share-copy {
    grid-column: 1 / -1;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid transparent;
}

/* ---- Status Card (Step 5) ---- */
.status-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
}
.status-indicator {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
}
.status-indicator.waiting { background: var(--orange-light); }
.status-indicator.arrived { background: var(--green-light); }
.status-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}
.status-info p {
    font-size: 13px;
    color: var(--gray-600);
}
.new-stop-alert {
    background: var(--white);
    border: 2px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 14px;
}
.cta-section { padding-top: 8px; }

/* ---- Dashboard ---- */
.map-hero {
    position: relative;
    height: 280px;
    overflow: hidden;
}
.map-container {
    width: 100%;
    height: 100%;
}
.map-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    z-index: 400;
}
.map-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.map-code {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    color: var(--orange);
    letter-spacing: 2px;
}

/* Stats bar */
.stats-bar {
    display: flex;
    background: var(--dark);
    padding: 16px 24px;
}
.stats-bar-item {
    flex: 1;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.1);
}
.stats-bar-item:last-child { border-right: none; }
.stats-bar-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--white);
    display: block;
}
.stats-bar-value.green { color: var(--green); }
.stats-bar-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
}

/* Timeline */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
    display: flex;
    gap: 12px;
}
.timeline-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 24px;
    flex-shrink: 0;
}
.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--orange);
    flex-shrink: 0;
    margin-top: 4px;
}
.timeline-dot.origin { background: var(--green); }
.timeline-dot.latest {
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 4px rgba(210,132,61,0.2);
    margin-top: 2px;
}
.timeline-line {
    width: 2px;
    flex: 1;
    min-height: 16px;
    background: var(--gray-200);
}
.timeline-card {
    flex: 1;
    padding-bottom: 16px;
}
.timeline-city {
    font-weight: 600;
    font-size: 14px;
}
.timeline-meta {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 6px;
}
.timeline-message {
    font-size: 13px;
    padding: 8px 12px;
    border-left: 3px solid var(--orange);
    border-radius: 0 6px 6px 0;
    background: var(--gray-100);
    margin-top: 6px;
}
.timeline-message.secret {
    border-color: var(--gray-400);
    color: var(--gray-400);
    font-style: italic;
}
.timeline-message.pending {
    border-color: var(--orange);
    background: var(--orange-light);
    color: var(--orange);
    font-style: italic;
}

/* Photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.photo-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: var(--white);
    font-size: 11px;
}

/* Action links */
.action-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}
.action-link:last-child { border-bottom: none; }
.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.action-icon.orange { background: var(--orange-light); color: var(--orange); }
.action-icon.green { background: var(--green-light); color: var(--green); }
.action-arrow { margin-left: auto; color: var(--gray-400); }

/* Overview */
.overview-hero {
    background: var(--dark);
    padding: 32px 24px;
    text-align: center;
}
.overview-hero h1 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.overview-hero p {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ---- Overview: wide layout (desktop) ---- */
.app--wide {
    max-width: 1200px;
}
body.kc-wide { background: var(--gray-100); }

.overview-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.overview-col { padding: 24px; }
.overview-section-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    color: var(--dark);
}
.overview-map {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* About section */
.overview-about p {
    font-size: 14px;
    color: var(--gray-900);
    margin-bottom: 12px;
}
.overview-about-h {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 18px 0 6px;
    color: var(--orange);
}
.overview-steps {
    padding-left: 20px;
    margin: 8px 0 12px;
}
.overview-steps li {
    font-size: 14px;
    color: var(--gray-900);
    margin-bottom: 4px;
}
.overview-link {
    color: var(--orange);
    font-weight: 600;
    text-decoration: none;
}
.overview-link:hover { text-decoration: underline; }
.overview-cta-note { margin-top: 8px; }

/* Leaderboard */
.overview-leaderboard {
    margin-top: 32px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
}
.overview-lb-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.overview-lb-tabs {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 999px;
    padding: 4px;
    width: fit-content;
}
.overview-lb-tab {
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--gray-600);
    transition: background .15s, color .15s;
}
.overview-lb-tab.is-active {
    background: var(--dark);
    color: var(--white);
}
.overview-lb-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.overview-lb-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}
.overview-lb-row:last-child { border-bottom: none; }
.overview-lb-rank {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--gray-400);
    text-align: center;
}
.overview-lb-row:nth-child(1) .overview-lb-rank { color: var(--orange); }
.overview-lb-row:nth-child(2) .overview-lb-rank { color: var(--gray-600); }
.overview-lb-row:nth-child(3) .overview-lb-rank { color: #b07f3c; }
.overview-lb-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.overview-lb-code {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    color: var(--dark);
    letter-spacing: 0.5px;
}
.overview-lb-code:hover { color: var(--orange); }
.overview-lb-route {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.overview-lb-value {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--green);
}
.overview-lb-value small {
    font-size: 10px;
    color: var(--gray-600);
    font-weight: 400;
    margin-left: 2px;
}
.overview-lb-loading {
    padding: 20px 0;
    text-align: center;
    color: var(--gray-400);
    list-style: none;
}
.overview-lb-empty {
    padding: 20px 0;
    text-align: center;
    color: var(--gray-400);
    list-style: none;
}

.overview-footer { margin-top: auto; }

/* ---- Legal pages (Terms, Privacy) ---- */
.legal-page {
    padding: 0 0 40px;
    max-width: 820px;
    margin: 0 auto;
    background: var(--white);
    width: 100%;
}
.legal-hero {
    background: var(--dark);
    color: var(--white);
    padding: 40px 24px 32px;
    text-align: center;
}
.legal-hero h1 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 30px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    line-height: 1.15;
}
.legal-hero .legal-sub {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 6px;
}
.legal-hero .legal-meta {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.legal-page section {
    padding: 18px 24px 4px;
}
.legal-page h2 {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 8px;
    color: var(--orange);
}
.legal-page p {
    font-size: 15px;
    line-height: 1.65;
    color: var(--gray-900);
    margin-bottom: 10px;
}
.legal-page ul,
.legal-page ol {
    padding-left: 22px;
    margin: 8px 0 12px;
}
.legal-page li {
    font-size: 15px;
    line-height: 1.65;
    color: var(--gray-900);
    margin-bottom: 4px;
}
.legal-page a {
    color: var(--orange);
    text-decoration: underline;
}
.legal-page a:hover { opacity: 0.85; }
.legal-page strong { font-weight: 600; }

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 16px;
    font-size: 13px;
}
.legal-table th,
.legal-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: top;
}
.legal-table th {
    background: var(--gray-100);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    color: var(--gray-600);
}
.legal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-top: 1px solid var(--gray-200);
    margin-top: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.legal-back {
    color: var(--orange);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.legal-back:hover { text-decoration: underline; }

/* Footer links row on overview */
.overview-footer-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 4px;
    flex-wrap: wrap;
}
.overview-footer-links a {
    color: var(--gray-400);
    font-size: 12px;
    text-decoration: none;
}
.overview-footer-links a:hover {
    color: var(--orange);
    text-decoration: underline;
}

@media (min-width: 900px) {
    .legal-hero { padding: 56px 32px 40px; }
    .legal-hero h1 { font-size: 42px; }
    .legal-page section { padding: 22px 32px 6px; }
    .legal-footer { padding: 28px 32px; }
}

/* ---- Share toast ---- */
.kc-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translate(-50%, 20px);
    background: var(--dark);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 10000;
    max-width: 90vw;
    text-align: center;
}
.kc-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Desktop layout — 2 column side-by-side */
@media (min-width: 900px) {
    .app--wide { max-width: 1200px; }
    .overview-grid {
        display: grid;
        grid-template-columns: 1fr 380px;
        gap: 24px;
        padding: 24px;
    }
    .overview-col { padding: 0; }
    .overview-map { height: calc(100dvh - 280px); min-height: 500px; }
    .overview-hero {
        padding: 48px 24px;
    }
    .overview-hero h1 { font-size: 40px; }
    .overview-hero p { font-size: 16px; }
    .stats-bar { padding: 20px 24px; }
    .stats-bar-value { font-size: 28px; }
}

@media (min-width: 1200px) {
    .overview-grid {
        grid-template-columns: 1fr 420px;
    }
}

/* Error pages */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 60vh;
}
.error-icon { margin-bottom: 24px; }
.error-page h1 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 24px;
    margin-bottom: 8px;
}
.error-page p {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 24px;
}

/* ---- Footer ---- */
.app-footer {
    padding: 12px 24px;
    text-align: center;
    background: var(--white);
}
/* On non-step pages (overview, unsubscribe) keep the footer pinned to bottom
   via sticky since those templates don't have a flex-locked .kc-step wrapper. */
.app > .app-footer:last-child {
    position: sticky;
    bottom: 0;
    z-index: 10;
    border-top: 1px solid var(--gray-100);
}
.powered-by {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 8px;
}
.lang-switch {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
}
.lang-switch:hover { color: var(--orange); }

/* ---- Animations ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes revealMessage {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes popIn {
    0% { opacity: 0; transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes confettiFall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    50% { transform: rotate(-10deg); }
    75% { transform: rotate(15deg); }
}

.animate-in {
    animation: fadeUp 0.5s ease forwards;
}
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-reveal {
    animation: revealMessage 0.5s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}
.animate-pop {
    animation: popIn 0.6s ease forwards;
}

/* ---- Leaflet overrides ---- */
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); }

/* ---- Inline validation feedback ---- */
.field-error {
    display: block;
    color: #D64545;
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
    animation: fadeInField 0.2s ease;
}
.has-error input[type="text"],
.has-error input[type="email"],
.has-error textarea,
input.has-error,
textarea.has-error {
    border-color: #D64545 !important;
    background: #FEF2F2;
}
.checkbox-label.has-error {
    color: #D64545;
}
.checkbox-label.has-error input[type="checkbox"] {
    outline: 2px solid #D64545;
    outline-offset: 2px;
    border-radius: 3px;
}
.kc-shake {
    animation: kcShake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes kcShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}
@keyframes fadeInField {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Toast notifications ---- */
.kc-toast-wrap {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100% - 32px);
    width: 420px;
}
.kc-toast {
    background: var(--dark);
    color: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .25s ease, transform .25s ease;
    border-left: 4px solid var(--orange);
}
.kc-toast.visible {
    opacity: 1;
    transform: translateY(0);
}
.kc-toast.kc-toast-error  { border-left-color: #D64545; }
.kc-toast.kc-toast-success { border-left-color: var(--green); }
.kc-toast-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.kc-toast-msg  { flex: 1; }

/* Plugin version badge (footer) */
.kc-plugin-version {
    position: fixed;
    bottom: 6px;
    right: 10px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.28);
    letter-spacing: 0.5px;
    font-family: inherit;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}
