/*
 * COMPONENT: Atlas & Map
 * ----------------------------
 * 核心图集模块，包含：
 * 1. .row-atlas (布局容器)
 * 2. .atlas-directory, .log-card (侧边栏与列表)
 * 3. .atlas-map (Leaflet 地图容器)
 * 4. .gallery-image (模态框图集)
 * 
 * 依赖: _variables.css
 */

/* --- Row 3: Atlas --- */
.row-atlas {
    display: grid;
    grid-template-columns: 300px 1fr 1fr;
    height: 600px;
    gap: 20px;
    gap: 20px;
    /* overflow: hidden; REMOVED to allow left shadow */
    padding-left: 0px;
    /* Safety padding for shadow */
}

.atlas-directory {
    background: var(--lw-panel-bg);
    backdrop-filter: var(--lw-glass-blur) var(--lw-glass-saturate);
    -webkit-backdrop-filter: var(--lw-glass-blur) var(--lw-glass-saturate);
    border: 1px solid var(--lw-border);
    border-radius: 12px;
    overflow-y: auto;
}

.atlas-directory h3 {
    padding: 20px;
    margin: 0;
    font-size: 0.9rem;
    color: var(--lw-accent);
    border-bottom: 1px solid var(--lw-border);
    background: var(--lw-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.log-entry {
    padding: 18px 20px;
    border-bottom: 1px solid var(--lw-border);
    cursor: pointer;
    transition: background 0.2s;
    background: var(--lw-bg);
}

.log-entry:hover,
.log-entry.active {
    background: var(--lw-panel-hover);
    border-left: 3px solid var(--lw-accent);
}

/* USER FIX: Title + View count row */
.log-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.log-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lw-text);
    flex: 1;
}

/* USER FIX: View count display - compact version */
.log-card-views {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: rgba(212, 175, 55, 0.7);
    font-family: monospace;
    flex-shrink: 0;
}

.log-card-views svg {
    opacity: 0.6;
}

.log-card-views span {
    font-weight: 500;
}

.log-date {
    font-size: 0.7rem;
    color: var(--lw-text-muted);
    display: block;
    margin-bottom: 4px;
}

.log-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 500;
    color: var(--lw-text);
}

.log-tags {
    margin-top: 5px;
}

.tag {
    font-size: 0.65rem;
    background: var(--lw-border);
    padding: 2px 5px;
    border-radius: 3px;
    margin-right: 4px;
    color: var(--lw-text-muted);
}

.atlas-reader {
    background: var(--lw-bg);
    padding: 40px;
    overflow-y: auto;
    border-radius: 12px;
    /* border: 1px solid var(--lw-border); REMOVED */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.reader-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lw-text-muted);
    font-style: italic;
}

.reader-content .meta-tag {
    color: var(--lw-accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reader-content h2 {
    font-size: 2rem;
    margin: 10px 0;
    color: var(--lw-text);
    font-weight: 300;
}

.reader-date {
    color: var(--lw-text-muted);
    font-size: 0.8rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--lw-border);
    padding-bottom: 10px;
}

.reader-body p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: var(--lw-text);
    font-size: 1.05rem;
}

.atlas-map {
    background: var(--lw-panel-bg);
    backdrop-filter: var(--lw-glass-blur) var(--lw-glass-saturate);
    -webkit-backdrop-filter: var(--lw-glass-blur) var(--lw-glass-saturate);
    border: 1px solid var(--lw-border);
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    /* Map gets its own glow via shared class */
    z-index: 50;
    /* Ensure map sits above potential invisible siblings */
    isolation: isolate;
    /* Create new stacking context */
    min-height: 400px;
    /* Safe default */
    height: 100%;
}

/* Leaflet Map Container */
#lw-leaflet-map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: rgba(0, 0, 0, 0.01);
    /* Hit-test surface */
    /* FORCE INTERACTIVITY */
    pointer-events: auto !important;
    touch-action: none;
    /* Let Leaflet handle touches */
}

/* Ensure Leaflet internal layers are clickable */
.leaflet-container,
.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
    pointer-events: auto !important;
    z-index: auto;
    /* Let Leaflet manage internal Z */
}

/* Hide static bg elements */
.map-bg,
.map-projection-wrapper {
    display: none !important;
}

/* Custom Marker CSS */
.leaflet-div-icon {
    background: transparent;
    border: none;
}

