@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #f6f4ee;
    --bg-alt: #ede8dc;
    --paper: rgba(255, 255, 255, 0.78);
    --line: rgba(19, 56, 71, 0.12);
    --text: #1f343e;
    --muted: #5d7079;
    --brand: #1e6fbf;
    --brand-strong: #0b4fa8;
    --warm: #4fb3ff;
    --danger: #a24141;
    --danger-bg: rgba(210, 96, 96, 0.14);
    --shadow: 0 24px 54px rgba(12, 25, 31, 0.12);
    --shadow-soft: 0 12px 26px rgba(12, 25, 31, 0.09);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    overflow-x: clip;
}

html { scroll-padding-top: 0; }

body {
    position: relative;
    overflow-x: hidden;
    overflow-x: clip;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 8%, rgba(79, 179, 255, 0.22), transparent 36%),
        radial-gradient(circle at 88% 5%, rgba(11, 95, 168, 0.2), transparent 35%),
        radial-gradient(circle at 76% 92%, rgba(255, 255, 255, 0.8), transparent 36%),
        linear-gradient(130deg, #faf8f2 0%, var(--bg-alt) 52%, #f7f5ee 100%);
    transform: scale(1.08);
    transform-origin: center;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(90deg, rgba(31, 52, 62, 0.03) 1px, transparent 1px),
        linear-gradient(180deg, rgba(31, 52, 62, 0.03) 1px, transparent 1px);
    background-size: 34px 34px;
}

.bg-image-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.4s;
}

.bg-image-overlay.active {
    opacity: var(--bg-image-opacity, 0.3);
}

.bg-image-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bg-image-remove {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,0.04);
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bg-image-remove:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.bg-image-preview {
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,0.02);
    height: 48px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bg-image-hint {
    font-size: 0.72rem;
    color: var(--muted);
}

