/* ============ VOL.PUB 庇护所终端 ============ */

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/terminal/jetbrains-mono-400.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/terminal/jetbrains-mono-500.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/terminal/jetbrains-mono-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Noto Sans SC';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/terminal/noto-sans-sc-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Noto Sans SC';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/terminal/noto-sans-sc-700.woff2') format('woff2');
}

/* 磷光主色：注册为可过渡属性，切换天气时平滑变色（不支持的浏览器退化为瞬时切换） */
@property --phosphor {
    syntax: '<color>';
    inherits: true;
    initial-value: #ffb000;
}
@property --phosphor-hi {
    syntax: '<color>';
    inherits: true;
    initial-value: #ffd25e;
}

:root {
    --bg: #060809;
    --panel: rgba(8, 10, 12, 0.78);
    --bone: #e8e3d5;
    --bone-dim: rgba(232, 227, 213, 0.48);
    --red: #ff3b30;
    --mono: 'JetBrains Mono', 'Noto Sans SC', 'Microsoft YaHei', monospace;

    --phosphor: #ffb000;
    --phosphor-hi: #ffd25e;
    --phosphor-dim: color-mix(in srgb, var(--phosphor) 55%, transparent);
    --phosphor-faint: color-mix(in srgb, var(--phosphor) 28%, transparent);
    --line: color-mix(in srgb, var(--phosphor) 16%, transparent);
    transition: --phosphor 1.2s ease, --phosphor-hi 1.2s ease;
}
/* 晴天：灰蓝背景上的冷青磷光 */
:root[data-weather="sunny"] {
    --phosphor: #7fd6e6;
    --phosphor-hi: #c9f0f8;
}
/* 辐射雨：灰绿背景上的酸性绿磷光 */
:root[data-weather="fallout"] {
    --phosphor: #93e04b;
    --phosphor-hi: #cdf7a0;
}

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

html, body { overflow-x: hidden; }

body {
    font-family: var(--mono);
    background: var(--bg);
    color: var(--bone);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--phosphor); color: #060809; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #060809; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--phosphor) 35%, transparent); border: 2px solid #060809; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--phosphor) 60%, transparent); }
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--phosphor) 35%, transparent) #060809; }

a { color: inherit; text-decoration: none; }
a:hover, a:focus { color: var(--phosphor-hi); }
button { font-family: var(--mono); cursor: pointer; background: none; border: none; color: inherit; }
:focus-visible { outline: 1px solid var(--phosphor); outline-offset: 3px; }

/* ---------- 背景层（逻辑不动，仅氛围压暗） ---------- */

.container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    pointer-events: none;
    transition: filter 0.9s ease;
}
.slideshow { position: relative; height: 100vh; width: 100vw; overflow: hidden; }
.slideshow::before { background: rgba(4, 6, 8, 0.28); }
#container { position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100% !important; }

body[data-weather="storm"] .container { filter: brightness(0.82); }
body[data-weather="drizzle"] .container { filter: brightness(0.9) saturate(0.85); }
body[data-weather="sunny"] .container { filter: brightness(0.86) saturate(1.02); }
body[data-weather="fallout"] .container { filter: brightness(0.6) sepia(0.35) hue-rotate(48deg); }

/* ---------- 静态背景降级（手机 / 无 WebGL：不跑雨幕引擎，按天气切换静态图） ---------- */

.static-bg #container { display: none; }
.static-bg .slide {
    opacity: 0;
    transition: opacity 0.9s ease;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
}
.static-bg .slide--current { opacity: 1; }
.static-bg #slide-1 { background-image: url('../img/weather/texture-storm-lightning-bg.png'); }
.static-bg #slide-2 { background-image: url('../img/weather/texture-drizzle-bg.png'); }
.static-bg #slide-3 { background-image: url('../img/weather/texture-sun-bg.png'); }
.static-bg #slide-4 { background-image: url('../img/weather/texture-fallout-bg.png'); }

#particle-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.4s ease;
}
#particle-canvas.hidden { opacity: 0; }

.vignette {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(4, 6, 8, 0.72) 0%, rgba(4, 6, 8, 0.45) 45%, rgba(4, 6, 8, 0.12) 70%, transparent 85%),
        linear-gradient(to top, rgba(4, 6, 8, 0.6), transparent 22%),
        linear-gradient(to bottom, rgba(4, 6, 8, 0.5), transparent 18%),
        radial-gradient(ellipse at center, transparent 55%, rgba(4, 6, 8, 0.5) 100%);
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.nosupport { display: none; }
.no-webgl .nosupport {
    display: block;
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 1em;
    background: var(--red);
    color: #fff;
    text-align: center;
    z-index: 1000;
    font-size: 0.8rem;
}

/* ---------- 入场揭示（开机样式已内联至 index.html；仅 JS 正常时启用，noscript 直接可见） ---------- */

