/* ========================================
   ChenCertain 游戏服务器 — 个人简洁风格
   支持多游戏 / 白天黑夜模式
   ======================================== */

/* ========== 暗色主题（默认） ========== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: rgba(22, 27, 34, 0.7);
    --bg-card-hover: rgba(30, 38, 48, 0.9);
    --bg-ip-box: rgba(88, 166, 255, 0.06);
    --bg-ip-box-border: rgba(88, 166, 255, 0.18);
    --accent: #58a6ff;
    --accent-2: #7ee787;
    --accent-glow: rgba(88, 166, 255, 0.4);
    --danger: #f85149;
    --success: #3fb950;
    --warn: #d29922;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --border: rgba(139, 148, 158, 0.15);
    --border-hover: rgba(88, 166, 255, 0.3);
    --particle-color: 88, 166, 255;
    --radius: 12px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 亮色主题 ========== */
[data-theme="light"] {
    --bg-primary: #f6f8fa;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --bg-ip-box: rgba(9, 105, 218, 0.05);
    --bg-ip-box-border: rgba(9, 105, 218, 0.15);
    --accent: #0969da;
    --accent-2: #1a7f37;
    --accent-glow: rgba(9, 105, 218, 0.25);
    --danger: #cf222e;
    --success: #1a7f37;
    --warn: #9a6700;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8c959f;
    --border: rgba(31, 35, 40, 0.12);
    --border-hover: rgba(9, 105, 218, 0.3);
    --particle-color: 9, 105, 218;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 60px; overflow-x: hidden; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    cursor: none;
    transition: background 0.4s ease, color 0.4s ease;
}

/* ========== 背景光斑装饰 ========== */
.bg-blobs {
    position: fixed; inset: 0; z-index: -2;
    overflow: hidden; pointer-events: none;
}

.blob {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.15;
    animation: blob-float 20s ease-in-out infinite;
}

.blob-1 {
    width: 400px; height: 400px;
    background: var(--accent);
    top: 10%; left: -5%;
}

.blob-2 {
    width: 350px; height: 350px;
    background: var(--accent-2);
    top: 50%; right: -5%;
    animation-delay: -7s;
}

.blob-3 {
    width: 300px; height: 300px;
    background: var(--accent);
    bottom: 5%; left: 30%;
    animation-delay: -14s;
}

[data-theme="light"] .blob { opacity: 0.1; }

@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 30px) scale(0.9); }
}

/* ========== 鼠标光标 ========== */
.cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0;
    pointer-events: none; z-index: 9999;
    border-radius: 50%; transform: translate(-50%, -50%);
}

.cursor-dot {
    width: 7px; height: 7px; background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.2s, height 0.2s;
}

.cursor-ring {
    width: 32px; height: 32px; border: 1.5px solid var(--accent);
    transition: width 0.3s, height 0.3s, border-color 0.3s, background 0.3s;
}

.cursor-ring.hovering {
    width: 48px; height: 48px;
    border-color: var(--accent-2);
    background: rgba(126, 231, 135, 0.08);
}

.cursor-dot.hovering { width: 4px; height: 4px; }
.cursor-ring.clicking { width: 22px; height: 22px; border-width: 2.5px; }

/* ========== 粒子背景 ========== */
.particle-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1; opacity: 0.35;
}

[data-theme="light"] .particle-canvas { opacity: 0.2; }

/* ========== 导航栏 ========== */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(13, 17, 23, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

[data-theme="light"] .navbar { background: rgba(246, 248, 250, 0.6); }

.navbar.scrolled {
    background: rgba(13, 17, 23, 0.85);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

[data-theme="light"] .navbar.scrolled {
    background: rgba(246, 248, 250, 0.92);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.nav-container {
    max-width: 900px; margin: 0 auto;
    padding: 0 24px; height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}

.nav-right { display: flex; align-items: center; gap: 10px; }

.nav-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text-primary);
    font-size: 1.1rem; font-weight: 600;
}

.nav-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    transition: var(--transition);
    flex-shrink: 0;
}

