/* ==========================================
   派的院子 H5 页面核心样式表
   采用现代 CSS 变量、毛玻璃效果 (Glassmorphism) 及响应式布局
   ========================================== */

/* 1. 变量定义与主题配色 */
:root {
    --primary-color: #2d6a4f;      /* 森系深绿，与院子植被呼应 */
    --accent-color: #d4a373;       /* 雅致木色，金黄高亮 */
    --text-dark: #1b263b;          /* 深蓝灰字色，高对比度 */
    --text-light: #f4f6f9;         /* 浅色字色 */
    --glass-bg: rgba(255, 255, 255, 0.76); /* 弹窗毛玻璃背景色 */
    --glass-border: rgba(255, 255, 255, 0.6);  /* 弹窗玻璃边缘线 */
    --shadow-premium: 0 16px 40px rgba(0, 0, 0, 0.3); /* 阴影 */
    --font-outfit: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-zh: 'Noto Sans SC', "Microsoft YaHei", "PingFang SC", sans-serif;
}

/* 2. 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 消除移动端点击蓝色高亮 */
}

body {
    background-color: #12161a; /* 极暗背景，衬托页面容器 */
    color: var(--text-dark);
    font-family: var(--font-zh);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 3. 页面主容器 (限制最大宽度以模拟手机视口) */
#app {
    width: 100%;
    max-width: 540px; /* 适配大屏手机或PC端预览，防止图片过大失真 */
    background-color: #1a1f24;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: filter 0.3s ease;
}

/* 4. 互动地图核心区域 */
.map-container {
    position: relative;
    width: 100%;
    /* 高度由图片按比例自适应撑开 */
}

#map-bg {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

/* 5. 热区按钮与指示标记 */
.hotspot {
    position: absolute;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, border 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    border-radius: 8px;
}

/* 页面打开弹窗时，未选中的热区半透明并不可点击 */
.dialog-open .hotspot:not(.selected) {
    opacity: 0.15;
    pointer-events: none;
}

/* 选中雅座热区的聚光灯高亮效果 */
.hotspot.selected {
    z-index: 110 !important; /* 提升层级，显示在暗色遮罩之上 */
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(212, 163, 115, 0.9), inset 0 0 10px rgba(212, 163, 115, 0.4);
    background-color: rgba(255, 255, 255, 0.08); /* 保持微弱高亮，让被选中的区域非常清晰 */
    pointer-events: auto; /* 保证依然可以点击 */
}

/* 激活或点击态稍微缩放 */
.hotspot:active {
    transform: scale(0.95);
}

/* 数字标记圆标 */
.spot-label {
    position: relative;
    width: 22px;
    height: 22px;
    background-color: rgba(45, 106, 79, 0.85); /* 森系绿色半透明 */
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: #ffffff;
    font-family: var(--font-outfit);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 2;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

/* 悬停或获得焦点时，圆标变亮 */
.hotspot:hover .spot-label,
.hotspot:focus .spot-label {
    background-color: var(--accent-color);
    border-color: #ffffff;
}

/* 被选中时，圆标保持金色高亮状态 */
.hotspot.selected .spot-label {
    background-color: var(--accent-color);
    border-color: #ffffff;
    transform: scale(1.15);
}

/* 脉冲呼吸灯动效环 */
.pulse-ring {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 2px solid rgba(212, 163, 115, 0.8); /* 使用 accent 木金色呼吸圈 */
    border-radius: 50%;
    animation: pulse 2s infinite ease-out;
    z-index: 1;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* 6. 精致遮罩层 (去除了高斯模糊，仅保留半透明暗色，实现聚光灯对比) */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 20, 0.55); /* 稍微加深，突出清晰区域 */
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dialog-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 智能定位：热区在下方，弹窗贴近顶部显示 */
.dialog-overlay.pos-top {
    align-items: flex-start;
}

/* 智能定位：热区在上方，弹窗贴近底部显示 */
.dialog-overlay.pos-bottom {
    align-items: flex-end;
    padding-bottom: 92px; /* 增加底部内边距，完美避让悬浮在最底部的预定按钮 */
}

/* 7. 弹窗卡片 (Glassmorphism 极致打磨) */
.dialog-card {
    width: 100%;
    max-width: 380px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 28px 24px;
    position: relative;
    overflow: visible; /* 允许植物叶子装饰溢出边界，显得灵动 */
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

/* 从上方滑入动画 */
.dialog-overlay.pos-top.active .dialog-card {
    opacity: 1;
    transform: translateY(20px) scale(1);
}

.dialog-overlay.pos-top .dialog-card {
    transform: translateY(-20px) scale(0.9);
}

/* 从下方滑入动画 */
.dialog-overlay.pos-bottom.active .dialog-card {
    opacity: 1;
    transform: translateY(-20px) scale(1);
}

.dialog-overlay.pos-bottom .dialog-card {
    transform: translateY(20px) scale(0.9);
}

/* 8. 绿植树叶装饰 (SVG) */
.leaf-decor {
    position: absolute;
    pointer-events: none;
    z-index: -1; /* 放在内容层后方，不遮挡文字 */
}

/* 左上角树叶 */
.leaf-decor-top {
    top: -15px;
    left: -15px;
    transform-origin: bottom right;
    animation: leaf-breath-top 6s ease-in-out infinite alternate;
}

/* 右下角树叶 */
.leaf-decor-bottom {
    bottom: -15px;
    right: -15px;
    transform-origin: top left;
    animation: leaf-breath-bottom 6s ease-in-out infinite alternate;
}

@keyframes leaf-breath-top {
    0% {
        transform: scale(1) rotate(-8deg);
        filter: drop-shadow(0 2px 5px rgba(45, 106, 79, 0.1));
    }
    100% {
        transform: scale(1.06) rotate(2deg);
        filter: drop-shadow(0 4px 10px rgba(45, 106, 79, 0.2));
    }
}

@keyframes leaf-breath-bottom {
    0% {
        transform: scale(1) rotate(172deg);
        filter: drop-shadow(0 -2px 5px rgba(45, 106, 79, 0.1));
    }
    100% {
        transform: scale(1.06) rotate(182deg);
        filter: drop-shadow(0 -4px 10px rgba(45, 106, 79, 0.2));
    }
}

/* 9. 关闭按钮 */
.dialog-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #4a5768;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.25s ease, color 0.25s ease;
    z-index: 10;
}

.dialog-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* 10. 弹窗内容排版 */
.dialog-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dialog-seat-name {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 8px;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0) 100%);
    margin-bottom: 18px;
}

