/* === CSS Reset & Variables === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --accent: #22c55e;
    --accent-dark: #16a34a;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-full: 999px;
    --control-height: 44px;
    --control-inner-size: 36px;
    --control-shell-padding: 3px;
    --world-tour-action-height: 36px;
    --world-tour-menu-height: clamp(212px, 24vh, 250px);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
    word-break: keep-all;
    overflow-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* === Layout === */
body {
    display: flex;
    flex-direction: column;
}

#header {
    position: fixed;
    /* Leave a small breathing room above browser toolbars that overlay the viewport. */
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    background: transparent;
    padding: 0;
    z-index: 1002;
    /* Above dim overlay */
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 620px;
    margin: 0 auto;
    padding: 8px 12px;
    pointer-events: auto;
}

#main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.service-status-banner {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    width: min(calc(100% - 24px), 620px);
    padding: 12px 14px;
    border-radius: 16px;
    backdrop-filter: blur(18px);
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1004;
    pointer-events: auto;
    transform: translateX(-50%);
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}

.service-status-banner.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -12px);
}

.service-status-banner.tone-ok {
    background: rgba(8, 47, 31, 0.82);
    border-color: rgba(74, 222, 128, 0.18);
}

.service-status-banner.tone-warn {
    background: rgba(68, 45, 8, 0.84);
    border-color: rgba(251, 191, 36, 0.2);
}

.service-status-banner.tone-danger {
    background: rgba(69, 10, 10, 0.84);
    border-color: rgba(248, 113, 113, 0.2);
}

.service-status-title {
    padding-right: 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.service-status-body {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
}

.service-status-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(226, 232, 240, 0.72);
}

.service-status-time {
    min-width: 0;
}

.service-status-countdown {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    color: rgba(248, 250, 252, 0.88);
    font-variant-numeric: tabular-nums;
}

.service-status-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.45);
    color: rgba(248, 250, 252, 0.86);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.service-status-close:hover {
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    transform: scale(1.04);
}

.view {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.view.active {
    opacity: 1;
    visibility: visible;
}

/* === Segment Control (Sliding Tabs) === */
.segment-control {
    display: flex;
    position: relative;
    flex: 0 0 auto;
    height: var(--control-height);
    min-height: var(--control-height);
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    padding: var(--control-shell-padding);
    border: 1px solid var(--border-color);
}

.segment-indicator {
    position: absolute;
    top: var(--control-shell-padding);
    left: var(--control-shell-padding);
    width: var(--control-inner-size);
    height: var(--control-inner-size);
    background: var(--accent);
    border-radius: 50%;
    z-index: 1;
    transition: transform var(--transition);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.segment-btn {
    position: relative;
    z-index: 2;
    width: var(--control-inner-size);
    height: var(--control-inner-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.segment-btn.active {
    color: var(--bg-primary);
}

.segment-btn svg {
    pointer-events: none;
}

/* === Search Box === */
.search-box {
    flex: 1;
    max-width: none;
    height: var(--control-height);
    min-height: var(--control-height);
    position: relative;
    z-index: 1001;
    /* Above dim overlay */
}

.search-box input {
    width: 100%;
    height: var(--control-height);
    padding: 0 78px 0 16px;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: none;
}

.search-location {
    position: absolute;
    right: 40px;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.search-location:hover,
.search-location:focus-visible { color: var(--accent); background: rgba(34, 197, 94, 0.12); }
.search-location.loading { animation: search-location-pulse 850ms ease-in-out infinite alternate; pointer-events: none; }
@keyframes search-location-pulse { to { color: var(--accent); transform: translateY(-50%) scale(1.12); } }

/* The bottom bar deliberately keeps just search and one navigation doorway. */
.app-menu-trigger {
    flex: 0 0 auto;
    min-width: 66px;
    height: var(--control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.94);
    color: var(--text-primary);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.app-menu-trigger[aria-expanded="true"] {
    border-color: var(--accent);
    color: #bbf7d0;
    background: rgba(20, 83, 45, 0.9);
}

.app-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(2, 6, 23, 0.68);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.app-menu-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* The menu owns the whole viewport while open, including the bottom bar. */
body.app-menu-open #header {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-menu-sheet {
    width: min(100%, 580px);
    max-height: min(760px, calc(100dvh - 24px));
    overflow: auto;
    padding: 8px 16px 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    background:
        radial-gradient(circle at 92% 0%, rgba(34, 197, 94, 0.18), transparent 30%),
        linear-gradient(160deg, #172338, #0f172a 62%);
    box-shadow: 0 -16px 60px rgba(0, 0, 0, 0.46);
    transform: translateY(18px);
    transition: transform 220ms cubic-bezier(0.22, 0.9, 0.28, 1);
}

.app-menu-backdrop.active .app-menu-sheet { transform: translateY(0); }
.app-menu-handle { width: 36px; height: 4px; margin: 3px auto 14px; border-radius: 99px; background: rgba(226, 232, 240, 0.26); }
.app-menu-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.app-menu-heading p { color: #86efac; font-size: 10px; font-weight: 900; letter-spacing: 0.14em; }
.app-menu-heading h2 { margin-top: 3px; font-size: 21px; letter-spacing: -0.04em; }
.app-menu-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(148, 163, 184, 0.14); color: var(--text-primary); font-size: 24px; cursor: pointer; }
.app-menu-section { margin-top: 15px; }
.app-menu-label { display: block; margin: 0 2px 8px; color: #94a3b8; font-size: 11px; font-weight: 800; }
.app-menu-primary-grid, .app-menu-secondary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.app-menu-card, .app-menu-row { border: 1px solid rgba(148, 163, 184, 0.26); color: var(--text-primary); background: transparent; cursor: pointer; text-align: left; }
.app-menu-card { min-height: 100px; padding: 14px; border-radius: 16px; }
.app-menu-card:hover, .app-menu-row:hover { border-color: rgba(134, 239, 172, 0.55); }
.app-menu-card.is-active, .app-menu-row.is-active { border-color: rgba(74, 222, 128, 0.72); background: linear-gradient(145deg, rgba(22, 101, 52, 0.68), rgba(20, 83, 45, 0.4)); box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.32); }
.app-menu-icon { display: block; margin-bottom: 8px; color: #86efac; font-size: 26px; line-height: 1; }
.app-menu-icon svg, .app-menu-row-icon svg { display: block; width: 1em; height: 1em; }
.app-menu-card strong, .app-menu-row strong { display: block; font-size: 14px; }
.app-menu-card small, .app-menu-row small { display: block; margin-top: 4px; color: #94a3b8; font-size: 11px; line-height: 1.35; }
.app-menu-row { display: flex; width: 100%; min-height: 62px; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 14px; }
.app-menu-row-icon { flex: 0 0 32px; color: #86efac; font-size: 23px; text-align: center; }
.app-menu-row > span:nth-child(2) { min-width: 0; flex: 1; }
.app-menu-row > b { color: #94a3b8; font-size: 24px; font-weight: 400; }
.app-menu-tools { display: flex; align-items: center; gap: 8px; margin-top: 17px; padding-top: 14px; border-top: 1px solid rgba(148, 163, 184, 0.15); }
.app-menu-tools > button, .quality-badge { min-height: 38px; border: 1px solid rgba(148, 163, 184, 0.16); border-radius: 12px; background: rgba(15, 23, 42, 0.5); color: #cbd5e1; font-size: 12px; font-weight: 700; cursor: pointer; }
.app-menu-tools > button { flex: 0 0 auto; padding: 0 12px; }
.quality-badge-group { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; }
.quality-badge { flex: 1 1 calc(50% - 3px); min-width: 72px; padding: 0 9px; }
.quality-badge:hover, .quality-badge:focus-visible { border-color: rgba(134, 239, 172, 0.6); color: #dcfce7; }
.quality-badge.active { border-color: var(--accent); background: rgba(22, 163, 74, 0.28); color: #dcfce7; }
@media (max-width: 390px) { .app-menu-sheet { padding-inline: 12px; } .app-menu-card { padding: 11px; } .app-menu-card strong, .app-menu-row strong { font-size: 13px; } }

.search-box input:not(:placeholder-shown) ~ .search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Location Button === */
.location-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.location-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.location-btn.loading {
    animation: location-pulse 1.5s infinite;
    color: var(--accent);
}

@keyframes location-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* === Weather Button === */
.weather-btn {
    flex: 0 0 var(--control-height);
    width: var(--control-height);
    height: var(--control-height);
    min-width: var(--control-height);
    min-height: var(--control-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.weather-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

button,
input,
textarea,
select {
    font: inherit;
    word-break: keep-all;
}

.weather-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.weather-btn.world-tour-btn {
    color: #a7f3d0;
    background:
        radial-gradient(circle at 30% 20%, rgba(34, 197, 94, 0.22), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96));
}

.weather-btn.world-tour-btn.active {
    border-color: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.weather-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* === Quality Controls === */
.quality-controls {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 3px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow);
}

.quality-sort-select {
    height: 34px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: 0;
}

.quality-sort-select {
    max-width: 112px;
    padding: 0 12px;
    background: rgba(30, 41, 59, 0.85);
    background-image: none;
    color-scheme: dark;
}

.quality-sort-select::-ms-expand {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .quality-controls {
        display: none;
    }
}

@media (max-width: 820px), (max-height: 520px) and (max-width: 1100px) {
    .quality-controls {
        display: none;
    }
}

@media (min-width: 400px) {
    .quality-controls {
        display: inline-flex;
        flex: 0 0 auto;
    }
}

/* === Video Grid === */
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 4px;
    height: 100%;
    padding: 4px;
    background: var(--bg-tertiary);
}

.video-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    position: relative;
    /* overflow: visible needed for dropdowns */
    overflow: visible;
    min-width: 0;
    min-height: 0;
    transition: z-index 0s;
}

.video-panel.z-active {
    z-index: 50;
}

.video-content-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Clip video here */
    border-radius: var(--radius-sm);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    touch-action: pan-y;
}

.video-panel video,
.video-panel iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    border: none;
    display: block;
    background: #000;
}

/* Embedded providers cannot bubble touch events out of their document.
   Let the panel own tap and pan gestures just like native video feeds. */
#video-grid .video-panel iframe {
    pointer-events: none;
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.video-placeholder.error {
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    text-align: center;
    background:
        radial-gradient(circle at top, rgba(34, 197, 94, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.88));
}

.video-loading-indicator {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    z-index: 12;
}

.video-loading-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

.video-loading-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.video-loading-indicator strong {
    font-size: 12px;
    font-weight: 600;
}

.video-loading-indicator span {
    font-size: 11px;
    color: var(--text-secondary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Defensive backstop: even if cached/old JS injects a .panel-health-badge
 * node (e.g. browsers serving an older SW build), never render it — the
 * same status is already shown by the dot in the .cctv-select-trigger. */
.panel-health-badge {
    display: none !important;
}

._archived-panel-health-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 7px 9px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    cursor: help;
    z-index: 15;
}

.panel-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.panel-health-badge.tone-ok .panel-health-dot,
.panel-health-dot.tone-ok {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2), 0 0 12px rgba(34, 197, 94, 0.35);
}

.panel-health-badge.tone-ok-soft .panel-health-dot,
.panel-health-dot.tone-ok-soft {
    background: #84cc16;
    box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.2), 0 0 12px rgba(132, 204, 22, 0.28);
}

.panel-health-badge.tone-warn .panel-health-dot,
.panel-health-dot.tone-warn {
    background: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22), 0 0 12px rgba(250, 204, 21, 0.28);
}

.panel-health-badge.tone-danger .panel-health-dot,
.panel-health-dot.tone-danger {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22), 0 0 12px rgba(239, 68, 68, 0.32);
}

.panel-health-badge.tone-unknown .panel-health-dot,
.panel-health-dot.tone-unknown {
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.panel-health-badge.tone-ok,
.tone-ok {
    color: #86efac;
}

.panel-health-badge.tone-ok-soft,
.tone-ok-soft {
    color: #bbf7d0;
}

.panel-health-badge.tone-warn,
.tone-warn {
    color: #fde68a;
}

.panel-health-badge.tone-danger,
.tone-danger {
    color: #fca5a5;
}

.panel-health-badge.tone-unknown,
.tone-unknown {
    color: #cbd5e1;
}

.panel-health-sep {
    opacity: 0.55;
}

/* === Panel Controls (Dropdown + Expand) === */
.panel-controls {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 8px;
    z-index: 20;
    opacity: 1;
    /* Always visible for mobile */
    transition: opacity var(--transition);
    pointer-events: auto;
    /* Always clickable */
}

.video-panel:hover .panel-controls,
.video-panel.expanded .panel-controls {
    opacity: 1;
}

/* CCTV Dropdown Selector */
.cctv-select-container {
    position: relative;
    max-width: min(58%, 360px);
    min-width: 0;
    flex: 0 1 auto;
}

.cctv-select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all var(--transition);
}

.cctv-select-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cctv-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.62), 0 0 10px rgba(100, 116, 139, 0.45);
}

.cctv-status-dot.tone-ok {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.62), 0 0 10px rgba(34, 197, 94, 0.78);
}

.cctv-status-dot.tone-ok-soft {
    background: #84cc16;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.62), 0 0 10px rgba(132, 204, 22, 0.72);
}

.cctv-status-dot.tone-warn {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.62), 0 0 10px rgba(245, 158, 11, 0.72);
}

.cctv-status-dot.tone-danger {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.62), 0 0 10px rgba(239, 68, 68, 0.78);
}

.cctv-status-dot.tone-unknown {
    background: #94a3b8;
}

.cctv-select-trigger:hover {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.85);
}

.cctv-select-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    max-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    display: none;
    flex-direction: column;
    z-index: 100;
}

