:root {
    --glass-bg: rgba(15, 23, 42, 0.80);
    --glass-bg-strong: rgba(15, 23, 42, 0.92);
    --glass-border: rgba(255, 255, 255, 0.14);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --shadow-lg: 0 20px 45px rgba(2, 6, 23, 0.45);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
    background: #0f172a;
    color: var(--text-main);
}

body.map-page {
    overflow: hidden;
}

body.home-page {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    background: radial-gradient(circle at 15% 10%, #1e3a8a 0%, #0f172a 48%, #020617 100%);
}

#three-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    touch-action: none;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(56, 189, 248, 0.25);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

/* 3D CSS2D Region Banners & Spot Labels */
.region-banner {
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.84);
    border: 2px solid #38bdf8;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.region-banner:hover {
    transform: scale(1.08);
    background: rgba(30, 41, 59, 0.96);
}

.region-banner small {
    color: #cbd5e1;
    font-size: 10px;
    letter-spacing: 0.4px;
}

.region-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.spot-pin-label {
    pointer-events: auto;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.spot-pin-label:hover, .spot-pin-label.selected {
    transform: scale(1.12);
    background: #0f172a;
    border-color: #facc15;
    z-index: 30;
}

.pin-day {
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

/* Top Floating Header */
.top-bar {
    position: fixed;
    top: 12px;
    left: 14px;
    right: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
    pointer-events: none;
}

.top-bar > * {
    pointer-events: auto;
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    padding: 7px 14px;
    border-radius: 13px;
    box-shadow: var(--shadow-lg);
    min-width: 0;
}

.brand-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.home-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 9px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #e0f2fe;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.home-back-btn:hover {
    background: #0284c7;
    color: #fff;
    transform: translateY(-1px);
}

.brand-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.brand-sub {
    font-size: 11px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.glass-btn {
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: #f8fafc;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.glass-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(56, 189, 248, 0.65);
    transform: translateY(-1px);
}

.glass-btn.active {
    background: #0284c7;
    border-color: #7dd3fc;
}

.glass-btn.primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
}

.time-group {
    display: inline-flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 11px;
    padding: 3px;
    backdrop-filter: blur(12px);
}

.time-btn {
    border: none;
    background: transparent;
    color: #cbd5e1;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.time-btn.active {
    background: #0ea5e9;
    color: #fff;
}

/* Left Itinerary Sidebar */
.sidebar {
    position: fixed;
    top: 76px;
    left: 14px;
    bottom: 84px;
    width: 340px;
    z-index: 20;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-360px);
}

.day-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--glass-border);
}

.day-pill {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(30, 41, 59, 0.72);
    color: #e2e8f0;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.day-pill:hover {
    border-color: #38bdf8;
}

.day-pill.active {
    background: #0284c7;
    color: #fff;
    border-color: #7dd3fc;
}

.sidebar-summary {
    padding: 10px 12px;
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.45);
    border-bottom: 1px solid var(--glass-border);
    line-height: 1.45;
}

.sidebar-summary strong {
    display: block;
    color: #fff;
    font-size: 13px;
    margin-bottom: 3px;
}

.day-note-chip {
    margin-top: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(250, 204, 21, 0.14);
    border: 1px solid rgba(250, 204, 21, 0.32);
    color: #fef08a;
    font-size: 11px;
}

.spot-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.spot-list::-webkit-scrollbar { width: 6px; }
.spot-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 99px; }

.spot-list-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 11px;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.18s ease;
}

.spot-list-item:hover, .spot-list-item.active {
    background: rgba(30, 58, 138, 0.52);
    border-color: #38bdf8;
    transform: translateX(2px);
}