/* Fullscreen Map Mode */
/* Fullscreen Map Mode -> Modal Card Mode */
.atlas-map.fullscreen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw !important;
    height: 85vh !important;
    max-width: 1200px;
    z-index: 9999;
    background: #0a0f1e !important;
    /* Dark background */
    border-radius: 24px;
    border: 1px solid var(--lw-border) !important;
    padding: 0;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    /* Improve map container inside modal */
}

/* Add backdrop when map is fullscreen? Requires JS change or pseduo-element on body. 
   For now, a huge shadow helps. */

body.light-mode .atlas-map.fullscreen {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.2);
}

.map-fs-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--lw-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    backdrop-filter: blur(5px);
}

.map-fs-btn:hover {
    background: var(--lw-accent);
    color: #000;
}

body.light-mode .map-fs-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    border-color: rgba(0, 0, 0, 0.1);
}

.map-pin.log {
    background: var(--lw-accent);
    border-radius: 50%;
}

.map-pin.video {
    background: #fff;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid #fff;
    border-radius: 0;
}

.pin-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 1px solid var(--lw-accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* --- Row 3: Atlas (Journal & Map) Redesign --- */
.row-atlas {
    display: grid;
    grid-template-columns: 250px 1fr 1fr;
    gap: 20px;
    height: 550px !important;
    /* Force Height Increase */
    min-height: 550px;
}

.atlas-directory,
.atlas-reader,
.atlas-map {
    background: var(--lw-panel-bg);
    border: 1px solid var(--lw-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100% !important;
    /* Force fill parent */
}

/* Journal Filter Bar (Replaces H3 Header) */
.log-filter-bar {
    padding: 10px;
    border-bottom: 1px solid var(--lw-border);
    display: flex;
    gap: 10px;
    height: 70px;
    box-sizing: border-box;
    /* Fix box model issue */
    flex-shrink: 0;
    /* Prevent shrinking */
}

/* Dynamic Island: Stacked Style */
.filter-island {
    flex: 1;
    background: #008080;
    border-radius: 12px;
    border: 1px solid var(--lw-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.filter-island:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 255, 0.15);
    background: #008b8b;
}

.island-top,
.island-bot {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lw-text);
    position: relative;
    width: 100%;
}

.island-top {
    flex: 3;
    background: rgba(0, 0, 0, 0.1);
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.island-bot {
    flex: 2;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.island-bot:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Log List Layout */
.log-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    height: 100%;
    /* Explicit height */
}

.log-entry {
    padding: 15px;
    border-bottom: 1px solid var(--lw-border);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry:hover,
.log-entry.active {
    background: var(--lw-panel-hover);
    border-left: 3px solid var(--lw-accent);
}

/* USER FIX: Modal view count - clean minimal */
.modal-views {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: rgba(212, 175, 55, 0.85);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
    text-shadow: none;
}

.modal-views svg {
    opacity: 0.7;
    flex-shrink: 0;
}

/* USER FIX: Modal location - clean text only */
.modal-location {
    font-size: 0.8rem;
    color: var(--lw-text-muted);
    font-weight: 400;
    text-shadow: none;
}

body.light-mode .modal-location {
    color: #6d4c41;
}

.modal-date {
    font-size: 0.75rem;
    color: var(--lw-text-muted);
    font-family: 'Monaco', 'Courier New', monospace;
    opacity: 0.75;
    font-weight: 500;
    text-shadow: none;
}

.log-title {
    font-size: 0.95rem;
    color: var(--lw-sys-text-main);
    margin: 0;
    line-height: 1.3;
    font-weight: 600;
}

.log-meta-row {
    display: flex;
    justify-content: space-between;
    /* This should push items apart */
    align-items: center;
    margin-top: 4px;
    width: 100%;
}

.log-tags {
    display: flex;
    gap: 5px;
}

.log-tags .tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 4px;
    color: var(--lw-text-muted);
}

.log-date-bottom {
    font-size: 0.75rem;
    color: var(--lw-text-muted);
    font-family: 'Outfit', sans-serif;
    opacity: 0.8;
    display: flex;
    gap: 10px;
    height: 70px;
    /* Fixed height for the islands */
    box-sizing: content-box;
}

/* Dynamic Island: Stacked Style */
.filter-island {
    flex: 1;
    /* Equal width */
    background: #008080;
    /* Teal Base */
    border-radius: 12px;
    border: 1px solid var(--lw-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.filter-island:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 255, 0.15);
    background: #008b8b;
}

.island-top,
.island-bot {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lw-text);
    position: relative;
    /* transition: background 0.2s; */
}

/* Level 1 (Top): Region / Year */
.island-top {
    flex: 3;
    /* Taller */
    background: rgba(0, 0, 0, 0.1);
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Level 2 (Bottom): Country / Month */
.island-bot {
    flex: 2;
    /* Shorter */
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.island-bot:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Log List Layout (Minor Tweak: ensure full height) */
.log-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}


/* --- Journal V3 Redesign: Sidebar | List | Map --- */

.row-atlas {
    display: grid;
    grid-template-columns: 1.2fr 2fr 1.5fr;
    /* USER FIX: Golden ratio - Left 24% | Center 41% | Right 35% */
    gap: 20px;
    height: 688px !important;
    /* USER FIX: Increased by 25% (550px -> 688px) */
    min-height: 688px;
}

.atlas-sidebar,
.atlas-list,
.atlas-map {
    background: rgba(14, 18, 26, 0.88) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.30) !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    overflow: hidden;
    height: 100% !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

body.light-mode .atlas-sidebar,
body.light-mode .atlas-list,
body.light-mode .atlas-map {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

/* USER FIX: Hide sidebar scrollbar */
.atlas-sidebar {
    position: relative;
    overflow-y: auto !important;
    padding: 10px;
    gap: 10px;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    border-right: none;
}

.atlas-sidebar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.journal-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 15px;
}

/* --- Atlas 纯粹微型时间灵动岛 (Step 48.01: 110px 露头滑动收缩 -> 175px 展开) --- */
.atlas-micro-island {
    position: relative;
    width: 110px; /* 约两个年份宽度：中间完整年份，两侧露头 (如 17 2018 20) */
    margin: 0 auto 14px auto !important; /* 在侧边栏横梁绝对水平居中 */
    box-sizing: border-box;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease;
    cursor: pointer;
    z-index: 25;
}

/* 点击展开态：宽度优雅延展至约 3 个年份按钮宽度 */
.atlas-micro-island.is-expanded {
    width: 175px;
}

.atlas-chrono-surface {
    background: rgba(18, 22, 30, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 5px 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    transition: border-radius 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease,
                background 0.3s ease;
}

.atlas-micro-island.is-expanded .atlas-chrono-surface {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 16px rgba(var(--lw-color-cyan-rgb), 0.25);
}

.atlas-micro-island.is-expanded.has-months .atlas-chrono-surface {
    border-radius: 14px; /* 展开月份时自适应平滑大圆角 */
}

body.light-mode .atlas-chrono-surface {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* 年份横向滑动轨 (两端微露头，带羽化渐隐滑动暗示) */
.atlas-micro-island .chrono-years-track {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0;
    mask-image: linear-gradient(to right, transparent 0%, black 14%, black 86%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 14%, black 86%, transparent 100%);
}

.atlas-micro-island .chrono-years-track::-webkit-scrollbar {
    display: none;
}

.atlas-micro-island .chrono-year {
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.65) !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 3px 6px !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.atlas-micro-island .chrono-year:hover {
    color: #fff !important;
}

.atlas-micro-island .chrono-year.active {
    color: var(--lw-accent) !important;
    text-shadow: 0 0 12px rgba(var(--lw-color-cyan-rgb), 0.6) !important;
    transform: scale(1.08) !important;
    font-weight: 700 !important;
}

body.light-mode .atlas-micro-island .chrono-year {
    color: #666 !important;
}

body.light-mode .atlas-micro-island .chrono-year:hover {
    color: #111 !important;
}

body.light-mode .atlas-micro-island .chrono-year.active {
    color: var(--lw-accent) !important;
}

/* 月份展示轨 (彻底根除下半截截断，留足 34px 饱满高度与底部呼吸内边距) */
.atlas-micro-island .chrono-months-track {
    display: flex;
    align-items: center;
    gap: 3px;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid transparent;
    box-sizing: border-box;
}

.atlas-micro-island .chrono-months-track::-webkit-scrollbar {
    display: none;
}

.atlas-micro-island.is-expanded.has-months .chrono-months-track:not(:empty) {
    max-height: 40px; /* 留足充裕空间 */
    opacity: 1;
    transform: translateY(0);
    margin-top: 5px;
    padding-top: 5px;
    padding-bottom: 4px; /* 彻底杜绝文字下边缘被裁剪 */
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .atlas-micro-island.is-expanded.has-months .chrono-months-track:not(:empty) {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.atlas-micro-island .chrono-month {
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    padding: 2px 6px !important;
    min-width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    text-align: center !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.atlas-micro-island .chrono-month:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.atlas-micro-island .chrono-month.active {
    color: #000 !important;
    background: var(--lw-accent) !important;
    font-weight: 700 !important;
    box-shadow: 0 0 10px rgba(var(--lw-color-cyan-rgb), 0.4) !important;
}

body.light-mode .atlas-micro-island .chrono-month {
    color: #666 !important;
}

body.light-mode .atlas-micro-island .chrono-month:hover {
    color: #111 !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .atlas-micro-island .chrono-month.active {
    color: #fff !important;
    background: var(--lw-accent) !important;
}

/* USER FIX: Premium year button design */
#island-date button {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(255, 215, 0, 0.2));
    border: 1.5px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #D4AF37;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.1);
}

#island-date button:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(255, 215, 0, 0.3));
    border-color: #D4AF37;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

#island-date button.active {
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    border-color: #D4AF37;
    color: var(--lw-text);
    box-shadow: 0 44px 12px rgba(212, 175, 55, 0.4);
}

/* Location Accordion */
.journal-accordion {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--lw-border);
    padding-top: 10px;
}

.j-country-header {
    padding: 10px 16px 10px 16px !important;
    /* USER FIX: Align with continent */
    margin: 3px 0 !important;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--lw-text-muted);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s ease;
    text-align: left !important;
}

.j-region-header {
    padding: 8px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--lw-text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.03);
}

.j-region-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.j-continent-content {
    display: none;
    padding: 0 !important;
    /* USER FIX: Remove ALL padding */
    margin: 0 !important;
    /* USER FIX: Remove ALL margin */
}

.j-continent-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.j-country-content {
    display: none;
    padding: 0 !important;
    /* USER FIX: Remove ALL padding */
    margin: 0 !important;
    /* USER FIX: Remove ALL margin */
}

.j-country-content.active {
    display: block;
}


.j-country-item {
    font-size: 0.85rem;
    /* USER FIX: Enlarged for better readability */
    padding: 6px 10px;
    color: var(--lw-text-muted);
    cursor: pointer;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* USER FIX: Premium hover effect */
.j-country-item:hover {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), transparent);
    border-left: 3px solid #D4AF37;
    color: #FFD700;
    transform: translateX(2px);
    padding-left: 12px;
}

/* --- Col 2: Log List (Cards) --- */
.log-list-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 10px 0;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    background: transparent;
    border: none;
}

