/* VPN 智能网关 · 入口页
   视觉：蔚蓝天空底 + 玻璃面板 + 极光/节点网格；页面以资源列表为主体，检索框可选置顶
   可读性：文字用深海军蓝、阴影带蓝调、焦点用实色描边（半透明光晕在浅底上对比度不够） */

:root {
    --bg: #cbe1ff;
    --bg-top: #e4f0ff;
    --bg-mid: #bfd9ff;
    --bg-bot: #9cc3ff;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-solid: rgba(255, 255, 255, 0.96);

    --ink: #0b1c39;
    --ink-dim: #33507d;
    --ink-faint: #4a6488;

    --line: rgba(37, 99, 235, 0.18);
    --line-strong: rgba(37, 99, 235, 0.34);

    /* 强调色：只用蓝色家族 */
    --accent: #2563eb;
    --accent-deep: #1d4ed8;
    --accent-mid: #2563eb;
    --accent-ink: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.14);

    /* 状态色：压深保证浅蓝底上 ≥4.5:1 */
    --ok: #0b6b43;
    --ok-soft: rgba(16, 138, 88, 0.13);
    --ok-line: rgba(11, 107, 67, 0.24);
    --warn: #8a5300;
    --warn-soft: rgba(180, 110, 0, 0.14);
    --warn-line: rgba(138, 83, 0, 0.26);
    /* 粗校完成：介于校验中与完成校验之间，用青色区分 */
    --info: #0f6b73;
    --info-soft: rgba(15, 107, 115, 0.12);
    --info-line: rgba(15, 107, 115, 0.26);

    /* 错误态语义色 */
    --danger: #a32318;
    --danger-soft: rgba(163, 35, 24, 0.12);
    --danger-line: rgba(163, 35, 24, 0.28);
    /* 延后处理 / 未标记：低饱和灰蓝，弱化存在感 */
    --muted: #5b6b85;
    --muted-soft: rgba(91, 107, 133, 0.12);
    --muted-line: rgba(91, 107, 133, 0.26);

    /* 形状与动效 */
    --radius-pill: 999px;
    --radius-card: 20px;
    --radius-tile: 14px;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --shell-max: 1120px;

    --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    color-scheme: light;
}

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

/* 卡片筛选 / 最近访问都用 hidden 控制显隐，需压过 display:flex/grid */
[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
    background: radial-gradient(ellipse 66% 52% at 18% 6%, rgba(255, 255, 255, 0.62), transparent 62%),
    radial-gradient(ellipse 62% 52% at 86% 84%, rgba(70, 128, 246, 0.55), transparent 66%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-bot) 100%);
    color: var(--ink);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(37, 99, 235, 0.22);
    color: var(--ink);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* 1. 动态背景层 */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 极光：缓慢漂移的模糊光斑，只动 transform / opacity 走合成层 */
.aurora {
    position: absolute;
    inset: 0;
}

.aurora__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    will-change: transform;
}

.aurora__blob--a {
    width: 54vw;
    height: 54vw;
    min-width: 380px;
    min-height: 380px;
    top: -18vw;
    left: -10vw;
    background: radial-gradient(circle at 38% 38%, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0) 68%);
    animation: drift-a 24s var(--ease) infinite alternate;
}

.aurora__blob--b {
    width: 46vw;
    height: 46vw;
    min-width: 320px;
    min-height: 320px;
    right: -12vw;
    bottom: -16vw;
    background: radial-gradient(circle at 60% 40%, rgba(59, 130, 246, 0.55), rgba(59, 130, 246, 0) 68%);
    animation: drift-b 31s var(--ease) infinite alternate;
}

.aurora__blob--c {
    width: 38vw;
    height: 38vw;
    min-width: 260px;
    min-height: 260px;
    top: 42%;
    left: 46%;
    background: radial-gradient(circle at 50% 50%, rgba(186, 224, 255, 0.85), rgba(186, 224, 255, 0) 70%);
    animation: drift-c 27s var(--ease) infinite alternate;
}

@keyframes drift-a {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(9vw, 7vh, 0) scale(1.16);
    }
}

@keyframes drift-b {
    from {
        transform: translate3d(0, 0, 0) scale(1.08);
    }
    to {
        transform: translate3d(-11vw, -8vh, 0) scale(0.94);
    }
}

