:root {
    --gold-light: #fbe6ba; --gold-glow: rgba(251, 230, 186, 0.6);
    --bg-deep: #03060a; --glass-bg: rgba(15, 20, 30, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

body, html {
    margin: 0; padding: 0; width: 100%; font-family: var(--font-sans);
    background-color: transparent; color: #fff;
    scroll-behavior: smooth; overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

#audio-controller {
    position: fixed; top: 25px; right: 25px; height: 36px;
    background: var(--glass-bg); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border); border-radius: 18px;
    display: flex; align-items: center; padding: 0 14px; gap: 12px;
    z-index: 100; transition: 0.3s; box-shadow: 0 0 15px rgba(0,0,0,0.5);
}
#audio-controller:hover { border-color: var(--gold-light); transform: scale(1.05); }

.audio-play-btn { display: flex; gap: 3px; align-items: center; height: 100%; cursor: pointer; }

.sound-bar {
    width: 3px; background: var(--gold-light); border-radius: 2px;
    height: 16px; transform-origin: bottom; transform: scaleY(0.33);
    transition: 0.2s; opacity: 0.5; will-change: transform;
}

#audio-controller.playing .sound-bar { opacity: 1; box-shadow: 0 0 5px var(--gold-glow); }
#audio-controller.playing .sound-bar:nth-child(1) { animation: soundBounce 1s infinite ease-in-out alternate; }
#audio-controller.playing .sound-bar:nth-child(2) { animation: soundBounce 1.2s infinite ease-in-out alternate-reverse; }
#audio-controller.playing .sound-bar:nth-child(3) { animation: soundBounce 0.8s infinite ease-in-out alternate; }

@keyframes soundBounce { 0% { transform: scaleY(0.33); } 100% { transform: scaleY(1); } }

.audio-divider { width: 1px; height: 14px; background: rgba(255,255,255,0.2); }

.audio-next-btn {
    color: var(--gold-light); display: flex; align-items: center; justify-content: center;
    opacity: 0.6; cursor: pointer; transition: 0.3s;
}
.audio-next-btn:hover { opacity: 1; transform: scale(1.15); text-shadow: 0 0 10px var(--gold-glow); }

#world-bg {
    position: fixed; top: -5%; left: -5%; width: 110%; height: 110%;
    background-color: var(--bg-deep);
    background-image: url('../senlin.avif'); background-size: cover; background-position: center;
    z-index: -2; filter: brightness(1.0) contrast(1.1);
    animation: breatheBg 30s ease-in-out infinite alternate;
    transition: opacity 1.5s ease-in-out;
}
@keyframes breatheBg { 0% { transform: scale(1); } 100% { transform: scale(1.05); } }

#fireflies { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.section-title {
    text-align: center; font-family: var(--font-serif); font-size: 2rem; color: var(--gold-light);
    letter-spacing: 4px; text-shadow: 0 0 20px var(--gold-glow); margin-bottom: 50px;
}

.screen-section { position: relative; width: 100%; min-height: 100vh; padding: 80px 20px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: center; }

#danmaku-container { position: absolute; top: 10%; left: 0; width: 100%; height: 30%; pointer-events: none; overflow: hidden; z-index: 1; }
.danmaku-item { position: absolute; white-space: nowrap; font-family: var(--font-serif); font-size: 1.05rem; color: rgba(255,255,255,0.7); text-shadow: 0 2px 4px rgba(0,0,0,1); background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%); padding: 5px 20px; border-radius: 20px; will-change: transform; left: 100%; }
.danmaku-item span { color: var(--gold-light); font-weight: bold; }

#secret-trigger { position: absolute; top: 20%; left: 50%; transform: translateX(-50%); width: 120px; height: 200px; z-index: 50; cursor: default; }

#ui-layer {
    position: relative; z-index: 10; width: 100%; max-width: 540px;
    background: linear-gradient(145deg, var(--glass-bg) 0%, rgba(5,8,15,0.6) 100%);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 24px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.15);
    padding: 40px; box-sizing: border-box;
}

.tabs { display: flex; justify-content: center; gap: 40px; margin-bottom: 30px; position: relative; }
.tab-btn { background: transparent; border: none; font-size: 1.15rem; letter-spacing: 3px; color: rgba(255,255,255,0.4); cursor: pointer; transition: 0.4s; font-family: var(--font-serif); }
.tab-btn.active { color: var(--gold-light); text-shadow: 0 0 15px var(--gold-glow); }
.tab-indicator { position: absolute; bottom: -5px; height: 2px; background: var(--gold-light); transition: 0.4s; }