/* USER FIX: Hide scrollbar for WebKit browsers */
.log-list-scroll::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.log-card-item {
    padding: 15px 10px;
    border-bottom: 1px solid var(--lw-border);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.log-card-item:hover {
    background: var(--lw-panel-hover);
}

.log-card-row-1 {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.log-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--lw-text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-card-views {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--lw-text-muted);
    opacity: 0.7;
    white-space: nowrap;
}

.log-card-tags-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-mini {
    font-size: 0.5rem;
    padding: 1px 4px;
    background: rgba(var(--lw-accent-raw), 0.1);
    border: 1px solid rgba(var(--lw-accent-raw), 0.2);
    border-radius: 3px;
    color: var(--lw-accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.log-card-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.log-card-summary {
    font-size: 0.65rem;
    color: var(--lw-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    opacity: 0.8;
}

.log-card-meta-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
    min-width: 80px;
}

.log-card-city {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--lw-text);
}

.log-card-date {
    font-size: 0.65rem;
    font-family: 'Outfit', sans-serif;
    color: var(--lw-text-muted);
    opacity: 0.6;
}

/* --- Gallery & Modal Cards --- */

.gallery-image {
    width: 100%;
    height: 0;
    padding-bottom: 60%;
    /* 4:3 Aspect Ratio */
    /* Fallback if URL fails */
    background-color: rgba(255, 255, 255, 0.05);
    /* Lighter placeholder for transparent bg */
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    /* Overlay the actual image URL logic via style tag in HTML, this supports basic fallback visual */
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    /* Stronger shadow for floating effect */
    position: relative;
    border: 1px solid var(--lw-border);
    transition: transform 0.3s ease;
}

.gallery-image:hover {
    transform: scale(1.02);
    border-color: var(--lw-accent);
    box-shadow: 0 0 30px var(--lw-accent-glow);
}

/* 1. Floating Label: Bottom Right, Capsule Style */
#lw-log-modal .gallery-label {
    position: absolute;
    top: auto;
    bottom: 20px;
    right: 20px;

    background: rgba(0, 0, 0, 0.3) !important;
    /* Force Transparent */
    backdrop-filter: blur(12px) !important;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    /* Visible Border */

    color: rgba(255, 255, 255, 0.95);
    font-size: 0.75rem;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;

    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 20 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.05) !important;
}

