/* 页面视觉由本地 CSS 实现；资源图标可读取线上地址，失败时显示配置中的文字占位。 */
:root {
    color-scheme: dark;
    font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    --bg: #07111f;
    --panel: #0c1c30;
    --panel-light: #112741;
    --text: #f4f8ff;
    --muted: #a4b8d0;
    --line: rgba(89, 168, 215, 0.33);
    --accent: #50e4f6;
    --accent-rgb: 80, 228, 246;
    --violet: #9073ef;
    --viewport-height: 100vh;
}

@supports (height: 100dvh) {
    :root {
        --viewport-height: 100dvh;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* 锁定背景滚动时仍保留滚动条槽，避免弹窗开关导致页面宽度变化。 */
    scrollbar-gutter: stable;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body.dialog-open, body.category-open {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

button, input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

svg {
    display: block;
}

/* 首屏状态：HTML 中默认可见。主页面只能在配置成功后解除 hidden。 */
.boot-screen, .error-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--viewport-height);
    padding: 28px;
    text-align: center;
    overflow: hidden;
    background: radial-gradient(circle at 50% 44%, rgba(28, 83, 130, .3), transparent 33%),
    linear-gradient(rgba(78, 162, 215, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78, 162, 215, .07) 1px, transparent 1px), var(--bg);
    background-size: auto, 72px 72px, 72px 72px, auto;
}

.boot-screen::before, .error-screen::before {
    content: "";
    position: absolute;
    width: min(78vw, 560px);
    aspect-ratio: 1;
    border: 1px solid rgba(95, 166, 218, .14);
    border-radius: 50%;
    box-shadow: 0 0 0 70px rgba(95, 166, 218, .025), 0 0 0 142px rgba(95, 166, 218, .018);
    pointer-events: none;
}

.boot-screen h1, .error-screen h1 {
    position: relative;
    margin: 38px 0 8px;
    font-size: clamp(24px, 3vw, 34px);
    letter-spacing: .12em;
}

.boot-screen p, .error-screen p {
    position: relative;
    margin: 0;
    color: var(--muted);
    letter-spacing: .09em;
}

.boot-visual {
    position: relative;
    width: 260px;
    aspect-ratio: 1;
    filter: drop-shadow(0 0 22px rgba(var(--accent-rgb), .23));
}

.boot-orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(103, 184, 238, .19);
}

.boot-orbit--outer {
    animation: spin 16s linear infinite;
    border-top-color: var(--accent);
    border-bottom-color: var(--violet);
}

.boot-orbit--middle {
    inset: 26px;
    border-style: dashed;
    border-color: rgba(95, 204, 243, .4);
    animation: spin-reverse 11s linear infinite;
}

.boot-orbit--inner {
    inset: 55px;
    border-width: 3px;
    border-color: transparent;
    border-left-color: var(--accent);
    border-right-color: var(--violet);
    box-shadow: inset 0 0 20px rgba(var(--accent-rgb), .08);
    animation: spin 5s ease-in-out infinite;
}

.boot-core {
    position: absolute;
    inset: 88px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb), .72);
    background: radial-gradient(circle, rgba(var(--accent-rgb), .64), rgba(43, 90, 153, .25) 40%, transparent 70%);
    transform: rotate(45deg);
    animation: core-pulse 2.8s ease-in-out infinite;
}

.boot-core span {
    width: 45px;
    height: 45px;
    border: 1px solid rgba(205, 248, 255, .62);
}

.boot-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent);
}

.boot-node--top {
    top: -4px;
    left: calc(50% - 4px);
}

.boot-node--right {
    right: -4px;
    top: calc(50% - 4px);
}

.boot-node--bottom {
    bottom: -4px;
    left: calc(50% - 4px);
}

.boot-node--left {
    left: -4px;
    top: calc(50% - 4px);
}

.loading-dots {
    display: inline-block;
    width: 1.4em;
    overflow: hidden;
    vertical-align: bottom;
    animation: dots 1.3s steps(4, end) infinite;
}

.error-symbol {
    position: relative;
    display: grid;
    place-items: center;
    width: 190px;
    aspect-ratio: 1;
    border: 3px dashed rgba(235, 178, 102, .8);
    border-radius: 50%;
    box-shadow: 0 0 0 28px rgba(80, 228, 246, .035), inset 0 0 30px rgba(235, 178, 102, .1);
    color: #f2b66e;
    font-size: 70px;
}