.nav-logo:hover .nav-avatar {
    transform: scale(1.1);
    box-shadow: 0 0 14px var(--accent-glow);
}

.logo-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 主题切换按钮 */
.theme-toggle {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 50%; cursor: none;
    transition: var(--transition);
    color: var(--text-secondary);
    position: relative; overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--accent); color: var(--accent);
    transform: rotate(20deg) scale(1.05);
}

.theme-toggle:active { transform: rotate(20deg) scale(0.95); }

.theme-icon-moon { display: block; }
.theme-icon-sun { display: none; }

[data-theme="light"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: block; }

/* 汉堡菜单 */
.nav-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: none; padding: 8px;
}

.nav-toggle span {
    width: 24px; height: 2.5px; background: var(--text-primary);
    border-radius: 2px; transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ========== Hero ========== */
.hero {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 80px 24px 120px;
    position: relative;
}

/* 第一页背景 — 径向渐变光晕 */
.hero-bg {
    position: absolute; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse 800px 500px at 25% 15%, rgba(88, 166, 255, 0.35), transparent 65%),
        radial-gradient(ellipse 700px 450px at 75% 85%, rgba(126, 231, 135, 0.22), transparent 65%),
        radial-gradient(ellipse 500px 300px at 50% 50%, rgba(88, 166, 255, 0.08), transparent 70%),
        linear-gradient(180deg, rgba(88,166,255,0.05) 0%, transparent 50%, var(--bg-primary) 100%);
    opacity: 1;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

[data-theme="light"] .hero-bg {
    background:
        radial-gradient(ellipse 800px 500px at 25% 15%, rgba(9, 105, 218, 0.25), transparent 65%),
        radial-gradient(ellipse 700px 450px at 75% 85%, rgba(26, 127, 55, 0.15), transparent 65%),
        radial-gradient(ellipse 500px 300px at 50% 50%, rgba(9, 105, 218, 0.06), transparent 70%),
        linear-gradient(180deg, rgba(9,105,218,0.04) 0%, transparent 50%, var(--bg-primary) 100%);
}

.hero-content { max-width: 560px; z-index: 2; position: relative; }

.hero-title {
    font-size: clamp(2rem, 7vw, 3.5rem);
    font-weight: 700; line-height: 1.15; margin-bottom: 32px;
}

.title-line { display: block; }

.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    background-size: 200% 200%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 4s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 打字光标 */
#typewriter::after {
    content: '|';
    -webkit-text-fill-color: var(--accent);
    color: var(--accent);
    margin-left: 2px;
    font-weight: 300;
}

#typewriter.typing::after {
    animation: cursor-blink 0.6s step-end infinite;
}

#typewriter.typed::after {
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; border-radius: 10px;
    font-size: 0.95rem; font-weight: 600;
    text-decoration: none; border: none; cursor: none;
    transition: var(--transition); position: relative; overflow: hidden;
}

.btn-primary { background: var(--accent); color: var(--bg-primary); }

.btn-primary::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before { left: 100%; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--accent-glow); }

.btn-icon { font-size: 1rem; }

/* ========== Hero 滚动指引 ========== */
.hero-scroll-hint {
    position: absolute; bottom: 32px; left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 0.78rem; color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    animation: scroll-hint-bounce 2s ease-in-out infinite;
    z-index: 2;
}

.hero-scroll-hint:hover { color: var(--accent); }

.scroll-mouse {
    width: 24px; height: 38px;
    border: 2px solid var(--text-muted); border-radius: 12px;
    display: flex; justify-content: center; padding-top: 6px;
}

.scroll-wheel {
    width: 3px; height: 8px; background: var(--text-muted);
    border-radius: 2px; animation: scroll-wheel 1.8s infinite;
}

@keyframes scroll-wheel {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(12px); }
}

@keyframes scroll-hint-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

/* ========== Section ========== */
.section {
    padding: 72px 24px; max-width: 900px; margin: 0 auto;
    position: relative;
}