@keyframes drift-c {
    from {
        transform: translate3d(-4vw, 3vh, 0) scale(0.95);
        opacity: 0.7;
    }
    to {
        transform: translate3d(6vw, -6vh, 0) scale(1.2);
        opacity: 1;
    }
}

/* 节点网格：canvas，尺寸由 JS 按 DPR 设置 */
.mesh {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* 细网格：比视口大一圈，用 transform 平移，避免重绘 */
.grid {
    position: absolute;
    inset: -64px;
    background-image: linear-gradient(to right, rgba(37, 99, 235, 0.11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, 0.11) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 30%, #000 18%, transparent 76%);
    mask-image: radial-gradient(ellipse 78% 62% at 50% 30%, #000 18%, transparent 76%);
    animation: grid-drift 28s linear infinite;
    will-change: transform;
}

@keyframes grid-drift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(64px, 64px, 0);
    }
}

/* 顶部提亮、四周染蓝，把视线收拢到资源区 */
.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 108% 84% at 50% 30%, rgba(255, 255, 255, 0.40) 0%, rgba(255, 255, 255, 0) 56%),
    radial-gradient(ellipse 132% 100% at 50% 36%, transparent 42%, rgba(64, 118, 230, 0.34) 100%);
}

/* 胶片颗粒：内联 SVG 噪声，平铺，一次性栅格化 */
.grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 140px 140px;
    opacity: 0.05;
    mix-blend-mode: multiply;
}

/* 2. 内容层 */

.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: clamp(22px, 4vh, 40px) clamp(18px, 4vw, 48px) calc(28px + env(safe-area-inset-bottom));
}

/* ---- 顶栏：品牌在左，检索框（可选）靠右置于页面上方 ---- */

.topbar {
    display: flex;
    align-items: center;
    gap: clamp(18px, 3vw, 36px);
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    animation: rise 0.8s var(--ease) both;
}

.brand__mark {
    position: relative;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-tile);
    border: 1px solid rgba(37, 99, 235, 0.26);
    background: linear-gradient(150deg, #ffffff, #d7e7ff);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 20px -10px rgba(29, 78, 216, 0.55);
}

/* 环 + 芯：一个「网关 / 隧道」的抽象记号，纯 CSS 绘制 */
.brand__mark::before {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    border: 1.5px solid rgba(37, 99, 235, 0.45);
}

.brand__mark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px 2px rgba(37, 99, 235, 0.55);
    animation: core-pulse 3.4s ease-in-out infinite;
}

@keyframes core-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.85);
    }
    50% {
        opacity: 1;
        transform: scale(1.12);
    }
}

.brand__copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand__name {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink);
}

.brand__tagline {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
}

/* ---- 检索框（?showSearch 才渲染） ---- */

.gate {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 340px;
    max-width: 560px;
    margin-left: auto;
    padding: 6px 6px 6px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62)),
    var(--surface);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    box-shadow: inset 0 1px 0 #fff,
    inset 0 -1px 0 rgba(37, 99, 235, 0.06),
    0 20px 48px -26px rgba(23, 63, 150, 0.42);
    transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
    animation: rise 0.8s 0.06s var(--ease) both;
}

/* 光标高光：--mx / --my 由 JS 写入 */
.gate::before {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%),
    rgba(37, 99, 235, 0.12), transparent 62%);
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    pointer-events: none;
}

.gate:hover::before,
.gate:focus-within::before {
    opacity: 1;
}

.gate:focus-within {
    /* 焦点用实色描边：半透明光晕在浅色底上达不到 3:1 */
    border-color: var(--accent-deep);
    box-shadow: inset 0 1px 0 #fff,
    0 0 0 4px rgba(37, 99, 235, 0.20),
    0 20px 48px -24px rgba(23, 63, 150, 0.55);
}

/* 状态指示点：呼吸的节点 */
.gate__glyph {
    position: relative;
    z-index: 1;
    flex: none;
    width: 18px;
    height: 18px;
    margin-left: 18px;
    border-radius: 50%;
    border: 1px solid rgba(37, 99, 235, 0.35);
}

.gate__glyph::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px 2px rgba(37, 99, 235, 0.45);
    animation: core-pulse 2.8s ease-in-out infinite;
}

.gate__input {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0 14px 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 0.01em;
    caret-color: var(--accent);
}

.gate__input::placeholder {
    color: var(--ink-faint);
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
}

