/* =========================================================
   BTHUNTER — COMMUNITY MAP
   GLOBAL MAP + LIVE COMMENT CSS
   ========================================================= */


/* =========================================================
   1. GLOBAL VARIABLES
   ========================================================= */

:root {

    /* Layering */
    --z-map: 1;
    --z-overlay: 950;
    --z-navbar: 10000;

    /* Live Comment layout */
    --live-comment-height: 0px;

    /* Live Comment colors */
    --live-bg: rgba(15, 23, 42, .97);
    --live-bg-dark: rgba(2, 6, 23, .97);
    --live-border: rgba(255, 255, 255, .10);
    --live-text: #ffffff;
    --live-muted: #94a3b8;
    --live-blue: #00d9ff;
    --live-blue-dark: #2563eb;
    --live-red: #ff3040;
    --live-gold: #ffd700;
    --live-radius: 20px;

}


/* =========================================================
   2. PAGE / SCROLL
   ========================================================= */

body.lock-scroll {

    overflow: hidden;
    touch-action: none;

}


/* SEO content */

#seo-map-content {

    max-width: 900px;

}


/* =========================================================
   3. MAP CONTAINER
   ========================================================= */

#map {

    position: fixed;

    top: var(--nav-h, 0px);
    left: 0;
    right: 0;
    bottom: 0;

    z-index: var(--z-map);

}


/* =========================================================
   4. LEAFLET GENERAL CONTROL
   ========================================================= */

.leaflet-control {

    box-shadow: none !important;

}


/* Zoom control */

.leaflet-control-zoom,
.leaflet-control-zoom a {

    border: none !important;
    box-shadow: none !important;

}


.leaflet-control-zoom {

    overflow: visible !important;

}


/* =========================================================
   5. LEAFLET RIGHT CONTROLS
   ========================================================= */

.leaflet-top.leaflet-right {

    top: 170px;
    right: 12px;

    display: flex;
    flex-direction: column;
    gap: 8px;

}


/* Control order */

.leaflet-control-zoom {

    order: 1;

}


.leaflet-control-layers {

    order: 2;
    overflow: hidden;

}


/* Mobile */

@media (max-width: 768px) {

    .leaflet-top.leaflet-right {

        top: 170px !important;
        right: 12px !important;

    }

}


/* =========================================================
   6. LEAFLET LEFT CONTROLS
   ========================================================= */

@media (max-width: 768px) {

    .leaflet-top.leaflet-left {

        top: 80px !important;

    }

}


/* =========================================================
   7. LEAFLET LAYER CONTROL
   ========================================================= */

.leaflet-control-layers-toggle {

    background-size: 18px 18px !important;

}


.leaflet-control-layers-expanded {

    padding: 12px !important;

    background: rgba(255, 255, 255, .96) !important;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

}


/* Layer labels */

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {

    margin-bottom: 6px;
    font-weight: 500;
    cursor: pointer;

}


/* Checkbox / radio */

.leaflet-control-layers input {

    margin-right: 6px;

}


/* =========================================================
   8. LEAFLET POPUP
   ========================================================= */

.leaflet-popup-content-wrapper {

    background: rgba(255, 255, 255, .96) !important;

    border-radius: 16px !important;

    box-shadow:
        0 10px 28px rgba(0, 0, 0, .25) !important;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

}


/* Popup tip */

.leaflet-popup-tip {

    display: none !important;

}


/* Popup content */

.leaflet-popup-content {

    min-width: 220px;

    margin: 0 !important;
    padding: 12px !important;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;

}


/* Popup buttons */

.leaflet-popup-content .btn {

    width: 100%;

    padding: 10px 12px;

    border: none !important;
    border-radius: 12px !important;

    font-size: 14px;
    font-weight: 600;

}


/* Primary */

.leaflet-popup-content .btn-primary {

    background: #2563eb !important;

}


/* Danger */

.leaflet-popup-content .btn-danger {

    background: #fee2e2 !important;
    color: #dc2626 !important;

}


/* =========================================================
   9. MAP INFO BUTTON
   ========================================================= */

.map-info-btn {

    position: fixed;

    right: 14px;

    bottom:
        calc(
            var(--live-comment-height) + 14px
        );

    width: 36px;
    height: 36px;

    z-index: var(--z-overlay);

    display: flex;
    align-items: center;
    justify-content: center;

    background: #0d6efd;
    color: #fff;

    border-radius: 50%;

    font-size: 16px;
    cursor: pointer;
    user-select: none;

    box-shadow:
        0 6px 16px rgba(13, 110, 253, .35);

}


/* =========================================================
   10. MAP EMPTY STATE
   ========================================================= */

