/* ===================================================
   设计变量：深夜书桌 —— 暖琥珀灯光 + 冷夜青 + 衬线标题
   =================================================== */
:root {
    --ink: #eef0f6;
    --ink-dim: rgba(238, 240, 246, 0.62);
    --ink-faint: rgba(238, 240, 246, 0.36);

    --bg-deep: #0b0c14;
    --bg-panel: rgba(19, 21, 32, 0.66);

    --amber: #eaa64d;
    --amber-soft: rgba(234, 166, 77, 0.14);
    --amber-line: rgba(234, 166, 77, 0.32);

    --teal: #6fd9c9;
    --teal-soft: rgba(111, 217, 201, 0.12);
    --teal-line: rgba(111, 217, 201, 0.3);

    --line: rgba(238, 240, 246, 0.08);
    --line-strong: rgba(238, 240, 246, 0.14);

    --radius-lg: 1.75rem;
    --radius-md: 1.1rem;
    --radius-sm: 0.7rem;

    --font-display: 'Noto Serif SC', 'Songti SC', serif;
    --font-body: 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Noto Sans SC', monospace;
}

/* 全局重置与字体 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    min-height: 100vh;
    background: var(--bg-deep);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    color: var(--ink);
}

/* 主卡片容器 */
.card {
    position: relative;
    max-width: 1100px;
    width: 100%;
    background: var(--bg-panel);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.8rem 3rem;
    box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.8), inset 0 1px 1px rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    overflow: hidden;
    transition: background 0.3s;
}

/* SVG 背景图形 */
.bg-art {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    overflow: hidden;
    border-radius: var(--radius-lg);
}
.bg-art svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 内容层 */
.content {
    position: relative;
    z-index: 1;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1.1rem;
}

.logo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
    color: var(--amber);
}
.logo span {
    font-weight: 400;
    color: var(--ink-faint);
}

/* 导航：滑动胶囊标签 */
.nav {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 999px;
}
.nav-indicator {
    position: absolute;
    top: 0.3rem;
    bottom: 0.3rem;
    left: 0.3rem;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--amber-soft), var(--teal-soft));
    border: 1px solid var(--amber-line);
    transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1), width 0.35s cubic-bezier(0.65, 0, 0.35, 1);
    z-index: 0;
    pointer-events: none;
}
.nav button {
    position: relative;
    z-index: 1;
    background: transparent;
    border: 1px solid transparent;
    padding: 0.45rem 1.1rem;
    border-radius: 2rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-dim);
    cursor: pointer;
    transition: color 0.25s;
    letter-spacing: 0.3px;
}
.nav button:hover {
    color: #fff;
}
.nav button.active {
    color: #fff;
}

/* 页面区块 */
.page {
    display: none;
    animation: fadeUp 0.4s ease-out;
}
.page.active {
    display: block;
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 首页 (Hero) */
.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

/* 台灯光晕：跟随光标（由 script.js 设置 --mx / --my） */
.lamp-glow {
    position: absolute;
    inset: -3rem -1rem;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(360px circle at var(--mx, 30%) var(--my, 10%), rgba(234, 166, 77, 0.16), transparent 62%);
    transition: background 0.15s ease-out;
}

.hero-image {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 200px;
    border-radius: 1.8rem;
    overflow: hidden;
    background: radial-gradient(circle at 20% 30%, #2b2416, #12141f);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
}
.hero-image svg {
    width: 80%;
    height: 80%;
    opacity: 0.75;
    filter: drop-shadow(0 0 30px rgba(234, 166, 77, 0.18));
}

.hero-text {
    position: relative;
    z-index: 1;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--teal);
    background: var(--teal-soft);
    border: 1px solid var(--teal-line);
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.hero-text h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--ink);
    line-height: 1.25;
}
.hero-text h1 mark {
    background: none;
    color: var(--amber);
    position: relative;
}
.hero-text h1 mark::after {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: 0.06em;
    height: 0.32em;
    background: var(--amber-soft);
    z-index: -1;
    border-radius: 2px;
}
.hero-text p {
    font-size: 1.05rem;
    color: var(--ink-dim);
    max-width: 600px;
    margin-top: 1rem;
    line-height: 1.7;
    border-left: 3px solid var(--amber-line);
    padding-left: 1.2rem;
}

/* 通用小节标题 */
.section-title {
    color: var(--ink-dim);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    margin-bottom: 1.4rem;
}

/* 占位区块 */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    padding: 2rem 0;
}
.placeholder .tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--teal);
    background: var(--teal-soft);
    border: 1px solid var(--teal-line);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1.1rem;
}
.placeholder .icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    background: var(--amber-soft);
    border: 1px solid var(--amber-line);
    margin-bottom: 1.2rem;
}

/* ===== 小工具：答案之书 ===== */
.answerbook {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    padding: 1rem 0 2rem;
    max-width: 640px;
    margin: 0 auto;
}

.answerbook-intro h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0.7rem 0 0.8rem;
}

.answerbook-intro p {
    color: var(--ink-dim);
    line-height: 1.75;
    font-size: 0.98rem;
}

.answerbook-note {
    color: var(--ink-faint) !important;
    font-size: 0.85rem !important;
    margin-top: 0.6rem !important;
}

.answerbook-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    background: linear-gradient(160deg, rgba(234, 166, 77, 0.08), rgba(111, 217, 201, 0.05));
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 2.4rem 2rem;
}