/* 第二页顶部渐变过渡（衔接 Hero 背景） */
.section::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 120px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, transparent 100%);
    pointer-events: none; z-index: 0;
}

/* 第二页底部渐变过渡（衔接 Footer） */
.section::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
    background: linear-gradient(0deg, var(--bg-secondary) 0%, transparent 100%);
    pointer-events: none; z-index: 0;
}

.section > * { position: relative; z-index: 1; }

.section-header { text-align: center; margin-bottom: 40px; }

.section-tag {
    display: inline-block; font-size: 0.75rem; font-weight: 700;
    letter-spacing: 3px; color: var(--accent); margin-bottom: 10px;
}

.section-title { font-size: clamp(1.6rem, 4.5vw, 2.2rem); font-weight: 700; margin-bottom: 8px; }
.section-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* ========== 服务器卡片 ========== */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.server-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    backdrop-filter: blur(10px); transition: var(--transition);
    position: relative; overflow: hidden;
}

/* 卡片滚动渐入（用 animation，不和 hover transition 冲突） */
.server-card.card-hidden {
    opacity: 0; transform: translateY(40px);
}

.server-card.card-revealed {
    animation: cardFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.server-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 3px; background: var(--accent);
}

.server-card.online::before { background: var(--success); }
.server-card.offline::before { background: var(--danger); }

.server-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
}

.server-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
}

.server-game-info { display: flex; align-items: center; gap: 12px; }

.server-game-icon { font-size: 2rem; }

.server-game-name { font-size: 0.78rem; color: var(--text-muted); }
.server-name { font-size: 1.15rem; font-weight: 600; margin-top: 2px; }

.server-status-badge {
    flex-shrink: 0; padding: 4px 12px; border-radius: 100px;
    font-size: 0.78rem; font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    background: rgba(139, 148, 158, 0.12); color: var(--text-secondary);
    border: 1px solid var(--border);
}

.server-status-badge.online {
    background: rgba(63, 185, 80, 0.12); color: var(--success);
    border-color: rgba(63, 185, 80, 0.25);
}

.server-status-badge.online::before {
    content: ''; width: 6px; height: 6px;
    background: var(--success); border-radius: 50%;
    animation: blink 1.5s infinite;
}

.server-status-badge.offline {
    background: rgba(248, 81, 73, 0.12); color: var(--danger);
    border-color: rgba(248, 81, 73, 0.25);
}

.server-status-badge.offline::before {
    content: ''; width: 6px; height: 6px;
    background: var(--danger); border-radius: 50%;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.server-meta { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.server-meta-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.92rem;
}

.server-meta-key { color: var(--text-muted); }
.server-meta-val { color: var(--text-primary); font-weight: 500; }
.server-meta-val.text-success { color: var(--success); }
.server-meta-val.text-danger { color: var(--danger); }

.player-bar {
    height: 5px; background: rgba(255,255,255,0.05);
    border-radius: 3px; overflow: hidden; margin-bottom: 16px;
}

[data-theme="light"] .player-bar { background: rgba(0,0,0,0.06); }

.player-bar-fill {
    height: 100%; border-radius: 3px; background: var(--success);
    transition: width 0.8s ease;
}

/* IP 框 */
.server-ip-box {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-ip-box); border: 1px solid var(--bg-ip-box-border);
    border-radius: 8px; padding: 10px 14px; gap: 8px;
}

.server-ip-box code { color: var(--accent); font-size: 0.95rem; font-weight: 600; }

.btn-copy {
    flex-shrink: 0; background: var(--accent); color: var(--bg-primary);
    border: none; padding: 5px 14px; border-radius: 6px;
    cursor: none; font-size: 0.82rem; font-weight: 600;
    transition: var(--transition);
}

.btn-copy:hover { background: var(--accent-2); }

/* ========== 卡片内嵌指引折叠 ========== */
.card-guide {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.card-guide-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; background: none; border: none;
    color: var(--text-secondary); font-size: 0.88rem; font-weight: 600;
    cursor: none; transition: var(--transition);
    padding: 4px 0;
}