.view-section { display: none; flex-direction: column; gap: 20px; }
.view-section.active { display: flex; animation: fadeUp 0.6s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.form-group { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 0.85rem; letter-spacing: 2px; color: rgba(255,255,255,0.5); text-transform: uppercase; }
select, input, textarea { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; color: #fff; padding: 12px 15px; font-size: 16px; outline: none; transition: 0.3s; }
select option { background: #111827; }
select:focus, input:focus, textarea:focus { border-color: var(--gold-light); box-shadow: 0 0 0 1px var(--gold-glow); }
textarea { resize: none; height: 100px; }
.flex-row { display: flex; gap: 10px; }
.flex-row > * { flex: 1; min-width: 0; }

.submit-btn { background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0)); color: var(--gold-light); font-size: 1.1rem; letter-spacing: 4px; padding: 15px; border: 1px solid rgba(251,230,186,0.3); border-radius: 50px; cursor: pointer; transition: 0.4s; margin-top: 10px; font-family: var(--font-serif); width: 100%; box-sizing: border-box; text-align: center;}
.submit-btn:hover { background: rgba(251,230,186,0.1); border-color: var(--gold-light); box-shadow: 0 0 20px rgba(251,230,186,0.2); transform: translateY(-2px); }

.scroll-down { position: absolute; bottom: 30px; font-size: 0.8rem; color: rgba(255,255,255,0.4); letter-spacing: 2px; text-transform: uppercase; animation: bounce 2s infinite; cursor: pointer; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }

#section-timeline { background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.6)); }
.timeline-container { position: relative; max-width: 900px; width: 100%; margin: 0 auto; padding: 20px 0; }
.timeline-container::after { content: ''; position: absolute; width: 2px; background: rgba(251,230,186,0.3); top: 0; bottom: 0; left: 50%; margin-left: -1px; box-shadow: 0 0 15px rgba(251,230,186,0.5); }

.timeline-item { padding: 10px 40px; position: relative; background: inherit; width: 50%; box-sizing: border-box; }
.timeline-item:nth-child(odd) { left: 0; text-align: right; }
.timeline-item:nth-child(even) { left: 50%; text-align: left; }

.timeline-item::after { content: ''; position: absolute; width: 16px; height: 16px; background: var(--gold-light); border: 4px solid var(--bg-deep); border-radius: 50%; top: 20px; z-index: 1; box-shadow: 0 0 10px var(--gold-light); }
.timeline-item:nth-child(odd)::after { right: -10px; }
.timeline-item:nth-child(even)::after { left: -10px; }

.timeline-card { background: var(--glass-bg); padding: 20px; border-radius: 16px; border: 1px solid var(--glass-border); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: 0.4s; display: inline-block; width: 100%; text-align: left;}
.timeline-card:hover { transform: translateY(-5px); border-color: rgba(251,230,186,0.4); box-shadow: 0 15px 40px rgba(0,0,0,0.8), 0 0 20px rgba(251,230,186,0.1); }
.timeline-date { font-family: var(--font-serif); color: var(--gold-light); font-size: 0.9rem; letter-spacing: 2px; margin-bottom: 10px; }
.timeline-title { font-size: 1.2rem; font-weight: bold; margin-bottom: 10px; color: #fff; }
.timeline-img { width: 100%; border-radius: 10px; margin-bottom: 15px; border: 1px solid rgba(255,255,255,0.1); object-fit: cover; max-height: 250px;}
.timeline-desc { font-size: 0.95rem; color: rgba(255,255,255,0.7); line-height: 1.6; }

#section-friends { background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.9)); position: relative;}

#d3-friends-container {
    width: 100%; height: 60vh; min-height: 450px;
    position: relative; overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}
.lantern-wrapper {
    position: absolute; top: 0; left: 0;
    display: flex; justify-content: center; align-items: center;
    will-change: transform; cursor: pointer; z-index: 1;
}

.lantern-entity {
    width: 100%; height: 100%; border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.9) 0%, rgba(251,230,186,0.6) 30%, rgba(20,25,35,0.4) 90%);
    border: 1px solid rgba(251,230,186,0.3);
    box-shadow: 0 0 20px rgba(251,230,186,0.2), inset 0 0 15px rgba(251,230,186,0.3);
    display: flex; justify-content: center; align-items: center;
    animation: lanternBreathe 3s infinite alternate ease-in-out;
    transition: filter 0.3s, border-color 0.3s, transform 0.3s;
}

.lantern-wrapper:hover { z-index: 10; }
.lantern-wrapper:hover .lantern-entity {
    box-shadow: 0 0 40px rgba(251,230,186,0.8), inset 0 0 20px rgba(255,255,255,0.6);
    border-color: var(--gold-light); transform: scale(1.15) !important;
}

.lantern-text { color: var(--gold-light); font-family: var(--font-serif); text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.8); pointer-events: none; }

@keyframes lanternBreathe { 0% { filter: brightness(0.85); transform: scale(0.97); } 100% { filter: brightness(1.15); transform: scale(1.03); } }