a,
button,
input,
select,
textarea {
    font: inherit;
    touch-action: manipulation;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

.page {
    position: relative;
    z-index: 1;
    width: min(1240px, 100%);
    margin: 0 auto;
    padding: 0 14px 2.4rem;
    min-width: 0;
}

.route-switch {
    position: sticky;
    top: 10px;
    z-index: 1150;
    width: min(1240px, calc(100% - 24px));
    margin: 10px auto 0.92rem;
    padding: 0.38rem;
    border-radius: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.36rem;
}

.route-tab {
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.route-tab:hover {
    color: var(--brand-strong);
    background: rgba(255, 255, 255, 0.62);
}

.route-tab.active {
    color: #eef5f6;
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.route-view {
    position: relative;
    z-index: 1;
    animation: routeViewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes routeViewFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.route-view.is-hidden {
    display: none;
}

/* 页面切换时的过渡效果 */
.route-home,
.route-gallery,
.route-chat {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.route-gallery {
    padding: 0;
}

.route-chat {
    padding: 0 12px 1rem;
}

.chat-shell {
    width: min(1240px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 0.72rem;
}

.chat-shell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    border-radius: 20px;
    padding: 0.72rem 0.82rem;
}

.chat-shell-note {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

.chat-frame {
    width: 100%;
    height: calc(100dvh - 110px - env(safe-area-inset-bottom));
    border: 0;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

body.route-gallery-active .bullet-lane,
body.route-chat-active .bullet-lane {
    display: none;
}

body.route-gallery-active #memoModal,
body.route-chat-active #memoModal {
    display: none !important;
}

.panel {
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: var(--paper);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.bullet-lane {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.bullet {
    position: absolute;
    left: 100%;
    padding: 0.46rem 0.92rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: color-mix(in srgb, var(--brand-strong) 88%, #000);
    color: #f2f6f7;
    white-space: nowrap;
    font-size: 0.9rem;
    box-shadow: 0 14px 34px rgba(10, 27, 32, 0.22);
    animation: bulletMove 14s linear forwards;
    transition: background 0.3s;
}

.topbar {
    position: fixed;
    top: 12px;
    left: 8px;
    right: 8px;
    margin: 0 auto;
    width: auto;
    max-width: 1240px;
    transform: none;
    z-index: 1200;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.82rem 0.95rem;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.74);
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    min-width: 0;
}

/* 全局悬浮音乐控制 */
.bgm-dock {
    position: fixed;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 1450;
    display: flex;
    align-items: flex-end;
    gap: 0.44rem;
}

.floating-bgm {
    display: inline-flex;
    position: static;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--brand-strong);
    color: #f1f6f7;
    border: 1px solid rgba(255, 255, 255, 0.36);
    box-shadow: var(--shadow-soft);
    font-size: 1rem;
    touch-action: manipulation;
    transition: background 0.3s, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.bgm-menu-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: var(--brand-strong);
    color: #eef6f7;
    box-shadow: var(--shadow-soft);
    font-size: 1.22rem;
    line-height: 1;
    transition: background 0.3s;
}

.bgm-menu-btn[aria-expanded="true"] {
    filter: brightness(1.15);
}

.bgm-menu-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.56rem);
    width: min(320px, calc(100vw - 24px));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 60px rgba(12, 25, 31, 0.16), 0 0 0 1px rgba(0,0,0,0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0;
    overflow: hidden;
    animation: panelSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelSlideUp {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-section {
    padding: 0.88rem 1rem;
    display: grid;
    gap: 0.6rem;
}

.panel-section-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.panel-section-icon {
    font-size: 0.9rem;
}

.panel-section-title {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex: 1;
}

.panel-divider {
    height: 1px;
    background: var(--line);
    margin: 0 1rem;
}

.bgm-menu-panel .audio-status {
    font-size: 0.68rem;
    color: var(--muted);
    background: rgba(0,0,0,0.04);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}

.bgm-menu-panel .audio-name {
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,0.02);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    color: var(--text);
}

.audio-controls {
    display: flex;
}

.audio-file-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    background: var(--brand-strong);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.audio-file-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.audio-file-btn input {
    display: none;
}

.audio-file-icon {
    font-size: 0.85rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-icon {
    font-size: 0.85rem;
    opacity: 0.6;
}

.volume-range {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--line);
    border-radius: 999px;
    outline: none;
}

.volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand-strong);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

.volume-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-value {
    font-size: 0.72rem;
    color: var(--muted);
    min-width: 2.2rem;
    text-align: right;
    font-weight: 600;
}

/* Theme Swatches */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.theme-swatch {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--swatch);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.theme-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.theme-swatch.active {
    border-color: var(--swatch);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--swatch);
}

.swatch-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
}

.theme-swatch.active .swatch-check {
    opacity: 1;
}

/* 菜单按钮（仅在小屏可见） */
.menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.1rem;
    color: var(--brand-strong);
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.04);
}

/* 小屏优化：紧凑顶部栏 + 抽屉式导航 */
@media (max-width: 520px) {
    .menu-btn {
        display: none;
    }

    .nav-links {
        display: none !important;
    }

    .audio-toggle {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .floating-bgm {
        width: 46px;
        height: 46px;
    }

    .bgm-menu-btn {
        width: 40px;
        height: 40px;
    }

    .bgm-menu-panel {
        width: min(300px, calc(100vw - 20px));
    }
}

.brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.46rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--brand-strong);
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.56rem;
    min-width: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    padding: 0.58rem 0.96rem;
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
}

.nav-links a:hover {
    background: var(--brand-strong);
    color: #f0f5f6;
}

.audio-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background: var(--brand-strong);
    color: #f1f6f7;
    font-size: 0.95rem;
    font-weight: 700;
}

.hero {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    min-width: 0;
}

.hero-main,
.hero-side,
.stats,
.recent,
.audio-panel,
.timeline,
.memo-manager {
    padding: 1.3rem;
    min-width: 0;
}

.hero-main {
    position: relative;
    overflow: hidden;
}

.hero-main::before {
    content: '';
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 179, 255, 0.24), transparent 72%);
    pointer-events: none;
    z-index: 0;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    padding: 0.5rem 0.82rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.hero-kicker::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warm);
}

.hero h1 {
    margin-top: 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.7rem, 7vw, 5rem);
    letter-spacing: 0.12em;
    line-height: 0.92;
    color: var(--brand-strong);
    text-transform: uppercase;
}

.hero-actions {
    margin-top: 1.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    position: relative;
    z-index: 2;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 999px;
    padding: 0.72rem 1.12rem;
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--brand-strong);
    color: #edf5f6;
}