.spot-thumb {
    width: 68px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.spot-item-body {
    flex: 1;
    min-width: 0;
}

.spot-item-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.mini-tag {
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}

.cat-pill {
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 10px;
}

.spot-item-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spot-item-sub {
    font-size: 11px;
    color: #94a3b8;
}

/* Right Spot Detail Card */
.detail-card {
    position: fixed;
    top: 76px;
    right: 14px;
    width: 370px;
    max-height: calc(100vh - 165px);
    z-index: 25;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(400px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.detail-scroll-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-card.open {
    transform: translateX(0);
    opacity: 1;
}

.detail-hero {
    position: relative;
    width: 100%;
    height: 195px;
    overflow: hidden;
    border-bottom: 1px solid var(--glass-border);
}

.detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(15, 23, 42, 0.84);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(8px);
}

.close-btn:hover { background: #ef4444; }

.detail-content {
    padding: 15px 16px 18px;
}

.detail-top-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-badge {
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.detail-day {
    font-size: 12px;
    color: #cbd5e1;
    font-weight: 600;
}

.detail-content h2 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 3px;
}

.detail-jp {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 10px;
}

.detail-travel-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.detail-desc {
    font-size: 13px;
    line-height: 1.65;
    color: #e2e8f0;
    margin-bottom: 12px;
}

.detail-notes-box {
    padding: 9px 11px;
    border-radius: 10px;
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(250, 204, 21, 0.32);
    color: #fef08a;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.detail-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ext-link-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.ext-link-btn.maps {
    background: linear-gradient(135deg, #059669, #10b981);
}

.ext-link-btn.official {
    background: linear-gradient(135deg, #2563eb, #0284c7);
}

.ext-link-btn.info {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
}

.ext-link-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.detail-nav-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.96);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}

.detail-nav-btn {
    flex: 1;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
}

.detail-nav-btn:hover {
    background: #0284c7;
    border-color: #7dd3fc;
}

.detail-nav-counter {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    min-width: 56px;
    text-align: center;
}

/* Bottom Bar: Region Jump + Telemetry + Zoom */
.bottom-bar {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 12px;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}

.bottom-bar > * { pointer-events: auto; }

.bottom-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: calc(100% - 140px);
}

.region-jump-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.region-btn {
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: #f8fafc;
    padding: 5px 11px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease;
}

.region-btn i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.region-btn:hover, .region-btn.active {
    background: rgba(2, 132, 199, 0.92);
    border-color: #7dd3fc;
    transform: translateY(-1px);
}

/* Mode Toggle Toast Banner */
.mode-toast {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    z-index: 60;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.55);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    max-width: 92vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.telemetry-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    font-size: 11px;
    color: #cbd5e1;
}

.tree-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tree-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zoom-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.zoom-btn:hover { background: #0284c7; }

/* Full Day-by-Day Itinerary Summary Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop.open {
    display: flex;
}

.summary-modal-card {
    width: 100%;
    max-width: 1160px;
    max-height: 88vh;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    box-shadow: 0 28px 65px rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 22px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(124, 58, 237, 0.25));
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.day-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.85);
    border-left: 5px solid #38bdf8;
    margin-bottom: 10px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.summary-table th, .summary-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    vertical-align: middle;
}

.summary-table th {
    background: rgba(15, 23, 42, 0.9);
    color: #94a3b8;
    font-weight: 700;
    font-size: 12px;
}

.summary-table tr:hover td {
    background: rgba(30, 41, 59, 0.45);
}

.table-thumb {
    width: 72px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.table-link {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: #0284c7;
}

.table-link.maps { background: #059669; }
.table-link:hover { filter: brightness(1.15); }

.summary-fly-btn {
    border: 1px solid rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.14);
    color: #7dd3fc;
    padding: 4px 9px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.summary-fly-btn:hover {
    background: #0284c7;
    color: #fff;
}

.acc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.acc-card {
    padding: 14px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(139, 92, 246, 0.35);
}

/* =========================================================================
   MOBILE RESPONSIVE LAYOUT (max-width: 768px)
   ========================================================================= */
@media (max-width: 768px) {
    /* Requirement 2: Hide bottom DEM / Traffic / Tree telemetry bar on mobile */
    .telemetry-bar {
        display: none !important;
    }

    /* Compact two-row top header */
    .top-bar {
        top: 8px;
        left: 8px;
        right: 8px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .brand-card {
        padding: 6px 12px;
        border-radius: 11px;
    }

    .brand-icon {
        font-size: 18px;
    }

    .brand-title {
        font-size: 14px;
    }

    .brand-sub {
        display: none;
    }

    .top-actions {
        justify-content: flex-start;
        gap: 5px;
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .time-group {
        padding: 2px;
        flex-shrink: 0;
    }

    .time-btn {
        padding: 4px 6px;
        font-size: 11px;
    }

    .glass-btn {
        padding: 5px 8px;
        font-size: 11.5px;
        border-radius: 9px;
        flex-shrink: 0;
    }

    /* Mobile Sidebar Drawer */
    .sidebar {
        top: 122px;
        left: 8px;
        right: 8px;
        bottom: 60px;
        width: auto;
        z-index: 30;
        border-radius: 14px;
    }

    .sidebar.collapsed {
        transform: translateX(-110%);
        pointer-events: none;
    }

    /* Mobile Spot Detail Card as Bottom Sheet */
    .detail-card {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: 72vh;
        z-index: 35;
        border-radius: 16px;
        transform: translateY(110%);
    }

    .detail-card.open {
        transform: translateY(0);
    }

    .detail-hero {
        height: 155px;
    }

    .detail-content {
        padding: 12px 14px 16px;
    }

    .detail-content h2 {
        font-size: 16px;
    }

    /* Bottom Region Bar: smooth horizontal swipeable strip */
    .bottom-bar {
        left: 8px;
        right: 8px;
        bottom: 10px;
        align-items: center;
        gap: 8px;
    }

    .bottom-left {
        max-width: calc(100% - 48px);
        overflow: hidden;
    }

    .region-jump-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .region-jump-bar::-webkit-scrollbar {
        display: none;
    }

    .region-btn {
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .zoom-controls {
        gap: 5px;
    }

    .zoom-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    /* Smaller 3D labels for phone screen clarity */
    .region-banner {
        padding: 3px 8px;
        font-size: 11px;
    }

    .region-banner small {
        display: none;
    }

    .spot-pin-label {
        font-size: 10px;
        padding: 2px 6px 2px 3px;
    }

    /* Mobile Summary Table Modal */
    .modal-backdrop {
        padding: 8px;
    }

    .summary-modal-card {
        max-height: 92vh;
        border-radius: 14px;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-header h2 {
        font-size: 15px !important;
    }

    .modal-body {
        padding: 12px 10px;
        gap: 16px;
    }

    .acc-grid {
        grid-template-columns: 1fr;
    }

    /* Stack summary table rows as mobile cards */
    .summary-table thead {
        display: none;
    }

    .summary-table, .summary-table tbody, .summary-table tr, .summary-table td {
        display: block;
        width: 100%;
    }

    .summary-table tr {
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 10px;
        background: rgba(30, 41, 59, 0.55);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .summary-table td {
        padding: 4px 0;
        border-bottom: none;
    }

    .table-thumb {
        width: 100%;
        height: 110px;
        border-radius: 8px;
        margin-bottom: 4px;
    }

    .home-back-btn {
        padding: 4px 8px;
        font-size: 11.5px;
    }
}

/* =========================================================================
   FAMILY TRAVEL HOMEPAGE (吳們這一家旅遊資訊)
   ========================================================================= */
.home-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 20px 48px;
}

.home-hero {
    text-align: center;
    padding: 36px 24px 32px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(30, 58, 138, 0.42), rgba(15, 23, 42, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 24px 55px rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(14px);
    margin-bottom: 26px;
}

.home-hero-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.home-hero-title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 900;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ffffff 20%, #bae6fd 70%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-hero-sub {
    font-size: 15px;
    color: #cbd5e1;
    max-width: 680px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.home-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    max-width: 780px;
    margin: 0 auto;
}

.home-stat-card {
    padding: 14px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-val {
    font-size: 24px;
    font-weight: 900;
    color: #38bdf8;
}

.stat-lbl {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 3px;
}

.home-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.home-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-tab {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(30, 41, 59, 0.72);
    color: #cbd5e1;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.home-tab:hover, .home-tab.active {
    background: #0284c7;
    color: #fff;
    border-color: #7dd3fc;
}

.home-quick-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #cbd5e1;
}

.trip-select {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
}

.home-go-btn {
    border: none;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    padding: 7px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.home-go-btn:hover { filter: brightness(1.12); }

.trips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 20px;
}

.trip-card {
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
    transition: transform 0.22s ease, border-color 0.22s ease;
}

.trip-card:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, 0.6);
}

.trip-card.pulse-highlight {
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.35);
}

.trip-card-cover {
    position: relative;
    padding: 16px 18px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.trip-cover-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.trip-year-pill, .trip-status-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    backdrop-filter: blur(6px);
}

.trip-status-pill.ready {
    background: rgba(22, 163, 74, 0.85);
}

.trip-cover-emoji {
    font-size: 52px;
    text-align: center;
    margin: 6px 0;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

.trip-folder-tag {
    align-self: flex-end;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.58);
    color: #e2e8f0;
}

.trip-card-body {
    flex: 1;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trip-card-title {
    font-size: 19px;
    font-weight: 800;
    color: #fff;
}

.trip-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    color: #7dd3fc;
    font-weight: 600;
}

.trip-card-summary {
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
}

.trip-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.highlight-chip {
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11.5px;
    color: #e2e8f0;
}

.trip-card-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trip-counts {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.enter-map-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 11px 16px;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
    transition: transform 0.16s ease, filter 0.16s ease;
}

.enter-map-btn:hover:not(.disabled) {
    transform: translateY(-1px);
    filter: brightness(1.12);
}

.enter-map-btn.disabled {
    background: rgba(51, 65, 85, 0.7);
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
}

.home-footer {
    text-align: center;
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12.5px;
    color: #94a3b8;
}

.home-footer code {
    background: rgba(30, 41, 59, 0.9);
    padding: 2px 6px;
    border-radius: 5px;
    color: #7dd3fc;
}

@media (max-width: 768px) {
    .home-shell {
        padding: 16px 12px 32px;
    }

    .home-hero {
        padding: 22px 14px;
    }

    .trips-grid {
        grid-template-columns: 1fr;
    }
}


/* ==================== Global Floating Travel BGM Player ==================== */
.bgm-floating-widget {
    position: fixed;
    right: 16px;
    bottom: 108px;
    z-index: 95;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(56, 189, 248, 0.42);
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.48);
    backdrop-filter: blur(12px);
    color: #f8fafc;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

body.home-page .bgm-floating-widget {
    bottom: 22px;
    right: 22px;
}

.bgm-floating-widget.bgm-inline-topbar {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    padding: 5px 11px;
    border-radius: 10px;
    box-shadow: none;
    height: auto;
    pointer-events: auto;
}

.bgm-floating-widget:hover {
    border-color: rgba(56, 189, 248, 0.85);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.35);
}

.bgm-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 2px;
    white-space: nowrap;
}

.bgm-eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    width: 14px;
}