.map-empty-state {

    position: fixed;

    top: var(--nav-h);
    left: 0;
    right: 0;

    bottom: var(--live-comment-height);

    z-index: 400;

    display: flex;
    align-items: center;
    justify-content: center;

    pointer-events: none;

    animation: fadeUp .25s ease-out;

}


.map-empty-state.hidden {

    display: none;

}


/* Empty card */

.empty-card {

    max-width: 280px;

    padding: 16px 18px;

    background: rgba(255, 255, 255, .95);

    border-radius: 16px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, .18);

    text-align: center;

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

}


/* Empty icon */

.empty-icon {

    margin-bottom: 8px;
    font-size: 22px;

}


.empty-icon i {

    font-size: 22px;
    color: #6c757d;

}


/* Empty text */

.empty-text {

    color: #333;

    font-size: 13px;
    line-height: 1.5;

}


.empty-text strong {

    display: block;
    margin-bottom: 4px;

}


/* Animation */

@keyframes fadeUp {

    from {

        opacity: 0;

        transform:
            translateY(8px);

    }

    to {

        opacity: 1;

        transform:
            translateY(0);

    }

}


/* Mobile */

@media (max-width: 576px) {

    .empty-card {

        max-width: 240px;
        font-size: 12.5px;

    }

}


/* =========================================================
   11. STATION LABEL
   ========================================================= */

.station-wrap {

    display: flex;
    align-items: center;
    gap: 6px;

}


/* Station dot */

.station-dot {

    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #ffd600;

    border: 1px solid #fff;

    box-shadow:
        0 0 8px rgba(255, 214, 0, .8);

}


/* Station name */

.station-name {

    padding: 3px 8px;

    background: rgba(0, 0, 0, .72);
    color: #fff;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    box-shadow:
        0 2px 10px rgba(0, 0, 0, .25);

}


/* Mobile station */

@media (max-width: 768px) {

    .station-name {

        padding: 2px 7px;
        font-size: 10px;

    }

}


/* =========================================================
   12. TERMINAL OSM
   ========================================================= */

.terminal-osm-marker {

    background: none !important;
    border: none !important;

}


.terminal-osm-icon {

    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #2563eb;

    border: 3px solid #fff;

    font-size: 20px;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, .35),
        0 0 10px rgba(37, 99, 235, .45);

    transition:
        transform .2s ease;

}


.terminal-osm-icon:hover {

    transform: scale(1.12);

}


/* =========================================================
   13. BUS STOP OSM
   ========================================================= */

.bus-stop-osm-marker {

    background: none !important;
    border: none !important;

}


.bus-stop-osm-icon {

    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #f59e0b;

    border: 2px solid #fff;

    font-size: 16px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, .3);

    transition:
        transform .2s ease;

}


.bus-stop-osm-icon:hover {

    transform: scale(1.12);

}


/* =========================================================
   14. USER TRAIN
   ========================================================= */

.train-user-wrap img {

    position: relative;

    z-index: 2;

    width: 24px;
    height: 24px;

    filter:
        drop-shadow(0 0 4px #00d9ff);

    animation:
        trainPulse 2.2s ease-in-out infinite;

}


/* Glow */

.train-user-wrap::before {

    content: "";

    position: absolute;

    inset: 4px;

    z-index: 1;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(0, 217, 255, .9),
            transparent 70%
        );

    animation:
        glowPulse 4s ease-in-out infinite;

}


/* Glow animation */

@keyframes glowPulse {

    0% {

        transform: scale(.8);
        opacity: .7;

    }

    50% {

        transform: scale(1.3);
        opacity: .2;

    }

    100% {

        transform: scale(.8);
        opacity: .7;

    }

}


/* Train icon pulse */

@keyframes trainPulse {

    0%,
    100% {

        transform: scale(1);
        opacity: .95;

    }

    50% {

        transform: scale(1.08);
        opacity: 1;

    }

}


/* =========================================================
   15. AVATAR MARKER
   ========================================================= */

.avatar-marker {

    background: none !important;
    border: none !important;

}


.avatar-wrap {

    width: 48px;
    height: 48px;

    overflow: hidden;

    border-radius: 50%;

    background: #fff;

    border: 3px solid #00d9ff;

    box-shadow:
        0 0 12px rgba(0, 217, 255, .5);

}


.avatar-wrap img {

    width: 100%;
    height: 100%;

    object-fit: cover;

}


/* =========================================================
   18. MOBILE PERFORMANCE
   ========================================================= */

@media (max-width: 768px) {

    .leaflet-popup-content-wrapper,
    .leaflet-control-layers-expanded,
    .station-name,
    .empty-card {

        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;

    }

}


/* =========================================================
   19. LIVE COMMENT — MAIN PANEL
   ========================================================= */