.btn-ghost {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
}

.hero-side {
    display: grid;
    gap: 0.8rem;
    align-content: start;
}

.hero-note {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.66);
}

.hero-note-label {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-note-value {
    margin-top: 0.38rem;
    color: var(--brand-strong);
    font-size: 1rem;
    font-weight: 700;
}

.stats {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.stat-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.stat-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    color: var(--brand-strong);
}

.stat-label {
    margin-top: 0.25rem;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.section {
    margin-top: 1rem;
    scroll-margin-top: 5.8rem;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    color: var(--brand-strong);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section-sub {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.recent-grid {
    margin-top: 1rem;
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.recent-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #ffffff;
    aspect-ratio: 1 / 1;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.recent-card img,
.recent-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.52rem 0.6rem;
    font-size: 0.67rem;
    letter-spacing: 0.1em;
    color: #eff5f6;
    background: linear-gradient(0deg, rgba(12, 27, 31, 0.84), rgba(12, 27, 31, 0));
}

.recent-empty {
    margin-top: 0.9rem;
    border-radius: 16px;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.45);
    color: var(--muted);
    padding: 1rem;
    text-align: center;
}

.is-hidden {
    display: none;
}

.audio-panel {
    display: grid;
    gap: 0.9rem;
}

.audio-top,
.audio-meta,
.audio-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
}

.audio-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.audio-meta {
    padding: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
}

.audio-name {
    color: var(--brand-strong);
    font-weight: 700;
    min-width: 0;
    word-break: break-word;
}

.audio-status {
    justify-self: end;
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.8);
}

.audio-file {
    min-height: 42px;
    border-radius: 999px;
    background: var(--brand-strong);
    color: #ecf5f6;
    padding: 0.7rem 1rem;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.audio-file input {
    display: none;
}

.volume-range {
    width: 100%;
    accent-color: var(--brand-strong);
}

.audio-value {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

.timeline-grid {
    margin-top: 1rem;
    display: grid;
    gap: 0.78rem;
}

.timeline-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.44rem;
    flex-wrap: wrap;
}

.timeline-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
    padding: 0.38rem 0.78rem;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

.timeline-chip.active {
    background: var(--brand-strong);
    color: #eef5f6;
    border-color: var(--brand-strong);
}

.timeline-item {
    padding: 0.92rem 0.92rem 0.84rem 1.1rem;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--line) 80%, var(--brand) 20%);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58));
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 1.15rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warm);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--warm) 25%, transparent);
}

.timeline-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.timeline-badge {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    padding: 0.2rem 0.56rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
}

.timeline-badge-milestone {
    color: #fff;
    border-color: var(--brand-strong);
    background: var(--brand-strong);
}

.timeline-badge-memory {
    color: var(--brand-strong);
    border-color: color-mix(in srgb, var(--brand) 35%, var(--line) 65%);
    background: color-mix(in srgb, var(--warm) 20%, #fff 80%);
}

.timeline-date {
    color: var(--warm);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

.timeline-event {
    margin-top: 0.44rem;
    color: var(--brand-strong);
    font-size: 0.96rem;
    font-weight: 700;
}

.timeline-detail {
    margin-top: 0.24rem;
    font-size: 0.79rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.timeline-empty {
    margin-top: 0.8rem;
    border-radius: 14px;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.46);
    color: var(--muted);
    text-align: center;
    padding: 0.9rem;
}

.timeline-foot {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.timeline-info {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.timeline-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
}

.manager-header {
    display: grid;
    gap: 0.7rem;
}

.manager-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.manager-tools {
    display: grid;
    gap: 0.64rem;
}

.manager-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.56rem;
}

.bullet-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.38rem 0.6rem;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.bullet-switch input {
    appearance: none;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--line);
    position: relative;
    background: rgba(255, 255, 255, 0.9);
}

.bullet-switch input::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(12, 25, 31, 0.22);
    transition: transform 0.2s ease;
}