.error-symbol::before {
    content: "";
    position: absolute;
    inset: -28px;
    border: 1px solid rgba(var(--accent-rgb), .25);
    border-radius: 50%;
}

.error-screen h1 {
    margin-top: 58px;
}

.retry-button {
    position: relative;
    margin-top: 32px;
    min-width: 180px;
}

.noscript-message {
    position: fixed;
    z-index: 110;
    inset: auto 10px 10px;
    padding: 14px;
    text-align: center;
    background: #12283f;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes spin-reverse {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes core-pulse {
    50% {
        transform: rotate(45deg) scale(.82);
        opacity: .7;
    }
}

@keyframes dots {
    from {
        width: 0;
    }
    to {
        width: 1.4em;
    }
}

/* 页面背景和轨道线：用 CSS 渐变与细线代替效果图中的装饰文字。 */
.site-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: var(--viewport-height);
    isolation: isolate;
    overflow: clip;
    background: radial-gradient(ellipse at 8% 38%, rgba(37, 59, 166, .22), transparent 26%),
    radial-gradient(ellipse at 91% 33%, rgba(29, 95, 158, .22), transparent 23%),
    linear-gradient(rgba(72, 155, 209, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 155, 209, .045) 1px, transparent 1px), var(--bg);
    background-size: auto, auto, 64px 64px, 64px 64px, auto;
}

.page-width {
    width: min(100% - 64px, 1220px);
    margin-inline: auto;
}

.site-shell > .site-header, .site-shell > .site-footer {
    flex-shrink: 0;
}

.site-shell > main {
    flex: 1;
}

.ambient {
    position: absolute;
    z-index: -1;
    width: 430px;
    aspect-ratio: 1;
    border: 1px solid rgba(74, 151, 255, .31);
    border-radius: 50%;
    pointer-events: none;
}

.ambient--left {
    top: 180px;
    left: -270px;
    background: radial-gradient(circle at 70% 45%, rgba(24, 55, 129, .35), transparent 65%);
    box-shadow: 0 0 100px rgba(31, 72, 169, .1);
}

.ambient--right {
    top: 210px;
    right: -275px;
    background: radial-gradient(circle at 20% 45%, rgba(18, 103, 178, .3), transparent 67%);
}

.orbit-decoration {
    position: absolute;
    z-index: -1;
    top: 245px;
    width: 350px;
    height: 110px;
    border: 1px solid rgba(68, 160, 227, .29);
    border-left: 0;
    border-bottom: 0;
    border-radius: 50%;
    pointer-events: none;
    transform: rotate(-10deg);
}

.orbit-decoration--left {
    left: -25px;
}

.orbit-decoration--right {
    right: -35px;
    transform: rotate(15deg) scaleX(-1);
}

.orbit-decoration i {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), .85);
}

.orbit-decoration i:nth-child(1) {
    top: 12px;
    left: 22%;
}

.orbit-decoration i:nth-child(2) {
    top: 63px;
    left: 52%;
    background: var(--violet);
}

.orbit-decoration i:nth-child(3) {
    top: 19px;
    right: 16%;
}

.site-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 92px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 21px;
    font-weight: 750;
    letter-spacing: .12em;
}

.brand-mark {
    position: relative;
    display: block;
    width: 38px;
    height: 38px;
}

.brand-mark::before {
    content: "";
    position: absolute;
    inset: 11px 0;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    transform: rotate(-18deg);
}

.brand-mark::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 14px;
    width: 11px;
    height: 34px;
    background: var(--accent);
    clip-path: polygon(50% 0, 68% 38%, 100% 50%, 68% 62%, 50% 100%, 32% 62%, 0 50%, 32% 38%);
    filter: drop-shadow(0 0 8px var(--accent));
}

.header-link {
    padding: 10px 2px;
    background: none;
    border: 0;
    color: #edf5ff;
    font-size: 15px;
    letter-spacing: .06em;
}

.header-link:hover {
    color: var(--accent);
}

.hero {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 54px;
    text-align: center;
}

