:root {
            --bg: #040206;
            --text: rgba(240, 236, 248, 0.92);
            --text-dim: rgba(180, 174, 205, 0.6);
            --accent: #b39dff;
            --accent-ice: #7cd4fd;
            --accent-warm: #ffb8d9;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            background: var(--bg);
            color: var(--text);
            font-family: "Manrope", "Noto Serif SC", serif;
            height: 100vh;
            overflow: hidden;
        }

        /* ---- 3D 视口 ---- */
        #scene {
            position: fixed;
            inset: 0;
            z-index: 1;
        }
        #scene canvas { display: block; }

        .hidden { display: none !important; }

        /* ---- 玻璃态 ---- */
        .void-glass {
            background: rgba(255, 255, 255, 0.02);
            backdrop-filter: blur(16px) saturate(120%);
            -webkit-backdrop-filter: blur(16px) saturate(120%);
            border: 1px solid rgba(255, 255, 255, 0.06);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 32px rgba(0, 0, 0, 0.4);
        }
        .void-glass-strong {
            background: rgba(255, 255, 255, 0.04);
            backdrop-filter: blur(24px) saturate(140%);
            -webkit-backdrop-filter: blur(24px) saturate(140%);
            border: 1px solid rgba(255, 255, 255, 0.10);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 12px 48px rgba(0, 0, 0, 0.5);
        }

        .font-heading { font-family: "Cormorant Garamond", "Noto Serif SC", serif; }

        /* ---- 顶部导航 ---- */
        #navbar {
            position: fixed;
            top: 0; left: 0; right: 0;
            z-index: 15;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1.2rem 1.8rem;
            pointer-events: none;
            opacity: 0;
            transition: opacity 1.5s ease;
        }
        #navbar.show { opacity: 1; }
        #navbar .brand {
            font-family: "Cormorant Garamond", "Noto Serif SC", serif;
            font-style: italic;
            font-weight: 600;
            font-size: 1.15rem;
            letter-spacing: 0.08em;
            color: rgba(240, 236, 248, 0.85);
        }
        #navbar .count {
            font-size: 0.72rem;
            font-weight: 300;
            letter-spacing: 0.2em;
            color: var(--text-dim);
        }

        /* ---- 悬停日期标签 ---- */
        #star-tip {
            position: fixed;
            z-index: 18;
            pointer-events: none;
            padding: 0.3rem 0.7rem;
            border-radius: 0.5rem;
            font-size: 0.72rem;
            font-weight: 300;
            letter-spacing: 0.2em;
            color: rgba(240, 236, 248, 0.9);
            white-space: nowrap;
            opacity: 0;
            transform: translate(-50%, -140%);
            transition: opacity 0.25s;
        }
        #star-tip.show { opacity: 1; }

        /* ---- 星之锁 ---- */
        .gate-wrap {
            position: fixed;
            inset: 0;
            z-index: 30;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 1.5rem;
            background: rgba(4, 2, 6, 0.55);
            transition: opacity 1s ease, visibility 1s;
        }
        .gate-wrap.unlocked {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        .gate {
            width: 100%;
            max-width: 30rem;
            text-align: center;
            padding: 2.8rem 2rem 2.2rem;
            border-radius: 1.25rem;
            animation: gateIn 1.4s ease both;
            transition: transform 0.18s ease-out;
            will-change: transform;
        }
        @keyframes gateIn {
            from { opacity: 0; filter: blur(8px); }
            to   { opacity: 1; filter: blur(0); }
        }
        .gate.shake { animation: gateShake 0.45s ease; }
        @keyframes gateShake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-4px); }
            50% { transform: translateX(3px); }
            75% { transform: translateX(-2px); }
        }
        .gate h1 {
            font-style: italic;
            font-weight: 600;
            font-size: 1.6rem;
            letter-spacing: 0.3em;
            text-indent: 0.3em;
            margin-bottom: 0.6rem;
            background: linear-gradient(120deg, #cfc4ff, #ffb8d9);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .gate h2 {
            font-size: 0.85rem;
            font-weight: 300;
            color: var(--text-dim);
            letter-spacing: 0.18em;
            margin-bottom: 1.8rem;
        }

        .dials {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: flex-start;
            gap: 0.5rem;
            margin-bottom: 1.6rem;
        }
        .dial-unit {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.45rem;
        }
        .dial-group { display: flex; gap: 0.45rem; }
        .dial-sep {
            align-self: center;
            padding-bottom: 1.4rem;
            color: rgba(179, 157, 255, 0.4);
            font-size: 1.1rem;
        }
        .dial-group-label {
            font-size: 0.68rem;
            letter-spacing: 0.35em;
            text-indent: 0.35em;
            color: rgba(180, 174, 205, 0.5);
        }
        .dial {
            width: 3rem;
            height: 3.7rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.15rem;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 0.8rem;
            color: var(--text);
            cursor: grab;
            touch-action: none;
            transition: border-color 0.4s, box-shadow 0.4s;
            -webkit-tap-highlight-color: transparent;
            user-select: none;
            -webkit-user-select: none;
        }
        .dial:active { cursor: grabbing; }
        .dial:hover {
            border-color: rgba(124, 212, 253, 0.45);
            box-shadow: 0 0 14px rgba(124, 212, 253, 0.15);
        }
        .dial .dial-star {
            display: inline-block;
            font-size: 0.7rem;
            color: rgba(179, 157, 255, 0.6);
        }
        /* 拨动数字时星标闪一下金光 */
        .dial.spark .dial-star {
            animation: starSpark 0.45s ease;
        }
        @keyframes starSpark {
            0% {
                color: var(--gold, #ffd9a0);
                text-shadow: 0 0 14px rgba(255, 217, 160, 1);
                transform: scale(1.8);
            }
            100% {
                color: rgba(179, 157, 255, 0.6);
                text-shadow: none;
                transform: scale(1);
            }
        }
        .dial .dial-num {
            font-size: 1.25rem;
            font-weight: 300;
            font-variant-numeric: tabular-nums;
        }

        .gate-submit {
            width: 100%;
            padding: 0.72rem;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(124, 212, 253, 0.35);
            border-radius: 0.7rem;
            color: #cfe9fb;
            font-size: 0.9rem;
            font-family: inherit;
            letter-spacing: 0.4em;
            text-indent: 0.4em;
            cursor: pointer;
            transition: box-shadow 0.3s, border-color 0.3s, transform 0.2s;
        }
        .gate-submit:hover {
            border-color: rgba(124, 212, 253, 0.7);
            box-shadow: 0 0 22px rgba(124, 212, 253, 0.25);
            transform: translateY(-1px);
        }
        .gate-submit:active { transform: translateY(0); }

        .gate .gate-feedback {
            min-height: 1.4em;
            margin-top: 1rem;
            font-size: 0.82rem;
            letter-spacing: 0.12em;
            color: var(--accent);
            opacity: 0;
            transition: opacity 0.4s;
        }
        .gate .gate-feedback.show { opacity: 1; }
        .gate .gate-attempts {
            margin-top: 0.35rem;
            font-size: 0.7rem;
            letter-spacing: 0.2em;
            color: rgba(180, 174, 205, 0.45);
        }
        .gate .gate-hint {
            margin-top: 0.9rem;
            font-size: 0.78rem;
            font-weight: 300;
            color: var(--text-dim);
            letter-spacing: 0.15em;
            animation: hintPulse 3.5s ease-in-out infinite;
        }

        /* ---- 星海覆盖层 ---- */
        #ocean-ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

        #hint {
            position: absolute;
            bottom: 9vh;
            left: 0; right: 0;
            text-align: center;
            font-size: 0.8rem;
            font-weight: 300;
            letter-spacing: 0.3em;
            text-indent: 0.3em;
            color: rgba(179, 157, 255, 0.55);
            animation: hintPulse 3s ease-in-out infinite;
            transition: opacity 1.2s;
        }
        #hint.gone { opacity: 0; }
        @keyframes hintPulse {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.8; }
        }

        #ocean-footer {
            position: absolute;
            bottom: 2.5vh;
            left: 0; right: 0;
            text-align: center;
            font-size: 0.7rem;
            font-weight: 300;
            letter-spacing: 0.2em;
            color: rgba(180, 174, 205, 0.4);
            transition: opacity 0.4s;
        }
        #ocean-footer:hover { color: rgba(180, 174, 205, 0.7); }

        /* ---- 日记卡片 ---- */
        #entry-card {
            position: fixed;
            z-index: 20;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: min(28rem, calc(100vw - 3rem));
            max-height: 70vh;
            display: flex;
            flex-direction: column;
            padding: 2.2rem 2.4rem 1.8rem;
            border-radius: 1rem;
            animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
        }
        #entry-card.closing { animation: cardOut 0.5s ease both; }
        @keyframes cardIn {
            from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
            to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        }
        @keyframes cardOut {
            from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            to   { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
        }

        #entry-card .card-head {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin-bottom: 1.2rem;
        }
        #entry-card .card-dot {
            width: 0.6rem;
            height: 0.6rem;
            border-radius: 50%;
            flex-shrink: 0;
        }
        #entry-card .card-date {
            font-size: 0.72rem;
            font-weight: 300;
            letter-spacing: 0.25em;
            color: var(--text-dim);
        }
        #entry-card .card-text {
            overflow-y: auto;
            font-family: "Cormorant Garamond", "Noto Serif SC", serif;
            font-size: 1.08rem;
            line-height: 2;
            color: rgba(240, 236, 248, 0.9);
            letter-spacing: 0.3px;
            scrollbar-width: thin;
            scrollbar-color: rgba(179,157,255,0.3) transparent;
        }
        #entry-card .card-close {
            position: absolute;
            top: 0.8rem;
            right: 1rem;
            background: none;
            border: none;
            color: var(--text-dim);
            font-size: 1rem;
            cursor: pointer;
            padding: 0.3rem;
            transition: color 0.3s;
        }
        #entry-card .card-close:hover { color: var(--accent-warm); }

        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(20px); }
            to   { opacity: 1; transform: translateY(0); }
        }

/* ---- 小屏适配 ---- */
@media (max-width: 480px) {
    .gate { padding: 2.2rem 1.2rem 1.8rem; }
    .dial {
        width: 2.55rem;
        height: 3.2rem;
        border-radius: 0.65rem;
    }
    .dial .dial-num { font-size: 1.1rem; }
    .dial-group { gap: 0.35rem; }
    .dials { gap: 0.4rem; }
    #navbar { padding: 1rem 1.2rem; }
}

/* ---- 解锁瞬间的星光闪白 ---- */
#flash {
    position: fixed;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%,
        rgba(235, 228, 255, 0.95),
        rgba(170, 140, 255, 0.5) 40%,
        transparent 75%);
}
#flash.go { animation: flashOut 1.1s ease-out both; }
@keyframes flashOut {
    0% { opacity: 0; }
    22% { opacity: 1; }
    100% { opacity: 0; }
}
