/* ============================================================
   水族迁徙 · 地形图演示样式（Leaflet 版）
   配色遵循全组统一色板（素材总库/10-配色标准/色板.css，2026-08-14 定版）：
   主色 深藏蓝 #1A2A5C / 辅色 暗金褐 #B8860B / 背景 米白 #F7F2E7 / 警示 #A04438
   ============================================================ */
:root {
    --indigo: #1A2A5C;
    --indigo-dark: #16244E;
    --indigo-light: #5F6A8D;
    --gold: #B8860B;
    --gold-light: #E6D5AA;
    --cream: #F7F2E7;
    --card: #FFFDF6;
    --danger: #A04438;
    --split: #9AA5B8;
    --text: #232833;
    --text-soft: #76819A;
    --font-display: "华文行楷", "STXingkai", "LXGW WenKai", "华文楷体", "STKaiti", "KaiTi", "Microsoft YaHei", serif;
    --font-kai: "LXGW WenKai", "华文楷体", "STKaiti", "KaiTi", "Microsoft YaHei", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--font-kai);
    background: #10141c;
    color: var(--text);
    overflow: hidden;
}

/* ============ Leaflet 地图容器 ============ */
#map {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #0c1118;
}

/* ============ 地图加载中遮罩 ============ */
.map-loading {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    padding: 12px 26px;
    background: rgba(255, 253, 246, 0.92);
    border: 1px solid rgba(26, 42, 92, 0.3);
    border-radius: 30px;
    color: var(--indigo);
    font-size: 15px;
    letter-spacing: 2px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.map-loading.hidden { opacity: 0; visibility: hidden; }
.map-loading.error { color: var(--text); border-color: rgba(160, 68, 56, 0.5); }
.leaflet-control-zoom a {
    color: var(--indigo) !important;
    background: var(--card) !important;
    border-color: rgba(26, 42, 92, 0.25) !important;
}
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(247, 242, 231, 0.7) !important;
}

/* ============ 顶部标题栏 ============ */
.map-header {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 1000;
    display: flex; align-items: center; gap: 12px;
    padding: 8px 26px;
    background: rgba(255, 253, 246, 0.9);
    border: 1px solid rgba(184, 134, 11, 0.45);
    border-radius: 40px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}
.header-ornament { width: 22px; height: 22px; opacity: 0.8; }
.header-title {
    font-family: var(--font-display);
    font-size: 26px; font-weight: 400;
    letter-spacing: 3px; color: var(--indigo);
}


/* ============ 左上角信息浮层卡 ============ */
.info-card {
    position: fixed; top: 120px; left: 22px; z-index: 1000;
    width: 320px; max-height: calc(100vh - 280px);
    display: flex; flex-direction: column;
    background: rgba(255, 253, 246, 0.95);
    border: 1px solid rgba(26, 42, 92, 0.2);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.info-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(90deg, var(--indigo), var(--indigo-light));
}
.info-badge {
    font-size: 13px; letter-spacing: 1px; color: var(--card);
    background: rgba(184, 134, 11, 0.9);
    padding: 2px 10px; border-radius: 10px;
}
.info-toggle {
    width: 26px; height: 26px; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, 0.2); color: var(--card);
    font-size: 16px; line-height: 1; cursor: pointer;
}
.info-toggle:hover { background: rgba(255, 255, 255, 0.35); }
.info-card-body { padding: 14px 16px 16px; overflow-y: auto; }
.info-title {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 400; color: var(--indigo);
    margin-bottom: 4px;
}
.info-time { font-size: 13px; color: var(--gold); font-weight: 700; margin-bottom: 6px; }
.info-route { font-size: 13px; color: var(--indigo-light); margin-bottom: 8px; }
.info-desc { font-size: 14px; line-height: 1.7; color: var(--text); }
.info-nodes {
    list-style: none; margin-top: 10px;
    display: flex; flex-direction: column; gap: 6px;
}
.info-nodes li {
    font-size: 13px; color: var(--text-soft);
    padding-left: 14px; position: relative;
}
.info-nodes li::before {
    content: "◆"; position: absolute; left: 0; top: 0;
    color: var(--gold); font-size: 10px;
}
.info-card.collapsed { max-height: 46px; }
.info-card.collapsed .info-card-body { display: none; }
/* 第三次迁徙（分流）播放时：信息卡自动移到页面下方，避免遮挡图腾 */
.info-card.info-card-bottom {
    top: auto;
    bottom: 100px;
    max-height: calc(100vh - 130px);
}

/* ============ 右下角图例 ============ */
.legend {
    position: fixed; right: 22px; bottom: 100px; z-index: 1000;
    background: rgba(255, 253, 246, 0.94);
    border: 1px solid rgba(26, 42, 92, 0.18);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px; color: var(--text-soft);
    display: flex; flex-direction: column; gap: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-line {
    display: inline-block; width: 28px; height: 4px; border-radius: 2px;
}
.line-m1 { background: var(--indigo); }
.line-m2 { background: var(--gold); }
.line-split { background: transparent; border-top: 3px dashed var(--split); height: 0; }
.line-settle { background: transparent; border: 2px dashed #5B9BD5; border-radius: 50%; width: 14px; height: 14px; }
.line-area { background: transparent; border: 2px dashed var(--gold); border-radius: 50%; width: 14px; height: 14px; }
.legend-ring {
    display: inline-block; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--gold);
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.8);
}
.legend-totem { font-size: 15px; }
.legend-totem img { width: 22px; height: 13px; vertical-align: middle; }