.live-comment-wrapper {

    position: fixed;

    left: 50%;

    bottom:
        calc(
            12px +
            env(safe-area-inset-bottom)
        );

    transform: translateX(-50%);

    width:
        min(
            430px,
            calc(100% - 24px)
        );

    max-height: 68vh;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    color: var(--live-text);

    background: var(--live-bg);

    border: 1px solid var(--live-border);

    border-radius: var(--live-radius);

    box-shadow:
        0 14px 40px rgba(0, 0, 0, .40),
        0 4px 14px rgba(0, 0, 0, .20);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    z-index: 2000;

    transition:
        max-height .25s ease,
        width .25s ease,
        transform .25s ease;

}


/* =========================================================
   20. LIVE COMMENT — MINIMIZED
   ========================================================= */

.live-comment-wrapper.min {

    width:
        min(
            360px,
            calc(100% - 28px)
        );

    max-height: 60px;

}


.live-comment-wrapper.min .live-body,
.live-comment-wrapper.min .live-input {

    display: none;

}


/* =========================================================
   21. LIVE COMMENT — HEADER
   ========================================================= */

.live-header {

    position: relative;

    min-height: 60px;

    padding: 0 15px;

    display: flex;
    align-items: center;

    gap: 9px;

    flex-shrink: 0;

    cursor: pointer;

    background:
        linear-gradient(
            135deg,
            rgba(15, 23, 42, .99),
            rgba(30, 41, 59, .98)
        );

    border-bottom:
        1px solid rgba(255, 255, 255, .08);

    user-select: none;
    -webkit-user-select: none;

    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;

    touch-action: manipulation;

}


/* =========================================================
   22. LIVE COMMENT — HANDLE
   ========================================================= */

.live-handle {

    position: absolute;

    top: 7px;
    left: 50%;

    width: 40px;
    height: 4px;

    transform: translateX(-50%);

    border-radius: 999px;

    background:
        rgba(255, 255, 255, .28);

    pointer-events: none;

}


/* =========================================================
   23. LIVE COMMENT — LIVE DOT
   ========================================================= */

.live-dot {

    width: 9px;
    height: 9px;

    flex: 0 0 9px;

    border-radius: 50%;

    background: var(--live-red);

    box-shadow:
        0 0 0 4px rgba(255, 48, 64, .12);

    animation:
        liveDotPulse 1.8s infinite;

}


@keyframes liveDotPulse {

    0%,
    100% {

        box-shadow:
            0 0 0 3px rgba(255, 48, 64, .12);

    }

    50% {

        box-shadow:
            0 0 0 7px rgba(255, 48, 64, 0);

    }

}


/* =========================================================
   24. LIVE COMMENT — TITLE
   ========================================================= */

.live-title {

    color: #fff;

    font-size: 14px;
    font-weight: 800;

    line-height: 1;

    white-space: nowrap;

}


/* =========================================================
   25. LIVE COMMENT — HINT
   ========================================================= */

.live-hint {

    margin-left: auto;

    color: var(--live-gold);

    font-size: 11px;
    font-weight: 800;

    line-height: 1;

    white-space: nowrap;

    text-shadow:
        0 0 7px rgba(255, 215, 0, .45);

    animation:
        liveHintPulse 1.8s infinite;

}


@keyframes liveHintPulse {

    0%,
    100% {

        opacity: .65;

    }

    50% {

        opacity: 1;

    }

}


/* =========================================================
   26. LIVE COMMENT — BODY
   ========================================================= */

.live-body {

    height: 300px;

    padding: 12px;

    overflow-x: hidden;
    overflow-y: auto;

    display: flex;
    flex-direction: column;

    gap: 9px;

    overscroll-behavior: contain;

    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;

}


.live-body::-webkit-scrollbar {

    width: 4px;

}


.live-body::-webkit-scrollbar-track {

    background: transparent;

}


.live-body::-webkit-scrollbar-thumb {

    background:
        rgba(255, 255, 255, .18);

    border-radius: 999px;

}


/* =========================================================
   27. LIVE COMMENT — ITEM
   ========================================================= */

.live-item {

    position: relative;

    width: 100%;

    display: flex;
    align-items: flex-start;

    gap: 9px;

    padding: 8px;

    border-radius: 14px;

    background:
        rgba(255, 255, 255, .055);

    border:
        1px solid rgba(255, 255, 255, .055);

    animation:
        liveCommentIn .22s ease-out;

}


@keyframes liveCommentIn {

    from {

        opacity: 0;

        transform:
            translateY(7px);

    }

    to {

        opacity: 1;

        transform:
            translateY(0);

    }

}


/* =========================================================
   28. LIVE COMMENT — AVATAR
   ========================================================= */