.friend-tooltip {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); opacity: 0;
    background: linear-gradient(145deg, rgba(15,20,30,0.45) 0%, rgba(5,8,15,0.65) 100%);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255,255,255,0.08); border-top: 1px solid rgba(251,230,186,0.25);
    box-shadow: 0 40px 80px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.15);
    padding: 40px; border-radius: 24px; color: #fff; pointer-events: none;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 10;
    width: 85%; max-width: 360px; text-align: center;
}
.friend-tooltip.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.tooltip-close { position: absolute; top: 15px; right: 20px; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 1.5rem; transition: 0.3s; }
.tooltip-close:hover { color: var(--gold-light); transform: rotate(90deg); }

.add-msg-box { background: rgba(0,0,0,0.5); padding: 30px; border-radius: 16px; border: 1px dashed rgba(255,255,255,0.2); text-align: center; max-width: 500px; margin: 40px auto 0; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); z-index: 100; display: none; justify-content: center; align-items: center; opacity: 0; transition: 0.4s; }
.modal-box {
    background: linear-gradient(145deg, rgba(15,20,30,0.45) 0%, rgba(5,8,15,0.65) 100%);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(251,230,186,0.25);
    box-shadow: 0 40px 80px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.15);
    border-radius: 24px; padding: 40px; width: 90%; max-width: 420px;
    transform: scale(0.95); transition: 0.4s; -webkit-user-select: none; user-select: none;
}
.modal-box input, .modal-box textarea { -webkit-user-select: auto; user-select: auto; }
.modal-box h3 { color: var(--gold-light); font-family: var(--font-serif); letter-spacing: 2px; text-align: center; margin-top: 0; margin-bottom: 25px; }
.uuid-display {
    background: rgba(0,0,0,0.3); padding: 18px; font-family: monospace; font-size: 1.3rem;
    letter-spacing: 3px; color: var(--gold-light); border-radius: 12px; margin-bottom: 25px;
    cursor: pointer; text-align: center;
    border: 1px solid rgba(255,255,255,0.05); box-shadow: inset 0 0 15px rgba(0,0,0,0.6);
}
#toast { position: fixed; top: -60px; left: 50%; transform: translateX(-50%); background: rgba(30,35,45,0.9); color: #fff; padding: 12px 30px; border-radius: 50px; font-size: 0.95rem; box-shadow: 0 10px 30px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.1); transition: 0.4s; z-index: 200; pointer-events: none; }
#toast.show { top: 40px; }

#global-nav {
    position: fixed; top: 0; left: 0; width: 100%;
    background: linear-gradient(to bottom, rgba(5,8,15,0.85) 0%, rgba(5,8,15,0) 100%);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 90; display: flex; justify-content: center; gap: 60px;
    padding: 25px 0 35px 0;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.nav-item { color: rgba(255,255,255,0.4); text-decoration: none; font-family: var(--font-serif); font-size: 1.15rem; letter-spacing: 4px; transition: 0.4s; position: relative; }
.nav-item::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 0; height: 2px; background: var(--gold-light); transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.nav-item:hover, .nav-item.active { color: var(--gold-light); text-shadow: 0 0 15px var(--gold-glow); }
.nav-item:hover::after, .nav-item.active::after { width: 100%; box-shadow: 0 0 10px var(--gold-light); }

.custom-file-upload { border: 1px dashed rgba(251,230,186,0.3); border-radius: 12px; padding: 16px; text-align: center; color: rgba(255,255,255,0.5); cursor: pointer; transition: 0.3s; background: rgba(0,0,0,0.2); font-size: 0.95rem; display: block; }
.custom-file-upload:hover { border-color: var(--gold-light); color: var(--gold-light); background: rgba(251,230,186,0.05); transform: translateY(-1px); }

@media (max-width: 768px) {
    .timeline-container::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 20px; }
    .timeline-item:nth-child(even), .timeline-item:nth-child(odd) { left: 0; text-align: left; }
    .timeline-item:nth-child(even)::after, .timeline-item:nth-child(odd)::after { left: 23px; right: auto; }

    #global-nav { gap: 15px; padding: 15px 0 20px 0; }
    .nav-item { font-size: 0.85rem; letter-spacing: 2px; }

    #ui-layer { padding: 25px 20px; }
    .modal-box { padding: 25px 20px; }
    .friend-tooltip { padding: 25px 20px; width: 90%; }

    .section-title { font-size: 1.6rem; margin-bottom: 30px; letter-spacing: 2px; }
    .tabs { gap: 20px; margin-bottom: 20px; }
    .tab-btn { font-size: 1rem; }
    .flex-row { gap: 6px; }

    #audio-controller { top: 15px; right: 15px; height: 32px; padding: 0 10px; }
    .audio-divider { height: 12px; }

    #danmaku-container { top: 15%; height: 25%; }
}
