/* ==========================================
   1. Mobile First Reset 和 全局样式
   ========================================== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 隐藏滚动条，实现满屏显示 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei"; 
    color: #FFFFFF; 
    background-color: #000000; 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
}

/* 地图容器样式 */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* 最底层 */
    background-color: #000000; 
}

/* ==========================================
   2. UI 覆盖层样式 (主要文本显示区域)
   ========================================== */
#text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* 穿透点击，让底层地图接收交互 */
    
    /* Flexbox 绝对居中布局 (最适合 html2canvas 截图) */
    display: flex;
    justify-content: center;
    align-items: center;
    
    text-align: center;
    color: #ffffff;
    padding: 0 20px;
    box-sizing: border-box;
    
    /* 核心动画过渡 */
    transition: opacity 0.5s ease-in-out; 
}

#text-overlay p {
    margin: 0; 
    /* 使用纯净的 vw 单位确保多端兼容 */
    font-size: 8vw; 
    font-weight: 300; 
    line-height: 1.4; 
    color: #FFFFFF; 
    text-shadow: 0 2px 10px rgba(0,0,0,0.5); /* 增加文字阴影，防止在地图亮色区域看不清 */
}

/* 坐标信息显示区域样式 */
#coordinates-info {
    position: absolute;
    left: 15px;
    bottom: 30px; 
    z-index: 10; 
    font-size: 0.85em; 
    color: #888888; 
    opacity: 0.9; 
    padding: 5px 10px; 
}

/* 隐藏 Leaflet 地图的版权信息，保持极简 */
.leaflet-control-attribution {
    display: block !important;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ==========================================
   3. 作者信息与社交互动区
   ========================================== */

/* 左上角作者信息 */
#author-info {
    position: absolute;
    top: 40px; 
    left: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 15px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.5s ease;
}

#author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    background-color: #222;
    image-rendering: pixelated; /* 优化像素头像清晰度 */
}

#author-name {
    font-size: 0.95em;
    color: #FFFFFF;
    font-weight: 500;
    text-shadow: 0 1px 5px rgba(0,0,0,0.8);
}

/* 右侧互动按钮侧边栏 */
#action-sidebar {
    position: absolute;
    right: 15px;
    bottom: 25%; 
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: opacity 0.5s ease;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    opacity: 0.8;
    transition: transform 0.2s, opacity 0.2s;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn .icon {
    font-size: 1.8em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); 
}

.action-btn .count {
    font-size: 0.75em;
    color: #FFFFFF;
    margin-top: 5px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ==========================================
   4. 右下角系统控制区 (音乐按钮 + 分享按钮)
   ========================================== */
#system-controls {
    position: absolute;
    right: 15px;
    bottom: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.sys-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.sys-btn:active {
    transform: scale(0.9);
}

.btn-label {
    position: absolute;
    bottom: -18px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    letter-spacing: 1px;
}

/* 音乐声波动画 */
.waveform {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.bar {
    width: 3px;
    height: 4px;
    background: #fff;
    border-radius: 2px;
    transition: height 0.2s, background 0.3s;
}

/* 播放状态下的跳动动画 */
.playing .bar {
    background: #007AFF; 
    animation: bar-dance 0.8s infinite alternate;
}

.playing .bar-1 { animation-delay: 0s; }
.playing .bar-2 { animation-delay: 0.2s; height: 10px; }
.playing .bar-3 { animation-delay: 0.4s; }

@keyframes bar-dance {
    from { height: 4px; }
    to { height: 16px; }
}

/* ==========================================
   5. 模态框、波纹与 Toast 动画
   ========================================== */

/* 截图明信片模态框 */
#screenshot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); 
    z-index: 9999; 
    display: none; /* 由 JS 控制切换显示 */
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    padding: 20px;
    box-sizing: border-box;
    opacity: 0; 
    transition: opacity 0.3s ease-in-out;
}

#screenshot-modal.modal-show {
    display: flex;
    opacity: 1; 
}

#screenshot-modal img {
    max-width: 90%; 
    max-height: 75vh; 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 8px;
    object-fit: contain; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); /* 增加明信片的悬浮感 */
}

#screenshot-modal p {
    margin-top: 20px;
    font-size: 1em;
    color: #AAAAAA;
    text-align: center;
    letter-spacing: 2px; 
}

/* 双击波纹动画 */
@keyframes ripple-animation {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

.ripple {
    position: absolute;
    width: 60px;   
    height: 60px;  
    border: 1px solid #FFFFFF; 
    border-radius: 50%; 
    pointer-events: none; 
    animation: ripple-animation 0.8s ease-out forwards; 
    z-index: 100; 
}

/* 底部胶囊 Toast */
.toast {
    position: absolute;
    bottom: 15vh; 
    left: 50%;
    transform: translateX(-50%); 
    z-index: 1000; 
    background-color: rgba(0, 0, 0, 0.85); 
    color: #FFFFFF; 
    padding: 12px 24px;
    border-radius: 30px; 
    font-size: 0.95em;
    text-align: center;
    white-space: nowrap; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s ease-in-out; 
    border: 1px solid rgba(255,255,255,0.1);
}

.toast-show {
    opacity: 1; 
    visibility: visible; 
}

/* ==========================================
   6. 状态控制工具类
   ========================================== */
.fade-out {
    opacity: 0 !important;
}

.ui-fade-out {
    opacity: 0 !important;
}

.active-blue {
    filter: drop-shadow(0 0 10px #007AFF) !important; 
    color: #007AFF !important;
    transform: scale(1.2); 
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Comment Drawer */
body.comment-open {
    overflow: hidden;
}

#comment-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
}

#comment-modal.show {
    display: block;
}

.comment-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.comment-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(72vh, 620px);
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.98) 0%, rgba(7, 7, 7, 0.98) 100%);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.28s ease-out;
    display: flex;
    flex-direction: column;
}

#comment-modal.show .comment-sheet {
    transform: translateY(0);
}

.comment-sheet-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 600;
}

#comment-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 9px 0;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3a3a3a 0%, #1e1e1e 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.comment-body {
    min-width: 0;
}

.comment-user {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 4px;
}

.comment-text {
    font-size: 14px;
    color: #ffffff;
    line-height: 1.45;
    word-break: break-word;
}

.comment-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 4px;
}

.comment-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.55);
}

#comment-input {
    flex: 1;
    height: 38px;
    border-radius: 19px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}

#comment-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

#comment-send {
    height: 38px;
    border-radius: 19px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #1272ff;
    color: #fff;
    padding: 0 14px;
    font-weight: 600;
    cursor: pointer;
}
