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

body {
    font-family: "Segoe UI", sans-serif;
    overflow-x: hidden;
    transition: background 0.6s, color 0.6s;
    background: transparent;
}

/* =============================
   默认亮色主题（科技玻璃态）
   ============================= */
html[data-theme="light"] {
    background: linear-gradient(135deg, #e9eef7, #f7faff);
    background-attachment: fixed;
}

html[data-theme="light"] body {
    background: linear-gradient(135deg, #e9eef7, #f7faff);
    color: #111;
}

html[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    color: #000;
}

html[data-theme="light"] .card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    transform: translateY(-8px) rotateX(4deg) rotateY(4deg);
}

/* =============================
   暗色主题（霓虹科幻）
   ============================= */
html[data-theme="dark"] {
    background: radial-gradient(circle at 30% 20%, #00121f, #00030a 70%);
    background-attachment: fixed;
}

html[data-theme="dark"] body {
    background: radial-gradient(circle at 30% 20%, #00121f, #00030a 70%);
    color: #c8f8ff;
}

html[data-theme="dark"] .card {
    background: rgba(0, 25, 40, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.25);
    color: #dffcff;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.15);
}

html[data-theme="dark"] .card:hover {
    border-color: rgba(0, 255, 200, 0.8);
    transform: translateY(-8px) rotateX(6deg) rotateY(6deg);
    box-shadow: 0 0 40px rgba(0, 255, 200, 0.5);
}

header {
    text-align: center;
    padding: 50px 20px;
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

/* 搜索框 */
#search {
    margin-top: 10px;
    width: 260px;
    padding: 12px 16px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.12);
}

/* 科技 3D 卡片 Grid */
.grid {
    padding: 40px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: auto;
    perspective: 1000px;
    z-index: 10;
    position: relative;
}

.card {
    padding: 25px;
    border-radius: 20px;
    text-decoration: none;
    display: block;
    /* 分别指定各个属性的过渡效果，确保动画流畅 */
    transition: transform 0.4s cubic-bezier(.07, .78, .14, 1),
    box-shadow 0.4s cubic-bezier(.07, .78, .14, 1),
    border-color 0.4s cubic-bezier(.07, .78, .14, 1);
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
}

.card-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.card-desc {
    font-size: 1rem;
    opacity: 0.8;
}

/* 六边形霓虹框效果 */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: linear-gradient(60deg, rgba(0, 255, 255, 0.6), transparent 60%),
    linear-gradient(240deg, rgba(0, 255, 255, 0.6), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(.07, .78, .14, 1),
    filter 0.4s cubic-bezier(.07, .78, .14, 1);
    pointer-events: none;
    z-index: -1;
}

.card:hover::before {
    opacity: 1;
    filter: blur(6px);
}

/* 粒子与星空 Canvas */
#stars, #particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    pointer-events: none;
}

#stars {
    z-index: 0;
}

#particles {
    z-index: 1;
}

/*右上角主题开关*/
.theme-switch {
    position: absolute;
    top: 20px;
    right: 25px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    width: 55px;
    height: 28px;
    background: #888;
    border-radius: 25px;
    position: relative;
    transition: 0.3s;
    cursor: pointer;
}

.switch::after {
    content: "";
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 4px;
    transition: 0.3s;
    cursor: pointer;
}

html[data-theme="dark"] .switch {
    background: #00eaff;
}

html[data-theme="dark"] .switch::after {
    transform: translateX(26px);
}

/* 保证根元素与文档满屏，避免 html/body 背景不一致 */
html, body {
    height: 100%;
    min-height: 100%;
}

/* 网站图标样式 */
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    margin-right: 15px;
    /* 添加过渡效果使图标变化更平滑 */
    transition: transform 0.4s cubic-bezier(.07, .78, .14, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.card-content {
    display: flex;
    align-items: center;
    /* 添加过渡效果使内容变化更平滑 */
    transition: transform 0.4s cubic-bezier(.07, .78, .14, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.card-text {
    flex: 1;
    text-align: left;
}

/* 导航栏样式 - 适配双主题 */
.navbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

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

/* 亮色主题下的导航链接 */
html[data-theme="light"] .nav-link {
    text-decoration: none;
    background: rgba(135, 206, 235, 0.2); /* 天空蓝 */
    color: #111;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(135, 206, 235, 0.3);
}

html[data-theme="light"] .nav-link:hover {
    background: rgba(135, 206, 250, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(135, 206, 235, 0.3);
}

/* 暗色主题下的导航链接 */
html[data-theme="dark"] .nav-link {
    text-decoration: none;
    background: rgba(0, 255, 255, 0.15); /* 霓虹青色 */
    color: #dffcff;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 255, 255, 0.25);
}

html[data-theme="dark"] .nav-link:hover {
    background: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
}