.bullet-switch input:checked {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.bullet-switch input:checked::after {
    transform: translateX(19px);
}

.memo-search,
.memo-sort,
.reply-input,
.modal textarea {
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    color: var(--text);
    outline: none;
}

.memo-search,
.memo-sort {
    min-height: 42px;
    padding: 0.68rem 0.86rem;
}

.memo-list {
    margin-top: 1rem;
    display: grid;
    gap: 0.7rem;
}

.memo-item {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
    border-radius: 16px;
    padding: 0.84rem 0.9rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.7rem;
}

.memo-text {
    line-height: 1.68;
    word-break: break-word;
}

.memo-meta {
    margin-top: 0.34rem;
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 700;
}

.memo-replies {
    margin-top: 0.56rem;
    display: grid;
    gap: 0.42rem;
}

.reply-item {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    padding: 0.5rem 0.62rem;
}

.reply-text {
    font-size: 0.9rem;
    line-height: 1.56;
}

.reply-meta {
    margin-top: 0.28rem;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

.reply-empty {
    color: var(--muted);
    font-size: 0.8rem;
}

.memo-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.48rem;
}

.memo-btn {
    min-height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    padding: 0.56rem 0.8rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text);
}

.memo-btn.primary {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    color: #ecf5f6;
}

.memo-btn.danger {
    background: var(--danger-bg);
    border-color: rgba(162, 65, 65, 0.36);
    color: var(--danger);
}

.reply-editor {
    margin-top: 0.56rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.reply-editor.is-hidden {
    display: none;
}

.reply-input {
    min-height: 38px;
    padding: 0.58rem 0.72rem;
    border-radius: 999px;
}

.memo-pagination {
    margin-top: 0.95rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.7rem;
}

.memo-page-btn {
    min-height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    color: var(--text);
    padding: 0.56rem 0.85rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.memo-page-btn:disabled {
    opacity: 0.46;
    cursor: not-allowed;
}

.memo-page-info {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

.footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(11, 23, 28, 0.56);
    z-index: 1400;
    padding: 1rem;
}

.modal {
    width: min(520px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.94);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.modal h3 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--brand-strong);
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.modal textarea {
    width: 100%;
    height: 140px;
    margin-top: 0.8rem;
    padding: 0.9rem;
    resize: none;
}

.modal-actions {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.55rem;
}

@keyframes bulletMove {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-120vw, 0, 0);
    }
}

/* ===== 动画交互效果 ===== */

/* 入场动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.15); }
    28% { transform: scale(1); }
    42% { transform: scale(1.15); }
    70% { transform: scale(1); }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* 首页入场动画 */