.live-item img {

    width: 34px !important;
    height: 34px !important;

    flex: 0 0 34px;

    object-fit: cover;

    border-radius: 50%;

    border:
        2px solid var(--live-blue) !important;

    background: #1e293b;

    box-shadow:
        0 0 8px rgba(0, 217, 255, .25);

}


/* =========================================================
   29. LIVE COMMENT — CONTENT
   ========================================================= */

.live-item .comment-content {

    min-width: 0;
    flex: 1;

}


.live-item .comment-text {

    color: #f8fafc;

    font-size: 13px;
    line-height: 1.45;

    word-break: break-word;
    overflow-wrap: anywhere;

}


/* =========================================================
   30. LIVE COMMENT — USERNAME
   ========================================================= */

.live-item .username {

    display: block;

    margin-bottom: 2px;

    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

}


/* =========================================================
   31. LIVE COMMENT — TIME
   ========================================================= */

.live-item .comment-time {

    margin-top: 3px;

    color: var(--live-muted);

    font-size: 10px;

}


/* =========================================================
   32. LIVE COMMENT — LIKE BUTTON
   ========================================================= */

.live-item .like-btn {

    flex: 0 0 auto;

    min-width: 40px;
    height: 32px;

    padding: 0 7px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 3px;

    border: 0;
    border-radius: 16px;

    background:
        rgba(255, 255, 255, .07);

    color: #fff;

    font-size: 12px;

    cursor: pointer;

    transition:
        transform .15s ease,
        background .15s ease;

}


.live-item .like-btn:hover {

    background:
        rgba(255, 255, 255, .13);

}


.live-item .like-btn:active {

    transform: scale(.90);

}


/* Like count */

.live-item .like-count {

    color: #cbd5e1;

    font-size: 10px;

}


/* =========================================================
   33. LIVE COMMENT — INPUT CONTAINER
   ========================================================= */

.live-input {

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 9px 10px;

    flex-shrink: 0;

    background: var(--live-bg-dark);

    border-top:
        1px solid rgba(255, 255, 255, .08);

}


/* =========================================================
   34. LIVE COMMENT — INPUT
   ========================================================= */

.live-input input {

    width: 100%;
    min-width: 0;

    height: 42px;

    padding: 0 14px;

    outline: none;

    border:
        1px solid rgba(255, 255, 255, .10);

    border-radius: 22px;

    background:
        rgba(255, 255, 255, .07);

    color: #fff;

    font-family: inherit;
    font-size: 14px;

    -webkit-appearance: none;

}


.live-input input::placeholder {

    color:
        rgba(255, 255, 255, .42);

}


.live-input input:focus {

    border-color:
        rgba(0, 217, 255, .45);

    background:
        rgba(255, 255, 255, .09);

    box-shadow:
        0 0 0 3px rgba(0, 217, 255, .07);

}


/* =========================================================
   35. LIVE COMMENT — SEND BUTTON
   ========================================================= */

.live-input button {

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #00d9ff,
            #2563eb
        );

    color: #fff;

    font-size: 18px;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 4px 12px rgba(37, 99, 235, .30);

    transition:
        transform .15s ease,
        opacity .15s ease;

}


.live-input button:hover {

    opacity: .92;

}


.live-input button:active {

    transform: scale(.90);

}


/* =========================================================
   36. LIVE COMMENT — MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .live-comment-wrapper {

        left: 8px;
        right: 8px;

        bottom:
            calc(
                8px +
                env(safe-area-inset-bottom)
            );

        width: auto;

        transform: none;

        max-height: 68vh;

        border-radius: 18px;

    }


    .live-comment-wrapper.min {

        width: auto;
        max-height: 58px;

    }


    .live-header {

        min-height: 56px;

        padding: 0 13px;

    }


    .live-title {

        font-size: 13px;

    }


    .live-hint {

        font-size: 10px;

    }


    .live-body {

        height: 270px;

        padding: 10px;

    }


    .live-item {

        padding: 7px;

    }


    .live-item .comment-text {

        font-size: 12.5px;

    }


    .live-input {

        padding: 8px;

    }


    .live-input input {

        height: 40px;

        font-size: 14px;

    }


    .live-input button {

        width: 40px;
        height: 40px;

        flex-basis: 40px;

    }

}


/* =========================================================
   37. LIVE COMMENT — SMALL PHONE
   ========================================================= */

@media (max-width: 380px) {

    .live-comment-wrapper {

        left: 6px;
        right: 6px;

    }


    .live-hint {

        display: none;

    }


    .live-body {

        height: 250px;

    }


    .live-item .like-btn {

        min-width: 34px;

        padding: 0 5px;

    }

}