.card-guide-toggle:hover { color: var(--accent); }

.card-guide-toggle .guide-label {
    display: flex; align-items: center; gap: 6px;
}

.card-guide-chevron {
    font-size: 0.75rem; transition: transform 0.3s ease;
}

.card-guide.open .card-guide-chevron { transform: rotate(90deg); }

.card-guide-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.35s ease;
}

.card-guide.open .card-guide-body { max-height: 1000px; }

.card-guide-body-inner { padding-top: 14px; }

/* ========== 指引步骤 ========== */
.guide-steps { display: flex; flex-direction: column; gap: 14px; }

.guide-step {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 10px 0;
}

.guide-step + .guide-step { border-top: 1px solid var(--border); }

.guide-step-num {
    flex-shrink: 0; width: 26px; height: 26px;
    background: var(--accent); color: var(--bg-primary);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
}

.guide-step-content h4 { font-size: 0.92rem; margin-bottom: 4px; }
.guide-step-content p { color: var(--text-secondary); font-size: 0.86rem; }
.guide-step-content strong { color: var(--text-primary); }

.guide-ip-inline {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-ip-box); border: 1px solid var(--bg-ip-box-border);
    border-radius: 6px; padding: 4px 8px 4px 12px; margin-top: 6px;
}

.guide-ip-inline code { color: var(--accent); font-weight: 600; font-size: 0.86rem; }

.guide-ip-inline button {
    background: var(--accent); color: var(--bg-primary);
    border: none; padding: 3px 12px; border-radius: 5px;
    cursor: none; font-size: 0.76rem; font-weight: 600;
    transition: var(--transition);
}

.guide-ip-inline button:hover { background: var(--accent-2); }

/* ========== 状态栏 ========== */
.status-note {
    display: flex; justify-content: center; align-items: center;
    gap: 14px; margin-top: 28px;
    font-size: 0.85rem; color: var(--text-muted);
}

.btn-text {
    background: none; border: none; color: var(--accent);
    cursor: none; font-size: 0.85rem; transition: var(--transition);
}

.btn-text:hover { text-shadow: 0 0 8px var(--accent-glow); }

/* ========== Footer ========== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 32px 24px 24px;
}

.footer-friends {
    max-width: 900px; margin: 0 auto 20px;
    padding-bottom: 20px; border-bottom: 1px solid var(--border);
}

.footer-friends-title {
    font-size: 0.8rem; font-weight: 700; letter-spacing: 2px;
    color: var(--text-muted); margin-bottom: 12px;
}

.footer-friends-list { display: flex; flex-wrap: wrap; gap: 12px; }

.footer-friends-list a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.88rem; transition: var(--transition);
}

.footer-friends-list a:hover {
    border-color: var(--border-hover); color: var(--accent);
    transform: translateY(-2px);
}

.footer-friends-list a .friend-icon { font-size: 1rem; }

.footer-bottom {
    text-align: center;
    color: var(--text-muted); font-size: 0.82rem;
}

/* ========== Toast ========== */
.toast {
    position: fixed; bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-secondary); color: var(--text-primary);
    padding: 12px 24px; border-radius: 10px;
    border: 1px solid var(--accent);
    box-shadow: 0 6px 24px var(--accent-glow);
    font-size: 0.9rem; font-weight: 500; z-index: 10000;
    opacity: 0; transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ========== 滚动渐入 ========== */
.scroll-reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    body { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none; }
    * { cursor: auto !important; }

    .nav-toggle { display: flex; }

    .hero { padding-top: 80px; }
    .hero-actions { flex-direction: column; width: 100%; }
    .btn { width: 100%; justify-content: center; }
    .section { padding: 56px 16px; }
    .server-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.6rem; }
    .guide-step { flex-direction: column; gap: 8px; }
    .server-card { padding: 18px; }
    .nav-avatar { width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .particle-canvas, .bg-blobs { display: none; }
}