.cctv-select-options.active {
    display: flex;
}

/* Bottom-row selectors open upward so the persistent search bar never hides
   the last camera choices. */
.video-panel[data-slot="2"] .cctv-select-options,
.video-panel[data-slot="3"] .cctv-select-options {
    top: auto;
    bottom: calc(100% + 8px);
}

.cctv-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background var(--transition);
}

.cctv-option-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cctv-option.confidence-danger {
    color: #fecaca;
}

.cctv-option.confidence-warn {
    color: #fde68a;
}

.cctv-option.confidence-ok,
.cctv-option.confidence-ok-soft {
    color: #d1fae5;
}

.cctv-option:last-child {
    border-bottom: none;
}

.cctv-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cctv-option.selected {
    color: var(--accent);
    font-weight: 600;
}

/* Panel Refresh Button */
.panel-refresh-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all var(--transition);
    flex-shrink: 0;
}

.panel-refresh-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.85);
}

.panel-refresh-btn svg {
    pointer-events: none;
}

/* Panel Expanded (Fullscreen) State */
.video-panel.expanded {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2000 !important;
    border-radius: 0 !important;
    background: #000;
}

.video-panel.panel-suspended {
    background:
        radial-gradient(circle at 50% 20%, rgba(34, 197, 94, 0.1), transparent 32%),
        var(--bg-primary);
}

.video-panel.panel-suspended .video-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-placeholder.suspended {
    max-width: 280px;
    padding: 18px;
    color: rgba(226, 232, 240, 0.78);
    text-align: center;
    line-height: 1.5;
}

.video-panel.expanded .panel-controls {
    opacity: 1;
    pointer-events: auto;
    top: 16px;
    left: 16px;
    right: 16px;
}

.video-panel.expanded .panel-health-badge {
    font-size: 12px;
    min-height: 34px;
}

.video-panel.expanded iframe,
.video-panel.expanded video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Iframe Fill Optimization */
/* Iframe Fill Optimization */
.video-panel iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #000;
}

/* === Map View === */
#kakao-map {
    width: 100%;
    height: 100%;
    position: relative;
}

/* === Windy Map Overlay & Button === */
/* === Windy Layers Panel === */
/* === Windy Layers Panel === */
.windy-panel-container {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 102; /* Higher than map overlay (95) and close button (101) */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    pointer-events: auto;
}

.windy-panel-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease;
}

.windy-label {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    opacity: 0.9;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.windy-panel-item:hover .windy-label {
    opacity: 1;
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(2px);
}

.windy-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.windy-panel-item:hover .windy-icon-circle {
    transform: scale(1.05);
    border-color: var(--accent);
    box-shadow: none;
    background: rgba(30, 41, 59, 0.95);
}

/* Menu Toggle Button Styling */
.menu-toggle-item .windy-icon-circle {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--accent);
}

.menu-toggle-item:hover .windy-icon-circle {
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--accent);
}

.menu-toggle-item.active .windy-icon-circle {
    background: rgba(15, 23, 42, 0.95);
    border-color: var(--accent);
    box-shadow: none;
}

.menu-toggle-item.windy-active .windy-icon-circle {
    background: var(--accent);
    border: 1.5px solid #ffffff;
    color: #ffffff;
    box-shadow: none;
}

/* Layers List Container */
.windy-layers-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-height: 600px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.windy-layers-list.collapsed {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    pointer-events: none;
}

/* Layer item specific active styling */
.layer-item.active .windy-label {
    background: var(--accent);
    border: 1.5px solid #ffffff;
    color: #ffffff;
    font-weight: 700;
    box-shadow: none;
}

.layer-item.active .windy-icon-circle {
    background: var(--accent);
    border: 1.5px solid #ffffff;
    color: #ffffff;
    box-shadow: none;
    transform: scale(1.05);
}

/* Responsive scroll behavior for mobile viewports */
@media (max-height: 680px) {
    .windy-layers-list {
        max-height: 400px;
        overflow-y: auto;
        padding-left: 4px;
    }
}


.windy-map-overlay {
    position: absolute;
    inset: 0;
    z-index: 95;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.windy-map-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.windy-iframe-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden; /* Hide the clipped 40px red offline banner */
}

#windy-radar-iframe {
    position: absolute;
    left: 0;
    top: -40px;
    width: calc(100% + 100px);
    height: calc(100% + 40px);
    border: none;
}

.windy-overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 101;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease;
}

.windy-overlay-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* === Map Controls Panel (Right Side) === */
.map-controls-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 102; /* Higher than map overlay (95) and close button (101) */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.map-control-btn:hover {
    transform: scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
    background: rgba(30, 41, 59, 0.95);
}

.map-control-btn:active {
    transform: scale(0.95);
}

/* Zoom Control Group */
.map-control-group {
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.map-control-group .map-control-btn {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    height: 38px;
    width: 40px;
}

.map-control-group .map-control-btn:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.map-control-group .map-control-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    transform: none;
    box-shadow: none;
}

.map-control-btn:disabled,
.map-control-group button.map-control-btn:disabled {
    color: #64748b !important;
    background: rgba(15, 23, 42, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none !important;
    transform: none !important;
    box-shadow: none !important;
}

/* === Overlays === */
#overlays {
    position: fixed;
    inset: 0;
    pointer-events: none;
    /* Modal menus must be above the fixed bottom search bar. */
    z-index: 2100;
}

#overlays>* {
    pointer-events: auto;
}

.dim-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    /* 2x darker */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    pointer-events: none;
}

