Files
rong dd2935366e feat: 游戏中心——1818 单端口统一入口,进程按需拉起 + 空闲释放
- 一个端口按路径分发:/cnchess /cngo /cs 进程型,/alonelyroad /myword 静态目录
- 进程型首次访问以动态端口拉起子进程,就绪探测后转发;空闲 600s 且无 WS 连接才回收
- WebSocket 走原始 TCP 隧道(握手转发 + 101 透传 + 双向对拷,任一方向 EOF 即拆连)
- 文本响应就地重写根绝对路径(href/src/fetch/url(/ 与 location.host}/ws),游戏源码零改动
- 入口页只显示状态与进入入口,不提供管理按钮;网关/运维接口为 /api/*
- 配置 games.json 磁盘优先、内嵌兜底,改完刷新即生效
2026-10-23 10:09:06 +08:00

507 lines
9.7 KiB
CSS

:root {
--bg: #070b12;
--panel: rgba(15, 23, 37, 0.78);
--panel-2: rgba(11, 17, 28, 0.9);
--line: rgba(120, 165, 255, 0.14);
--line-strong: rgba(120, 165, 255, 0.3);
--text: #dde8fb;
--muted: #7d8ca8;
--muted-2: #5a6780;
--blue: #4a8dff;
--green: #46d39a;
--amber: #f0b429;
--red: #ff6b6b;
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
}
body {
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
"Helvetica Neue", Arial, sans-serif;
font-size: 14px;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}
/* 背景:深蓝径向光 + 细网格 */
.bg {
position: fixed;
inset: 0;
z-index: 0;
pointer-events: none;
background:
radial-gradient(900px 520px at 12% -8%, rgba(74, 141, 255, 0.16), transparent 70%),
radial-gradient(760px 460px at 92% 6%, rgba(70, 211, 154, 0.09), transparent 72%),
radial-gradient(680px 420px at 50% 108%, rgba(74, 141, 255, 0.08), transparent 70%);
}
.bg::after {
content: "";
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(120, 165, 255, 0.045) 1px, transparent 1px),
linear-gradient(90deg, rgba(120, 165, 255, 0.045) 1px, transparent 1px);
background-size: 64px 64px;
mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
-webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}
.topbar,
main {
position: relative;
z-index: 1;
}
/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
flex-wrap: wrap;
padding: 26px clamp(18px, 5vw, 56px) 18px;
border-bottom: 1px solid var(--line);
backdrop-filter: blur(6px);
}
.brand {
display: flex;
align-items: center;
gap: 14px;
}
.logo {
width: 42px;
height: 42px;
border-radius: 13px;
border: 1px solid rgba(74, 141, 255, 0.45);
background: linear-gradient(150deg, rgba(74, 141, 255, 0.22), rgba(74, 141, 255, 0.04));
display: grid;
place-items: center;
box-shadow: 0 0 24px rgba(74, 141, 255, 0.18) inset;
}
.logo i {
width: 16px;
height: 16px;
border-radius: 50%;
border: 2px solid var(--blue);
box-shadow: 0 0 12px rgba(74, 141, 255, 0.7);
position: relative;
}
.logo i::after {
content: "";
position: absolute;
inset: 4px;
border-radius: 50%;
background: #9cc2ff;
}
.brand-text h1 {
margin: 0;
font-size: 19px;
letter-spacing: 0.5px;
font-weight: 650;
}
.brand-text p {
margin: 0;
font-family: var(--mono);
font-size: 11px;
letter-spacing: 1.4px;
color: var(--muted-2);
text-transform: uppercase;
}
.topbar-right {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.runtime {
display: flex;
align-items: center;
gap: 9px;
padding: 8px 14px;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--panel-2);
font-size: 12.5px;
color: var(--muted);
}
.runtime b {
color: var(--text);
font-family: var(--mono);
font-weight: 600;
}
.runtime em {
font-style: normal;
color: var(--muted-2);
margin: 0 2px;
}
.runtime-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--muted-2);
box-shadow: 0 0 0 0 rgba(70, 211, 154, 0.5);
}
.runtime-dot.on {
background: var(--green);
animation: breathe 2.2s infinite;
}
@keyframes breathe {
0% {
box-shadow: 0 0 0 0 rgba(70, 211, 154, 0.45);
}
70% {
box-shadow: 0 0 0 7px rgba(70, 211, 154, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(70, 211, 154, 0);
}
}
/* ------------------------------- 卡片区 ------------------------------- */
main {
padding: 30px clamp(18px, 5vw, 56px) 48px;
max-width: 1320px;
margin: 0 auto;
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(306px, 1fr));
gap: 18px;
}
.card {
--accent: var(--blue);
position: relative;
display: flex;
flex-direction: column;
gap: 12px;
padding: 20px 20px 16px;
border-radius: 18px;
border: 1px solid var(--line);
background: linear-gradient(160deg, rgba(20, 30, 48, 0.9), rgba(10, 15, 25, 0.92));
overflow: hidden;
cursor: pointer;
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
color: inherit;
text-decoration: none;
}
.card::before {
content: "";
position: absolute;
inset: -40% -20% auto -20%;
height: 220px;
background: radial-gradient(
circle at 30% 0%,
color-mix(in srgb, var(--accent) 26%, transparent),
transparent 68%
);
opacity: 0.55;
transition: opacity 0.18s ease;
pointer-events: none;
}
.card:hover {
transform: translateY(-3px);
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--accent) 60%, transparent),
0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent) inset;
}
.card:hover::before {
opacity: 0.9;
}
.card.loading {
cursor: progress;
}
.card.loading::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(
100deg,
transparent 20%,
color-mix(in srgb, var(--accent) 14%, transparent) 50%,
transparent 80%
);
animation: sweep 1.1s linear infinite;
}
@keyframes sweep {
from {
transform: translateX(-60%);
}
to {
transform: translateX(60%);
}
}
.card-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
position: relative;
}
.glyph {
width: 50px;
height: 50px;
border-radius: 14px;
display: grid;
place-items: center;
font-size: 22px;
font-weight: 700;
letter-spacing: 0;
color: color-mix(in srgb, var(--accent) 88%, white);
border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
background: color-mix(in srgb, var(--accent) 16%, rgba(9, 14, 23, 0.9));
box-shadow: 0 0 22px -8px color-mix(in srgb, var(--accent) 70%, transparent) inset;
}
.pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-radius: 999px;
font-size: 11.5px;
font-family: var(--mono);
letter-spacing: 0.3px;
border: 1px solid var(--line);
color: var(--muted);
background: rgba(9, 14, 23, 0.72);
white-space: nowrap;
}
.pill::before {
content: "";
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
.pill.running {
color: var(--green);
border-color: rgba(70, 211, 154, 0.35);
background: rgba(70, 211, 154, 0.08);
}
.pill.asleep {
color: var(--muted-2);
}
.pill.static {
color: #8fb6ff;
border-color: rgba(120, 165, 255, 0.28);
background: rgba(74, 141, 255, 0.08);
}
.pill.error {
color: var(--red);
border-color: rgba(255, 107, 107, 0.35);
background: rgba(255, 107, 107, 0.08);
}
.pill.starting {
color: var(--amber);
border-color: rgba(240, 180, 41, 0.35);
background: rgba(240, 180, 41, 0.08);
}
.pill.starting::before {
animation: blink 0.9s infinite;
}
@keyframes blink {
50% {
opacity: 0.25;
}
}
.card h2 {
margin: 2px 0 0;
font-size: 17px;
font-weight: 650;
letter-spacing: 0.3px;
position: relative;
}
.tag {
margin: -8px 0 0;
font-size: 12.5px;
color: var(--muted);
min-height: 40px;
position: relative;
}
.meta {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0;
padding: 0;
position: relative;
}
.meta li {
font-size: 11px;
color: var(--muted);
padding: 3px 9px;
border-radius: 7px;
background: rgba(120, 165, 255, 0.07);
border: 1px solid rgba(120, 165, 255, 0.1);
white-space: nowrap;
}
.card-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 4px;
padding-top: 12px;
border-top: 1px dashed rgba(120, 165, 255, 0.12);
position: relative;
}
.stat {
font-family: var(--mono);
font-size: 11.5px;
color: var(--muted-2);
letter-spacing: 0.2px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stat b {
color: var(--muted);
font-weight: 500;
}
.go {
font-size: 12px;
font-weight: 600;
padding: 5px 12px;
border-radius: 9px;
color: color-mix(in srgb, var(--accent) 92%, white);
border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
background: color-mix(in srgb, var(--accent) 14%, transparent);
white-space: nowrap;
flex: 0 0 auto;
transition: all 0.16s;
}
.card:hover .go {
background: color-mix(in srgb, var(--accent) 26%, transparent);
}
/* ------------------------------- 页脚 ------------------------------- */
.page-foot {
margin-top: 34px;
padding: 18px 20px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--panel);
color: var(--muted);
font-size: 12.5px;
}
.page-foot p {
margin: 0;
}
.page-foot b {
color: var(--text);
font-weight: 600;
}
.page-foot .tiny {
margin-top: 6px;
color: var(--muted-2);
font-size: 11.5px;
}
/* ------------------------------- toast ------------------------------- */
.toast {
position: fixed;
left: 50%;
bottom: 32px;
transform: translate(-50%, 16px);
padding: 10px 18px;
border-radius: 11px;
border: 1px solid var(--line-strong);
background: rgba(16, 24, 38, 0.96);
color: var(--text);
font-size: 13px;
box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.9);
opacity: 0;
pointer-events: none;
transition: opacity 0.2s, transform 0.2s;
z-index: 20;
max-width: min(560px, 88vw);
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
.toast.err {
border-color: rgba(255, 107, 107, 0.45);
color: #ffd2d2;
}
@media (max-width: 620px) {
.topbar {
padding-top: 18px;
}
.runtime {
order: 3;
width: 100%;
justify-content: center;
}
.cards {
grid-template-columns: 1fr;
}
.tag {
min-height: 0;
}
}