/* 属性详情行 */
.seat-info-item {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.seat-info-item .label {
    font-size: 13px;
    color: #5c6a79;
    font-weight: 500;
}

.seat-info-item .value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.seat-info-item .value.highlight {
    font-family: var(--font-zh);
    color: var(--primary-color);
}

/* 确认按钮 */
.dialog-action-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px 20px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 14px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.25);
    transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.dialog-action-btn:hover {
    background-color: #1b4d3e;
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.35);
}

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

/* 11. 底部悬浮预定按钮 (position: fixed 常驻视口最底下) */
.call-btn {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: calc(100% - 48px);
    max-width: 340px;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1b4d3e 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1.2px;
    box-shadow: 0 4px 16px rgba(45, 106, 79, 0.35);
    z-index: 90; /* 保证浮于地图上方，但在弹窗遮罩(z-index: 100)下方，开启弹窗时被优雅压暗 */
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.call-btn:hover {
    background: linear-gradient(135deg, #387c5c 0%, #205c4a 100%);
    box-shadow: 0 6px 20px rgba(45, 106, 79, 0.45);
}

.call-btn:active {
    transform: translateX(-50%) scale(0.97); /* 保持水平居中位移，仅应用缩放 */
    box-shadow: 0 2px 8px rgba(45, 106, 79, 0.2);
}

.phone-icon {
    stroke-width: 2.2;
    animation: phone-wiggle 4s ease-in-out infinite;
}

/* 电话抖动微动效，增强用户点击欲望 */
@keyframes phone-wiggle {
    0%, 85%, 100% { transform: rotate(0); }
    87% { transform: rotate(-12deg); }
    89% { transform: rotate(12deg); }
    91% { transform: rotate(-10deg); }
    93% { transform: rotate(10deg); }
    95% { transform: rotate(-6deg); }
    97% { transform: rotate(6deg); }
}

/* ==========================================
   12. 随机实景照片展示区样式 (高级动效)
   ========================================== */
.random-photo-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 20px; /* 恢复左右内边距，展现卡片式布局 */
    background-color: #12161a;
    transition: max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease, padding 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 激活展开状态 */
.random-photo-container.active {
    max-height: 700px;
    opacity: 1;
    padding: 24px 20px 100px 20px; /* 底部预留 100px 边距，完美避让悬浮按钮 */
}

/* 标题外框，横向 flex 布局以实现两边虚线自适应延伸 */
.photo-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.random-photo-container.active .photo-title-wrapper {
    opacity: 1;
    transform: translateY(0);
}

/* 两侧的虚线装饰 */
.photo-title-wrapper::before,
.photo-title-wrapper::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.15); /* 虚线样式 */
}