.dim-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* === Search Results (Connected Panel) === */
.search-results {
    position: fixed;
    bottom: calc(84px + max(12px, env(safe-area-inset-bottom)));
    left: 16px;
    right: 16px;
    transform: none;
    width: auto;
    max-width: 600px;
    margin: 0 auto;
    /* Match search-box max-width */
    max-height: var(--search-results-max-height, min(50dvh, 560px));
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    /* The dim overlay lives in #overlays (2100); results must sit above it. */
    z-index: 2201;
}

.search-results.active {
    opacity: 1;
    visibility: visible;
}

/* Keep the typed query usable while its dimmed result panel is open. */
body.search-input-active #header {
    z-index: 2202;
}

.search-sort-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background:
        radial-gradient(circle at 16% 0%, rgba(34, 197, 94, 0.16), transparent 40%),
        rgba(15, 23, 42, 0.96);
}

.search-sort-select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 36px;
    padding: 0 38px 0 14px;
    border: 1px solid rgba(52, 211, 153, 0.18);
    background:
        rgba(30, 41, 59, 0.92)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a7f3d0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
        no-repeat right 13px center;
    background-size: 18px 18px;
}

/* "전국 주요 도시 라이브" entry — feature removed per user request.
 * Defensive `display: none !important` ensures any cached old JS that
 * still injects these buttons can't render anything visible. */
.search-compare-btn,
.compare-mode-btn {
    display: none !important;
}

.search-history-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.search-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.search-section-title {
    padding: 12px 16px 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #29374e;
}

.search-section-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

/* Search Result Item with Icon */
.search-result-item {
    display: flex;
    align-items: center;
    /* Center icon logic */
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 12px;
    /* Gap between icon and text */
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:active,
.search-result-item.keyboard-active {
    background-color: var(--bg-tertiary);
}

.search-result-item.keyboard-active {
    /* ↑/↓ 키로 이동했을 때 호버보다 한 단계 더 또렷한 강조 */
    outline: 2px solid var(--accent-color, #16a34a);
    outline-offset: -2px;
}

.search-result-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: center;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    /* Text truncation override */
}

.search-result-name {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-address {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-share-search,
.btn-bookmark,
.btn-delete {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.btn-share-search:hover,
.btn-bookmark:hover,
.btn-delete:hover {
    background: var(--bg-tertiary);
}

.btn-share-search:hover {
    color: var(--accent-primary);
}

.share-copy-toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
    z-index: 3000;
    max-width: min(92vw, 420px);
    padding: 12px 16px;
    border: 1px solid rgba(52, 211, 153, 0.42);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.96);
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 14px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.share-copy-toast.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

.share-copy-toast.is-warn {
    border-color: rgba(251, 191, 36, 0.42);
    color: #fde68a;
}

.btn-bookmark.active {
    color: #fbbf24;
    /* Yellow for bookmarked */
}

.btn-delete:hover {
    color: #ef4444;
    /* Red on hover */
}

/* === Weather Layer === */
.weather-layer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 1003;
    /* Above header and search */
}

.weather-layer.active {
    opacity: 1;
    visibility: visible;
}

body.world-tour-active {
    overflow: hidden;
}

body.world-tour-active #header,
body.world-tour-active #service-status-banner,
body.world-tour-active #pwa-install-prompt {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.weather-layer.world-tour-layer {
    align-items: stretch;
    justify-content: stretch;
    background: #07111f;
    z-index: 5000;
}

.weather-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--shadow);
}

.weather-content.world-tour-content {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    overflow: hidden;
    border-radius: 0;
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.16), transparent 36%),
        rgba(15, 23, 42, 0.98);
    border: 0;
}

.world-tour-layer .weather-header {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    z-index: 1400;
    padding: 0;
    gap: 8px;
    justify-content: flex-end;
    pointer-events: none;
}

.world-tour-layer .weather-header h2 {
    display: none;
}

.world-tour-layer .weather-header button {
    background: rgba(2, 6, 23, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #f8fafc;
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(16px);
    pointer-events: auto;
}

.world-tour-header-switch {
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.world-tour-header-switch[hidden] {
    display: none;
}

.world-tour-header-switch .world-tour-mode-switch {
    --world-tour-action-height: 38px;
    gap: 0;
    height: 38px;
    min-height: 38px;
    padding: 2px;
    border: 1px solid rgba(71, 85, 105, 0.58);
    border-radius: var(--radius-full);
    background: rgba(11, 22, 39, 0.94);
    box-shadow: none;
    backdrop-filter: none;
}

.world-tour-layer .weather-header .world-tour-header-switch .world-tour-mode-option {
    width: auto;
    min-width: 62px;
    height: 32px;
    min-height: 32px;
    padding: 0 11px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: #aab6c7;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
    backdrop-filter: none;
}

.world-tour-layer .weather-header .world-tour-header-switch .world-tour-mode-option.active {
    background: #31c690;
    color: #05261e;
    box-shadow: none;
}

.world-tour-map .leaflet-top.leaflet-right {
    top: max(58px, calc(env(safe-area-inset-top) + 56px));
    right: max(12px, env(safe-area-inset-right));
}

.world-tour-map .leaflet-control-zoom {
    border: 1px solid rgba(15, 23, 42, 0.22);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
}

.world-tour-layer .weather-list {
    height: 100%;
    padding: 0;
    overflow: hidden;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
}

.weather-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.weather-header button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
}

.weather-header button:hover {
    color: var(--accent);
}

.weather-list {
    display: flex;
    flex-direction: column;
    padding: 0 8px 12px;
    gap: 0;
}

.weather-now {
    margin: 8px 0 10px;
    padding: 16px;
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), transparent 38%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
    border: 1px solid rgba(74, 222, 128, 0.18);
}

.weather-now-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.weather-now-temp {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.weather-now-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.weather-now-label {
    font-size: 13px;
    font-weight: 600;
    color: #bbf7d0;
}

.weather-now-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.weather-pill {
    padding: 7px 10px;
    border-radius: var(--radius-full);
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-primary);
    font-size: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.weather-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.weather-item:last-child {
    border-bottom: none;
}

.weather-day {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 40px;
}

.weather-icon {
    font-size: 24px;
}

.weather-temp {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: right;
}

.weather-range {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 70px;
    text-align: right;
}

.world-tour-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 8px 14px;
}

.world-tour-map-shell,
.world-tour-video-shell {
    position: relative;
    height: 100%;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.world-tour-map-stage {
    position: absolute;
    inset: 0 0 var(--world-tour-menu-height);
    overflow: hidden;
    background: #07111f;
}

.world-tour-map-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.28), transparent 22%),
        linear-gradient(0deg, rgba(2, 6, 23, 0.72), transparent 46%);
    z-index: 1;
}

.world-tour-map-card {
    display: none;
    position: absolute;
    top: max(68px, calc(env(safe-area-inset-top) + 64px));
    left: max(16px, env(safe-area-inset-left));
    z-index: 1200;
    width: min(360px, calc(100% - 32px));
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    background: rgba(2, 6, 23, 0.76);
    color: #f8fafc;
    box-shadow: 0 22px 70px rgba(2, 6, 23, 0.34);
    backdrop-filter: blur(18px);
}

.world-tour-map-card > span {
    color: #86efac;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.world-tour-map-card > strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(20px, 2.8vw, 30px);
    line-height: 1.05;
    letter-spacing: -0.05em;
}

.world-tour-map-card > p {
    margin: 8px 0 0;
    color: #cbd5e1;
    font-size: 13px;
}

.world-tour-bottom-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1300;
    display: grid;
    grid-template-columns: minmax(240px, 0.36fr) minmax(0, 1fr);
    gap: 14px;
    height: var(--world-tour-menu-height);
    max-height: none;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(52, 211, 153, 0.14), transparent 42%),
        rgba(15, 23, 42, 0.88);
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.38);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.world-tour-selected-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(52, 211, 153, 0.18);
    border-radius: 20px;
    background: rgba(2, 6, 23, 0.34);
}

.world-tour-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.world-tour-title-row h3 {
    flex: 1 1 auto;
    overflow: hidden;
    margin: 0;
    color: #f8fafc;
    font-size: clamp(18px, 2.2vw, 26px);
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-favorite-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
}

.world-tour-favorite-btn svg {
    display: block;
    width: 17px;
    height: 17px;
}

.world-tour-favorite-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(250, 204, 21, 0.56);
    color: #fde68a;
}

.world-tour-favorite-btn.active {
    border-color: rgba(250, 204, 21, 0.64);
    background: rgba(113, 63, 18, 0.42);
    color: #facc15;
    box-shadow: 0 10px 24px rgba(250, 204, 21, 0.16);
}

.world-tour-favorite-btn.active svg {
    fill: currentColor;
}

.world-tour-favorite-btn-card {
    width: 28px;
    height: 28px;
    background: rgba(2, 6, 23, 0.34);
}

.world-tour-favorite-btn-card svg {
    width: 15px;
    height: 15px;
}

.world-tour-card-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.world-tour-share-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(2, 6, 23, 0.34);
    color: #cbd5e1;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
}

.world-tour-share-card-btn svg {
    width: 15px;
    height: 15px;
}

.world-tour-share-card-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(52, 211, 153, 0.52);
    background: rgba(20, 83, 45, 0.34);
    color: #bbf7d0;
}

.world-tour-title-nav {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
}

.world-tour-title-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.72);
    color: #d1fae5;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.world-tour-title-nav-btn svg {
    display: block;
    width: 18px;
    height: 18px;
}

.world-tour-title-nav-btn:hover {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(20, 83, 45, 0.36);
    color: #86efac;
}