/* =========================================================
   38. ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .live-comment-wrapper,
    .live-dot,
    .live-hint,
    .live-item,
    .live-input button {

        animation: none !important;
        transition: none !important;

    }

}


/* =========================================================
   END BTHUNTER MAP + LIVE COMMENT CSS
   ========================================================= */
   
   
/* =========================================================
   BTHUNTER HYBRID MAP — LEAFLET 2D + MAPLIBRE 3D
   #map utama tetap menggunakan aturan lama di bagian 3.
   ========================================================= */


/* =========================================================
   BTHUNTER HYBRID MAP — LEAFLET 2D + MAPLIBRE 3D
   MOBILE UI REFINEMENT — SAFE CSS
   ========================================================= */

/* ---------- PETA 3D ---------- */
#map3d {
    position: fixed;
    top: var(--nav-h, 0px);
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    z-index: 2;
    background: #dbeafe;
    overflow: hidden;
}

#map3d[hidden],
#map[hidden] {
    display: none !important;
}

#map3d .maplibregl-canvas-container,
#map3d .maplibregl-canvas {
    width: 100%;
    height: 100%;
}

#map3d .maplibregl-ctrl-top-right,
#map3d .maplibregl-ctrl-top-left {
    z-index: 10;
}

/* ---------- TOMBOL 2D / 3D ---------- */
.toggle-map-3d,
#toggleMap3D {
    position: fixed !important;
    top: calc(var(--nav-h, 0px) + 80px) !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10001 !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;

    width: auto !important;
    height: auto !important;
    min-height: 42px;
    max-width: calc(100vw - 24px);
    margin: 0 !important;
    padding: 10px 14px !important;

    box-sizing: border-box;
    border: 1px solid #475569 !important;
    border-radius: 10px !important;
    background: #0f172a !important;
    color: #fff !important;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;

    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#toggleMap3D:hover,
.toggle-map-3d:hover {
    background: #1e40af !important;
}

#toggleMap3D:focus-visible,
.toggle-map-3d:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 3px;
}

#toggleMap3D:active,
.toggle-map-3d:active {
    transform: scale(.98);
}

/* ---------- JOURNEY: PANEL REKAM ---------- */
.journey-record-panel {
    position: absolute;
    z-index: 710;
    top: 76px;
    left: 14px;
    width: min(300px, calc(100vw - 28px));
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, .4);
    border-radius: 13px;
    background: rgba(15, 23, 42, .96);
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    font-family: system-ui, sans-serif;
}

.journey-record-heading {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

#journey-record-status {
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.45;
}

#journey-record-status[data-recording="true"] {
    color: #4ade80;
}

#journey-title {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    padding: 9px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: #1e293b;
    color: #fff;
    font-size: 14px;
}

.journey-record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 9px;
}

.journey-record-actions button {
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

#journey-start-record {
    background: #166534;
    color: #fff;
}

#journey-resume-record,
#journey-playback-button {
    background: #1d4ed8;
    color: #fff;
}

#journey-stop-record {
    background: #b91c1c;
    color: #fff;
}

.journey-record-actions button[hidden],
.journey-finished-actions[hidden],
#journey-share-status[hidden],
#journey-inline-playback[hidden] {
    display: none !important;
}

/* ---------- JOURNEY: HASIL REKAMAN ---------- */
.journey-finished-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0;
}

.journey-finished-actions button {
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#journey-share-button {
    background: #0891b2;
    color: #fff;
}

#journey-share-status {
    overflow-wrap: anywhere;
    color: #cbd5e1;
    font-size: 11px;
}

/* ---------- JOURNEY: PANEL PLAYBACK ---------- */
#journey-inline-playback {
    position: fixed;
    top: calc(var(--nav-h, 0px) + 250px);
    left: 12px;
    width: min(360px, calc(100vw - 24px));
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, .4);
    border-radius: 14px;
    background: rgba(15, 23, 42, .97);
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    z-index: 9000;
}

#journey-inline-playback-status {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.journey-inline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.journey-inline-controls button {
    min-height: 40px;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: #1d4ed8;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

#journey-inline-stop {
    background: #334155;
}

#journey-inline-range {
    display: block;
    width: 100%;
    min-height: 30px;
    margin: 8px 0 2px;
    accent-color: #a855f7;
    cursor: pointer;
}

#journey-inline-time {
    display: block;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* ---------- SPOT TERBARU ---------- */
.spot-mini-slider {
    position: absolute;
    z-index: 700;
    left: 14px;
    bottom: 34px;
    width: min(290px, calc(100vw - 28px));
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, .45);
    border-radius: 15px;
    background: rgba(15, 23, 42, .94);
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    font-family: system-ui, sans-serif;
}

.spot-mini-top,
.spot-mini-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.spot-mini-heading {
    font-size: 12px;
    font-weight: 800;
}

