/* Portal home: drivable 3D Haitian countryside (assets/lakou.js) + flag-themed sections. No purple. */

.p-body--lakou {
    --lk-night: #050913;
    --lk-blue: #00209f;
    --lk-blue-lift: #2f5bff;
    --lk-red: #d21034;
    --lk-red-dark: #a80c29;
    --lk-gold: #f5c518;
    --lk-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.lk-lock,
html.lk-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}

/* ---------- world ---------- */

.lk-world {
    position: relative;
    height: calc(100vh - 72px);
    height: calc(100svh - 72px);
    min-height: 560px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(180deg, #6fb3ea 0%, #bfe0f5 55%, #ffe3b8 100%);
    font-family: "Inter", system-ui, sans-serif;
    isolation: isolate;
    touch-action: pan-y;
}

.lk-world.is-driving {
    position: fixed;
    inset: 0;
    z-index: 3000;
    height: 100%;
    min-height: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.lk-world__canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.lk-world__veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, rgba(5, 9, 19, 0.72) 0%, rgba(5, 9, 19, 0.35) 38%, transparent 62%);
    pointer-events: none;
    transition: opacity 0.6s var(--lk-ease);
}

.lk-world.is-driving .lk-world__veil {
    opacity: 0;
}

.lk-flagdot {
    display: inline-block;
    flex-shrink: 0;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--lk-blue-lift) 50%, var(--lk-red) 50%);
    box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.22);
}

/* ---------- intro copy ---------- */

.lk-intro {
    position: absolute;
    top: 50%;
    left: max(1.25rem, calc((100% - 1200px) / 2));
    z-index: 2;
    width: min(36rem, calc(100% - 2.5rem));
    transform: translateY(-50%);
}

.lk-world.is-driving .lk-intro {
    pointer-events: none;
}

.lk-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 1.2rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(5, 9, 19, 0.35);
    backdrop-filter: blur(10px);
    color: var(--lk-gold);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.lk-intro__title {
    display: flex;
    flex-direction: column;
    margin: 0;
    color: #fff;
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    font-size: clamp(2.8rem, 6.5vw, 5.4rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 0.95;
    text-shadow: 0 10px 40px rgba(5, 9, 19, 0.45);
}

.lk-intro__line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.08em;
}

.lk-intro__line > span {
    display: inline-block;
}

.lk-intro__line--accent {
    color: var(--lk-gold);
}

.lk-intro__lead {
    max-width: 30rem;
    margin: 1.3rem 0 1.8rem;
    color: rgba(255, 255, 255, 0.86);
    font-size: clamp(1rem, 1.3vw, 1.1rem);
    line-height: 1.6;
    text-shadow: 0 2px 16px rgba(5, 9, 19, 0.5);
}

.lk-intro__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.lk-intro__hint {
    margin: 1.1rem 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.lk-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 3rem;
    padding: 0.85rem 1.4rem;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.35s var(--lk-ease), box-shadow 0.35s var(--lk-ease), background 0.35s;
}

.lk-btn:hover {
    transform: translateY(-2px);
}

.lk-btn:disabled {
    cursor: progress;
    opacity: 0.6;
}

.lk-btn:focus-visible,
.lk-hud__exit:focus-visible,
.lk-touch button:focus-visible {
    outline: 2px solid var(--lk-gold);
    outline-offset: 3px;
}

.lk-btn--gold {
    background: var(--lk-gold);
    color: var(--lk-night);
    box-shadow: 0 14px 34px -12px rgba(245, 197, 24, 0.75);
}

.lk-btn--red {
    background: var(--lk-red);
    color: #fff;
    box-shadow: 0 14px 34px -14px rgba(210, 16, 52, 0.75);
}

.lk-btn--red:hover {
    background: var(--lk-red-dark);
    color: #fff;
}

.lk-btn--ghost {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(5, 9, 19, 0.3);
    backdrop-filter: blur(8px);
    color: #fff;
}

.lk-btn--ghost:hover {
    border-color: var(--lk-gold);
    color: var(--lk-gold);
}

.lk-btn--sm {
    min-height: 2.5rem;
    padding: 0.65rem 1.1rem;
    font-size: 0.9rem;
}

/* ---------- loading / fallback ---------- */

.lk-loading {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    transform: translateX(-50%);
    transition: opacity 0.5s;
}

.lk-loading.is-done {
    opacity: 0;
    pointer-events: none;
}

.lk-loading__bar {
    position: relative;
    width: 10rem;
    height: 3px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.25);
}

.lk-loading__bar i {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--lk-blue-lift) 50%, var(--lk-red) 50%);
    transform: scaleX(var(--lk-progress, 0.1));
    transform-origin: left;
    transition: transform 0.3s;
}

.lk-fallback {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 3;
    max-width: 22rem;
    margin: 0;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: rgba(5, 9, 19, 0.6);
    font-size: 0.85rem;
}

/* ---------- HUD ---------- */