.hero h1 {
    margin: 0;
    font-size: clamp(35px, 4.2vw, 60px);
    line-height: 1.28;
    font-weight: 800;
    letter-spacing: .075em;
    background: linear-gradient(90deg, #f6f9ff 18%, #cce9ff 57%, var(--accent) 100%);
    color: transparent;
    background-clip: text;
}

.hero > p {
    margin: 10px 0 0;
    color: #d6e1f3;
    font-size: clamp(16px, 1.6vw, 23px);
    letter-spacing: .18em;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 17px;
    width: min(100%, 700px);
    height: 62px;
    margin-top: 38px;
    padding: 0 21px;
    text-align: left;
    border: 1px solid var(--accent);
    border-radius: 32px;
    background: linear-gradient(110deg, rgba(21, 48, 75, .88), rgba(15, 38, 67, .9));
    box-shadow: 0 0 23px rgba(var(--accent-rgb), .17), inset 0 0 22px rgba(var(--accent-rgb), .035);
}

.search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .13), 0 0 30px rgba(var(--accent-rgb), .23);
}

.search-box svg, .category-search svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: #90eaf8;
    stroke-width: 1.8;
    stroke-linecap: round;
    flex: none;
}

.search-box input, .category-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
}

.search-box input {
    font-size: 17px;
}

.search-box input::placeholder, .category-search input::placeholder {
    color: #91a9c3;
}

.search-box input::-webkit-search-cancel-button, .category-search input::-webkit-search-cancel-button {
    filter: grayscale(1) brightness(2);
    cursor: pointer;
}

.search-hint {
    padding: 1px 7px;
    color: #87a2bd;
    border: 1px solid rgba(137, 181, 215, .32);
    border-radius: 5px;
    font-size: 12px;
}

/* 分类不换行堆叠：桌面快捷入口 + 可搜索面板，手机为快捷横滑 + 全屏分类页。 */
.category-navigation {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: min(100%, 850px);
    margin-top: 29px;
}

.quick-categories {
    display: flex;
    flex: none;
    max-width: 100%;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    padding-block: 4px;
    margin-block: -4px;
}

.quick-categories::-webkit-scrollbar {
    display: none;
}

.quick-categories .category-chip {
    flex: none;
    scroll-snap-align: start;
}

.quick-categories .category-chip:focus-visible {
    outline: none;
}

.category-chip, .outline-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 41px;
    padding: 8px 19px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(18, 43, 70, .65);
    color: #ecf4ff;
    white-space: nowrap;
    transition: border-color .2s, background .2s, box-shadow .2s, transform .2s;
}

.category-chip:hover, .outline-button:hover {
    border-color: var(--accent);
    background: rgba(26, 68, 100, .78);
}

.category-chip.is-active, .category-list button.is-active {
    border-color: transparent;
    background: linear-gradient(120deg, #40d8ed, #64c5ff);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), .28);
    color: #071626;
    font-weight: 700;
}

.category-more {
    flex: none;
}

.category-more__mobile-label {
    display: none;
}

.category-more[aria-expanded="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(var(--accent-rgb), .18);
}

.chevron {
    flex: none;
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: -4px 1px 0 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s;
}

.category-more[aria-expanded="true"] .chevron {
    transform: rotate(225deg);
    margin-top: 4px;
}

.category-panel {
    --category-panel-top: 16px;
    --category-panel-left: 16px;
    --category-panel-max-height: calc(var(--viewport-height) - 32px);
    position: fixed;
    z-index: 40;
    top: var(--category-panel-top);
    left: var(--category-panel-left);
    width: min(560px, calc(100vw - 32px));
    max-height: var(--category-panel-max-height);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    text-align: left;
    border: 1px solid rgba(var(--accent-rgb), .65);
    border-radius: 17px;
    background: rgba(10, 29, 49, .98);
    box-shadow: 0 20px 70px rgba(0, 0, 0, .45), 0 0 26px rgba(var(--accent-rgb), .1);
    backdrop-filter: blur(18px);
}

.category-panel[hidden] {
    display: none;
}

.category-panel__top {
    display: flex;
    flex: none;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 13px;
}

.category-panel h2 {
    margin: 0;
    font-size: 18px;
}

.category-panel__summary {
    margin: 4px 0 0;
    color: #91abc4;
    font-size: 12px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: none;
    color: #d7e9fa;
    font-size: 26px;
    line-height: 1;
}

.icon-button:hover {
    color: var(--accent);
}

.category-search {
    display: flex;
    flex: none;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(95, 172, 223, .4);
    border-radius: 22px;
    background: rgba(20, 48, 76, .62);
}

.category-search svg {
    width: 17px;
    height: 17px;
}

.category-search input {
    font-size: 14px;
}

.category-list {
    display: grid;
    flex: 0 1 auto;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 8px;
    max-height: 270px;
    margin-top: 15px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(var(--accent-rgb), .4) transparent;
}

.category-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    min-width: 0;
    min-height: 41px;
    padding: 8px 11px;
    border: 1px solid rgba(92, 158, 211, .29);
    border-radius: 10px;
    background: rgba(23, 51, 80, .6);
    color: #e6f2ff;
    text-align: left;
}