.spot-mini-counter {
    font-size: 10px;
    color: #cbd5e1;
}

.spot-mini-content {
    min-height: 66px;
    padding: 8px 0 5px;
}

.spot-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
}

.spot-mini-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #1e40af;
    font-size: 22px;
}

.spot-mini-info {
    min-width: 0;
    flex: 1;
}

.spot-mini-name,
.spot-mini-detail,
.spot-mini-city {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spot-mini-name {
    font-size: 13px;
    font-weight: 800;
}

.spot-mini-detail {
    margin-top: 3px;
    font-size: 11px;
    color: #cbd5e1;
}

.spot-mini-city {
    margin-top: 2px;
    font-size: 10px;
    color: #94a3b8;
}

.spot-mini-controls {
    justify-content: center;
}

.spot-mini-controls button {
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid #475569;
    border-radius: 7px;
    background: #1e293b;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.spot-mini-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.spot-mini-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #64748b;
}

.spot-mini-dot.active {
    width: 14px;
    border-radius: 5px;
    background: #38bdf8;
}

.spot-mini-empty {
    padding: 14px 0;
    color: #cbd5e1;
    font-size: 11px;
}

/* ---------- KOMUNITAS LIVE ---------- */
.live-comment-wrapper {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(430px, calc(100% - 24px));
    max-height: 68vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--live-text, #fff);
    background: var(--live-bg, rgba(15, 23, 42, .97));
    border: 1px solid var(--live-border, rgba(255, 255, 255, .1));
    border-radius: var(--live-radius, 20px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
    z-index: 2000;
}

.live-comment-wrapper.min {
    width: min(360px, calc(100% - 28px));
    max-height: 60px;
}

.live-comment-wrapper.min .live-body,
.live-comment-wrapper.min .live-input {
    display: none;
}

/* =========================================================
   RESPONSIVE MOBILE
   ========================================================= */
@media (max-width: 768px) {

    /* Tombol 2D/3D di bawah navbar */
    #toggleMap3D,
    .toggle-map-3d {
        top: calc(var(--nav-h, 60px) + 5px) !important;
        right: 8px !important;
        max-width: 46vw;
        min-height: 38px;
        padding: 8px 10px !important;
        font-size: 11px;
    }

    /* Panel Journey tidak bertabrakan dengan tombol mode */
    .journey-record-panel {
        position: fixed !important;
        top: calc(var(--nav-h, 60px) + 52px) !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        max-height: 34vh;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 11px !important;
        border-radius: 14px;
        z-index: 9000;
    }

    .journey-record-heading {
        gap: 4px;
        margin-bottom: 8px;
    }

    .journey-record-heading strong {
        font-size: 13px;
    }

    #journey-title {
        min-height: 40px;
        margin-bottom: 8px;
        font-size: 13px;
    }

    .journey-record-actions,
    .journey-finished-actions {
        gap: 7px;
    }

    .journey-record-actions button,
    .journey-finished-actions button {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 11px;
    }

    #journey-inline-playback {
        top: calc(var(--nav-h, 60px) + 230px);
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        max-height: 32vh;
        overflow-y: auto;
        padding: 11px;
    }

    .journey-inline-controls button {
        flex: 1 1 110px;
        min-height: 42px;
    }

    /* Spot Terbaru berada di atas panel Live */
    .spot-mini-slider {
        left: 8px;
        bottom: calc(76px + env(safe-area-inset-bottom));
        width: min(245px, calc(100vw - 16px));
        padding: 9px 10px;
        border-radius: 14px;
    }

    .spot-mini-content {
        min-height: 56px;
        padding: 6px 0 4px;
    }

    /* Komunitas Live tetap di bawah */
    .live-comment-wrapper {
        left: 8px;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        width: auto;
        transform: none;
        max-height: 68vh;
        border-radius: 17px;
    }

    .live-comment-wrapper.min {
        width: auto;
        max-height: 56px;
    }

    .live-header {
        min-height: 54px;
        padding: 0 12px;
    }

    .live-title {
        font-size: 13px;
    }

    .live-hint {
        font-size: 10px;
    }

    .live-body {
        height: 250px;
        padding: 10px;
    }

    .live-input {
        padding: 8px;
    }

    .live-input input {
        min-width: 0;
        height: 40px;
        font-size: 14px;
    }

    .live-input button {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    /* Popup Leaflet tidak melebar keluar layar */
    .leaflet-popup-content {
        min-width: 0;
        max-width: calc(100vw - 80px);
        padding: 10px !important;
    }

    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 50px);
    }

    .leaflet-popup-content .btn {
        min-height: 40px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    #toggleMap3D,
    .toggle-map-3d {
        max-width: 44vw;
        padding: 7px 8px !important;
        font-size: 10px;
    }

    .journey-record-panel {
        left: 7px !important;
        right: 7px !important;
        padding: 9px !important;
    }

    .journey-record-actions button,
    .journey-finished-actions button {
        padding: 8px;
        font-size: 10px;
    }

    .spot-mini-slider {
        width: min(220px, calc(100vw - 14px));
    }

    .live-hint {
        display: none;
    }

    .live-body {
        height: 230px;
    }
}

