* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg-grad-1: #0f2027;
    --bg-grad-2: #203a43;
    --bg-grad-3: #2c5364;
    --primary: #06b6d4;
    --primary-2: #3b82f6;
    --accent: #5eead4;
    --text: #f5f7fa;
    --muted: #98c5dd;
    --muted-2: #a4c4d9;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-border: rgba(255, 255, 255, 0.08);
}
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%);
    min-height: 100vh;
    color: var(--text);
    padding: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 920px; margin: 0 auto; }

.header { text-align: center; padding: 28px 12px 18px; }
.header h1 {
    font-size: clamp(22px, 5vw, 30px);
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.header p {
    color: var(--muted-2);
    font-size: clamp(12px, 3.4vw, 14px);
}

.panel {
    background: var(--panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
}

#summary { min-height: 50px; }
.hint { color: var(--muted-2); font-size: 13px; text-align: center; padding: 6px 0; }
.loading { color: var(--muted-2); text-align: center; padding: 20px; }
.error { color: #ff7a7a; text-align: center; padding: 18px; }

/* 推荐卡 */
.best-card { text-align: center; padding: 4px 0 6px; }
.best-title {
    color: var(--muted); font-size: 12px;
    letter-spacing: 4px; margin-bottom: 8px;
}
.best-name {
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 600;
    margin-bottom: 6px;
}
.best-ms {
    font-size: clamp(24px, 7vw, 28px);
    color: var(--accent); font-weight: 700; margin-bottom: 14px;
}
.btn-go {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff; text-decoration: none;
    padding: 12px 28px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 15px;
    transition: transform 0.15s;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
    min-height: 44px;
    line-height: 20px;
}
.btn-go:active { transform: translateY(1px); }
@media (hover: hover) { .btn-go:hover { transform: translateY(-2px); } }
.countdown { margin-top: 12px; font-size: 12px; color: var(--muted-2); }

/* 节点行 */
.site-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr 130px;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.site-row.best {
    border-color: var(--accent);
    background: rgba(94, 234, 212, 0.08);
    box-shadow: 0 0 22px rgba(94, 234, 212, 0.18);
}
.site-name { font-size: 16px; font-weight: 600; word-break: break-all; }
.site-flag {
    display: inline-block;
    width: 22px;
    height: auto;
    margin-right: 8px;
    vertical-align: -4px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
}
.best-flag {
    display: inline-block;
    width: 26px;
    height: auto;
    margin-right: 6px;
    vertical-align: -5px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.site-url {
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    cursor: pointer;
    user-select: none;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    margin-top: 4px;
    max-width: 100%;
}
.site-url::before {
    content: "⧉ ";
    color: rgba(152, 197, 221, 0.6);
    margin-right: 2px;
    font-size: 11px;
}
.site-url:active { background: rgba(255, 255, 255, 0.1); }
@media (hover: hover) {
    .site-url:hover {
        background: rgba(94, 234, 212, 0.12);
        border-color: var(--accent);
        color: var(--accent);
    }
}
.site-url.copied {
    background: rgba(94, 234, 212, 0.22);
    border-color: var(--accent);
    color: #fff;
}
.site-url.no-copy {
    color: #6e8a9c;
    cursor: not-allowed;
    border-color: transparent;
    background: transparent;
}
.site-url.no-copy::before {
    content: none;
}
.site-desc {
    font-size: 12px;
    color: #c0d5e3;
    margin-top: 4px;
    line-height: 1.4;
}

.bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 4px;
}
.bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    transition: width 0.25s;
}
.bar-label { font-size: 11px; color: var(--muted-2); }

.site-result {
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}
.site-result.excellent { color: var(--accent); }
.site-result.good      { color: #86efac; }
.site-result.fair      { color: #fde047; }
.site-result.poor      { color: #fdba74; }
.site-result.bad       { color: #ff7a7a; }
.badge-best {
    display: inline-block;
    margin-left: 6px;
    background: var(--accent);
    color: #064e3b;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    vertical-align: middle;
}

/* 工具栏 + 单位切换 */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 0 24px;
    flex-wrap: wrap;
}
.unit-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.unit-toggle button {
    background: transparent;
    color: var(--muted-2);
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    min-height: 32px;
    transition: background 0.18s, color 0.18s;
    -webkit-appearance: none;
    appearance: none;
}
.unit-toggle button.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 9px 22px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    min-height: 38px;
    transition: background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.btn:active { background: rgba(255, 255, 255, 0.18); }
@media (hover: hover) { .btn:hover { background: rgba(255, 255, 255, 0.12); } }

.footer {
    text-align: center;
    color: #6e8a9c;
    font-size: 12px;
    padding: 16px 6px;
    line-height: 1.6;
}
.footer a { color: var(--muted); text-decoration: none; }

/* —— 响应式：≤ 720 平板/折叠竖屏 —— */
@media (max-width: 720px) {
    .site-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 12px;
    }
    .site-result { text-align: left; font-size: 16px; }
    .panel { padding: 14px; }
    body { padding: 12px; }
}

/* —— 响应式：≤ 480 手机竖屏 —— */
@media (max-width: 480px) {
    body { padding: 10px; }
    .header { padding: 18px 8px 14px; }
    .panel { padding: 12px; border-radius: 10px; margin-bottom: 12px; }
    .best-card { padding: 4px 0 2px; }
    .btn-go { width: 100%; max-width: 280px; padding: 14px 24px; }
    .toolbar { gap: 10px; padding: 4px 0 18px; }
    .unit-toggle button { padding: 7px 12px; font-size: 12px; }
    .site-row { padding: 12px 10px; }
    .site-name { font-size: 15px; }
    .site-url { font-size: 12px; padding: 5px 8px; }
    .footer { font-size: 11px; padding: 14px 4px; }
}

/* ============================ QQ/微信内置浏览器引导 ============================ */
.in-app-guard {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(160deg, #0f2027, #2c5364);
    color: #f5f7fa;
    padding: 16px 16px 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
html.in-app-blocked { overflow: hidden; height: 100%; }
html.in-app-blocked body { overflow: hidden; height: 100%; }
html.in-app-blocked > body > .wrap { visibility: hidden; }
html.in-app-blocked .in-app-guard { display: block; }

/* —— 顶部横幅提示 —— */
.guard-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #2563eb;
    color: #fff;
    text-align: center;
    padding: 10px 50px 10px 16px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    line-height: 1.4;
}
.guard-banner-text { display: inline-block; }

/* —— 右上角手指图标 —— */
.guard-finger {
    position: fixed;
    top: 36px;
    right: 8px;
    font-size: 36px;
    line-height: 1;
    z-index: 10002;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
    animation: finger-bob 0.9s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes finger-bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-10px) rotate(-5deg); }
}

/* —— 主卡片 —— */
.guard-card {
    margin: 60px auto 0;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 22px 18px 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 10000;
}
.guard-h1 {
    text-align: center;
    font-size: clamp(20px, 6.2vw, 26px);
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}
.guard-sub {
    text-align: center;
    color: #a4c4d9;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 18px;
}

/* —— 步骤块 —— */
.guard-step {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px 14px;
    margin-bottom: 14px;
}
.guard-step-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.guard-step-num {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #5eead4, #06b6d4);
    color: #064e3b;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(94, 234, 212, 0.3);
}
.guard-step-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}
.kbd-big {
    display: inline-block;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 2px 8px;
    margin: 0 3px;
    font-size: 15px;
    font-weight: 700;
    color: #fde047;
    vertical-align: -1px;
    font-family: inherit;
}

.guard-tip {
    text-align: center;
    color: #98c5dd;
    font-size: 12px;
    margin-top: 6px;
}

/* —— 仿真顶部栏图示 —— */
.mock-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f1f1f;
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
}
.mock-close {
    font-size: 20px;
    color: #aaa;
    font-weight: 400;
    width: 24px;
    text-align: left;
}
.mock-title {
    flex: 1;
    text-align: center;
    color: #ddd;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
}
.mock-dots {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.mock-dots-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2a2a2a;
    border: 2px solid #fde047;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    position: relative;
    animation: mock-pulse 1.4s ease-in-out infinite;
}
.mock-dots-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fde047;
}
@keyframes mock-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(253, 224, 71, 0.6); }
    50%      { box-shadow: 0 0 0 10px rgba(253, 224, 71, 0); }
}