.bgm-eq i {
    display: block;
    width: 3px;
    height: 5px;
    border-radius: 2px;
    background: #38bdf8;
    transition: height 0.2s ease;
}

.bgm-floating-widget.is-playing .bgm-eq i:nth-child(1) {
    animation: bgmBar 0.72s ease-in-out infinite alternate;
}
.bgm-floating-widget.is-playing .bgm-eq i:nth-child(2) {
    animation: bgmBar 0.56s ease-in-out 0.15s infinite alternate;
}
.bgm-floating-widget.is-playing .bgm-eq i:nth-child(3) {
    animation: bgmBar 0.82s ease-in-out 0.28s infinite alternate;
}

@keyframes bgmBar {
    0% { height: 4px; background: #38bdf8; }
    100% { height: 14px; background: #fbbf24; }
}

.bgm-icon-muted {
    display: none;
    font-size: 14px;
    line-height: 1;
}

.bgm-floating-widget.is-muted .bgm-eq { display: none; }
.bgm-floating-widget.is-muted .bgm-icon-muted { display: inline-block; }
.bgm-floating-widget.is-muted {
    border-color: rgba(148, 163, 184, 0.35);
    color: #94a3b8;
}

.bgm-floating-widget.is-waiting {
    border-color: rgba(251, 191, 36, 0.85);
    animation: bgmPulse 1.8s ease-in-out infinite;
}

@keyframes bgmPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(245, 158, 11, 0.22); }
    50% { box-shadow: 0 8px 30px rgba(251, 191, 36, 0.55); }
}