/* 实拍照片标题文本 */
.photo-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color); /* 优雅木金 */
    letter-spacing: 4px;
    flex-shrink: 0;
}

/* 恢复之前的精致卡片样式 */
.photo-card {
    background-color: #1a1f24;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.5s ease 0.3s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}

.random-photo-container.active .photo-card {
    opacity: 1;
    transform: scale(1);
}

/* 图片外框，恢复圆角 */
.photo-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 12px; /* 恢复圆角 */
    overflow: hidden;
    background-color: #12161a;
}

#random-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px; /* 恢复圆角 */
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* 图片加载完成后显示 */
.photo-frame.loaded #random-photo {
    opacity: 1;
}

/* 图片加载骨架屏，恢复圆角 */
.image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #1f272f 25%, #2a343e 50%, #1f272f 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    z-index: 1;
    opacity: 1;
    border-radius: 12px;
    transition: opacity 0.3s ease;
}

/* 加载成功后隐藏骨架屏 */
.photo-frame.loaded .image-skeleton {
    opacity: 0;
    pointer-events: none;
}

@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================
   13. 极具仪式感的双对开门开屏字幕转场样式
   ========================================== */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    pointer-events: auto; /* 阻挡后续点击 */
}

/* 开门动作完成，彻底销毁/隐藏遮罩 */
.intro-overlay.hidden {
    display: none !important;
}

/* 左右分屏的“门板” (改用深邃的高级墨绿色幕布) */
.intro-door {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    background: linear-gradient(135deg, #112a1f 0%, #05140e 100%); /* 森系暗色渐变 */
    z-index: 1;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.75); /* 边缘内阴影营造质感幕布凹凸感 */
    transition: transform 1.5s cubic-bezier(0.645, 0.045, 0.355, 1); /* 更优雅的幕布滑开物理阻尼 */
}

.door-left {
    left: 0;
    border-right: 1px solid rgba(212, 163, 115, 0.25); /* 左右中缝点缀金色饰线 */
}

.door-right {
    right: 0;
    border-left: 1px solid rgba(212, 163, 115, 0.25); /* 左右中缝点缀金色饰线 */
}

/* 向两侧对开拉门效果 */
.intro-overlay.open .door-left {
    transform: translateX(-100%);
}

.intro-overlay.open .door-right {
    transform: translateX(100%);
}

/* 字幕文本容器 */
.intro-text-container {
    position: relative;
    z-index: 3; /* 将层级提到落叶(z-index: 2)之上，以保证文字清晰易读 */
    width: 100%;
    max-width: 360px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

/* 一句一句字幕样式 (同一中心点重叠，利用 JS 切换状态) */
.intro-line {
    position: absolute;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 4px;
    text-align: center;
    white-space: nowrap;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 重点突出“派的院子”等信息为金色 */
#intro-line-1 {
    color: var(--accent-color);
    font-weight: 600;
}

/* 重点突出字幕内部的重点词语为金色 */
.highlight-text {
    color: var(--accent-color);
    font-weight: 600;
}

/* 激活淡入 */
.intro-line.active {
    opacity: 1;
    transform: translateY(0);
}

/* 退出淡出 */
.intro-line.exit {
    opacity: 0;
    transform: translateY(-16px);
}

/* 异步等待加载指示器 */
.intro-loader {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(212, 163, 115, 0.15);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: intro-spin 0.8s linear infinite;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.intro-loader.show {
    opacity: 0.75;
}

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

/* ==========================================
   14. 动态落叶雨飘零样式 (层级位于门板之上，文字之下)
   ========================================== */
.leaf-rain-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2; /* 浮于门板(z-index: 1)之上，文字(z-index: 3)之下 */
    overflow: hidden;
}

.intro-leaf {
    position: absolute;
    width: 28px;
    height: 28px;
    pointer-events: none;
    transform-origin: center;
    /* 通过 JS 分配随机延时、速度和位置，使用 leaf-flutter 动画 */
    animation: leaf-flutter linear infinite;
    opacity: 0;
}

/* 落叶飘落 + 左右横摆摇曳 + 双轴3D翻转动画 */
@keyframes leaf-flutter {
    0% {
        top: -8%;
        transform: translateX(0) rotate(0deg) rotateY(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.75;
    }
    90% {
        opacity: 0.75;
    }
    100% {
        top: 108%;
        transform: translateX(140px) rotate(640deg) rotateY(360deg);
        opacity: 0;
    }
}