.route-home .hero-main {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.route-home .hero-side {
    animation: fadeInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.route-home .stats {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.route-home .stat-card {
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.route-home .stat-card:nth-child(1) { animation-delay: 0.3s; }
.route-home .stat-card:nth-child(2) { animation-delay: 0.4s; }
.route-home .stat-card:nth-child(3) { animation-delay: 0.5s; }

.route-home .recent {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.route-home .timeline {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.route-home .memo-manager {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

/* 时间线项目交错动画 */
.timeline-item {
    animation: fadeInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--timeline-delay, 0s);
}

/* Hero标题心跳效果 */
.hero-kicker::before {
    animation: heartBeat 2s ease-in-out infinite;
}

/* 浮动装饰效果 */
.hero-main::before {
    animation: float 6s ease-in-out infinite;
}

/* 按钮涟漪效果 */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.btn:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(11, 79, 168, 0.25);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--brand-strong);
    color: var(--brand-strong);
}

/* 卡片悬浮效果 */
.panel {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.hero-main:hover,
.hero-side:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 60px rgba(12, 25, 31, 0.15);
}

.stat-card {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(12, 25, 31, 0.12);
    border-color: var(--brand);
}

.stat-card:hover .stat-number {
    color: var(--brand);
}

/* 统计数字动画 */
.stat-number {
    transition: color 0.3s ease;
}

/* 时间线hover效果 */
.timeline-item {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.timeline-item:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(8px);
    box-shadow: var(--shadow-soft);
}

.timeline-date {
    transition: color 0.3s ease;
}

.timeline-item:hover .timeline-date {
    color: var(--brand);
}

/* 留言卡片动画 */
.memo-item {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.memo-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(79, 179, 255, 0.3);
}

/* 近期照片网格动画 */
.recent-card {
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.recent-card:nth-child(1) { animation-delay: 0.5s; }
.recent-card:nth-child(2) { animation-delay: 0.55s; }
.recent-card:nth-child(3) { animation-delay: 0.6s; }
.recent-card:nth-child(4) { animation-delay: 0.65s; }
.recent-card:nth-child(5) { animation-delay: 0.7s; }
.recent-card:nth-child(6) { animation-delay: 0.75s; }

.recent-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 20px 40px rgba(12, 25, 31, 0.2);
    z-index: 10;
}

/* 路由标签动画 */
.route-tab {
    position: relative;
    overflow: hidden;
}

.route-tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--brand-strong);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.route-tab:hover::before {
    width: 60%;
}

.route-tab.active {
    animation: scaleIn 0.3s ease;
}

/* 弹幕dock动画 */
.bgm-dock {
    animation: fadeInDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.floating-bgm {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-bgm:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(11, 79, 168, 0.4);
}

.floating-bgm:active {
    transform: scale(0.92);
}

/* 模态框动画 */
.modal-backdrop {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    animation: slideInFromBottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 主题色切换动画 */
.theme-swatch {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-swatch:hover {
    transform: scale(1.15) rotate(5deg);
}

.theme-swatch:active {
    transform: scale(0.95);
}

/* 音量滑块动画 */
.volume-range::-webkit-slider-thumb {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.volume-range::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(11, 79, 168, 0.4);
}

/* 输入框focus动画 */
.memo-search:focus,
.memo-sort:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(30, 111, 191, 0.15);
    transition: all 0.3s ease;
}

/* 分页按钮动画 */
.memo-page-btn {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.memo-page-btn:hover:not(:disabled) {
    transform: translateX(3px);
    background: var(--brand-strong);
    color: #fff;
    border-color: var(--brand-strong);
}

.memo-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 弹幕动画增强 */
.bullet {
    animation: bulletMove 14s linear forwards, fadeInRight 0.3s ease;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(19, 56, 71, 0.2);
    border-radius: 999px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(19, 56, 71, 0.35);
}

/* 选中文本样式 */
::selection {
    background: rgba(30, 111, 191, 0.2);
    color: var(--text);
}

/* 加载动画 */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    animation: loadingDots 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

html.mobile-lite body::before,
html.mobile-lite body::after {
    position: absolute;
}

html.mobile-lite .panel,
html.mobile-lite .topbar,
html.mobile-lite .modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.92);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .recent-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .page {
        width: 100%;
        padding: 0.95rem 10px 2.4rem;
    }

    .topbar {
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-radius: 0 0 16px 16px;
        grid-template-columns: 1fr auto;
        row-gap: 0.55rem;
        align-items: center;
        padding: 0.72rem 0.62rem;
    }

    .brand {
        font-size: 1.1rem;
        letter-spacing: 0.1em;
        min-width: 0;
    }

    .nav-links {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.42rem;
        overflow: visible;
        white-space: normal;
        padding-bottom: 0;
    }

    .nav-links a {
        font-size: 0.76rem;
        padding: 0.52rem 0.38rem;
        text-align: center;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .hero-main,
    .hero-side,
    .stats,
    .recent,
    .audio-panel,
    .timeline,
    .memo-manager {
        border-radius: 20px;
        padding: 1rem;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recent-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.58rem;
    }

    .audio-top,
    .audio-meta,
    .audio-row,
    .memo-item,
    .manager-controls,
    .reply-editor {
        grid-template-columns: 1fr;
    }

    .audio-status {
        justify-self: start;
    }

    .memo-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .timeline-filters {
        width: 100%;
    }

    .timeline-chip {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 0.42rem 0.4rem;
    }

    .timeline-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .timeline-actions .memo-btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .page {
        width: 100%;
        padding: 0.8rem 10px 2.4rem;
    }

    .hero h1 {
        font-size: 2.25rem;
        line-height: 1;
        letter-spacing: 0.08em;
    }

    .nav-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .route-gallery {
        padding: 0 8px 0.7rem;
    }

    .route-chat {
        padding: 0 8px 0.7rem;
    }

    .chat-shell-note {
        font-size: 0.66rem;
    }

    .chat-frame {
        height: calc(100dvh - 74px - env(safe-area-inset-bottom));
        border-radius: 18px;
    }
}

@media (max-width: 860px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
    }
}
