/* ========================================
   梦未一言 - 现代化样式表（浅色主题）
   ======================================== */

/* --- 基础重置与变量 --- */
:root {
    --pink: #ff69b4;
    --pink-light: #ffb6d9;
    --pink-dark: #e0559e;
    --pink-bg: rgba(255, 105, 180, 0.06);
    --bg: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.55);
    --text-primary: #333333;
    --text-secondary: #696969;
    --text-muted: #999999;
    --border: rgba(255, 105, 180, 0.2);
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'LXGW WenKai', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

::selection {
    background: var(--pink);
    color: #fff;
}

a {
    color: var(--pink);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--pink-dark);
}

/* --- 字体 --- */
@font-face {
    font-family: 'kat';
    src: url('/static/font/kat.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'sq';
    src: url('/static/font/sq.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'dk';
    src: url('/static/font/dk.woff2') format('woff2');
    font-display: swap;
}

/* --- 侧边栏 --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 105, 180, 0.12);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'kat', serif;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-title {
    font-family: 'kat', serif;
    font-size: 18px;
    color: var(--text-primary);
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #000;
    font-size: 14px;
    font-weight: bold;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    color: var(--pink-dark);
    background: var(--pink-bg);
    border-left-color: var(--pink);
}

.sidebar-nav li a svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav li a:hover svg,
.sidebar-nav li a.active svg {
    opacity: 1;
    color: var(--pink);
}

.nav-divider {
    padding: 16px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 105, 180, 0.12);
    font-size: 12px;
    color: #000;
}

/* --- 遮罩层 --- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* --- 主内容区 --- */
.main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- 顶栏 --- */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    z-index: 100;
}

.menu-btn {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition);
}

.menu-btn:hover {
    background: var(--pink-bg);
}

.menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--transition);
}

.menu-btn:hover span {
    background: var(--pink);
}

.topbar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'kat', serif;
    font-size: 18px;
    font-weight: normal;
    color: var(--text-primary);
}

/* --- 内容区 --- */
.content {
    flex: 1;
    position: relative;
}

/* --- 背景层 --- */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #fff;
    transition: opacity 0.8s ease;
}

.bg-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.25);
}

/* --- 樱花画布 --- */
#sakuraCanvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* --- 一言卡片区域 --- */
.hero {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--topbar-height) - 60px);
    padding: 40px 20px;
}

.card {
    position: relative;
    width: 100%;
    max-width: 400px;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 20px 20px 60px rgba(255, 105, 180, 0.2);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 192, 203, 0.2) 0%,
        transparent 60%
    );
    pointer-events: none;
}

.card-inner {
    position: relative;
    padding: 40px 32px;
    text-align: center;
    width: 100%;
}

.card-title {
    font-family: 'kat', serif;
    font-size: 2.5rem;
    color: rgba(255, 105, 180, 0.6);
    margin-bottom: 24px;
    user-select: none;
}

.card-text {
    font-family: 'sq', serif;
    font-size: 1.25rem;
    line-height: 2;
    color: var(--text-primary);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.card-text .meta {
    display: block;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'dk', sans-serif;
}

.card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 28px;
    padding: 10px 24px;
    background: #fff;
    color: var(--text-primary);
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.card-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.3);
    color: var(--pink-dark);
}

.card-btn:active {
    transform: scale(0.97);
}

.card-btn svg {
    transition: transform 0.4s ease;
}

.card-btn:hover svg {
    transform: rotate(180deg);
}

/* --- 加载动画 --- */
.loading-dots {
    color: var(--text-muted);
    font-size: 1rem;
}

.dots {
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- 页脚 --- */
.footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 16px;
    font-size: 14px;
    font-weight: bold;
    color: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.footer a {
    color: #000;
    transition: color var(--transition);
}

.footer a:hover {
    color: var(--pink);
    text-decoration: underline;
}

.footer i {
    font-style: normal;
}

/* --- 响应式 --- */
@media (max-width: 480px) {
    .card {
        min-height: 320px;
        margin: 0 8px;
    }

    .card-inner {
        padding: 32px 20px;
    }

    .card-title {
        font-size: 2rem;
    }

    .card-text {
        font-size: 1.1rem;
    }
}

/* --- 竖屏/横屏背景 --- */
@media (orientation: portrait) {
    .bg-layer {
        background-image: url('../../wallpaper/?form=vertical');
    }
}

@media (orientation: landscape) {
    .bg-layer {
        background-image: url('../../wallpaper/?form=level');
    }
}

/* --- 淡入动画 --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* --- 页面切换过渡 --- */
.content {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
