:root {
    --bg-dark: #0b0f14;
    --bg-card: #151c26;
    --bg-card-hover: #1a2330;
    --primary: #35d07f;
    --primary-dark: #2aa865;
    --accent: #58a6ff;
    --text: #e6edf3;
    --text-muted: #9aa7b4;
    --border: #24303e;
    --danger: #f85149;
    --radius: 14px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
    background: transparent;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 背景图轮播层（最底，承载背景图） */
.bg-slider {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background: var(--bg-dark); /* 兜底深色，图片加载前/失败时显示 */
}

.bg-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
    will-change: opacity;
}

.bg-layer.active {
    opacity: 1;
}

/* 背景装饰遮罩（位于背景图之上，半透明，保证前景文字可读） */
.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 20%, rgba(53, 208, 127, 0.12), transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(88, 166, 255, 0.12), transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(88, 166, 255, 0.08), transparent 45%),
        rgba(11, 15, 20, 0.55); /* 半透明深色遮罩，让背景图透出且文字可读 */
}

/* 内容置于背景层之上 */
.container {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* 导航栏也在背景之上 */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.5rem;
    background: rgba(11, 15, 20, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

/* ===== 测试版提示横幅 ===== */
.beta-banner {
    position: relative;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.18), rgba(255, 138, 101, 0.16));
    border-bottom: 1px solid rgba(255, 183, 77, 0.35);
    text-align: center;
}

.beta-icon {
    font-size: 0.95rem;
}

.beta-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffd591;
    letter-spacing: 0.3px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.7rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.nav-btn:hover {
    border-color: #fb7299;
    background: rgba(251, 114, 153, 0.12);
    transform: translateY(-1px);
}

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

.nav-btn-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.nav-btn-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .topnav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.7rem 1rem;
    }
    .nav-links {
        width: 100%;
        justify-content: space-between;
    }
    .nav-btn {
        flex: 1;
        justify-content: center;
    }
}

/* ===== 头部 ===== */
.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff, #c4d0db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.badges {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.badge {
    background: rgba(53, 208, 127, 0.12);
    border: 1px solid rgba(53, 208, 127, 0.3);
    color: var(--primary);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ===== 信息卡片 ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.card-icon {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
}

.card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.card-main {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.card-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* key-value 统一行布局 */
.kv-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed rgba(36, 48, 62, 0.5);
}

.kv-row:last-of-type {
    border-bottom: none;
}

.kv-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.kv-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    word-break: break-all;
}

.kv-value.code {
    color: var(--accent);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 500;
}

.ip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.ip-copy {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.ip-copy:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

.ip-copy:active {
    transform: scale(0.98);
}

.ip-label {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ip-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    font-family: 'Consolas', 'Courier New', monospace;
    word-break: break-all;
}

.ip-hint {
    margin-top: 0.7rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== 状态区 ===== */
.status-section,
.iframe-section,
.guide-section {
    margin-top: 3rem;
}

.status-section h2,
.iframe-section h2,
.guide-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-section h2::before {
    content: '';
    width: 4px;
    height: 1.3em;
    background: var(--primary);
    border-radius: 2px;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    animation: pulse 1.5s infinite;
}

.status-dot.online {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    animation: none;
}

.status-ping {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.status-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.stat {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem;
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: inherit;
}

.refresh-btn:hover {
    background: var(--accent);
    color: #0b0f14;
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== iframe ===== */
.iframe-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.iframe-wrap iframe {
    border-radius: 8px;
    height: 450px;
    width: 100%;
    max-width: 850px;
}

.iframe-credit {
    margin-top: 0.6rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.iframe-credit a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(88, 166, 255, 0.4);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.iframe-credit a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* ===== 指南 ===== */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

.guide-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
}

.step-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.guide-step h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

.guide-step p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.guide-code {
    display: inline-block;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    color: var(--accent);
    font-size: 0.88rem;
    word-break: break-all;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.guide-code:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.12);
}

.guide-note {
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
}

.port-chip {
    color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid transparent;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.port-chip:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.2);
}

/* ===== 页脚 ===== */
.footer {
    margin-top: 3.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

/* ===== Toast 提示框系统 ===== */
.toast-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 100;
    pointer-events: none;
}

.toast {
    position: fixed;
    right: 1.5rem;
    bottom: 2rem; /* 初始值，实际由 JS 计算 bottom */
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 460px;
    max-width: 520px;
    background: #1a2330;
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.85rem 1rem 0.9rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: auto;
    overflow: hidden;
    transition: bottom 0.4s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-msg {
    flex: 1;
    word-break: break-all;
}

.toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.toast-close:hover {
    background: rgba(248, 81, 73, 0.25);
    color: var(--danger);
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    transform-origin: left;
    transform: scaleX(0);
    opacity: 1;
    animation: toastProgress 2.5s linear forwards;
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* 动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 入场动画：淡入上移 */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    animation: fadeUp 0.6s ease both;
}

/* 依次延迟错落入场 */
.hero h1.fade-up { animation-delay: 0.05s; }
.hero .subtitle.fade-up { animation-delay: 0.15s; }
.hero .badges.fade-up { animation-delay: 0.25s; }
.info-grid.fade-up { animation-delay: 0.35s; }
.status-section.fade-up { animation-delay: 0.45s; }
.iframe-section.fade-up { animation-delay: 0.55s; }
.guide-section.fade-up { animation-delay: 0.65s; }
.footer.fade-up { animation-delay: 0.75s; }

/* 响应式 */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.6rem; }
    .info-grid { grid-template-columns: 1fr; }
    .status-info { grid-template-columns: 1fr; }
    .guide-grid { grid-template-columns: 1fr; }
    .container { padding: 1.5rem 1rem 2rem; }
}

/* Toast 小屏幕适配 */
@media (max-width: 768px) {
    .toast {
        min-width: 0;
        max-width: none;
        left: 1rem;
        right: 1rem;
        width: auto; /* 由 left/right 决定，避免溢出 */
        padding: 0.8rem 0.9rem 0.85rem;
    }
}

@media (max-width: 480px) {
    .toast {
        left: 0.75rem;
        right: 0.75rem;
        width: auto; /* 由 left/right 决定 */
        gap: 0.6rem;
        font-size: 0.85rem;
    }
}

/* ===== 毛玻璃效果（置于末尾以确保覆盖各元素原有背景） ===== */
.glass {
    background: rgba(24, 32, 44, 0.5);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* 悬停时保持毛玻璃，仅提升亮度 */
.card.glass:hover,
.guide-step.glass:hover {
    background: rgba(30, 40, 54, 0.6);
    border-color: var(--primary);
}

.nav-btn.glass:hover {
    background: rgba(251, 114, 153, 0.18);
    border-color: #fb7299;
}

/* 小屏性能：降低模糊半径 */
@media (max-width: 768px) {
    .glass {
        backdrop-filter: blur(8px) saturate(130%);
        -webkit-backdrop-filter: blur(8px) saturate(130%);
    }
}