.category-list__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-list__count {
    flex: none;
    color: #86a8c4;
    font-size: 12px;
}

.category-list button.is-active .category-list__count {
    color: #164261;
}

.category-list button:hover {
    border-color: var(--accent);
}

.category-empty {
    margin: 18px 0 2px;
    color: var(--muted);
    text-align: center;
}

/* 资源卡片保留两行摘要；详情与外链是两个明确分开的操作。 */
.resources-section {
    position: relative;
    z-index: 1;
    margin-top: 38px;
}

.results-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 15px;
}

.results-heading h2 {
    margin: 0;
    color: #e4f2ff;
    font-size: 18px;
    letter-spacing: .06em;
}

.results-heading span {
    color: #8caec5;
    font-size: 13px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.resource-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 171px;
    padding: 18px 19px 13px;
    border: 1px solid rgba(var(--accent-rgb), .73);
    border-radius: 11px;
    background: linear-gradient(130deg, rgba(18, 43, 72, .94), rgba(11, 30, 51, .95));
    box-shadow: inset 0 0 20px rgba(var(--accent-rgb), .025);
    transition: transform .22s, border-color .22s, box-shadow .22s;
}

.resource-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 11px 28px rgba(0, 0, 0, .22), 0 0 22px rgba(var(--accent-rgb), .11);
}

.resource-card__main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: 84px;
}

.resource-icon {
    --icon-color: var(--accent);
    --icon-background: linear-gradient(140deg, rgba(17, 40, 66, .96), rgba(8, 24, 41, .96));
    position: relative;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    flex: none;
    overflow: hidden;
    border: 1px solid rgba(116, 167, 208, .25);
    border-radius: 15px;
    background: linear-gradient(140deg, rgba(17, 40, 66, .96), rgba(8, 24, 41, .96));
    color: var(--icon-color);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -.04em;
    text-shadow: 0 0 14px color-mix(in srgb, var(--icon-color), transparent 70%);
}

.resource-icon.has-image {
    background: var(--icon-background);
}

.resource-icon__image {
    width: 43px;
    height: 43px;
    object-fit: contain;
    visibility: hidden;
}

.resource-icon__fallback {
    display: none;
}

.resource-icon.has-image .resource-icon__image {
    visibility: visible;
}

.resource-icon.has-fallback .resource-icon__image {
    display: none;
}

.resource-icon.has-fallback .resource-icon__fallback {
    display: block;
}

.resource-icon.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .18);
    box-shadow: 0 0 18px rgba(var(--accent-rgb), .28);
    animation: icon-pulse 1.6s ease-in-out infinite;
}

@keyframes icon-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: .35;
        transform: translate(-50%, -50%) scale(.72);
    }
}

.resource-card__copy {
    min-width: 0;
    flex: 1;
}

.resource-card__title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.resource-card h3 {
    margin: 2px 0 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 650;
}

.pin-badge {
    display: inline-flex;
    align-items: center;
    flex: none;
    padding: 2px 6px;
    border: 1px solid rgba(245, 195, 103, .36);
    border-radius: 5px;
    color: #f0c783;
    background: rgba(153, 101, 38, .15);
    font-size: 11px;
}

.resource-card__description {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #c8d6e7;
    font-size: 14px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.resource-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 11px;
}

.more-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid rgba(116, 167, 208, .35);
    border-radius: 17px;
    background: rgba(19, 47, 78, .8);
    color: #e1edfa;
    font-size: 13px;
    white-space: nowrap;
}

.more-button:hover {
    border-color: var(--accent);
    background: rgba(31, 79, 110, .7);
}

.more-button__icon {
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

.visit-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.visit-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.visit-link span {
    font-size: 19px;
    line-height: 1;
}

.empty-state {
    padding: 64px 18px;
    border: 1px dashed rgba(var(--accent-rgb), .32);
    border-radius: 14px;
    background: rgba(13, 37, 60, .5);
    text-align: center;
}

.empty-state__icon {
    display: block;
    color: var(--accent);
    font-size: 56px;
}

.empty-state h3 {
    margin: 7px 0;
    font-size: 21px;
}

.empty-state p {
    color: var(--muted);
}

.empty-state button {
    margin-top: 12px;
}

.back-to-top {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(var(--accent-rgb), .65);
    border-radius: 14px;
    background: var(--panel);
    color: var(--accent);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
    transition: background .2s, border-color .2s;
}

.back-to-top:hover {
    background: var(--panel-light);
    border-color: var(--accent);
}

.back-to-top svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.category-open .back-to-top, body.dialog-open .back-to-top {
    display: none;
}

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 45px 0 28px;
    color: #8caac3;
    font-size: 13px;
    letter-spacing: .1em;
    text-align: center;
}