.answerbook-display {
    min-height: 3.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.5;
    padding: 0 1rem;
    transition: opacity 0.08s linear;
}
.answerbook-display.is-scrambling {
    color: var(--teal);
    opacity: 0.7;
}
.answerbook-display.is-revealed {
    animation: answerReveal 0.4s ease-out;
}
@keyframes answerReveal {
    0% { opacity: 0; transform: translateY(6px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.answerbook-btn {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: var(--amber-soft);
    border: 1px solid var(--amber-line);
    padding: 0.7rem 1.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.answerbook-btn:hover {
    background: rgba(234, 166, 77, 0.24);
}
.answerbook-btn:active {
    transform: scale(0.97);
}
.answerbook-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 480px) {
    .answerbook-card { padding: 1.8rem 1.2rem; }
    .answerbook-display { font-size: 1.2rem; }
}
.placeholder h2 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--ink-dim);
    margin-bottom: 0.6rem;
}
.placeholder p {
    color: var(--ink-faint);
    max-width: 400px;
    line-height: 1.6;
}

/* ===== 图库样式 ===== */
.gallery-container {
    padding: 0.5rem 0;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.2rem;
    margin-top: 0.5rem;
}
.gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s, border-color 0.25s;
    cursor: pointer;
}
.gallery-item:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: var(--amber-line);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.empty-tip {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--ink-faint);
    padding: 3rem 0;
    font-size: 1.1rem;
}

/* ===== 大图模态框 ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.lightbox-overlay.active img {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    background: none;
    border: none;
    transition: 0.2s;
    line-height: 1;
}
.lightbox-close:hover {
    color: #fff;
    transform: rotate(90deg);
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    font-size: 2.5rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.2s;
    z-index: 10;
    user-select: none;
}
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0, 0, 0, 0.7);
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    z-index: 10;
    backdrop-filter: blur(4px);
}

/* 响应式 */
@media (max-width: 700px) {
    .card { padding: 1.8rem 1.2rem 2rem; }
    .header { flex-direction: column; align-items: stretch; gap: 0.8rem; }
    .nav { justify-content: center; }
    .hero-text h1 { font-size: 2.2rem; }
    .hero-image { height: 150px; }
}
@media (max-width: 450px) {
    .nav button { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
}

/* ===== 烟花页面容器 ===== */
#page-fireworks .placeholder {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    min-height: 300px;
    flex: 1 1 auto;
    width: 100%;
}
#page-fireworks .placeholder .hint {
    color: var(--ink-faint);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.iframe-wrapper {
    width: 100%;
    max-width: 100%;      /* 原来卡在 800px，桌面端看起来偏小；现在跟随卡片实际宽度铺满 */
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 0 auto;
    padding-bottom: 0;
}

.iframe-wrapper iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 800 / 507;
    max-width: 100%;
    max-height: 74vh;      /* 防止在超宽的桌面卡片里高度也跟着涨到超出视口 */
    background: #000;
    border-radius: var(--radius-md);
    border: 1px dashed var(--line-strong);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* 竖屏手机：烟花尽量占满屏幕，底部贴合 */
@media (orientation: portrait) and (max-width: 768px) {
    #page-fireworks .placeholder {
        min-height: 0;
        height: calc(100vh - 280px);
        justify-content: flex-end;
        padding: 0;
    }

    .iframe-wrapper {
        max-width: 100%;
        height: 100%;
        flex: 0 0 auto;
        align-items: flex-end;
        padding-bottom: 0;
    }

    .iframe-wrapper iframe {
        width: 100%;
        height: 100%;
        aspect-ratio: auto;
        max-height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        object-fit: cover;
    }

    #page-fireworks .placeholder .hint {
        display: none;
    }

    #page-fireworks .placeholder .section-title {
        margin-bottom: 0.25rem;
        font-size: 1.1rem;
    }
}

/* ===== 计数日样式（票根风格） ===== */
#page-counter .placeholder {
    background: transparent;
    min-height: auto;
    padding: 0.5rem 0;
}

.counter-container {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.counter-title {
    padding-left: 0.5rem;
}

.counter-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.counter-item {
    background-color: rgba(18, 20, 32, 0.55);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, border-color 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.counter-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--amber-line);
}

.counter-label {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    word-break: break-word;
}

.counter-label .emoji {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.counter-value {
    color: #fff;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    background: var(--amber-soft);
    border: 1px solid var(--amber-line);
    padding: 0.15rem 0.7rem;
    border-radius: 2rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.counter-value.highlight {
    background: rgba(255, 200, 50, 0.22);
    border-color: rgba(255, 200, 50, 0.4);
    color: #ffd866;
}

/* 小屏手机 */
@media (max-width: 480px) {
    .counter-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        padding: 0.8rem 1rem;
        border-radius: var(--radius-sm);
    }

    .counter-label {
        font-size: 0.85rem;
        width: 100%;
        color: rgba(255, 255, 255, 0.85);
    }

    .counter-value {
        font-size: 0.85rem;
        white-space: normal;
        word-break: break-all;
        align-self: flex-start;
        margin-left: 1.8rem;
        background: var(--amber-soft);
    }

    .counter-container {
        padding: 0.2rem 0.3rem;
    }
}

/* 横屏模式（手机横屏，高度受限） */
@media (orientation: landscape) and (max-height: 500px) {
    .counter-container {
        padding: 0.2rem 0.5rem;
        max-width: 90%;
        background: rgba(0, 0, 0, 0.15);
    }

    .counter-item {
        padding: 0.4rem 0.8rem;
        gap: 0.2rem;
        border-radius: 0.6rem;
        background: rgba(18, 20, 32, 0.6);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    .counter-label {
        font-size: 0.8rem;
        gap: 0.3rem;
        color: rgba(255, 255, 255, 0.85);
    }

    .counter-label .emoji {
        font-size: 1rem;
    }

    .counter-value {
        font-size: 0.8rem;
        padding: 0.05rem 0.5rem;
    }

    .counter-list {
        gap: 0.4rem;
    }
}