.label-icon {
    opacity: 0.9;
    color: var(--lw-accent);
}

/* --- Mobile Adaptation (Breakpoints consistent with Theater/Timeline) --- */
@media (max-width: 1024px) {

    /* 5. Journal Filter (Sidebar) Floating Card */
    html.light-mode .atlas-sidebar,
    body.light-mode .atlas-sidebar {
        background: var(--lw-panel-bg) !important;
        border: 1px solid var(--lw-border) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        border-radius: 12px !important;
        margin-bottom: 15px !important;
        padding: 5px !important;
    }

    /* 6. Journal List Floating Card */
    html.light-mode .atlas-list,
    body.light-mode .atlas-list {
        background: var(--lw-panel-bg) !important;
        border: 1px solid var(--lw-border) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        border-radius: 12px !important;
        /* V5.12: Standardized Harmony */
        margin-bottom: 15px !important;
    }

    /* 7. Map Container Floating Card */
    html.light-mode .atlas-map,
    body.light-mode .atlas-map {
        background: var(--lw-panel-bg) !important;
        border: 1px solid var(--lw-border) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        border-radius: 12px !important;
    }

    /* Row 3: Atlas Stacking (Constrained) */
    .row-atlas {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        gap: 0 !important;
        /* COMPACT NO GAP */
    }

    .atlas-sidebar {
        width: 100% !important;
        flex: none !important;
        /* Unified Padding for Height Consistency (5px matches Light Mode Card) */
        padding: 5px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        margin: 0 !important;
        /* FORCE NO MARGIN */
    }

    .journal-sidebar-inner {
        gap: 0 !important;
    }

    .journal-accordion {
        padding-top: 0 !important;
        border-top: none !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        /* NO BOTTOM */
    }

    .j-continent-header {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    /* Fixed height container for journal list */
    .atlas-list {
        width: 100% !important;
        height: 485px !important;
        /* Fixed viewport for Journal List */
        flex: none !important;
        background: rgba(255, 255, 255, 0.03) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid var(--lw-border) !important;
        border-radius: 20px !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: none !important;
        margin: 0 0 15px 0 !important;
        /* Unified Gap for Light/Dark Mode */
    }

    /* Target inner list specifically for scroll */
    .atlas-list .log-list-scroll {
        flex: 1 !important;
        overflow-y: auto !important;
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
        padding: 0 15px !important;
        /* REMOVED 5px TOP/BOT */
    }

    .atlas-list .log-list-scroll::-webkit-scrollbar {
        display: none !important;
    }

    .chrono-years-track,
    .chrono-months-track {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        width: 100% !important;
        mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%) !important;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%) !important;
    }

    .chrono-years-track::-webkit-scrollbar,
    .chrono-months-track::-webkit-scrollbar {
        display: none !important;
    }

    .atlas-map {
        width: 100% !important;
        height: 350px !important;
        flex: none !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        border: 1px solid var(--lw-border) !important;
        margin: 0 !important;
        /* FORCE NO MARGIN */
    }

    /* Chronometer Mobile Polish */
    #journal-date-picker {
        margin-bottom: 0 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    .sidebar-chrono-surface {
        width: 130px !important;
        max-width: 130px !important;
        overflow: hidden !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    /* Fix log items in mobile list - Minimalist Floating Style */
    .log-card-item {
        padding: 12px 0 !important;
        margin-bottom: 0 !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transition: opacity 0.2s ease !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
    }

    .log-card-item:last-child {
        border-bottom: none !important;
    }

    .log-card-item:active {
        transform: none !important;
        opacity: 0.7;
    }

    .log-card-title {
        font-size: 0.68rem !important;
    }

    /* Mobile specific tweaks for Row 2 */
    .log-card-row-2 {
        gap: 10px !important;
    }

    .log-card-meta-col {
        min-width: 65px !important;
    }

    .log-card-summary {
        font-size: 0.65rem !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }

    /* Light Mode Minimalist Overrides */
    body.light-mode .log-card-item {
        background: transparent !important;
        border-bottom-color: rgba(0, 0, 0, 0.05) !important;
        box-shadow: none !important;
    }

    body.light-mode .log-card-title {
        color: var(--lw-text) !important;
    }

    body.light-mode .log-card-summary {
        color: var(--lw-text-muted) !important;
    }
}