.site-footer__tagline {
    display: flex;
    align-items: center;
    gap: 17px;
}

.site-footer__tagline span {
    flex: none;
    width: 24px;
    height: 1px;
    background: #638baa;
}

.site-footer p {
    margin: 0;
}

/* 资源详情：桌面为居中 dialog，手机通过媒体查询变为底部抽屉。 */
.detail-dialog, .about-dialog {
    width: min(620px, calc(100% - 36px));
    max-height: min(85vh, 780px);
    margin: auto;
    padding: 24px 28px;
    overflow: auto;
    border: 1px solid rgba(var(--accent-rgb), .85);
    border-radius: 16px;
    background: linear-gradient(140deg, #112a49, #0b1d31);
    color: var(--text);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 35px rgba(var(--accent-rgb), .12);
}

.detail-dialog::backdrop, .about-dialog::backdrop {
    background: rgba(1, 9, 21, .72);
    backdrop-filter: blur(2px);
}

.detail-close {
    position: absolute;
    top: 16px;
    right: 17px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-right: 38px;
}

.detail-icon {
    width: 75px;
    height: 75px;
}

.detail-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 11px;
}

.detail-title-line h2 {
    margin: 0;
    font-size: 25px;
}

.detail-category, .detail-tags span {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border: 1px solid rgba(var(--accent-rgb), .5);
    border-radius: 18px;
    background: rgba(14, 68, 102, .37);
    color: #e3f6ff;
    font-size: 13px;
}

.detail-body {
    margin-top: 19px;
    padding-top: 16px;
    border-top: 1px solid rgba(112, 165, 209, .24);
}

.detail-body h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 10px;
    font-size: 17px;
}

.detail-body h3::before {
    content: "";
    width: 4px;
    height: 19px;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), .55);
}