/* ============ 底部控制区 ============ */
.timeline-nav {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    z-index: 1000;
    display: flex; flex-direction: column; gap: 9px;
    background: rgba(255, 253, 246, 0.95);
    padding: 12px 14px; border-radius: 20px;
    border: 1px solid rgba(26, 42, 92, 0.18);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}
.tl-row {
    display: flex; gap: 10px; align-items: center; justify-content: center;
}
/* 播放进度条（点击 / 拖动跳转） */
.progress-wrap {
    position: relative;
    width: 100%;
    height: 8px;
    background: rgba(26, 42, 92, 0.12);
    border-radius: 4px;
    cursor: pointer;
}
.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 4px;
    transition: width 0.06s linear;
}
/* 进度条可拖动的小鱼头（素材总库手绘鱼纹 = 迁徙图腾，让人一眼看出可拖） */
.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 28px;
    height: auto;
    transform: translate(-50%, -50%) scaleX(-1);   /* 翻转：鱼头朝右（朝播放方向游） */
    transition: left 0.06s linear, transform 0.15s ease;
    pointer-events: none;   /* 拖动事件交给整条进度条 */
    filter: drop-shadow(0 1px 3px rgba(26, 42, 92, 0.55));
}
.progress-wrap:hover .progress-thumb,
.progress-wrap:active .progress-thumb {
    transform: translate(-50%, -50%) scaleX(-1) scale(1.25);
}
.tl-btn {
    font-family: var(--font-kai);
    font-size: 15px; color: var(--text);
    background: transparent;
    border: 1px solid rgba(26, 42, 92, 0.25);
 
.pause-btn { color: var(--indigo); }
.speed-btn { color: var(--text-soft); font-size: 13px; }   border-radius: 24px;
    padding: 6px 18px; cursor: pointer;
    transition: all 0.2s ease; line-height: 1.3;
}
.tl-btn small { color: var(--text-soft); font-size: 11px; }
.tl-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.tl-btn.active { background: var(--indigo); border-color: var(--indigo); color: var(--card); }
.tl-btn.active small { color: var(--gold-light); }
.play-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    border-color: var(--gold);
    color: var(--indigo-dark);
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(184, 134, 11, 0.4);
}
.play-btn:hover {
    color: var(--indigo-dark);
    border-color: var(--gold);
    transform: translateY(-1px);
}

/* ============ 地名标签（纯文字，无浮底） ============ */
/* 位置通过 pos-* 方位类控制，避开迁徙弧线，不与箭头互相遮挡 */
.place-label {
    font-family: var(--font-kai);
    font-size: 15px;
    font-weight: 700;
    color: var(--indigo);
    background: transparent;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 1px;
    /* inline-block：按文字实际宽度布局，避免被父容器压缩 */
    display: inline-block;
    line-height: 1.4;
    /* 白色描边让文字在彩色地形上清晰可读，无浮底 */
    text-shadow:
        -1px -1px 0 #fff, 1px -1px 0 #fff,
        -1px 1px 0 #fff, 1px 1px 0 #fff,
        0 0 4px #fff, 0 0 8px rgba(255,255,255,0.8);
}
/* 各方位偏移（divIcon 锚点为标签左上角，translate 相对自身） */
.pos-n  { transform: translate(-50%, -100%) translateY(-16px); }
.pos-ne { transform: translate(18px, -100%) translateY(-16px); }
.pos-e  { transform: translate(18px, -50%); }
.pos-se { transform: translate(18px, 16px); }
.pos-s  { transform: translate(-50%, 16px); }
.pos-sw { transform: translate(calc(-100% - 18px), 16px); }
.pos-w  { transform: translate(calc(-100% - 18px), -50%); }
.pos-nw { transform: translate(calc(-100% - 18px), -100%) translateY(-16px); }
.place-label.label-settle {
    color: var(--indigo);
    font-size: 15px;   /* 三都：与都柳江相当 */
    font-weight: 800;
}
.place-label.label-area {
    color: var(--indigo);
    font-size: 17px;   /* 荆楚地区、湘西桂北：字号更大 */
    font-weight: 800;
}
.place-label.label-sub {
    color: var(--text-soft);
    font-size: 13px;
}

/* ============ 动态光圈（脉冲） ============ */
.pulse-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--rc, var(--gold));
    box-shadow: 0 0 12px var(--rc, var(--gold));
    animation: pulse 1.3s ease-out infinite;
    position: relative;
}
.pulse-ring::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--rc, var(--gold));
    opacity: 0.6;
    animation: pulse 1.3s ease-out infinite 0.4s;
}
@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ============ 图腾（缩小版，沿路线行进） ============ */
.totem-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold));
    border: 2px solid var(--card);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}
.totem-fish {
    width: 20px;
    height: 12px;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.totem-halo {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(184, 134, 11, 0.65);
    animation: pulse 1.1s ease-out infinite;
}

/* Leaflet 图层容器透明 */
.leaflet-overlay-pane svg {
    overflow: visible;
}

/* 弧线流动虚线：静态弧线也有“迁徙行进”的动感（dash "14 8"，周期 22） */
path.flow-line {
    animation: flowDash 1.6s linear infinite;
}
@keyframes flowDash {
    to { stroke-dashoffset: -22; }
}

/* ============ 到达节点气泡 ============ */
.node-bubble {
    font-family: var(--font-kai);
    font-size: 13px;
    font-weight: 700;
    color: var(--card);
    background: var(--indigo);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 3px 12px;
    width: max-content;
    margin: 0 auto;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transform: translateY(-6px);   /* 锚点已落在节点，微上移一点更自然 */
    animation: bubbleIn 0.3s ease;
}
@keyframes bubbleIn {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(-6px); opacity: 1; }
}
