/* =================================
   主题变量
================================= */

/* 默认深色主题 */
:root {
    --bg: #0b1020;
    --card: #141a33;
    --text: #e8ebff;
    --muted: #9aa3ff;
    --accent: #6cf2c2;
    --accent2: #7aa2ff;
    --subtitle-green: #6cf2c2;
}

    /* 亮色主题 */
    :root[data-theme="light"] {
        --bg: #fdf6e3;
        --card: #ffffff;
        --text: #1b1b1b;
        --muted: #555555;
        --accent: #6cf2c2;
        --accent2: #7aa2ff;
        --subtitle-green: #007a3d;
    }

/* =================================
   全局基础样式
================================= */

* {
    box-sizing: border-box;
    transition: background-color 0.4s, color 0.4s, border-color 0.4s;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
}

/* 辅助功能 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent2);
    color: #0b1020;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 101;
}

    .skip-link:focus {
        top: 6px;
    }

/* =================================
   顶部按钮
================================= */
#theme-toggle {
    position: fixed;
    top: 8px;
    right: 10px;
    padding: 8px 20px;
    border: none;
    background: rgba(11,16,32,.9);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: background 0.3s, color 0.3s;
}

:root[data-theme="light"] #theme-toggle {
    background: rgba(255,255,255,.9);
}

#theme-toggle:hover {
    background: var(--accent2);
    color: #0b1020;
}

/* =================================
   Header
================================= */
header {
    padding: 35px 20px 20px;
    text-align: center;
    position: relative;
}

    header h1 {
        font-size: 40px;
        margin: 0 0 12px;
        letter-spacing: 2px;
    }

    header p {
        max-width: 1060px;
        margin: 0 auto;
        color: var(--muted);
        font-size: 18px;
    }

/* =================================
   导航
================================= */
nav {
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
    background: rgba(11,16,32,.6);
    border-bottom: 1px solid rgba(122,162,255,.15);
    z-index: 10;
}

:root[data-theme="light"] nav {
    background: rgba(255,255,255,.8);
}

nav ul {
    display: flex;
    justify-content: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 12px 16px;
    flex-wrap: wrap;
}

nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

    nav a:hover {
        color: var(--accent);
    }

    nav a:focus, a:focus, button:focus {
        outline: 2px solid var(--accent2);
        outline-offset: 2px;
    }

/* =================================
   Section & 标题
================================= */
section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

    section h2 {
        font-size: 28px;
        margin-bottom: 24px;
        border-left: 4px solid var(--accent2);
        padding-left: 12px;
    }

/* =================================
   软件卡片
================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 24px;
}

@media (max-width:900px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: linear-gradient(180deg, #1a2044, var(--card));
    border: 1px solid rgba(122,162,255,.18);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform .25s ease, box-shadow .25s ease;
}
    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 40px rgba(0,0,0,.3);
    }
:root[data-theme="light"] .card {
    background: linear-gradient(180deg, #e6ebf5, var(--card));
    border: 1px solid rgba(122,162,255,.2);
}

    :root[data-theme="light"] .card:hover {
        box-shadow: 0 12px 28px rgba(0,0,0,.12);
    }

.card h3 {
    margin-top: 0;
    font-size: 20px;
}

.card-subtitle {
    color: var(--subtitle-green);
    font-size: 14px;
    margin-bottom: 12px;
}

:root[data-theme="light"] .card-subtitle {
    color: var(--subtitle-green);
}

.card p {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 16px;
}

.tags {
    margin-bottom: 14px;
}

.tag {
    display: inline-block;
    background: rgba(108,242,194,.15);
    color: var(--subtitle-green);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    margin-right: 6px;
}

:root[data-theme="light"] .tag {
    background: rgba(0,122,61,.15);
}

.btn {
    display: inline-block;
    text-align: center;
    padding: 10px 14px;
    border-radius: 10px;

    background: linear-gradient( 90deg, var(--accent2) 0%, var(--accent) 100% );
    box-shadow: 0 6px 18px rgba(108,242,194,.25);

    color: #0b1020;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s;
}
:root[data-theme="light"] .btn {
    box-shadow: 0 4px 12px rgba(0,122,61,.2);
}

    .btn.disabled {
        opacity: 0.5;
        pointer-events: none;
        cursor: not-allowed;
    }

    .btn.secondary {
        background: transparent;
        border: 1px solid rgba(122,162,255,.4);
        color: var(--text);
        margin-left: 8px;
    }

    .btn:hover {
        opacity: 0.9;
    }

/* =================================
   关于布局
================================= */
.about {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

    .about p {
        color: var(--muted);
    }

@media(max-width:800px) {
    .about {
        grid-template-columns: 1fr;
    }
}

/* =================================
   Footer
================================= */
footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
    border-top: 1px solid rgba(122,162,255,.15);
    background: rgba(11,16,32,.6);
}

:root[data-theme="light"] footer {
    background: rgba(255,255,255,.8);
}

footer a {
    color: var(--accent2);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.3s, text-decoration 0.3s;
}

:root[data-theme="light"] footer a {
    color: #0056b3;
}

footer a:hover {
    color: var(--accent);
    text-decoration: none;
}

footer a:visited {
    color: var(--muted);
    opacity: 0.85;
}

:root[data-theme="light"] footer a:visited {
    color: #6c757d;
}

footer a.footer-highlight {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

    footer a.footer-highlight:hover {
        text-decoration: underline;
    }

:root[data-theme="light"] footer a.footer-highlight {
    color: #007a3d;
}

/* =================================
   打印优化
================================= */
@media print {
    nav, footer, .btn, #theme-toggle, .skip-link {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* =================================
   星空背景 & 动态星星
================================= */
#stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    transition: background 0.5s ease;
}

.star {
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 4s infinite alternate;
}

@keyframes twinkle {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 1;
    }
}

/* 星空背景颜色根据主题 */
:root[data-theme='dark'] #stars {
    background: var(--bg);
}

:root[data-theme='light'] #stars {
    background: var(--bg);
}