.topbar, .terminal, .bottombar, .atmos-panel {
    transition: opacity 0.6s ease, transform 0.6s ease, filter 0.6s ease;
}
body.booted .channel { transition-delay: calc(0.2s + var(--i) * 0.08s); }

/* ---------- 顶部状态栏 ---------- */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem clamp(1.25rem, 4vw, 2.5rem);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--phosphor-dim);
    background: linear-gradient(to bottom, rgba(6, 8, 9, 0.72), transparent);
}
.topbar-left { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; }
.topbar-left .dim { opacity: 0.5; }
.sig-dot { width: 6px; height: 6px; background: var(--phosphor); border-radius: 50%; animation: sig-blink 2.4s ease-in-out infinite; }
@keyframes sig-blink { 0%, 100% { opacity: 1; box-shadow: 0 0 8px color-mix(in srgb, var(--phosphor) 80%, transparent); } 50% { opacity: 0.35; box-shadow: none; } }

.topbar-right { display: flex; align-items: center; gap: 1rem; }
.clock { color: var(--bone-dim); font-size: 11px; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }

.snd-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--phosphor);
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 0.42rem 0.7rem;
    transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.snd-toggle:hover { border-color: var(--phosphor-dim); background: color-mix(in srgb, var(--phosphor) 8%, transparent); }
.snd-toggle[aria-pressed="false"] { color: var(--bone-dim); }
.snd-toggle[aria-pressed="false"]:hover { color: var(--phosphor-dim); }

/* ---------- 主终端 ---------- */

.terminal {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 6.5rem clamp(1.25rem, 5vw, 3rem) 8rem;
    position: relative;
    z-index: 10;
}

.overline {
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--phosphor-dim);
    margin-bottom: 0.9rem;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

.title {
    font-size: clamp(2.6rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.05;
    color: var(--phosphor-hi);
    text-shadow: 0 0 26px color-mix(in srgb, var(--phosphor) 28%, transparent), 0 2px 14px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.6);
}
.cursor {
    display: inline-block;
    width: 0.5ch;
    height: 0.82em;
    margin-left: 0.18ch;
    background: var(--phosphor);
    vertical-align: -0.06em;
    animation: cursor-blink 1.1s steps(1) infinite;
}
@keyframes cursor-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

.slogan-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    min-height: 1.7em;
    margin: 1.1rem 0 3rem;
    font-size: 13.5px;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, var(--phosphor-hi) 78%, transparent);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.prompt { color: var(--phosphor-dim); }
#dynamic-slogan { position: relative; }
#dynamic-slogan.glitching { animation: glitch-jitter 0.26s steps(2) both; }
#dynamic-slogan.glitching::before,
#dynamic-slogan.glitching::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    overflow: hidden;
}
#dynamic-slogan.glitching::before { color: var(--red); transform: translate(-2px, -1px); clip-path: inset(18% 0 42% 0); }
#dynamic-slogan.glitching::after { color: var(--phosphor-hi); transform: translate(2px, 1px); clip-path: inset(62% 0 8% 0); }
@keyframes glitch-jitter {
    0% { transform: translate(0); }
    25% { transform: translate(-2px, 1px) skewX(-4deg); }
    50% { transform: translate(2px, -1px); }
    75% { transform: translate(-1px, 0) skewX(3deg); }
    100% { transform: translate(0); }
}

/* ---------- 频道列表 ---------- */

.channels { max-width: 780px; border-top: 1px solid var(--line); }

.channel {
    display: grid;
    grid-template-columns: 3ch minmax(0, 1.1fr) minmax(0, 1.4fr) auto 3ch;
    align-items: center;
    gap: 1.2rem;
    padding: 1.05rem 0.6rem;
    border-bottom: 1px solid var(--line);
    position: relative;
    color: var(--bone);
    transition: background 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease, opacity 0.6s ease;
}
.channel:hover, .channel:focus-visible {
    background: linear-gradient(90deg, color-mix(in srgb, var(--phosphor) 10%, transparent), color-mix(in srgb, var(--phosphor) 2%, transparent) 55%, transparent);
    box-shadow: inset 2px 0 0 var(--phosphor);
    transform: translateX(4px);
    color: var(--bone);
}

.ch-index { font-size: 11px; color: var(--phosphor-faint); font-weight: 500; transition: color 0.28s; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.channel:hover .ch-index { color: var(--phosphor); }

.ch-name { display: flex; flex-direction: column; gap: 3px; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; transition: color 0.28s; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85); }
.ch-name small { font-size: 9px; font-weight: 400; letter-spacing: 0.24em; color: var(--bone-dim); }
.channel:hover .ch-name { color: var(--phosphor-hi); animation: name-glitch 0.3s steps(2) 1; }
@keyframes name-glitch {
    0%, 100% { text-shadow: none; }
    30% { text-shadow: -2px 0 var(--red), 2px 0 var(--phosphor-hi); }
    60% { text-shadow: 2px 0 var(--red), -2px 0 var(--phosphor-hi); }
}