.world-tour-selected-summary p {
    overflow: hidden;
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-bottom-main {
    display: flex;
    position: relative;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.world-tour-card-rail {
    display: flex;
    gap: 10px;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(52, 211, 153, 0.56) rgba(15, 23, 42, 0.78);
    cursor: grab;
    touch-action: pan-x;
    user-select: none;
}

.world-tour-region-tabs.is-dragging,
.world-tour-card-rail.is-dragging,
.world-tour-list-chip-row.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.world-tour-region-tabs.is-dragging *,
.world-tour-card-rail.is-dragging *,
.world-tour-list-chip-row.is-dragging * {
    cursor: grabbing;
    pointer-events: none;
}

.world-tour-card-rail::-webkit-scrollbar {
    height: 10px;
}

.world-tour-card-rail::-webkit-scrollbar-track {
    border-radius: var(--radius-full);
    background: rgba(2, 6, 23, 0.58);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.world-tour-card-rail::-webkit-scrollbar-thumb {
    border: 2px solid rgba(15, 23, 42, 0.9);
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.74), rgba(34, 197, 94, 0.62));
}

.world-tour-card-rail::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, rgba(45, 212, 191, 0.86), rgba(74, 222, 128, 0.76));
}

.world-tour-card-rail .world-tour-card {
    flex: 0 0 clamp(190px, 22vw, 260px);
    min-height: 92px;
}

.world-tour-video-shell .world-tour-hero {
    position: absolute;
    inset: 0 0 var(--world-tour-menu-height);
    padding: 0;
}

.world-tour-hero {
    display: block;
    padding: 8px;
}

.world-tour-video {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: #020617;
    min-height: 420px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
    --world-tour-frame-height: 0px;
    --world-tour-pan-x: 0px;
    --world-tour-object-position: 50% center;
}

.world-tour-video::before {
    content: "";
    display: block;
    padding-top: 56.25%;
}

.world-tour-video iframe {
    position: absolute;
    top: 0;
    left: 50%;
    width: max(100%, calc(var(--world-tour-frame-height) * 1.7778));
    height: 100%;
    border: 0;
    transform: translateX(calc(-50% + var(--world-tour-pan-x)));
    will-change: transform;
}

.world-tour-direct-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--world-tour-object-position);
    opacity: 0;
    transition: opacity var(--transition);
}

.world-tour-video.is-pannable {
    cursor: grab;
    touch-action: pan-y;
}

.world-tour-video.is-pannable iframe {
    pointer-events: none;
}

.world-tour-video.is-panning {
    cursor: grabbing;
}

.world-tour-video.is-panning iframe,
.world-tour-video.is-panning .world-tour-direct-video {
    pointer-events: none;
}

.world-tour-direct-video.is-ready {
    opacity: 1;
}

.world-tour-video-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
    z-index: 15;
    background: #0b0f19;
    transition: opacity 0.3s ease;
}

.world-tour-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(52, 211, 153, 0.15);
    border-top-color: #34d399;
    border-radius: 50%;
    animation: wt-spin 0.8s linear infinite;
}

.world-tour-loading-text {
    animation: wt-pulse 1.5s ease-in-out infinite;
}

@keyframes wt-spin {
    to { transform: rotate(360deg); }
}

@keyframes wt-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.world-tour-video-loading.hidden {
    display: none;
}

.world-tour-video-loading.is-error {
    color: #fecaca;
    flex-direction: column;
}

.world-tour-video-loading.is-error .world-tour-spinner {
    display: none;
}

.world-tour-outage-hero {
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 10;
}

.world-tour-outage-content {
    max-width: 440px;
    animation: fadeInScale 0.35s ease-out;
}

.world-tour-outage-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fb7185, #f43f5e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.world-tour-outage-text {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 20px;
}

.world-tour-action-btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #ffffff;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.world-tour-action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.world-tour-alternative-suggestions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    width: 90%;
    max-width: 480px;
    z-index: 20;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.world-tour-suggestion-header {
    font-size: 13px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    text-align: left;
}

.world-tour-suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.world-tour-suggestion-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.world-tour-suggestion-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(52, 211, 153, 0.42);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.18);
}

.world-tour-suggestion-btn .suggestion-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 72%;
}

.world-tour-suggestion-btn .suggestion-dist {
    font-size: 11px;
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 15px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}



.world-tour-external-preview {
    display: grid;
    place-items: center;
}

.world-tour-external-preview::before {
    display: none;
}

.world-tour-external-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.62;
    filter: saturate(1.08) contrast(0.95);
}

.world-tour-external-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(15, 23, 42, 0.14), rgba(2, 6, 23, 0.78)),
        linear-gradient(135deg, rgba(20, 184, 166, 0.2), transparent 48%);
    pointer-events: none;
}

.world-tour-external-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: min(520px, 86%);
    padding: 24px;
    border: 1px solid rgba(52, 211, 153, 0.26);
    border-radius: 22px;
    background: rgba(2, 6, 23, 0.68);
    text-align: center;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

.world-tour-external-copy span {
    color: #86efac;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.world-tour-external-copy strong {
    color: var(--text-primary);
    font-size: clamp(18px, 2.4vw, 28px);
    line-height: 1.25;
}

.world-tour-external-copy a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(52, 211, 153, 0.42);
    background: rgba(52, 211, 153, 0.16);
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.world-tour-map-wrap {
    min-height: 420px;
    overflow: hidden;
    border-radius: 22px;
    background: #020617;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

.world-tour-map-stage .world-tour-map-wrap {
    position: absolute;
    inset: 0;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
}

.world-tour-map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 420px;
    background: #08111f;
}

.world-tour-map.leaflet-container {
    background: #acd8e2;
}

.world-tour-map-stage .world-tour-map {
    min-height: 0;
}

.world-tour-map-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.world-tour-map .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.76);
    color: #cbd5e1;
    border-radius: 10px 0 0 0;
}

.world-tour-map .leaflet-control-attribution a {
    color: #86efac;
}

.world-tour-leaflet-tooltip {
    padding: 6px 9px;
    border: 1px solid rgba(52, 211, 153, 0.38);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.9);
    color: #f8fafc;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    font-weight: 800;
}

.world-tour-leaflet-popup .leaflet-popup-content-wrapper {
    overflow: hidden;
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.94);
    color: #f8fafc;
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.34);
}

.world-tour-leaflet-popup .leaflet-popup-content {
    margin: 0;
    min-width: 152px;
}

.world-tour-leaflet-popup .leaflet-popup-tip {
    border: 1px solid rgba(52, 211, 153, 0.18);
    background: rgba(15, 23, 42, 0.94);
}

.world-tour-marker-popup {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 11px;
}

.world-tour-marker-popup strong {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.25;
}

.world-tour-marker-popup span {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
}

.world-tour-marker-popup-actions {
    display: flex;
    gap: 7px;
}

.world-tour-marker-video-btn,
.world-tour-marker-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 30px;
    padding: 0 16px;
    border: 1px solid rgba(52, 211, 153, 0.38);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.96), rgba(20, 184, 166, 0.92));
    color: #022c22;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(16, 185, 129, 0.24);
}

.world-tour-marker-share-btn {
    border-color: rgba(148, 163, 184, 0.26);
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    box-shadow: none;
}

.world-tour-marker-video-btn-source-only {
    border-color: rgba(248, 113, 113, 0.48);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.96), rgba(244, 63, 94, 0.92));
    color: #fff7ed;
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.24);
}

.world-tour-marker-video-btn:hover,
.world-tour-marker-share-btn:hover {
    filter: brightness(1.06);
}

.world-tour-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 22px;
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.world-tour-kicker {
    color: #86efac;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.world-tour-meta h3 {
    font-size: clamp(24px, 4vw, 42px);
    line-height: 1.02;
    letter-spacing: -0.06em;
}

.world-tour-meta p {
    color: var(--text-secondary);
    line-height: 1.55;
}

.world-tour-tags,
.world-tour-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.world-tour-tags span {
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.world-tour-map-btn,
.world-tour-video-btn,
.world-tour-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--world-tour-action-height);
    min-height: var(--world-tour-action-height);
    padding: 0 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(52, 211, 153, 0.32);
    background: rgba(52, 211, 153, 0.12);
    color: #bbf7d0;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.world-tour-open-btn {
    width: var(--world-tour-action-height);
    min-width: var(--world-tour-action-height);
    height: var(--world-tour-action-height);
    min-height: var(--world-tour-action-height);
    padding: 0;
    border-radius: 50%;
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-primary);
}

.world-tour-open-btn svg {
    width: 19px;
    height: 19px;
}

.world-tour-share-btn svg {
    width: 16px;
    height: 16px;
}

.world-tour-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: var(--world-tour-action-height);
    min-height: var(--world-tour-action-height);
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(2, 6, 23, 0.38);
}

.world-tour-mode-option {
    min-width: 52px;
    height: var(--world-tour-action-height);
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.world-tour-mode-option.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.96), rgba(20, 184, 166, 0.9));
    color: #022c22;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.28);
}

.world-tour-region-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    position: relative;
    padding-right: 50px;
}

.world-tour-region-tabs {
    display: flex;
    gap: 8px;
    padding: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    touch-action: pan-x;
    user-select: none;
    scrollbar-width: none;
    /* WebKit thin scrollbar so the drag affordance is visible on hover. */
    scroll-behavior: smooth;
}

/* When inside the persistent bottom bar, the chip rail must actually shrink
 * to its parent so overflow scroll triggers and the list toggle stays put. */
.world-tour-bottom-menu .world-tour-region-tabs {
    flex: 1 1 0;
    min-width: 0;
    padding: 0;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
}

.world-tour-region-tabs::-webkit-scrollbar {
    display: none;
    height: 0;
}

.world-tour-country-select {
    flex: 0 0 clamp(128px, 12vw, 172px);
    width: clamp(128px, 12vw, 172px);
    height: 36px;
    min-height: 36px;
    padding: 0 30px 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.7)),
        rgba(15, 23, 42, 0.82);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: -0.02em;
    outline: none;
    cursor: pointer;
}