.gate__submit {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: none;
    height: 50px;
    padding: 0 24px;
    border: 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(140deg, var(--accent-deep), var(--accent-mid));
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 24px -10px rgba(29, 78, 216, 0.75);
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), filter 0.22s var(--ease);
}

.gate__submit:hover {
    filter: brightness(1.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 14px 30px -10px rgba(29, 78, 216, 0.85);
}

.gate__submit:active {
    transform: translateY(1px) scale(0.985);
}

.gate__submit:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

.gate__arrow {
    flex: none;
    width: 7px;
    height: 7px;
    border-top: 1.8px solid currentColor;
    border-right: 1.8px solid currentColor;
    transform: rotate(45deg) translate(-1px, 1px);
    transition: transform 0.22s var(--ease);
}

.gate__submit:hover .gate__arrow {
    transform: rotate(45deg) translate(1px, -1px);
}

/* ---- 主内容 ---- */

.main {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
}

.resources {
    margin-top: clamp(36px, 6vh, 64px);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px 28px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    animation: rise 0.7s 0.1s var(--ease) both;
}

.section-head__text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-head__title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-head__title {
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    font-weight: 650;
    letter-spacing: 0.02em;
    line-height: 1.25;
    color: var(--ink);
}

/* 标题右侧的当前分组名：?group=组名 可临时切换展示 */
.section-head__group {
    flex: none;
    color: var(--ink-faint);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* 资源列表旁的入口：齿轮进电子资源管理 */
.section-head__admin {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink-faint);
    text-decoration: none;
    transition: color 0.22s var(--ease), border-color 0.22s var(--ease),
    background-color 0.22s var(--ease), transform 0.45s var(--ease);
}

.section-head__admin svg {
    width: 16px;
    height: 16px;
}

.section-head__admin:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.9);
    color: var(--accent-deep);
    transform: rotate(45deg);
}

.section-head__admin:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.section-head__hint {
    font-size: 0.8125rem;
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: var(--ink-faint);
}

/* ---- 状态筛选：胶囊分段控件 ---- */

.filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.58);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    box-shadow: inset 0 1px 0 #fff,
    0 14px 32px -24px rgba(23, 63, 150, 0.55);
}

.filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 15px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink-dim);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.22s var(--ease), background-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}

.filter:hover {
    color: var(--accent-ink);
    background: rgba(255, 255, 255, 0.78);
}

.filter.is-active {
    color: #fff;
    background: linear-gradient(140deg, var(--accent-deep), var(--accent-mid));
    box-shadow: 0 8px 18px -10px rgba(29, 78, 216, 0.8);
}

.filter:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* 资源数据加载完成前禁用，避免和空列表抢交互 */
.filter:disabled {
    cursor: default;
    opacity: 0.6;
    pointer-events: none;
}

.filter__count {
    min-width: 1.5rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.12);
    color: inherit;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.filter.is-active .filter__count {
    background: rgba(255, 255, 255, 0.24);
}

/* ---- 语言顺序切换 ---- */

.order-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: -2px 0 20px;
}

.order-bar__label {
    flex: none;
    color: var(--ink-faint);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.order-bar__hint {
    flex: none;
    color: var(--ink-faint);
    font-size: 0.75rem;
}

.group-switch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: none;
    width: 300px;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    box-shadow: inset 0 1px 0 #fff;
}

/* 白色滑块跟随选中项移动 */
.group-switch__thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: var(--radius-pill);
    background: #fff;
    box-shadow: 0 8px 18px -12px rgba(23, 63, 150, 0.6);
    transition: transform 0.32s var(--ease);
}

.group-switch[data-active="zh"] .group-switch__thumb {
    transform: translateX(100%);
}

.group-switch__item {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink-dim);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.22s var(--ease);
}

.group-switch__item.is-active {
    color: var(--accent-deep);
}

.group-switch__item:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.group-switch__item:disabled {
    cursor: default;
    opacity: 0.6;
}

.group-switch__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    padding: 1px 5px;
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.1);
    color: inherit;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.5;
}

.group-switch__item.is-active .group-switch__count {
    background: var(--accent-soft);
}

/* ---- 资源分组（中文 / 英文） ---- */

/* 切换顺序时禁止误点卡片，并让浏览器提前提升合成层 */
.resource-groups.is-switching {
    pointer-events: none;
}

.resource-groups.is-switching .resource-group {
    will-change: transform, opacity;
}