.bgm-vol-wrap {
    display: inline-flex;
    align-items: center;
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width 0.25s ease, opacity 0.2s ease;
}

.bgm-floating-widget:hover .bgm-vol-wrap,
.bgm-floating-widget:focus-within .bgm-vol-wrap {
    width: 68px;
    opacity: 1;
}

#bgm-volume-slider {
    width: 64px;
    height: 4px;
    accent-color: #38bdf8;
    cursor: pointer;
}

@media (max-width: 768px) {
    .bgm-floating-widget.bgm-inline-topbar {
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        padding: 4px 9px;
        border-radius: 9px;
    }
    body.home-page .bgm-floating-widget {
        top: auto;
        bottom: 16px;
        right: 16px;
    }
    .bgm-status-text {
        font-size: 11.5px;
    }
    .bgm-floating-widget:hover .bgm-vol-wrap {
        width: 0;
        opacity: 0;
    }
}


/* ==================== Mobile Sidebar Close Button & Active Sync ==================== */
.glass-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #7dd3fc;
}

.sidebar-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-header-row .day-pills-wrap {
    flex: 1;
    min-width: 0;
    border-bottom: none;
}

.sidebar-close-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 10px 10px 0 0;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(30, 41, 59, 0.92);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.35);
}

.sidebar-close-btn:hover,
.sidebar-close-btn:active {
    background: #ef4444;
    border-color: #fca5a5;
}

@media (max-width: 768px) {
    .sidebar-close-btn {
        display: inline-flex;
    }
}