.world-tour-country-select:focus {
    border-color: rgba(52, 211, 153, 0.58);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.world-tour-region-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.64);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.world-tour-region-tab-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.world-tour-favorite-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    color: #facc15;
}

.world-tour-favorite-tab-icon svg {
    display: block;
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.world-tour-region-tab b {
    color: #86efac;
    font-size: 12px;
}

.world-tour-region-tab.active {
    border-color: rgba(52, 211, 153, 0.56);
    background: rgba(20, 83, 45, 0.36);
    color: var(--text-primary);
}

.world-tour-list-toggle {
    display: inline-flex;
    position: absolute;
    top: 0;
    right: 0;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.82);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.34);
}

.world-tour-list-toggle svg {
    width: 18px;
    height: 18px;
}

.world-tour-list-toggle.active,
.world-tour-list-toggle:hover {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(20, 83, 45, 0.36);
}

.world-tour-list-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(10px);
    transition: background var(--transition), backdrop-filter var(--transition);
}

/* While the user is actively searching, clear the dim+blur on the left
 * side so they can still see the map / video underneath. Paired with
 * `.world-tour-shell.is-searching .world-tour-bottom-menu { display:none }`
 * below — together they give the panel a focused, side-by-side feel. */
.world-tour-list-overlay.is-searching {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Let clicks / drags pass through to the underlying map and bottom
     * menu so the left side stays fully interactive. The panel inside
     * reclaims pointer events below. */
    pointer-events: none;
}

.world-tour-list-overlay.is-searching .world-tour-list-panel {
    pointer-events: auto;
}

.world-tour-shell.is-searching .world-tour-bottom-menu {
    display: none;
}

.world-tour-shell.is-searching .world-tour-hero,
.world-tour-shell.is-searching .world-tour-map-stage {
    /* The hero is normally constrained to the area above the bottom
     * menu. Once the menu is hidden, let it stretch to fill the screen
     * so the map/video reads as the background of the search session. */
    inset: 0;
    bottom: 0;
}

.world-tour-list-panel {
    display: flex;
    flex-direction: column;
    width: min(430px, 100%);
    height: 100dvh;
    max-height: 100dvh;
    border-left: 1px solid rgba(52, 211, 153, 0.18);
    background: rgba(7, 12, 24, 0.98);
    color: var(--text-primary);
    box-shadow: -24px 0 80px rgba(0, 0, 0, 0.42);
}

.world-tour-list-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.world-tour-list-head span {
    display: block;
    margin-bottom: 6px;
    color: #86efac;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
}

.world-tour-list-head strong {
    display: block;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.2;
}

.world-tour-list-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

.world-tour-list-search {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    margin: 14px 20px 10px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-secondary);
}

.world-tour-list-search svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

.world-tour-list-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
}

.world-tour-list-filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px 12px;
}

.world-tour-list-chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    overscroll-behavior-x: contain;
    cursor: grab;
    touch-action: pan-x;
    user-select: none;
    scrollbar-width: none;
}

.world-tour-list-chip-row::-webkit-scrollbar {
    display: none;
}

.world-tour-list-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.62);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.world-tour-list-chip b {
    color: #86efac;
}

.world-tour-list-chip.active {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(20, 83, 45, 0.36);
    color: var(--text-primary);
}

.world-tour-list-select-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.world-tour-list-select-row select {
    min-width: 0;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
}

.world-tour-list-count {
    padding: 0 20px 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
}

.world-tour-list-results {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    /* Just enough room for the iOS home indicator / safe area below the
     * last list item — overly large insets created an empty band. */
    padding: 0 20px max(24px, env(safe-area-inset-bottom));
    scrollbar-width: thin;
    scrollbar-color: rgba(52, 211, 153, 0.45) rgba(15, 23, 42, 0.72);
}

.world-tour-list-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.62);
    cursor: pointer;
}

.world-tour-list-item.active,
.world-tour-list-item:hover {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(20, 83, 45, 0.3);
}

.world-tour-list-item-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.world-tour-list-item-main span,
.world-tour-list-item-main em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-list-item-main strong {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 900;
}

.world-tour-list-item-main strong .world-tour-list-item-title-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-external-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
    cursor: help;
}

.world-tour-external-badge svg {
    width: 14px;
    height: 14px;
}

.world-tour-card-title .world-tour-external-badge {
    width: 18px;
    height: 18px;
    margin-left: 6px;
    vertical-align: -3px;
}

.world-tour-card-title .world-tour-external-badge svg {
    width: 12px;
    height: 12px;
}

.world-tour-list-external-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.world-tour-list-external-toggle svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.world-tour-list-external-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-list-external-toggle:hover {
    border-color: rgba(248, 113, 113, 0.48);
    color: #fecaca;
}

.world-tour-list-external-toggle.active {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
}