.resource-group + .resource-group {
    margin-top: 34px;
}

.resource-group__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.resource-group__title {
    flex: none;
    font-size: 1.125rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    line-height: 1.35;
    color: var(--ink);
}

/* 组标题前的蓝色标记 */
.resource-group__title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 18px;
    margin-right: 9px;
    border-radius: 2px;
    vertical-align: -3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}

.resource-group__count {
    flex: none;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-deep);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.6;
}

.resource-group__hint {
    flex: none;
    color: var(--ink-faint);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* 标题信息后面拉一条细线，区分两组 */
.resource-group__head::after {
    content: "";
    flex: 1;
    min-width: 24px;
    height: 1px;
    margin-left: 2px;
    background: linear-gradient(90deg, var(--line), transparent);
}

/* 英文资源：桌面 3 列，平板 2 列，手机走通用单列规则 */
@media (min-width: 901px) {
    .resource-group[data-lang="en"] .resource-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 561px) and (max-width: 900px) {
    .resource-group[data-lang="en"] .resource-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 状态标签较多，中等宽度下允许换行，避免筛选条撑出页面 */
    .filters {
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 18px;
    }
}

/* ---- 资源卡片 ---- */

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    list-style: none;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    padding: 18px 18px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.62)),
    var(--surface);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    box-shadow: inset 0 1px 0 #fff,
    0 18px 40px -30px rgba(23, 63, 150, 0.55);
    color: inherit;
    text-decoration: none;
    transition: transform 0.26s var(--ease), border-color 0.26s var(--ease), box-shadow 0.26s var(--ease);
    animation: rise 0.7s var(--ease) both;
    /* 错峰入场：--i 由 JS 按渲染顺序写入 */
    animation-delay: calc(var(--i, 0) * 0.04s);
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: inset 0 1px 0 #fff,
    0 26px 46px -26px rgba(23, 63, 150, 0.55);
}

/* 校验中的资源置顶，描边加重一层做提示 */
.resource[data-tags~="verifying"] .card {
    border-color: var(--line-strong);
}

.card:focus-visible {
    outline: 2px solid var(--accent-deep);
    outline-offset: 3px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

/* 一个资源可挂多个标签，放不下就换行 */
.badges {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.card__tile {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-tile);
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 10px 20px -12px rgba(29, 78, 216, 0.9);
    color: #fff;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1;
}

/* 每三张换一档蓝色深浅，整排不至于一个色 */
.resource:nth-child(3n + 2) .card__tile {
    background: linear-gradient(145deg, #2563eb, #1e40af);
}

.resource:nth-child(3n) .card__tile {
    background: linear-gradient(145deg, #60a5fa, #2563eb);
}

.card__body {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.card__name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.card__desc {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--ink-dim);
}

.card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 11px;
    border-top: 1px dashed var(--line);
}

.card__host {
    overflow: hidden;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.card__arrow {
    flex: none;
    width: 7px;
    height: 7px;
    border-top: 1.6px solid var(--accent-deep);
    border-right: 1.6px solid var(--accent-deep);
    opacity: 0.45;
    transform: rotate(45deg);
    transition: transform 0.24s var(--ease), opacity 0.24s var(--ease);
}

.card:hover .card__arrow {
    opacity: 1;
    transform: rotate(45deg) translate(1px, -1px);
}

/* ---- 状态标签徽标 ---- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
    white-space: nowrap;
}

.badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge--verifying {
    border-color: rgba(37, 99, 235, 0.3);
    background: var(--accent-soft);
    color: var(--accent-deep);
}

/* 校验中的状态点持续呼吸，暗示还没结束 */
.badge--verifying .badge__dot {
    animation: status-pulse 1.8s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.38);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0);
    }
}

.badge--verified {
    border-color: var(--ok-line);
    background: var(--ok-soft);
    color: var(--ok);
}

/* 粗校完成、精校未完成：静态青标，不做呼吸动画 */
.badge--rough {
    border-color: var(--info-line);
    background: var(--info-soft);
    color: var(--info);
}

.badge--pending {
    border-color: var(--warn-line);
    background: var(--warn-soft);
    color: var(--warn);
}

.badge--major {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.badge--deferred {
    border-color: var(--muted-line);
    background: var(--muted-soft);
    color: var(--muted);
}

.badge--unmarked {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink-faint);
}

/* ---- 空状态 ---- */