/* Kurangi efek visual berat pada HP */
@media (max-width: 768px) {
    .leaflet-popup-content-wrapper,
    .leaflet-control-layers-expanded,
    .station-name,
    .empty-card {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
}

/* Aksesibilitas */
@media (prefers-reduced-motion: reduce) {
    #toggleMap3D,
    .toggle-map-3d,
    .live-comment-wrapper {
        transition: none !important;
    }
}


/* =====================================================
   BTHUNTER — JOURNEY MINI MOBILE
   Panel ringkas, tombol ikon, area peta lebih luas
   ===================================================== */

@media (max-width: 600px) {

    /* Panel Journey dibuat kecil di pojok kiri atas */
    .journey-record-panel {
        top: calc(var(--nav-h, 60px) + 25px) !important;
        left: 8px !important;
        right: auto !important;
        width: 190px !important;
        max-width: calc(100vw - 16px) !important;
        max-height: 175px !important;
        overflow-y: auto !important;
        padding: 9px !important;
        border-radius: 12px !important;
        z-index: 9000 !important;
    }

    /* Judul dan status lebih kecil */
    .journey-record-heading {
        gap: 3px !important;
        margin-bottom: 6px !important;
    }

    .journey-record-heading strong {
        font-size: 11px !important;
    }

    #journey-record-status {
        font-size: 10px !important;
        line-height: 1.3 !important;
    }

    /* Input nama perjalanan */
    #journey-title {
        min-height: 32px !important;
        margin-bottom: 6px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
        border-radius: 7px !important;
    }

    /* Tombol menjadi ikon kecil */
    .journey-record-actions,
    .journey-finished-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin: 10px 0 !important;
    }

    .journey-record-actions button,
    .journey-finished-actions button {
        width: 34px !important;
        min-width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
        flex: 0 0 34px !important;
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        overflow: hidden !important;
        border-radius: 8px !important;
    }

    /* Ikon emoji tetap tampil */
    .journey-record-actions button::first-letter,
    .journey-finished-actions button::first-letter {
        font-size: 16px !important;
    }

    /* Jarak rekaman lebih ringkas */
    .journey-record-panel > small {
        display: block;
        margin-top: 4px !important;
        font-size: 10px !important;
    }

    /* Tombol 2D/3D kecil dan tidak melebar */
    #toggleMap3D,
    .toggle-map-3d {
        top: calc(var(--nav-h, 60px) + 8px) !important;
        right: 8px !important;
        max-width: 44vw !important;
        min-height: 32px !important;
        padding: 6px 8px !important;
        font-size: 10px !important;
    }

    /* Playback ringkas saat dibuka */
    #journey-inline-playback {
        top: calc(var(--nav-h, 60px) + 195px) !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        max-height: 24vh !important;
        overflow-y: auto !important;
        padding: 9px !important;
        z-index: 9100 !important;
    }

    #journey-inline-playback-status {
        margin-bottom: 6px !important;
        font-size: 11px !important;
    }

    .journey-inline-controls {
        gap: 6px !important;
    }

    .journey-inline-controls button {
        min-height: 34px !important;
        padding: 6px 9px !important;
        font-size: 11px !important;
    }

    #journey-inline-range {
        min-height: 25px !important;
        margin: 5px 0 !important;
    }

    #journey-inline-time {
        font-size: 10px !important;
    }
}

/* HP kecil */
@media (max-width: 380px) {
    .journey-record-panel {
        width: 174px !important;
        max-height: 160px !important;
        padding: 8px !important;
    }

    .journey-record-actions,
    .journey-finished-actions {
        gap: 5px !important;
    }

    .journey-record-actions button,
    .journey-finished-actions button {
        width: 31px !important;
        min-width: 31px !important;
        height: 31px !important;
        min-height: 31px !important;
        flex-basis: 31px !important;
    }
}


/* Perkecil tombol kontrol Journey Playback di HP */
@media (max-width: 600px) {
    .journey-inline-controls {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    .journey-inline-controls button {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        min-height: 30px !important;
        height: 30px !important;
        padding: 5px 9px !important;
        font-size: 10px !important;
        line-height: 1 !important;
        border-radius: 7px !important;
    }

    #journey-inline-playback {
        padding: 8px !important;
    }

    #journey-inline-playback-status {
        margin-bottom: 5px !important;
        font-size: 10px !important;
    }

    #journey-inline-range {
        min-height: 22px !important;
        margin: 4px 0 !important;
    }

    #journey-inline-time {
        font-size: 9px !important;
    }
}