/* ============================================================
   Leaflet 深度暗黑美学定制 (Step 43.04)
   ============================================================ */

/* 1. 缩放控件 (+ / -) 深度亚克力暗黑磨砂高定 */
.leaflet-control-zoom {
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    background: rgba(18, 22, 30, 0.8) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    margin-top: 15px !important;
    margin-left: 15px !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background: transparent !important;
    color: #fff !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.leaflet-control-zoom-out {
    border-bottom: none !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background: var(--lw-accent) !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(var(--lw-color-cyan-rgb), 0.5) !important;
}

body.light-mode .leaflet-control-zoom {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .leaflet-control-zoom-in,
body.light-mode .leaflet-control-zoom-out {
    color: #111 !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .leaflet-control-zoom-in:hover,
body.light-mode .leaflet-control-zoom-out:hover {
    background: var(--lw-accent) !important;
    color: #fff !important;
}

/* 2. 聚合标记 (Marker Cluster) 升级为青金色呼吸微光能量环 */
.marker-cluster,
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(0, 234, 255, 0.18) !important;
    border: 1.5px solid rgba(0, 234, 255, 0.5) !important;
    border-radius: 50% !important;
    box-shadow: 0 0 16px rgba(0, 234, 255, 0.35) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.marker-cluster div,
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(15, 18, 24, 0.92) !important;
    border-radius: 50% !important;
    color: var(--lw-accent) !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    box-shadow: inset 0 0 8px rgba(0, 234, 255, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.marker-cluster:hover {
    transform: scale(1.15) !important;
    box-shadow: 0 0 28px rgba(0, 234, 255, 0.7) !important;
    border-color: #fff !important;
}

body.light-mode .marker-cluster {
    background: rgba(214, 126, 46, 0.22) !important;
    border-color: rgba(214, 126, 46, 0.6) !important;
    box-shadow: 0 0 15px rgba(214, 126, 46, 0.3) !important;
}

body.light-mode .marker-cluster div {
    background: #fff !important;
    color: #d67e2e !important;
    box-shadow: inset 0 0 5px rgba(214, 126, 46, 0.2) !important;
}

/* 3. 归属标签弱化微磨砂 */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.45) !important;
    color: rgba(255, 255, 255, 0.35) !important;
    font-size: 0.62rem !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-radius: 4px 0 0 0 !important;
}

.leaflet-control-attribution a {
    color: var(--lw-accent) !important;
    text-decoration: none !important;
}

/* Step 537: 官方 OSM 瓦片黑夜模式极夜科技反色滤镜 (Dark Mode Tile Filter) */
html:not(.light-mode) #lw-map-container .leaflet-tile,
body:not(.light-mode) #lw-map-container .leaflet-tile,
html:not(.light-mode) #lw-leaflet-map .leaflet-tile,
body:not(.light-mode) #lw-leaflet-map .leaflet-tile,
html:not(.light-mode) .atlas-map.fullscreen .leaflet-tile,
body:not(.light-mode) .atlas-map.fullscreen .leaflet-tile {
    filter: invert(100%) hue-rotate(180deg) brightness(85%) contrast(110%) saturate(60%) !important;
}

/* 白天模式还原：保持原版明快和谐的自然色泽 */
html.light-mode #lw-map-container .leaflet-tile,
body.light-mode #lw-map-container .leaflet-tile,
html.light-mode #lw-leaflet-map .leaflet-tile,
body.light-mode #lw-leaflet-map .leaflet-tile,
html.light-mode .atlas-map.fullscreen .leaflet-tile,
body.light-mode .atlas-map.fullscreen .leaflet-tile {
    filter: none !important;
}