.empty {
    margin-top: 16px;
    padding: 30px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.5);
    color: var(--ink-faint);
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: center;
}

/* ---- 最近访问（次要区域） ---- */

.recent {
    margin-top: clamp(34px, 6vh, 56px);
    padding-top: 20px;
    border-top: 1px solid var(--line);
    animation: rise 0.7s 0.16s var(--ease) both;
}

.recent__head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.recent__label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink-dim);
}

.recent__hint {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--ink-dim);
}

.recent__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    list-style: none;
}

.recent__item {
    display: block;
    max-width: 240px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    backdrop-filter: blur(12px) saturate(150%);
    box-shadow: inset 0 1px 0 #fff,
    0 12px 24px -20px rgba(23, 63, 150, 0.7);
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.recent__item:hover {
    border-color: var(--line-strong);
    color: var(--accent-ink);
    transform: translateY(-1px);
}

.recent__item:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* ---- 页脚 ---- */

.foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    max-width: var(--shell-max);
    margin: clamp(38px, 7vh, 64px) auto 0;
    color: var(--ink);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.foot__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.4);
}

/* ---- 状态提示（默认不可见） ---- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 5;
    max-width: min(92vw, 440px);
    padding: 10px 18px;
    border: 1px solid rgba(163, 35, 24, 0.28);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 40px -20px rgba(23, 63, 150, 0.6);
    color: var(--danger);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---- 入场 ---- */

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* 3. 降级与适配 */

/* 不支持 backdrop-filter：改用接近实心的白色面板，保证文字对比度 */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .gate,
    .filters,
    .card,
    .recent__item {
        background: var(--surface-solid);
    }
}

@media (prefers-reduced-transparency: reduce) {
    .gate,
    .filters,
    .card,
    .recent__item {
        background: #fff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* 降低动效：关闭所有装饰动画，canvas 由 JS 只画一帧 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.001ms !important;
    }

    .brand,
    .gate,
    .section-head,
    .card,
    .recent {
        opacity: 1 !important;
        transform: none !important;
    }

    .grid {
        animation: none !important;
    }
}

/* 窄屏：检索框换到品牌下方整行，卡片单列 */
@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
    }

    .gate {
        flex-basis: 100%;
        max-width: none;
        margin-left: 0;
    }
}

@media (max-width: 560px) {
    .page {
        padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    }

    .topbar {
        gap: 16px;
    }

    .brand__mark {
        width: 34px;
        height: 34px;
    }

    .brand__mark::before {
        inset: 8px;
    }

    .brand__name {
        font-size: 1rem;
    }

    .brand__tagline {
        font-size: 0.6875rem;
    }

    .gate {
        padding: 5px 5px 5px 0;
    }

    .gate__glyph {
        width: 16px;
        height: 16px;
        margin-left: 14px;
    }

    .gate__glyph::after {
        inset: 4px;
    }

    .gate__input {
        height: 48px;
        padding: 0 10px 0 10px;
        /* 16px 是 iOS 不自动放大的下限 */
        font-size: 1rem;
    }

    .gate__submit {
        height: 48px;
        padding: 0 18px;
        font-size: 0.9375rem;
    }

    .resources {
        margin-top: 30px;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 16px;
    }

    .section-head__title {
        font-size: 1.3rem;
    }

    .order-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 16px;
    }

    .order-bar__label {
        display: block;
    }

    .order-bar__hint {
        display: none;
    }

    .group-switch {
        width: 100%;
    }

    .filters {
        display: grid;
        /* 状态标签较多，窄屏按可用宽度自适应列数，避免最后一行只剩一个 */
        grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
        width: 100%;
        gap: 6px;
        padding: 5px;
        border-radius: 18px;
    }

    .filter {
        gap: 6px;
        padding: 0 10px;
        font-size: 0.75rem;
    }

    .resource-group + .resource-group {
        margin-top: 24px;
    }

    .resource-group__head {
        margin-bottom: 10px;
    }

    .resource-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .recent {
        margin-top: 32px;
    }

    .recent__item {
        max-width: 100%;
    }
}

@media (max-width: 360px) {
    .gate__glyph {
        display: none;
    }

    .gate__submit {
        padding: 0 14px;
    }

    .filter {
        gap: 4px;
        padding: 0 7px;
    }

    .filter__count {
        min-width: 1.25rem;
        padding: 1px 4px;
    }
}