.lk-hud {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.lk-hud > * {
    pointer-events: auto;
}

.lk-hud__top {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    left: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    pointer-events: none;
}

.lk-hud__top > * {
    pointer-events: auto;
}

.lk-hud__place {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(5, 9, 19, 0.55);
    backdrop-filter: blur(10px);
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    font-size: 1.05rem;
}

.lk-hud__exit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(5, 9, 19, 0.6);
    backdrop-filter: blur(10px);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.lk-hud__exit:hover {
    border-color: var(--lk-gold);
    color: var(--lk-gold);
}

.lk-hud__map {
    position: absolute;
    left: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: 160px;
    height: 160px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(5, 9, 19, 0.45);
    backdrop-filter: blur(6px);
}

.lk-hud__speed {
    position: absolute;
    right: 1.25rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    border-radius: 18px;
    background: rgba(5, 9, 19, 0.55);
    backdrop-filter: blur(10px);
    font-family: "Outfit", "Inter", system-ui, sans-serif;
}

.lk-hud__speed strong {
    min-width: 2.6ch;
    color: var(--lk-gold);
    font-size: 2.4rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: right;
}

.lk-hud__speed span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.lk-hud__hint {
    position: absolute;
    left: 50%;
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    margin: 0;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(5, 9, 19, 0.45);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    white-space: nowrap;
    transform: translateX(-50%);
}

.lk-hud__hint--touch {
    display: none;
}

/* ---------- stop card ---------- */

.lk-stop {
    position: absolute;
    top: 50%;
    right: max(1rem, env(safe-area-inset-right));
    z-index: 5;
    width: min(21rem, calc(100% - 2rem));
    padding: 1.4rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 22px;
    background: rgba(5, 9, 19, 0.78);
    backdrop-filter: blur(14px);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
    transform: translateY(-50%);
}

.lk-stop::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--lk-blue-lift) 50%, var(--lk-red) 50%);
}

.lk-stop__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--lk-gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.lk-stop__title {
    margin: 0.6rem 0 0.4rem;
    color: #fff;
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.lk-stop__body {
    margin: 0 0 1.1rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
    line-height: 1.55;
}

/* ---------- touch controls ---------- */

.lk-touch {
    position: absolute;
    inset: auto 0 0;
    z-index: 4;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 1rem max(1rem, env(safe-area-inset-bottom));
    pointer-events: none;
}

.lk-touch[hidden] {
    display: none;
}

.lk-touch__group {
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    pointer-events: auto;
}

.lk-touch button {
    display: grid;
    place-items: center;
    width: 4.4rem;
    height: 4.4rem;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(5, 9, 19, 0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.lk-touch button.is-pressed {
    border-color: var(--lk-gold);
    background: rgba(245, 197, 24, 0.3);
}

.lk-touch .is-gas {
    width: 5rem;
    height: 5.6rem;
    border-radius: 22px;
    background: rgba(31, 138, 76, 0.55);
}

.lk-touch .is-brake {
    border-radius: 22px;
    background: rgba(210, 16, 52, 0.5);
}

.lk-touch .is-horn {
    width: 3.2rem;
    height: 3.2rem;
    align-self: flex-start;
}

/* touch layout: map and speed move up to make room for the controls */
.lk-world.is-touch .lk-hud__map {
    top: 4.5rem;
    bottom: auto;
    width: 110px;
    height: 110px;
}

.lk-world.is-touch .lk-hud__speed {
    top: 4.5rem;
    bottom: auto;
}

.lk-world.is-touch .lk-hud__hint--keys {
    display: none;
}

.lk-world.is-touch .lk-hud__hint--touch {
    display: block;
    top: 10.5rem;
    bottom: auto;
}

.lk-world.is-touch .lk-stop {
    top: auto;
    bottom: 7.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* ---------- flag ribbon ---------- */

.lk-ribbon {
    overflow: hidden;
    background: var(--lk-night);
}

.lk-ribbon__row {
    overflow: hidden;
    padding: 0.75rem 0;
}

.lk-ribbon__row--blue {
    background: var(--lk-blue);
}

.lk-ribbon__row--red {
    background: var(--lk-red);
}

.lk-ribbon__track {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: max-content;
    padding-right: 1.5rem;
    animation: lk-ribbon 34s linear infinite;
}

.lk-ribbon__row--red .lk-ribbon__track {
    animation-direction: reverse;
}

.lk-ribbon__track span {
    color: #fff;
    font-family: "Outfit", "Inter", system-ui, sans-serif;
    font-size: clamp(1.2rem, 2.4vw, 1.9rem);
    font-weight: 700;
    white-space: nowrap;
}

.lk-ribbon__track span:nth-of-type(even) {
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.85);
}

.lk-ribbon__track i {
    color: var(--lk-gold);
    font-style: normal;
}

@keyframes lk-ribbon {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---------- flag accents on the existing sections ---------- */

.p-body--lakou .p-eyebrow {
    color: var(--lk-red);
}

.p-body--lakou .p-section__head h2::after {
    content: "";
    display: block;
    width: 3.5rem;
    height: 3px;
    margin-top: 0.7rem;
    background: linear-gradient(90deg, var(--lk-blue) 50%, var(--lk-red) 50%);
}

.p-body--lakou .p-section__head--center h2::after {
    margin-inline: auto;
}

.p-body--lakou .p-step__num {
    background: linear-gradient(180deg, var(--lk-blue) 50%, var(--lk-red) 50%);
    color: #fff;
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
    .lk-world:not(.is-driving) {
        height: auto;
        min-height: calc(100svh - 64px);
    }

    .lk-world__veil {
        background: linear-gradient(180deg, transparent 25%, rgba(5, 9, 19, 0.55) 55%, rgba(5, 9, 19, 0.85) 100%);
    }

    .lk-intro {
        top: auto;
        bottom: 1.5rem;
        transform: none;
    }

    .lk-intro__hint {
        display: none;
    }

    .lk-hud__hint {
        white-space: normal;
        width: max-content;
        max-width: calc(100% - 2rem);
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lk-ribbon__track {
        animation: none;
    }
}