.world-tour-list-item-main span {
    color: var(--text-secondary);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.world-tour-list-item-main em {
    color: #86efac;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

/* Subtitle (description) row appears only when search hits the subtitle —
 * makes it clear WHY a row like "나이아가라 폭포" matched a query like "경"
 * (because the subtitle reads "...실시간 풍경"). */
.world-tour-list-item-main .world-tour-list-item-subtitle {
    overflow: hidden;
    color: #cbd5e1;
    font-size: 11.5px;
    font-style: italic;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Yellow-highlighter look on every part of a row that matched the search.
 * Saturated amber background + bold white text. We use amber rather than
 * pale yellow because white text needs a dark-enough background to stay
 * legible. */
.world-tour-search-highlight {
    padding: 0 3px;
    border-radius: 3px;
    background: rgba(202, 138, 4, 0.85);
    color: #ffffff;
    font-weight: 900;
    -webkit-text-fill-color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.world-tour-list-item-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    padding-left: 38px;
}

.world-tour-list-item-actions button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(52, 211, 153, 0.22);
    border-radius: var(--radius-full);
    background: rgba(52, 211, 153, 0.1);
    color: #bbf7d0;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.world-tour-list-item-actions button svg {
    width: 15px;
    height: 15px;
}

.world-tour-list-empty {
    display: grid;
    place-items: center;
    min-height: 160px;
    padding: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.world-tour-region-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.world-tour-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 0 10px;
}

.world-tour-section-title h4 {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.world-tour-section-title span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.world-tour-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 8px 4px;
}

.world-tour-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-height: 92px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.62);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.world-tour-card:hover,
.world-tour-card.active {
    transform: translateY(-2px);
    border-color: rgba(52, 211, 153, 0.52);
    background: rgba(20, 83, 45, 0.28);
}

.world-tour-card-title {
    font-size: 14px;
    font-weight: 800;
}

.world-tour-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.world-tour-card-title-row .world-tour-card-title {
    overflow: hidden;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-tour-card-sub {
    color: var(--text-secondary);
    font-size: 12px;
}

.world-tour-card-tag {
    color: var(--region-color, #86efac);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.world-tour-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin-top: auto;
}

.world-tour-source-tag {
    padding: 3px 7px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.world-tour-source-tag.playable {
    border-color: rgba(52, 211, 153, 0.24);
    background: rgba(52, 211, 153, 0.1);
    color: #bbf7d0;
}

.world-tour-empty-favorites {
    display: flex;
    flex: 1 0 240px;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    padding: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.42);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
}

.world-tour-nearby {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.world-tour-nearby strong {
    color: #bbf7d0;
    font-size: 13px;
}

.world-tour-nearby p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.world-tour-nearby-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.world-tour-nearby-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.28);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.world-tour-nearby-item:hover {
    border-color: rgba(52, 211, 153, 0.42);
    background: rgba(20, 83, 45, 0.24);
}

.world-tour-nearby-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
}

.world-tour-nearby-item em {
    flex-shrink: 0;
    color: #86efac;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

/* === Video Layer === */
.video-layer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 2000;
}

.video-layer.active {
    opacity: 1;
    visibility: visible;
}

.video-layer-content {
    width: 95%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
}

.video-layer-content.maximized {
    width: 100vw;
    max-width: none;
    height: 100vh;
    border-radius: 0;
}

.video-layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.video-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-layer-content.maximized .video-layer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    z-index: 10;
    margin-bottom: 0;
}

.video-layer-header h2 {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.video-layer-content.maximized .video-layer-header h2 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.video-layer-header button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.video-layer-header button:hover {
    color: var(--accent);
    border-color: rgba(34, 197, 94, 0.3);
}

.video-layer-content.maximized .video-layer-header button {
    background: rgba(30, 41, 59, 0.6);
}

.video-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.video-title-main {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-title-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.layer-action-btn {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    flex: 1;
}

.video-layer-content.maximized .video-frame {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 0;
    z-index: 1;
    /* Ensure header buttons (z-index: 10) remain clickable */
}

.video-frame video,
.video-frame iframe {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
}

/* === Responsive === */
@media (max-width: 600px) {
    .service-status-banner {
        top: max(10px, env(safe-area-inset-top));
        width: calc(100% - 20px);
        padding: 11px 12px;
    }

    .header-inner {
        gap: 8px;
        max-width: 100%;
    }

    .segment-btn svg {
        width: 18px;
        height: 18px;
    }

    .search-box {
        max-width: none;
    }

    .header-inner {
        gap: 8px;
        padding: 8px;
    }

    .video-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }

    /* Adjust controls for mobile in grid */
    .panel-controls {
        top: 6px;
        left: 6px;
        right: 6px;
    }

    /* Ensure video layer fits on mobile */
    .video-layer-content:not(.maximized) {
        width: 100%;
        border-radius: 0;
    }

    .video-layer-content:not(.maximized) .video-frame {
        border-radius: 0;
        /* Mobile Aspect Ratio Fix */
        max-height: 56.25vw;
        /* 16:9 of width */
    }

    .video-title-main {
        font-size: 15px;
    }

    .video-title-sub {
        font-size: 11px;
    }

    .weather-now-head {
        align-items: flex-start;
    }

    .weather-now-temp {
        font-size: 32px;
    }

    .weather-content.world-tour-content {
        --world-tour-menu-height: min(54dvh, 380px);
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .world-tour-layer .weather-header {
        top: max(10px, env(safe-area-inset-top));
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
    }

    .world-tour-layer .weather-header h2 {
        min-height: 34px;
        max-width: calc(100vw - 72px);
        padding: 0 11px;
        font-size: 13px;
    }

    .world-tour-layer .weather-header button {
        width: 34px;
        height: 34px;
    }

    .world-tour-map .leaflet-control-zoom {
        display: none;
    }

    .world-tour-map-card {
        display: none;
    }

    .world-tour-bottom-menu {
        grid-template-columns: 1fr;
        gap: 10px;
        height: var(--world-tour-menu-height);
        max-height: none;
        /* Just enough bottom inset for the iOS home indicator / browser
         * safe area — too much was clipping the card-rail's bottom row
         * and leaving a big empty band under the cards. */
        padding: 10px 10px max(20px, env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 0;
    }

    /* On narrow screens the "Favorite" word eats space — keep only star + count. */
    .world-tour-region-tab[data-world-region="Favorite"] .world-tour-region-tab-label > span:not(.world-tour-favorite-tab-icon) {
        display: none;
    }
    .world-tour-region-tab[data-world-region="Favorite"] {
        padding: 0 10px;
    }

    /* Pin the list toggle to the right edge of the chip row so it is
     * always reachable, even when many region chips are scrolled. The chip
     * rail uses flex:1 1 0 so the toggle naturally anchors to the right. */
    .world-tour-region-bar .world-tour-list-toggle {
        margin-left: 6px;
        box-shadow: -12px 0 18px -8px rgba(2, 6, 23, 0.85);
        z-index: 2;
        flex: 0 0 36px;
    }

    .world-tour-selected-summary {
        gap: 8px;
        padding: 14px;
        border-radius: 18px;
    }

    .world-tour-title-row h3 {
        display: -webkit-box;
        font-size: 20px;
        line-height: 1.08;
        text-overflow: unset;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .world-tour-selected-summary p {
        display: -webkit-box;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .world-tour-selected-summary .world-tour-tags {
        gap: 7px;
    }

    .world-tour-selected-summary .world-tour-tags span {
        font-size: 11px;
    }

    .world-tour-selected-summary .world-tour-actions {
        gap: 7px;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
    }

    .world-tour-video-shell .world-tour-hero {
        display: block;
        inset: 0 0 var(--world-tour-menu-height);
        padding: 0;
    }

    .world-tour-mode-switch {
        display: inline-flex;
        flex: 0 1 auto;
        min-width: 0;
    }

    .world-tour-mode-option {
        min-width: 58px;
        padding: 0 9px;
        font-size: 11px;
    }

    .world-tour-open-btn {
        flex: 0 0 auto;
        padding: 0;
    }

    .world-tour-open-btn svg {
        width: 19px;
        height: 19px;
    }

    .world-tour-card-rail .world-tour-card {
        flex-basis: min(76vw, 260px);
        min-height: 82px;
    }

    .world-tour-video-shell .world-tour-video {
        width: 100%;
        height: 100%;
        min-height: 0;
        border-radius: 0;
    }

    .world-tour-video-shell .world-tour-video::before,
    .world-tour-video-shell .world-tour-meta {
        display: none;
    }

    .world-tour-hero {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 6px;
    }

    .world-tour-video {
        min-height: 220px;
        border-radius: 0;
    }

    .world-tour-map-wrap,
    .world-tour-map {
        min-height: 320px;
        border-radius: 16px;
    }

    .world-tour-map-stage .world-tour-map-wrap,
    .world-tour-map-stage .world-tour-map {
        border-radius: 0;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .world-tour-meta {
        padding: 16px;
        border-radius: 16px;
    }

    .world-tour-region-tabs {
        padding: 0 6px;
    }

    .world-tour-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-height: 34vh;
        overflow: auto;
    }

    .world-tour-card {
        min-height: 86px;
        padding: 12px;
    }
}

@media (min-width: 400px) and (max-width: 600px) {
    .quality-controls {
        padding: 4px;
    }

    .quality-sort-select {
        max-width: 86px;
        height: 32px;
        padding: 0 9px;
        font-size: 11px;
    }

    .search-box input {
        padding-left: 12px;
        font-size: 14px;
    }
}

@media (max-width: 399px) {
    .search-results {
        left: 8px;
        right: 8px;
        bottom: calc(78px + max(12px, env(safe-area-inset-bottom)));
        max-height: var(--search-results-max-height, calc(100dvh - 112px));
        overflow: hidden;
        border-radius: 18px;
    }

    .search-history-scroll {
        max-height: min(254px, calc(100dvh - 186px));
    }

    .search-section-title {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 10px 12px 7px;
    }

    .search-result-item {
        min-height: 56px;
        padding: 10px 12px;
        gap: 10px;
    }

    .search-section-empty {
        padding: 12px;
    }
}

@media (max-width: 430px) {
    .world-tour-selected-summary {
        padding: 12px;
    }

    .world-tour-title-row {
        align-items: flex-start;
        gap: 8px;
    }

    .world-tour-title-row h3 {
        font-size: 18px;
    }

    .world-tour-title-nav-btn {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .world-tour-selected-summary .world-tour-tags {
        gap: 5px 7px;
    }

    .world-tour-selected-summary .world-tour-tags span {
        font-size: 10.5px;
    }

    .world-tour-selected-summary p {
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .weather-content.world-tour-content {
        --world-tour-mobile-list-height: min(46dvh, 380px);
        --world-tour-menu-height: min(54dvh, 380px);
    }

    .world-tour-list-overlay,
    .world-tour-list-overlay.is-searching {
        top: calc(100dvh - var(--world-tour-mobile-list-height));
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 2100;
        display: block;
        height: var(--world-tour-mobile-list-height);
        background: linear-gradient(180deg, rgba(2, 6, 23, 0.18), rgba(2, 6, 23, 0.9));
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        pointer-events: none;
    }

    .world-tour-list-panel {
        display: grid;
        grid-template-columns: minmax(104px, 0.82fr) minmax(0, 1.35fr);
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 8px;
        width: 100%;
        height: 100%;
        max-height: none;
        padding: 12px 12px max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid rgba(52, 211, 153, 0.2);
        border-left: 0;
        border-radius: 20px 20px 0 0;
        background:
            radial-gradient(circle at top left, rgba(20, 184, 166, 0.16), transparent 36%),
            rgba(7, 12, 24, 0.98);
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.42);
        pointer-events: auto;
    }

    .world-tour-list-head {
        grid-column: 1 / -1;
        grid-row: 1;
        min-height: 32px;
        padding: 0;
        border-bottom: 0;
        justify-content: flex-end;
    }

    .world-tour-list-head > div {
        display: none;
    }

    .world-tour-list-close {
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    .world-tour-list-search {
        grid-column: 2;
        grid-row: 2;
        min-height: 42px;
        margin: 0;
        padding: 0 10px;
        border-radius: 12px;
    }

    .world-tour-list-search input {
        font-size: 12px;
    }

    .world-tour-list-filter-group {
        display: contents;
        padding: 0;
    }

    .world-tour-list-chip-row,
    .world-tour-list-external-toggle,
    .world-tour-list-count {
        display: none;
    }

    .world-tour-list-select-row {
        display: contents;
    }

    .world-tour-list-select-row select {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        height: 42px;
        padding: 0 9px;
        border-radius: 12px;
        font-size: 12px;
    }

    .world-tour-list-results {
        grid-column: 1 / -1;
        grid-row: 3;
        gap: 10px;
        padding: 2px 0 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .world-tour-list-item {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 8px 10px;
        padding: 12px;
        border-radius: 10px;
    }

    .world-tour-list-item-main strong {
        font-size: 13px;
    }

    .world-tour-list-item-main span,
    .world-tour-list-item-main em {
        font-size: 11px;
    }

    .world-tour-list-item-actions {
        grid-column: 2;
        gap: 7px;
        padding-left: 0;
    }

    .world-tour-list-item-actions button {
        min-height: 32px;
        padding: 0 13px;
        font-size: 12px;
    }

    .world-tour-list-item-actions button[data-world-tour-list-share] {
        width: 34px;
        padding: 0;
    }

    .world-tour-shell.is-searching .world-tour-bottom-menu {
        display: none;
    }

    .world-tour-shell.is-searching .world-tour-hero,
    .world-tour-shell.is-searching .world-tour-map-stage {
        inset: 0 0 var(--world-tour-mobile-list-height) 0;
        bottom: var(--world-tour-mobile-list-height);
    }

    .world-tour-shell.is-searching .world-tour-video {
        width: 100%;
        height: 100%;
        min-height: 0;
        border-radius: 0;
    }

    .world-tour-shell.is-searching .world-tour-map-wrap,
    .world-tour-shell.is-searching .world-tour-map {
        min-height: 0;
        border-radius: 0;
    }
}

@media (max-width: 360px) {
    .weather-content.world-tour-content {
        --world-tour-menu-height: min(56dvh, 360px);
    }

    .world-tour-layer .weather-header {
        top: max(8px, env(safe-area-inset-top));
        left: 8px;
        right: 8px;
    }

    .world-tour-layer .weather-header h2 {
        min-height: 32px;
        max-width: calc(100vw - 56px);
        padding: 0 10px;
        font-size: 12px;
    }

    .world-tour-layer .weather-header button {
        width: 32px;
        height: 32px;
    }

    .world-tour-bottom-menu {
        gap: 8px;
        padding: 8px 8px max(16px, env(safe-area-inset-bottom));
    }

    .world-tour-selected-summary {
        padding: 10px;
        gap: 6px;
    }

    .world-tour-title-row h3 {
        font-size: 16px;
    }

    .world-tour-title-nav {
        gap: 3px;
    }

    .world-tour-title-nav-btn {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .world-tour-selected-summary p {
        font-size: 11px;
        line-height: 1.35;
        -webkit-line-clamp: 2;
    }

    .world-tour-selected-summary .world-tour-kicker {
        font-size: 10px;
    }

    .world-tour-selected-summary .world-tour-actions {
        gap: 6px;
    }

    .world-tour-mode-option {
        min-width: 50px;
        padding: 0 8px;
        font-size: 10.5px;
    }

    .world-tour-open-btn {
        padding: 0;
    }

    .world-tour-open-btn svg {
        width: 18px;
        height: 18px;
    }

    .world-tour-region-tab {
        min-height: 36px;
        padding: 0 10px;
        font-size: 12px;
    }

    .world-tour-region-tab b {
        font-size: 11px;
    }

    .world-tour-card-rail .world-tour-card {
        flex-basis: 218px;
        min-height: 68px;
        padding: 9px 10px;
    }

    .world-tour-card-title {
        font-size: 13px;
    }

    .world-tour-card-sub {
        font-size: 11px;
    }

    .world-tour-source-tag {
        display: none;
    }
}

@media (max-height: 520px) {
    .weather-content.world-tour-content {
        --world-tour-menu-height: 46dvh;
    }

    .world-tour-map-card {
        display: none;
    }

    .world-tour-bottom-menu {
        grid-template-columns: minmax(0, 1fr);
        padding: 9px;
    }

    .world-tour-selected-summary {
        display: flex;
        padding: 8px;
        gap: 5px;
    }

    .world-tour-card-rail .world-tour-card {
        flex-basis: min(220px, 48vw);
        min-height: 76px;
        padding: 10px;
    }

    .world-tour-layer .weather-header h2 {
        min-height: 32px;
        font-size: 12px;
    }

    .world-tour-layer .weather-header button {
        width: 32px;
        height: 32px;
    }
}

/* Weather date styling */
.weather-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.error-message-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 320px;
}

.error-message-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #bbf7d0;
}

.error-message-body {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

.error-message-meta {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.error-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.retry-btn,
.report-btn {
    border: none;
    padding: 11px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.retry-btn {
    background: var(--accent);
    color: var(--bg-primary);
}

.report-btn {
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-primary);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.retry-btn:hover,
.report-btn:hover {
    transform: translateY(-1px);
}

.retry-btn.pressed {
    transform: scale(0.96);
}

/* === PWA Install Prompt === */
.pwa-prompt {
    position: fixed;
    bottom: 80px;
    /* Above header/search bar */
    right: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow), 0 0 20px rgba(34, 197, 94, 0.3);
    cursor: pointer;
    z-index: 1003;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-width: 300px;
}

.pwa-prompt.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

.pwa-prompt.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pwa-prompt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.pwa-prompt-icon svg {
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

.pwa-prompt-text {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state (circular button) */
.pwa-prompt.collapsed {
    width: 44px;
    height: 44px;
    padding: 0;
    gap: 0;
    border-radius: 50%;
    justify-content: center;
}

.pwa-prompt.collapsed .pwa-prompt-text {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.pwa-prompt.collapsed .pwa-prompt-icon svg {
    animation: none;
}

.pwa-prompt:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow), 0 0 30px rgba(34, 197, 94, 0.5);
}

.pwa-prompt.collapsed:hover {
    transform: scale(1.1);
}

/* === Draggable Video Pan === */
.video-panel video,
.video-panel iframe {
    cursor: grab;
    object-position: center center;
    transition: object-position 0.1s ease-out;
}

.video-panel video:active,
.video-panel iframe:active {
    cursor: grabbing;
}

.video-panel.expanded.dragging video,
.video-panel.expanded.dragging iframe {
    transition: none;
}

/* === Floating Close Button for Expanded Panel === */
.panel-floating-close {
    display: none;
    position: fixed;
    /* Fixed to viewport, not panel */
    bottom: 72px;
    /* Above header (header-inner padding + content ~60px + gap) */
    right: 16px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 15;
    transition: all var(--transition);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.video-panel.expanded .panel-floating-close {
    display: flex;
}

.panel-floating-close:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}

.panel-floating-close:active {
    transform: scale(0.95);
}

/* === Draggable Video Pan for Video Layer (Map Popup) === */
.video-layer-content.maximized .video-frame video,
.video-layer-content.maximized .video-frame iframe {
    cursor: grab;
    object-position: center center;
    transition: object-position 0.1s ease-out;
}

.video-layer-content.maximized .video-frame video:active,
.video-layer-content.maximized .video-frame iframe:active {
    cursor: grabbing;
}

.video-layer-content.maximized.dragging .video-frame video,
.video-layer-content.maximized.dragging .video-frame iframe {
    transition: none;
}

/* === UTIC Iframe Scaling & Drag === */
.utic-iframe {
    --scale: 1.0;
    --translate-x: 0px;
    --translate-y: 0px;
    --default-y: 0px;
    /* Vertical centering adjustment */

    /* Combine scale, drag translation, and default vertical offset */
    transform: scale(var(--scale)) translate(var(--translate-x), calc(var(--translate-y) + var(--default-y)));
    transform-origin: center var(--origin-y, 50%);
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* Expanded/Maximized State: Device-Specific Tuning managed by JS updateUticLayout() */
.video-panel.expanded .utic-iframe,
.video-layer-content.maximized .utic-iframe {
    object-fit: fill !important;
    /* Transformation handled by JS dynamically */
}

/* Ensure container centers the iframe for consistent scaling origin behavior */
.video-frame {
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Desktop: Shift UTIC iframe down to reveal top part */
@media (min-width: 1025px) {

    .video-panel.expanded .utic-iframe,
    .video-layer-content.maximized .utic-iframe {
        --default-y: 10%;
    }
}

/* === Navigation Buttons === */
.nav-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: transparent;
}

/* === Source dot (SPATIC/UTIC/NTIC color-coded source pip) === */
.source-dot,
.cctv-source-dot {
    display: inline-block;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.4);
    vertical-align: middle;
}

.cctv-source-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    margin-right: 2px;
}

.video-title-source {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cctv-select-direction,
.video-title-direction {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.92em;
}

.cctv-select-main {
    font-weight: 600;
}

/* === Friendly error placeholder additions === */
.error-message-block {
    align-items: center;
    text-align: center;
}

.error-message-icon {
    font-size: 26px;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.try-another-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    padding: 11px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.try-another-btn .try-another-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.try-another-btn:hover {
    transform: translateY(-1px);
    background: rgba(34, 197, 94, 0.28);
}

.try-another-btn.pressed {
    transform: scale(0.96);
}

/* === Favorite (CCTV) toggle button in video layer header === */
.layer-action-btn.favorite-toggle {
    color: var(--text-secondary);
}

.layer-action-btn.favorite-toggle.active {
    color: #facc15;
}

.layer-action-btn.favorite-toggle:hover {
    color: #fde68a;
}

/* === Favorite CCTV entry inside the search history dropdown === */
.cctv-favorite-item .search-result-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.cctv-favorite-item .cctv-favorite-direction {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.92em;
}

.cctv-favorite-item .search-result-address {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* === World Tour snapshot hero (HK/USGS/Panomax/Roundshot direct JPG) === */
.world-tour-snapshot-hero {
    position: relative;
    overflow: hidden;
    background: #000;
}

/*
 * .world-tour-video 컨테이너는 ::before { padding-top: 56.25% } 로 16:9
 * 비율을 강제한다. 이 위에 이미지가 같이 배치되면 ::before 영역만큼
 * 화면 밖으로 밀려 검정 배경만 보이게 된다. iframe / direct-video 와
 * 동일하게 absolute + inset:0 으로 컨테이너를 정확히 채우게 한다.
 */
.world-tour-snapshot-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #000;
}

.world-tour-snapshot-overlay {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1.2;
    pointer-events: none;
}

.world-tour-snapshot-badge {
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #bbf7d0;
}

.world-tour-snapshot-meta {
    font-size: 10px;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .world-tour-snapshot-overlay {
        left: 8px;
        bottom: 8px;
        padding: 6px 10px;
        border-radius: 14px;
        font-size: 10px;
    }
}

/* === KMA precipitation overlay (Kakao map) === */
.kma-precip-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.84);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.kma-precip-toggle:hover {
    border-color: rgba(96, 165, 250, 0.6);
}

.kma-precip-toggle.active {
    border-color: rgba(59, 130, 246, 0.65);
    background: rgba(30, 58, 138, 0.55);
    color: #bfdbfe;
}

.kma-precip-toggle-label {
    letter-spacing: 0.03em;
}

.kma-precip-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.78);
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    transform: translate(-50%, 0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.kma-precip-label .kma-precip-city {
    margin-left: 4px;
    padding-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 10px;
}

.kma-precip-empty-hint {
    position: absolute;
    top: 56px;
    right: 12px;
    padding: 6px 10px;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 11px;
    z-index: 9;
    pointer-events: none;
}

@media (max-width: 600px) {
    .kma-precip-toggle {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
        font-size: 11px;
    }
    .kma-precip-toggle-label { display: none; }
    .kma-precip-label { font-size: 10px; padding: 3px 6px; }
}

/* === Multi-CCTV compare mode — feature removed.
 * Styles archived below for historical reference; defensive hide above
 * via .compare-mode-btn { display: none !important } takes precedence. */
._archived-compare-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
._archived-compare-mode-btn:hover {
    background: rgba(20, 83, 45, 0.42);
    color: #bbf7d0;
}

/* On narrow screens the compare button moves into the search panel
 * (next to the sort selector), so hide the header copy. */
@media (max-width: 600px) {
    .compare-mode-btn {
        display: none;
    }
}

.compare-layer {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(2, 6, 23, 0.96);
    display: none;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}
.compare-layer.active {
    display: flex;
}

.compare-layer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.compare-layer-header h2 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}
.compare-layer-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.compare-layer-close {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 38px;
}

.compare-grid {
    flex: 1 1 auto;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
}

.compare-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #000;
    aspect-ratio: 16 / 10;
    min-height: 180px;
}

.compare-tile-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(to bottom, rgba(2, 6, 23, 0.78), transparent);
    pointer-events: none;
    z-index: 2;
}
.compare-tile-city {
    font-weight: 800;
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.compare-tile-meta {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compare-tile-expand {
    pointer-events: auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.compare-tile-media {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.compare-tile-media video,
.compare-tile-media iframe,
.compare-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
    background: #000;
}

.compare-empty {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .compare-grid {
        grid-template-columns: 1fr;
        padding: 6px;
        gap: 6px;
    }
    .compare-tile {
        min-height: 220px;
    }
    .compare-layer-header h2 { font-size: 15px; }
    .compare-layer-header p { font-size: 11px; }
}

/* PR4 unified favorites — count badge + world-cam variant */
.search-section-count {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.cctv-favorite-item--world .source-dot {
    background: linear-gradient(135deg, #34d399, #38bdf8);
}

/* PR8 panel-aware hero gutter: while the right list panel is open the
 * world-tour shell carries .is-searching. Push the hero (map or video)
 * away from the right edge by the panel width so the visible left area
 * shows the content centered, not hidden under the 430px panel. */
@media (min-width: 720px) {
    .world-tour-shell.is-searching .world-tour-hero {
        right: min(430px, 100vw);
    }
    .world-tour-shell.is-searching .world-tour-map-stage {
        right: min(430px, 100vw);
    }
    .world-tour-shell.is-searching .world-tour-video {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }
}

/* PR10 — Korean World Tour cams surfaced in the domestic search dropdown */
.world-tour-search-result {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.10), transparent 60%);
}
.world-tour-search-result .search-result-icon {
    font-size: 18px;
}
.search-result-tag {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.22);
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ================================================================
   Performance Optimizations
   ================================================================ */

/*
 * 1. Mobile devices: disable backdrop-filter (blur) globally.
 *    blur() triggers a full off-screen composite on every frame —
 *    on mobile CPUs this causes visible stutter.
 */
body.is-mobile .service-status-banner,
body.is-mobile .search-box input,
body.is-mobile .video-panel,
body.is-mobile .windy-layers-panel,
body.is-mobile .video-layer,
body.is-mobile .search-dropdown,
body.is-mobile .bottom-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/*
 * 2. During map drag / zoom: suppress ALL transitions and GPU-heavy
 *    effects so Kakao Map tiles can render at full frame rate.
 */
body.map-moving *,
body.map-moving *::before,
body.map-moving *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: none !important;
    animation: none !important;
}

/* ================================================================
   New Features & Optimizations UI Styles
   ================================================================ */

/* 1. Live Badge */
.live-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.76);
    color: #ef4444;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    pointer-events: none;
    border: 1px solid rgba(239, 68, 68, 0.28);
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}
.live-dot {
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    animation: live-blink 1.2s infinite ease-in-out;
}
@keyframes live-blink {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* 2. Keyboard Navigation Highlight */
.search-result-item.keyboard-active {
    background: rgba(255, 255, 255, 0.08) !important;
    border-left: 3px solid #3b82f6 !important;
}

/* 3. Precipitation Restore Banner */
.precip-restore-banner {
    position: fixed;
    /* The header bar sits at the bottom; keep its buttons clickable. */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(59, 130, 246, 0.36);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 999px;
    z-index: 2000;
    color: #f8fafc;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
/* left:50% halves the shrink-to-fit width; size to content instead. */
.precip-restore-banner {
    width: max-content;
    max-width: calc(100vw - 24px);
}
.precip-restore-banner .precip-restore-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
.precip-restore-banner.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.precip-restore-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 11px;
    transition: background 0.2s;
}
.precip-restore-btn:hover {
    background: #2563eb;
}

/* 4. Map CCTV Custom Inline Preview Card */
.map-cctv-preview-card {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
    min-width: 210px;
    max-width: 260px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f8fafc;
    font-family: inherit;
    position: relative;
}
.preview-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.preview-card-title {
    font-size: 13.5px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}
.preview-card-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-top: -4px;
}
.preview-card-close:hover {
    color: #f1f5f9;
}
.preview-card-body {
    display: flex;
    align-items: center;
    font-size: 11.5px;
    color: #94a3b8;
    margin-bottom: 10px;
    gap: 5px;
}
.preview-card-body .source-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.preview-card-actions {
    display: flex;
}
.preview-view-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 7px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}
.preview-view-btn:hover {
    background: #2563eb;
}

/* 5. Split Controls & Buttons */
.split-controls {
    display: flex;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    margin-right: 8px;
}
.split-btn {
    background: none;
    border: none;
    color: #94a3b8;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.split-btn:hover {
    color: #f1f5f9;
}
.split-btn.active {
    background: #3b82f6;
    color: white;
}

/* 6. Dynamic Grid Split styles */
#video-grid[data-split="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}
#video-grid[data-split="1"] .video-panel[data-slot="1"],
#video-grid[data-split="1"] .video-panel[data-slot="2"],
#video-grid[data-split="1"] .video-panel[data-slot="3"] {
    display: none !important;
}

#video-grid[data-split="2"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}
@media (min-width: 768px) {
    #video-grid[data-split="2"] {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
    }
}
#video-grid[data-split="2"] .video-panel[data-slot="2"],
#video-grid[data-split="2"] .video-panel[data-slot="3"] {
    display: none !important;
}

/* 7. New Buttons (Header) */
.share-grid-btn, .precip-cctv-btn {
    background: none;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    margin-right: 8px;
}
.share-grid-btn:hover, .precip-cctv-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}
.precip-cctv-btn.has-rain {
    color: #3b82f6;
    animation: rain-pulse 2s infinite ease-in-out;
}
@keyframes rain-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* 8. Highway traffic (한국도로공사 실시간 소통) */
.highway-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.highway-traffic-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: var(--text-primary);
}
.highway-traffic-badge.tone-free { color: #86efac; border-color: rgba(34, 197, 94, 0.36); }
.highway-traffic-badge.tone-slow { color: #fde68a; border-color: rgba(251, 191, 36, 0.42); }
.highway-traffic-badge.tone-jam { color: #fca5a5; border-color: rgba(239, 68, 68, 0.48); }
.highway-traffic-badge.is-stale { opacity: 0.75; }

.panel-traffic-badge {
    position: absolute;
    /* Under the CCTV selector, above the loading card (z 12); the selector
       dropdown (panel-controls, z 20) still covers it when open. */
    left: 8px;
    top: 46px;
    max-width: calc(100% - 16px);
    z-index: 19;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.video-layer-traffic-badge {
    align-self: flex-start;
}

.highway-content {
    max-width: 440px;
}

.highway-panel-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px 14px;
}

.highway-traffic-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.highway-route-list {
    display: flex;
    flex-direction: column;
}

.highway-route-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: left;
    font: inherit;
}
.highway-route-item:last-child { border-bottom: none; }

.highway-route-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.highway-route-name {
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.highway-route-count {
    display: inline-flex;
    min-width: 24px;
    height: 22px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.highway-route-view {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(110, 231, 183, 0.46);
    border-radius: var(--radius-full);
    background: transparent;
    color: #86efac;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.highway-route-view:hover,
.highway-route-view:focus-visible {
    border-color: var(--accent);
    background: rgba(34, 197, 94, 0.14);
    outline: none;
}

.highway-grade-pill {
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
}
.highway-grade-pill.tone-free { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.highway-grade-pill.tone-slow { background: rgba(251, 191, 36, 0.16); color: #fde68a; }
.highway-grade-pill.tone-jam { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.highway-route-empty {
    padding: 16px 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* === Auth Lock Screen & Password Management === */
#auth-lock-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#auth-lock-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 26px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    animation: authPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authPopIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-icon-badge {
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.28);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input-wrapper {
    position: relative;
    width: 100%;
}

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    text-align: center;
    letter-spacing: 2px;
}

.auth-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.auth-input.error-shake {
    animation: authShake 0.4s ease-in-out;
    border-color: #ef4444;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.auth-msg {
    font-size: 12px;
    min-height: 18px;
    line-height: 1.4;
    transition: opacity 0.2s;
}

.auth-msg.error {
    color: #f87171;
}

.auth-msg.success {
    color: #4ade80;
}

.auth-submit-btn {
    width: 100%;
    height: 46px;
    background: var(--accent);
    color: #041d0f;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 4px;
}

.auth-submit-btn:hover {
    background: var(--accent-dark);
}

.auth-submit-btn:active {
    transform: scale(0.98);
}

/* Password Change Modal Layer */
.pwd-change-layer {
    position: fixed;
    inset: 0;
    z-index: 10005;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.pwd-change-layer.active {
    opacity: 1;
    visibility: visible;
}

.pwd-change-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 26px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: authPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwd-change-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.pwd-change-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwd-change-header h2 svg {
    color: var(--accent);
}

.pwd-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.pwd-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.pwd-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    text-align: left;
}

.pwd-field-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.pwd-field-group .auth-input {
    text-align: left;
    letter-spacing: normal;
}

.pwd-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.auth-lock-now-btn {
    flex: 1;
    height: 46px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-lock-now-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(51, 65, 85, 0.9);
}