.ch-desc { font-size: 12px; color: rgba(232, 227, 213, 0.62); letter-spacing: 0.04em; transition: color 0.28s; text-shadow: 0 1px 7px rgba(0, 0, 0, 0.85); }
.channel:hover .ch-desc { color: rgba(232, 227, 213, 0.9); }
.ch-pwr { display: block; margin-top: 3px; font-size: 8px; font-weight: 400; letter-spacing: 0.14em; color: rgba(232, 227, 213, 0.3); }

.ch-status { display: flex; align-items: center; gap: 0.45rem; font-size: 9.5px; letter-spacing: 0.18em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85); }
.ch-status i { width: 5px; height: 5px; border-radius: 50%; }
.ch-status.online { color: color-mix(in srgb, var(--phosphor) 78%, transparent); }
.ch-status.online i { background: var(--phosphor); animation: status-pulse 2.4s ease-out infinite; }
@keyframes status-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--phosphor) 50%, transparent); }
    70% { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.ch-status.offline { color: rgba(255, 82, 70, 0.9); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.ch-status.offline i { background: var(--red); animation: sig-blink 1.6s steps(2) infinite; }

.ch-arrow { font-size: 13px; color: var(--phosphor-faint); transition: transform 0.28s, color 0.28s; }
.channel:hover .ch-arrow { transform: translateX(4px); color: var(--phosphor-hi); }

/* ---------- 底部信息 ---------- */

.bottombar {
    position: fixed;
    left: clamp(1.25rem, 4vw, 2.5rem);
    bottom: 1.1rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: rgba(232, 227, 213, 0.45);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}
.bottombar a { color: inherit; transition: color 0.25s; }
.bottombar a:hover { color: var(--phosphor); }
.beian img { height: 12px; vertical-align: -2px; margin-right: 4px; }
.beian .sep { margin: 0 0.55em; opacity: 0.4; }

/* ---------- 大气控制面板 ---------- */

.atmos-panel {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 20;
    min-width: 196px;
    padding: 0.7rem 0.8rem 0.6rem;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.atmos-panel::before, .atmos-panel::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
}
.atmos-panel::before { top: -1px; left: -1px; border-top: 1px solid var(--phosphor); border-left: 1px solid var(--phosphor); }
.atmos-panel::after { bottom: -1px; right: -1px; border-bottom: 1px solid var(--phosphor); border-right: 1px solid var(--phosphor); }

.atmos-label { font-size: 9px; letter-spacing: 0.26em; color: var(--phosphor-faint); }
.atmos-options { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.atmos-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.5rem;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--bone-dim);
    border: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.atmos-btn i { font-size: 11px; }
.atmos-btn:hover { color: var(--phosphor); border-color: var(--line); }
.atmos-btn.active {
    color: var(--phosphor-hi);
    border-color: color-mix(in srgb, var(--phosphor) 55%, transparent);
    background: color-mix(in srgb, var(--phosphor) 10%, transparent);
}

.fx-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--line);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--phosphor);
    transition: color 0.25s;
}
.fx-toggle:hover { color: var(--phosphor-hi); }
.fx-toggle[aria-pressed="false"] { color: var(--bone-dim); }

/* ---------- 响应式 ---------- */

@media (max-width: 700px) {
    .terminal { padding: 5.5rem 1.25rem 2rem; }
    .slogan-line { margin-bottom: 2.2rem; font-size: 12.5px; }
    .channel {
        grid-template-columns: 3ch minmax(0, 1fr) auto;
        gap: 0.5rem 0.9rem;
        padding: 0.9rem 0.4rem;
    }
    .ch-name { grid-column: 2; grid-row: 1; }
    .ch-desc { grid-column: 2; grid-row: 2; font-size: 11px; }
    .ch-status { grid-column: 3; grid-row: 1 / span 2; }
    .ch-arrow { display: none; }
    .bottombar { position: static; padding: 0 1.25rem; margin: auto 0 4.9rem; }
    .atmos-panel {
        right: 0.75rem;
        bottom: 0.75rem;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        padding: 0.4rem 0.5rem;
    }
    .atmos-label { display: none; }
    .atmos-options { display: flex; gap: 2px; }
    .atmos-btn { flex-direction: column; gap: 3px; padding: 0.35rem 0.5rem; font-size: 9px; }
    .atmos-btn i { font-size: 13px; }
    .fx-toggle {
        border-top: none;
        border-left: 1px solid var(--line);
        padding: 0.35rem 0.2rem 0.35rem 0.6rem;
        margin-left: 2px;
        flex-direction: column;
        gap: 3px;
        font-size: 9px;
        letter-spacing: 0.08em;
    }
    .fx-toggle i { font-size: 12px; }
}

@media (max-width: 480px) {
    .clock { display: none; }
    .topbar { padding: 0.8rem 1rem; }
}

/* ---------- 减少动态 ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    #boot { display: none; }
    .cursor { animation: none; }
}