.detail-body p {
    margin: 0;
    color: #d7e4f2;
    font-size: 16px;
    line-height: 1.85;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.detail-actions {
    display: grid;
    grid-template-columns: 1fr .62fr;
    gap: 12px;
    margin-top: 24px;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 47px;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(115deg, #16d3e9, #57e4f4);
    color: #052038;
    font-weight: 750;
    box-shadow: 0 0 20px rgba(var(--accent-rgb), .2);
}

.primary-button:hover {
    filter: brightness(1.1);
}

.detail-secondary {
    border-radius: 12px;
}

.about-dialog {
    width: min(470px, calc(100% - 36px));
}

.about-dialog h2 {
    margin: 0 0 16px;
}

.about-dialog p {
    color: #c9d9e9;
    line-height: 1.8;
    white-space: pre-line;
}

.about-dialog > .outline-button {
    min-width: 120px;
    margin-top: 13px;
}

@media (max-width: 960px) {
    .resource-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ambient--left {
        left: -330px;
    }

    .ambient--right {
        right: -340px;
    }

}

@media (max-width: 640px) {
    .page-width {
        width: min(100% - 32px, 480px);
    }

    .site-header {
        height: 69px;
    }

    .brand {
        font-size: 17px;
        gap: 8px;
    }

    .brand-mark {
        transform: scale(.82);
        transform-origin: left center;
        margin-right: -5px;
    }

    .header-link {
        font-size: 13px;
    }

    .hero {
        padding-top: 36px;
    }

    .hero h1 {
        font-size: clamp(28px, 7vw, 40px);
        line-height: 1.38;
        letter-spacing: .04em;
    }

    .hero > p {
        margin-top: 8px;
        font-size: 14px;
        letter-spacing: .08em;
    }

    .search-box {
        height: 51px;
        margin-top: 28px;
        padding: 0 15px;
        gap: 12px;
    }

    .search-box input {
        font-size: 14px;
    }

    .search-box svg {
        width: 20px;
        height: 20px;
    }

    .search-hint {
        display: none;
    }

    .category-navigation {
        justify-content: flex-start;
        width: 100%;
        margin-top: 15px;
        gap: 8px;
    }

    .quick-categories {
        gap: 8px;
    }

    .quick-categories .category-chip {
        display: inline-flex;
        flex: none;
        min-height: 40px;
        padding: 8px 14px;
        font-size: 13px;
        scroll-snap-align: start;
    }

    .category-more {
        position: relative;
        width: 106px;
        max-width: none;
        min-height: 40px;
        padding: 8px 10px;
        border-color: rgba(var(--accent-rgb), .67);
        border-radius: 22px;
        font-size: 13px;
        background: var(--panel);
    }

    .category-more #category-more-label {
        display: none;
    }

    .category-more__mobile-label {
        display: inline;
    }

    .category-more.is-filtered::after {
        content: "";
        position: absolute;
        top: 3px;
        right: 5px;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--accent);
        box-shadow: 0 0 7px rgba(var(--accent-rgb), .5);
    }

    /* 全屏分类页固定标题与搜索栏，只让列表滚动；键盘弹出时仍可操作。 */
    .category-panel {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: var(--viewport-height);
        max-height: none;
        padding: max(24px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
        overflow: hidden;
        border: 0;
        border-radius: 0;
        background: radial-gradient(circle at 85% 5%, rgba(27, 87, 134, .25), transparent 33%), linear-gradient(#0c1b2d, #091624);
        box-shadow: none;
        backdrop-filter: none;
    }

    .category-panel__top {
        flex: none;
        align-items: center;
        margin-bottom: 23px;
    }

    .category-panel h2 {
        font-size: 23px;
    }

    .category-panel__summary {
        margin-top: 7px;
        font-size: 13px;
    }

    .category-panel .icon-button {
        width: 42px;
        height: 42px;
        border: 1px solid rgba(110, 169, 210, .32);
        border-radius: 50%;
        font-size: 27px;
    }

    .category-search {
        flex: none;
        height: 48px;
        border-color: rgba(var(--accent-rgb), .63);
        background: rgba(18, 45, 73, .82);
    }

    .category-list {
        flex: 1;
        min-height: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        gap: 9px;
        max-height: none;
        margin-top: 20px;
        padding-bottom: 16px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .category-list button {
        min-height: 51px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .category-empty {
        flex: 1;
        align-content: center;
    }

    body.category-open .hero {
        z-index: 30;
    }

    .resources-section {
        margin-top: 25px;
    }

    .results-heading h2 {
        font-size: 16px;
    }

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

    .resource-card {
        min-height: 158px;
        padding: 13px 14px 11px;
    }

    .resource-card__main {
        gap: 12px;
        min-height: 83px;
    }

    .resource-icon {
        width: 61px;
        height: 61px;
        font-size: 22px;
        border-radius: 12px;
    }

    .resource-icon__image {
        width: 37px;
        height: 37px;
    }

    .resource-card h3 {
        font-size: 16px;
    }

    .resource-card__description {
        font-size: 13px;
    }

    .resource-card__footer {
        padding-top: 7px;
    }

    .more-button {
        font-size: 12px;
        padding: 5px 9px;
    }

    .visit-link {
        font-size: 12px;
    }

    .site-footer {
        padding-top: 35px;
        font-size: 11px;
    }

    .detail-dialog {
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: none;
        max-height: 82dvh;
        margin: 0;
        padding: 32px 17px max(23px, env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
    }

    .detail-dialog::before {
        content: "";
        position: absolute;
        top: 11px;
        left: calc(50% - 20px);
        width: 40px;
        height: 4px;
        border-radius: 3px;
        background: #698eb4;
    }

    .detail-close {
        top: 25px;
        right: 15px;
    }

    .detail-icon {
        width: 62px;
        height: 62px;
    }

    .detail-title-line h2 {
        font-size: 21px;
    }

    .detail-header {
        gap: 12px;
    }

    .detail-body {
        margin-top: 16px;
    }

    .detail-body p {
        font-size: 14px;
    }

    .detail-actions {
        grid-template-columns: 1fr;
    }

    .detail-secondary {
        display: none;
    }

    .about-dialog {
        max-height: 80dvh;
    }

    .boot-visual {
        width: 210px;
    }

    .boot-core {
        inset: 70px;
    }

    .boot-orbit--middle {
        inset: 21px;
    }

    .boot-orbit--inner {
        inset: 44px;
    }
}

/* 系统要求减少动态效果时，保留静态图形，不强制播放旋转和位移动画。 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
