:root {
    --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    --font-serif: 'Noto Serif SC', 'Source Han Serif CN', 'SimSun', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.22);
    --glass-highlight: rgba(255, 255, 255, 0.45);
    --glass-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
    --text-primary: rgba(255, 255, 255, 0.96);
    --text-secondary: rgba(255, 255, 255, 0.74);
    --accent: #7dd3fc;
    --accent-hover: #38bdf8;
    --radius: 18px;
    --radius-sm: 12px;
}

/* 时段主题：根据 body[data-period] 切换强调色与玻璃质感 */
body[data-period="morning"] {
    --accent: #fcd34d;
    --accent-hover: #f59e0b;
    --glass-bg: rgba(255, 248, 225, 0.16);
    --glass-border: rgba(255, 235, 180, 0.32);
    --glow: 250, 204, 21;
}
body[data-period="noon"] {
    --accent: #7dd3fc;
    --accent-hover: #0ea5e9;
    --glass-bg: rgba(186, 230, 253, 0.14);
    --glass-border: rgba(186, 230, 253, 0.32);
    --glow: 125, 211, 252;
}
body[data-period="dusk"] {
    --accent: #fb923c;
    --accent-hover: #f97316;
    --glass-bg: rgba(254, 215, 170, 0.14);
    --glass-border: rgba(254, 215, 170, 0.34);
    --glow: 251, 146, 60;
}
body[data-period="night"] {
    --accent: #a5b4fc;
    --accent-hover: #818cf8;
    --glass-bg: rgba(30, 41, 80, 0.32);
    --glass-border: rgba(165, 180, 252, 0.26);
    --glow: 165, 180, 252;
}

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

html, body {
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text-primary);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

/* 文章正文与标题使用思源宋体 */
.markdown-body,
.article-item h3,
.hero-section h1,
.card h2 {
    font-family: var(--font-serif);
}

body.glass-page {
    position: relative;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1s ease-in-out;
}

.bg-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.35) 0%,
        rgba(0, 0, 0, 0.15) 50%,
        rgba(0, 0, 0, 0.45) 100%
    );
    backdrop-filter: blur(4px);
}

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius);
}

.top-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 1100px;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

.main-container {
    padding: 100px 20px 60px;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 100vh;
}

/* 首页 hero */
.hero-section {
    margin-bottom: 40px;
}

.hero-greeting {
    padding: 56px 30px 48px;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-greeting::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 80% at 50% -10%, rgba(var(--glow, 255 255 255), 0.22), transparent 60%);
    pointer-events: none;
}

.hero-section h1 {
    font-size: 2.6rem;
    margin-bottom: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.hero-section .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* 桌面小组件网格 */
.widget-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 16px;
}

@media (max-width: 800px) {
    .widget-grid {
        grid-template-columns: 1fr 1fr;
    }
    .widget-weather {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
    .widget-weather {
        grid-column: auto;
    }
}

.widget {
    padding: 20px 22px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(.2,.7,.2,1), box-shadow 0.3s, background 0.3s;
    isolation: isolate;
}

.widget::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, var(--glass-highlight) 0%, transparent 35%, transparent 65%, rgba(255, 255, 255, 0.08) 100%);
    mix-blend-mode: overlay;
    opacity: 0.55;
}

.widget:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(var(--glow, 255 255 255), 0.25) inset;
}

.widget-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-transform: none;
}

.widget-main {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.widget-foot {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.widget .exam-unit {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    margin-right: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.widget .exam-unit strong {
    font-size: 1.4rem;
    color: var(--accent);
    font-weight: 700;
    margin-right: 1px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot.alive {
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.dead {
    background: #f87171;
    box-shadow: 0 0 10px #f87171;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

/* 详情弹层 */
.widget-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.widget-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
}

.widget-modal-body {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 28px;
    animation: modal-in 0.3s cubic-bezier(.2,.7,.2,1);
}

@keyframes modal-in {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.widget-modal-title {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
    font-family: var(--font-serif);
}

.widget-modal-content {
    line-height: 1.8;
    color: var(--text-secondary);
}

.widget-modal-content .kv {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.widget-modal-content .kv:last-child {
    border-bottom: none;
}

.widget-modal-content .kv span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.widget-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}

.widget-modal-close:hover {
    color: var(--text-primary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.alive {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}

.status-dot.dead {
    background: #f87171;
    box-shadow: 0 0 8px #f87171;
}

/* 卡片 */
.card {
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.card h2 {
    font-size: 1.35rem;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

/* 文章列表 */
.article-list {
    display: grid;
    gap: 20px;
}

.article-item {
    padding: 20px;
}

.article-item h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.article-item h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.article-item h3 a:hover {
    color: var(--accent);
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 表单 */
.form-box {
    max-width: 420px;
    margin: 0 auto;
    padding: 32px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn.primary {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
    font-weight: 600;
}

.btn.primary:hover {
    background: var(--accent-hover);
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert.success {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.alert.error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.4);
}

.alert.warn {
    background: rgba(250, 204, 21, 0.15);
    border: 1px solid rgba(250, 204, 21, 0.4);
}

/* 验证码容器 */
.captcha-box {
    margin-bottom: 18px;
}

.captcha-image-wrap {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.captcha-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.05s linear;
}

.captcha-slider {
    width: 240px;
    margin: 0 auto;
}

.captcha-slider input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.captcha-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* Markdown 内容区 */
.markdown-body {
    line-height: 1.8;
    font-size: 1.05rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 24px 0 12px;
    font-weight: 700;
}

.markdown-body p {
    margin-bottom: 14px;
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-body code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
}

.markdown-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 12px 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    color: var(--text-secondary);
    margin: 16px 0;
}

.markdown-body ul,
.markdown-body ol {
    margin: 12px 0 12px 24px;
}

/* 评论 */
.comment-list {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.comment-item {
    padding: 16px;
}

.comment-item .author {
    font-weight: 600;
    margin-bottom: 6px;
}

.comment-item .time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 页脚 */
.site-footer {
    text-align: center;
    padding: 20px;
    margin: 40px auto 20px;
    max-width: 1000px;
}

.site-footer .contact-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 18px;
}

.site-footer .contact-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer .contact-links a:hover {
    color: var(--accent);
}

/* 管理员入口 */
.admin-login-box {
    max-width: 400px;
    margin: 80px auto;
    padding: 32px;
    text-align: center;
}

/* 响应式 */
@media (max-width: 640px) {
    .hero-section h1 {
        font-size: 1.9rem;
    }

    .top-nav {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .main-container {
        padding-top: 130px;
    }

    .nav-links {
        gap: 14px;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}