/* MINI BANGET — kontrol Playback mobile */
@media (max-width: 600px) {
    #journey-inline-playback .journey-inline-controls {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
    }

    #journey-inline-playback .journey-inline-controls button {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        min-height: 24px !important;
        height: 24px !important;
        padding: 3px 6px !important;
        margin: 0 !important;
        font-size: 9px !important;
        line-height: 1 !important;
        border-radius: 5px !important;
        box-shadow: none !important;
    }

    #journey-inline-playback {
        padding: 6px !important;
        border-radius: 9px !important;
    }

    #journey-inline-playback-status {
        margin: 0 0 4px !important;
        font-size: 9px !important;
        line-height: 1.3 !important;
    }

    #journey-inline-range {
        min-height: 18px !important;
        margin: 3px 0 !important;
    }

    #journey-inline-time {
        font-size: 8px !important;
        line-height: 1.2 !important;
    }
}

/* =====================================================
   BTHUNTER — MOBILE MAP: CEGAH PANEL BERTUMPUK
   ===================================================== */

@media (max-width: 600px) {

    /* Spot terbaru berada di atas Live Komentar */
    .spot-mini-slider {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        bottom: calc(70px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: 420px;
        margin-inline: auto;
        box-sizing: border-box;
        z-index: 700 !important;
    }

    /* Saat komentar dibuka, prioritaskan peta dan komentar */
    body:has(.live-comment-wrapper:not(.min)) .spot-mini-slider {
        display: none !important;
    }

    /* Live Komentar tetap di bagian bawah */
    .live-comment-wrapper {
        left: 8px !important;
        right: 8px !important;
        bottom: calc(8px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        z-index: 2000 !important;
    }

    /* Playback hanya tampil saat diperlukan */
    #journey-inline-playback[hidden] {
        display: none !important;
    }

    #journey-inline-playback {
        max-width: calc(100vw - 16px) !important;
        box-sizing: border-box;
    }
}


/* Turunkan tombol Rekam di mobile */
@media (max-width: 600px) {
    #journey-record-panel #journey-start-record {
        position: relative !important;
        top: 8px !important;
    }
}


/* ---------- JOURNEY PANEL: SATU IKON, BUKA/TUTUP ---------- */
.journey-record-panel {
    transition: width .18s ease, height .18s ease, padding .18s ease,
                border-radius .18s ease;
}

.journey-record-heading {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-bottom: 8px;
}

.journey-record-title {
    flex: 1;
}

.journey-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(37, 99, 235, .3);
}

.journey-panel-toggle:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 3px;
}

.journey-record-content {
    display: block;
}

.journey-record-panel.is-collapsed {
    width: 46px !important;
    height: 46px;
    padding: 5px;
    overflow: hidden;
    border-radius: 50%;
}

.journey-record-panel.is-collapsed .journey-record-heading {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
}

.journey-record-panel.is-collapsed .journey-record-title,
.journey-record-panel.is-collapsed #journey-record-status,
.journey-record-panel.is-collapsed .journey-record-content {
    display: none !important;
}

.journey-record-panel.is-collapsed .journey-panel-toggle {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    background: transparent;
    box-shadow: none;
    font-size: 21px;
}

@media (max-width: 600px) {
    .journey-record-panel.is-collapsed {
        left: 10px;
        top: 76px;
        width: 44px !important;
        height: 44px;
        padding: 4px;
    }

    .journey-record-panel.is-collapsed .journey-record-heading {
        width: 34px;
        height: 34px;
        min-height: 34px;
    }
}



/* Journey Playback panel toggle — authoritative final rules */
#journey-record-panel {
    position: fixed !important;
    z-index: 3000 !important;
    top: 72px !important;
    left: 12px !important;
    box-sizing: border-box !important;
}
#journey-record-panel.is-collapsed {
    display: block !important;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 5px !important;
    overflow: hidden !important;
    border-radius: 50% !important;
}
#journey-record-panel.is-collapsed .journey-record-title,
#journey-record-panel.is-collapsed #journey-record-status,
#journey-record-panel.is-collapsed .journey-record-content {
    display: none !important;
}
#journey-record-panel .journey-panel-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
}
#journey-record-panel.is-collapsed .journey-record-heading {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
}
@media (max-width: 600px) {
    #journey-record-panel { top: 76px !important; left: 10px !important; }
    #journey-record-panel.is-collapsed {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 4px !important;
    }
}