/* —— 仿真菜单图示 —— */
.mock-menu {
    background: #ffffff;
    color: #1f1f1f;
    border-radius: 10px;
    padding: 4px 0;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.mock-menu-item {
    padding: 11px 14px;
    font-size: 14px;
    color: #1f1f1f;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mock-menu-item:last-child { border-bottom: 0; }
.mock-menu-item.active {
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
    position: relative;
    animation: mock-flash 1.6s ease-in-out infinite;
}
.mock-menu-icon { font-size: 18px; }
.mock-menu-pick {
    margin-left: auto;
    color: #b45309;
    font-size: 13px;
    font-weight: 700;
}
@keyframes mock-flash {
    0%, 100% { background: #fef3c7; }
    50%      { background: #fde68a; }
}

/* —— 复制网址卡 —— */
.guard-url-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px 14px;
    margin-bottom: 14px;
}
.guard-url-label {
    color: #a4c4d9;
    font-size: 12px;
    margin-bottom: 6px;
}
.guard-url-text {
    background: rgba(0, 0, 0, 0.25);
    color: #c0d5e3;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    word-break: break-all;
    cursor: pointer;
    user-select: text;
    line-height: 1.5;
}

/* —— 大按钮 —— */
.guard-big-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    min-height: 48px;
    line-height: 1.3;
    -webkit-appearance: none;
    appearance: none;
}
.guard-btn-copy {
    background: linear-gradient(135deg, #5eead4, #06b6d4);
    color: #064e3b;
    box-shadow: 0 5px 16px rgba(94, 234, 212, 0.35);
}
.guard-btn-copy:active { transform: translateY(1px); }
.guard-btn-copy.copied {
    background: #10b981;
    color: #fff;
}

.guard-hint {
    color: #98c5dd;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    line-height: 1.5;
}

/* —— 小屏微调 —— */
@media (max-width: 380px) {
    .guard-card { padding: 18px 14px 16px; border-radius: 14px; }
    .guard-h1 { font-size: 19px; }
    .guard-pulse-dot { top: 42px; right: 2px; width: 34px; height: 34px; }
    .guard-step { padding: 10px 12px 12px; }
    .guard-step-title { font-size: 15px; }
}

/* ============================ 后台 ============================ */
.admin-body { background: #f5f7fa; color: #1f2937; min-height: 100vh; padding: 0; }
.admin-body .topbar {
    background: #1f2937;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-body .topbar nav { display: flex; flex-wrap: wrap; gap: 12px; }
.admin-body .topbar a { color: #cfd8e3; text-decoration: none; font-size: 14px; padding: 4px 2px; }
.admin-body .topbar a.active, .admin-body .topbar a:hover { color: #fff; }
.admin-body .container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.admin-body .card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.admin-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-body th, .admin-body td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e5e7eb; }
.admin-body th { color: #6b7280; font-weight: 500; background: #f9fafb; }
.admin-body input[type=text], .admin-body input[type=password], .admin-body input[type=number], .admin-body textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.admin-body label { display: block; font-size: 13px; color: #374151; margin-bottom: 4px; margin-top: 12px; }
.admin-body .btn-primary {
    background: #2563eb; color: #fff; border: none; padding: 9px 18px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.admin-body .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-body .btn-danger { background: #dc2626; color: #fff; padding: 5px 10px; border-radius: 5px; border: none; cursor: pointer; font-size: 12px; }
.admin-body .btn-link { background: none; color: #2563eb; border: none; cursor: pointer; font-size: 13px; padding: 0; }
.admin-body .badge-on { background: #10b981; color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.admin-body .badge-off { background: #6b7280; color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.admin-body .admin-flag {
    display: inline-block;
    width: 20px;
    height: auto;
    vertical-align: -4px;
    margin-right: 4px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.admin-body .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.admin-body .stat-item { background: #fff; padding: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.admin-body .stat-num { font-size: 26px; font-weight: 700; color: #1f2937; }
.admin-body .stat-label { font-size: 12px; color: #6b7280; margin-top: 4px; }
.admin-body .login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f5f7fa; padding: 16px;
}
.admin-body .login-card { width: 100%; max-width: 360px; background: #fff; padding: 28px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.admin-body .login-card h2 { text-align: center; margin-bottom: 6px; }
.admin-body .login-card p.muted { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 20px; }
.admin-body .err { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.admin-body .ok { background: #d1fae5; color: #065f46; padding: 10px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }

@media (max-width: 640px) {
    .admin-body .topbar { padding: 10px 14px; }
    .admin-body .container { padding: 0 12px; }
    .admin-body .card { padding: 14px; }
    .admin-body table { font-size: 13px; }
    .admin-body th, .admin-body td { padding: 8px 6px; }
}
