/* ═══════════════════════════════════════
   主题变量
   ═══════════════════════════════════════ */

html[data-theme="github"] {
    --bg: #05070a; --panel: rgba(13,17,23,0.94); --panel-bar: rgba(22,27,34,0.95);
    --border: rgba(48,54,61,0.9); --fg: #c9d1d9; --cmd: #e6edf3;
    --accent: #7ee787; --link: #58a6ff; --link-hi: #79c0ff;
    --muted: #8b949e; --dim: #6e7681;
    --glow: rgba(88,166,255,0.10); --glow2: rgba(126,231,135,0.07);
    --hover-bg: rgba(88,166,255,0.10); --scan-opacity: 0.45;
    --shadow: 0 0 90px rgba(88,166,255,0.07);
}
html[data-theme="dracula"] {
    --bg: #0d0f1a; --panel: rgba(40,42,54,0.95); --panel-bar: rgba(52,55,70,0.96);
    --border: rgba(68,71,90,0.9); --fg: #f8f8f2; --cmd: #ffffff;
    --accent: #50fa7b; --link: #bd93f9; --link-hi: #d6acff;
    --muted: #8b93b0; --dim: #6272a4;
    --glow: rgba(189,147,249,0.14); --glow2: rgba(80,250,123,0.08);
    --hover-bg: rgba(189,147,249,0.14); --scan-opacity: 0.32;
    --shadow: 0 0 90px rgba(189,147,249,0.10);
}
html[data-theme="nord"] {
    --bg: #0b1016; --panel: rgba(46,52,64,0.94); --panel-bar: rgba(59,66,82,0.95);
    --border: rgba(76,86,106,0.85); --fg: #eceff4; --cmd: #ffffff;
    --accent: #a3be8c; --link: #88c0d0; --link-hi: #8fbcbb;
    --muted: #9aa5b5; --dim: #6d7a8e;
    --glow: rgba(136,192,208,0.14); --glow2: rgba(163,190,140,0.09);
    --hover-bg: rgba(136,192,208,0.14); --scan-opacity: 0.30;
    --shadow: 0 0 90px rgba(136,192,208,0.10);
}
html[data-theme="gruvbox"] {
    --bg: #1a1614; --panel: rgba(40,40,40,0.95); --panel-bar: rgba(60,56,54,0.96);
    --border: rgba(80,73,69,0.9); --fg: #ebdbb2; --cmd: #fbf1c7;
    --accent: #b8bb26; --link: #83a598; --link-hi: #8ec07c;
    --muted: #a89984; --dim: #928374;
    --glow: rgba(131,165,152,0.14); --glow2: rgba(184,187,38,0.08);
    --hover-bg: rgba(131,165,152,0.16); --scan-opacity: 0.30;
    --shadow: 0 0 90px rgba(184,187,38,0.08);
}
html[data-theme="matrix"] {
    --bg: #000300; --panel: rgba(0,12,3,0.96); --panel-bar: rgba(0,20,6,0.97);
    --border: rgba(0,90,35,0.8); --fg: #b8ffcf; --cmd: #d6ffe6;
    --accent: #00ff6a; --link: #00cc55; --link-hi: #4dffa0;
    --muted: #3f9960; --dim: #1f5c33;
    --glow: rgba(0,255,106,0.16); --glow2: rgba(0,255,106,0.09);
    --hover-bg: rgba(0,255,106,0.12); --scan-opacity: 0.55;
    --shadow: 0 0 90px rgba(0,255,106,0.12);
}
html[data-theme="cyberpunk"] {
    --bg: #06020c; --panel: rgba(15,6,26,0.95); --panel-bar: rgba(26,10,40,0.96);
    --border: rgba(255,46,151,0.35); --fg: #f0e7ff; --cmd: #ffffff;
    --accent: #ff2e97; --link: #00e5ff; --link-hi: #6bffff;
    --muted: #a98ec7; --dim: #6e5387;
    --glow: rgba(255,46,151,0.16); --glow2: rgba(0,229,255,0.12);
    --hover-bg: rgba(0,229,255,0.12); --scan-opacity: 0.40;
    --shadow: 0 0 90px rgba(255,46,151,0.12);
}
html[data-theme="tokyo"] {
    --bg: #0a0e1a; --panel: rgba(26,27,38,0.95); --panel-bar: rgba(36,40,59,0.96);
    --border: rgba(65,72,104,0.85); --fg: #c0caf5; --cmd: #ffffff;
    --accent: #9ece6a; --link: #7aa2f7; --link-hi: #a9c1ff;
    --muted: #7982a9; --dim: #565f89;
    --glow: rgba(122,162,247,0.16); --glow2: rgba(158,206,106,0.08);
    --hover-bg: rgba(122,162,247,0.16); --scan-opacity: 0.35;
    --shadow: 0 0 90px rgba(122,162,247,0.12);
}
html[data-theme="solarized"] {
    --bg: #fdf6e3; --panel: rgba(253,246,227,0.96); --panel-bar: rgba(238,232,213,0.97);
    --border: rgba(147,161,161,0.45); --fg: #586e75; --cmd: #073642;
    --accent: #859900; --link: #268bd2; --link-hi: #2aa198;
    --muted: #839496; --dim: #93a1a1;
    --glow: rgba(38,139,210,0.12); --glow2: rgba(133,153,0,0.07);
    --hover-bg: rgba(38,139,210,0.12); --scan-opacity: 0.10;
    --shadow: 0 0 80px rgba(38,139,210,0.10);
}

:root {
    --mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono',
    'Fira Code', Consolas, 'Courier New', monospace;
}

/* ═══════════════════════════════════════
   Reset
   ═══════════════════════════════════════ */

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    overflow: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

body::before {
    content: '';
    position: fixed; inset: 0;
    background:
            radial-gradient(ellipse 60% 40% at 50% 0%,   var(--glow),  transparent 70%),
            radial-gradient(ellipse 60% 50% at 50% 110%, var(--glow2), transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: background 0.4s ease;
}

body::after {
    content: '';
    position: fixed; inset: 0;
    background: repeating-linear-gradient(
            to bottom,
            transparent 0, transparent 2px,
            rgba(0, 0, 0, 0.16) 3px, rgba(0, 0, 0, 0.16) 3px
    );
    pointer-events: none;
    z-index: 50;
    opacity: var(--scan-opacity);
    transition: opacity 0.4s ease;
}

#snake-bg {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    display: block;
    transition: opacity 0.5s ease;
}

/* ═══════════════════════════════════════
   Loading 遮罩
   ═══════════════════════════════════════ */

.loading {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition:
            opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
            visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
            radial-gradient(ellipse 50% 40% at 50% 50%, var(--glow),  transparent 70%),
            radial-gradient(ellipse 60% 50% at 50% 110%, var(--glow2), transparent 70%);
    pointer-events: none;
}

.loading-box {
    position: relative;
    width: min(320px, 78vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.5),
            0 24px 60px rgba(0, 0, 0, 0.6),
            var(--shadow);
    animation: loadingBoxIn 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes loadingBoxIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-cursor {
    font-family: var(--mono);
    font-size: 34px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 2px;
    text-shadow: 0 0 20px var(--accent), 0 0 40px var(--glow2);
    animation: loadingBlink 1.1s steps(1, end) infinite;
}

@keyframes loadingBlink {
    0%, 50%      { opacity: 1; }
    50.01%, 100% { opacity: 0.22; }
}

.loading-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--muted);
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-fill {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--link));
    box-shadow: 0 0 12px var(--accent);
    border-radius: 2px;
    transition: width 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.loading-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.4) 50%,
            transparent 100%
    );
    animation: loadingShimmer 1.4s linear infinite;
}

@keyframes loadingShimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.loading-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--dim);
    letter-spacing: 0.3px;
    gap: 8px;
}

.loading-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-percent {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   布局：三列 grid
   ═══════════════════════════════════════ */

.wrap {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    transition: opacity 0.4s ease;
}

body.playing .wrap {
    opacity: 0;
    pointer-events: none;
}

.stage {
    width: 100%;
    max-width: 1360px;
    height: 100%;
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) 200px;
    gap: 18px;
    justify-content: center;
    align-items: stretch;
}

.layout {
    width: 100%;
    height: 100%;
    max-width: 1300px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ═══════════════════════════════════════
   侧栏面板
   ═══════════════════════════════════════ */

.side-panel {
    align-self: end;
    max-height: calc(100% - 20px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.5),
            0 16px 44px rgba(0, 0, 0, 0.6),
            var(--shadow);
    transition: background 0.4s ease, border-color 0.4s ease;
    opacity: 0;
    animation: panelIn 0.8s 0.25s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.side-right { animation-delay: 0.35s; }

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

.panel-head {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    background: var(--panel-bar);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    user-select: none;
    flex-shrink: 0;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.panel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: panelPulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes panelPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.75); }
}

.panel-body {
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    flex: 1;
    min-height: 0;
}
.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── 左栏：系统指标 ── */

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

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 10px;
    letter-spacing: 0.6px;
}

.metric-label {
    color: var(--muted);
    font-weight: 700;
}

.metric-value {
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.metric-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.metric-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    border-radius: 2px;
    transition: width 0.7s cubic-bezier(0.2, 0.8, 0.3, 1),
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.metric-net .metric-value {
    display: inline-flex;
    gap: 6px;
    font-size: 10px;
}

.net-up   { color: var(--link); }
.net-down { color: var(--accent); }

/* ── 右栏：日志 ── */

.log-body {
    gap: 0;
    padding: 8px 10px;
    font-size: 10.5px;
    line-height: 1.85;
}

.log-line {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    animation: logIn 0.32s ease both;
}

@keyframes logIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.log-time {
    color: var(--dim);
    opacity: 0.7;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.log-msg {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.log-line.ok   .log-msg { color: var(--accent); }
.log-line.info .log-msg { color: var(--link); }
.log-line.warn .log-msg { color: #febc2e; }

/* ═══════════════════════════════════════
   Hero
   ═══════════════════════════════════════ */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 11px;
    padding: 4px 0 6px;
    flex-shrink: 0;
    animation: heroIn 0.75s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes heroIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    object-fit: cover;
    background:
            linear-gradient(var(--panel), var(--panel)) padding-box,
            linear-gradient(135deg, var(--accent), var(--link)) border-box;
    border: 2px solid transparent;
    box-shadow:
            0 0 26px var(--glow),
            0 0 52px var(--glow2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1),
    box-shadow 0.35s ease;
    animation: avatarIn 0.9s 0.05s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.avatar:hover {
    transform: scale(1.06) rotate(-2deg);
    box-shadow:
            0 0 42px var(--glow),
            0 0 84px var(--glow2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
@keyframes avatarIn {
    from { opacity: 0; transform: scale(0.7) rotate(-10deg); }
    to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.banner {
    font-family: var(--mono);
    font-size: clamp(6px, 1.35vw, 11px);
    line-height: 1.06;
    color: var(--accent);
    text-shadow: 0 0 18px var(--glow2), 0 0 36px var(--glow2);
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    letter-spacing: 0;
    transition: color 0.4s ease, text-shadow 0.4s ease;
    scrollbar-width: none;
}
.banner::-webkit-scrollbar { display: none; }

.hero-sign {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--link);
    text-shadow: 0 0 14px var(--glow);
    transition: color 0.4s ease;
}

/* ═══════════════════════════════════════
   Hero 社交图标行
   ═══════════════════════════════════════ */

.social-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
    animation: heroIn 0.9s 0.15s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--border);
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition:
            color 0.2s ease,
            border-color 0.2s ease,
            background 0.2s ease,
            transform 0.2s ease,
            box-shadow 0.2s ease;
}

.social-link svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
}

.social-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 22px var(--glow2);
}

.social-link:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════
   主题栏 + 操作按钮
   ═══════════════════════════════════════ */

.theme-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 0;
}

/* ── 主题下拉框 ── */
.theme-dropdown {
    position: relative;
    display: inline-flex;
    z-index: 30;
}

.theme-trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px 10px 12px;
    border-radius: 11px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.2s ease, border-color 0.2s ease,
    background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.theme-trigger:hover {
    border-color: var(--link);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.theme-dropdown.open .theme-trigger {
    border-color: var(--accent);
    background: var(--hover-bg);
    box-shadow: 0 0 0 1px var(--accent) inset, 0 0 20px var(--glow);
}

.trigger-icon {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.trigger-label {
    color: var(--muted);
    transition: color 0.2s ease;
}
.theme-trigger:hover .trigger-label,
.theme-dropdown.open .trigger-label {
    color: var(--fg);
}

.trigger-arrow {
    color: var(--muted);
    font-size: 10px;
    margin-left: 1px;
    transition: transform 0.22s ease, color 0.2s ease;
}
.theme-dropdown.open .trigger-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

/* ── 下拉菜单 ── */
.theme-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    min-width: 172px;
    padding: 6px;
    border-radius: 11px;
    background: var(--panel-bar);
    border: 1px solid var(--border);
    box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.4),
            0 16px 40px rgba(0, 0, 0, 0.6),
            var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.theme-dropdown.open .theme-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.theme-menu::-webkit-scrollbar { width: 6px; }
.theme-menu::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.theme-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.2px;
    text-align: left;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    transition: background 0.14s ease, color 0.14s ease;
}
.theme-item:hover {
    background: var(--hover-bg);
    color: var(--fg);
}
.theme-item.active {
    color: var(--accent);
    background: var(--hover-bg);
}

.item-icon {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
    transition: box-shadow 0.2s ease;
}
.theme-item.active .item-icon {
    box-shadow: 0 0 10px var(--accent);
}

.item-name {
    flex: 1;
}

.item-check {
    color: var(--accent);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.14s ease;
}
.theme-item.active .item-check {
    opacity: 1;
}

/* ── 操作按钮组 ── */
.action-btns {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px 10px 14px;
    border-radius: 11px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.2s ease, border-color 0.2s ease,
    background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn .action-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: box-shadow 0.25s ease, transform 0.25s ease,
    background 0.25s ease, border-color 0.25s ease;
}

.game-btn {
    border-color: rgba(126, 231, 135, 0.32);
    color: #7ee787;
}
.game-btn .game-dot {
    background: #7ee787;
    box-shadow:
            0 0 10px rgba(126, 231, 135, 0.65),
            0 0 22px rgba(126, 231, 135, 0.35);
}
.game-btn:hover {
    border-color: #7ee787;
    background: rgba(126, 231, 135, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(126, 231, 135, 0.18);
}
.game-btn:hover .game-dot { transform: scale(1.1); }
.game-btn.is-playing {
    border-color: #ff5f57;
    color: #ff5f57;
    background: rgba(255, 95, 87, 0.08);
}
.game-btn.is-playing .game-dot {
    background: #ff5f57;
    box-shadow: 0 0 10px rgba(255, 95, 87, 0.7),
    0 0 22px rgba(255, 95, 87, 0.4);
}

.min-btn {
    border-color: rgba(254, 188, 46, 0.32);
    color: #febc2e;
}
.min-btn .min-dot {
    background: #febc2e;
    box-shadow:
            0 0 10px rgba(254, 188, 46, 0.65),
            0 0 22px rgba(254, 188, 46, 0.35),
            inset 0 -2px 3px rgba(0, 0, 0, 0.2);
}
.min-btn:hover {
    border-color: #febc2e;
    background: rgba(254, 188, 46, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(254, 188, 46, 0.18);
}
.min-btn:hover .min-dot { transform: scale(1.1); }
.min-btn.is-minimized {
    border-color: var(--border);
    color: var(--muted);
}
.min-btn.is-minimized .min-dot {
    background: transparent;
    border: 2px solid var(--muted);
    box-shadow: none;
}
.min-btn.is-minimized:hover {
    border-color: var(--accent);
    color: var(--fg);
    background: var(--hover-bg);
    box-shadow: 0 0 22px var(--glow);
}
.min-btn.is-minimized:hover .min-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 14px var(--accent);
}

/* ═══════════════════════════════════════
   游戏退出按钮
   ═══════════════════════════════════════ */

.exit-game-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(13, 17, 23, 0.85);
    border: 1px solid rgba(255, 95, 87, 0.45);
    color: #ff5f57;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    outline: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}
.exit-game-btn .esc-key {
    padding: 3px 8px;
    background: rgba(255, 95, 87, 0.15);
    border-radius: 5px;
    font-size: 11px;
    letter-spacing: 1px;
}
.exit-game-btn:hover {
    background: rgba(255, 95, 87, 0.12);
    border-color: #ff5f57;
    box-shadow: 0 0 24px rgba(255, 95, 87, 0.3);
}
body.playing .exit-game-btn {
    display: inline-flex;
}

/* ═══════════════════════════════════════
   终端
   ═══════════════════════════════════════ */

.terminal {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.55),
            0 20px 60px rgba(0, 0, 0, 0.7),
            var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
            min-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
            max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
            border-color 0.25s ease,
            box-shadow 0.4s ease,
            background 0.4s ease;
}
.terminal:focus-within {
    border-color: var(--link);
    box-shadow:
            0 0 0 1px rgba(0, 0, 0, 0.55),
            0 20px 60px rgba(0, 0, 0, 0.7),
            0 0 110px var(--glow);
}

.terminal.minimized {
    min-height: 0;
    max-height: 46px;
    flex: 1;
}
.terminal.minimized .screen,
.terminal.minimized .status-bar,
.terminal.minimized .footer {
    visibility: hidden;
    pointer-events: none;
}
.terminal.minimized .titlebar { cursor: pointer; }
.terminal.minimized .titlebar:hover {
    background: rgba(255, 255, 255, 0.03);
}

.titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel-bar);
    border-bottom: 1px solid var(--border);
    user-select: none;
    flex-shrink: 0;
    transition: background 0.4s ease, border-color 0.4s ease;
}
.dots { display: flex; gap: 7px; flex-shrink: 0; }
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.dot.r { background: #ff5f57; }
.dot.y { background: #febc2e; cursor: pointer; }
.dot.g { background: #28c840; }
.dot.y:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(254, 188, 46, 0.7);
    transform: scale(1.15);
}

.title {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.4s ease;
}
.title-spacer { width: 46px; flex-shrink: 0; }

.screen {
    flex: 1;
    min-height: 0;
    padding: 18px 22px 22px;
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.8;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    cursor: text;
}
.screen::-webkit-scrollbar { width: 8px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.line {
    white-space: pre-wrap;
    word-break: break-word;
    animation: fade 0.28s ease both;
}
@keyframes fade {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.prompt-user { color: var(--accent); }
.prompt-path { color: var(--link); }
.prompt-sym  { color: var(--muted); }
.cmd  { color: var(--cmd); }
.out  { color: var(--muted); }

.brand {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 14px var(--glow2);
}
.sign {
    color: var(--link);
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 14px var(--glow);
}

.link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 4px 8px;
    margin: 1px 0;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    text-decoration: none;
    color: inherit;
    transition: background 0.16s, border-color 0.16s, transform 0.16s;
    cursor: pointer;
}
.link:hover {
    background: var(--hover-bg);
    border-left-color: var(--link);
    transform: translateX(3px);
}
.link .name { color: var(--link); min-width: 120px; transition: color 0.16s; }
.link:hover .name { color: var(--link-hi); }
.link .desc {
    flex: 1;
    color: var(--dim);
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.link .go {
    color: var(--dim);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.16s, transform 0.16s, color 0.16s;
}
.link:hover .go {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent);
}

.input-line {
    display: flex;
    align-items: baseline;
    animation: none;
}
.input-line .prompt { flex-shrink: 0; white-space: pre; }
.input-line input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--cmd);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    margin: 0;
    caret-color: var(--accent);
}

/* ═══════════════════════════════════════
   终端状态栏
   ═══════════════════════════════════════ */

.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 16px;
    background: var(--panel-bar);
    border-top: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.2px;
    color: var(--dim);
    flex-shrink: 0;
    user-select: none;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.sb-left,
.sb-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.sb-center {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--dim);
    opacity: 0.85;
}

.sb-sep {
    color: var(--border);
    font-size: 10px;
}

.sb-branch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
}

.sb-branch-icon {
    font-size: 11px;
}

.sb-cwd {
    font-style: italic;
}

.sb-online {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
}

.sb-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: sbPulse 2s ease-in-out infinite;
}

@keyframes sbPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.8); }
}

#sbTime {
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

#sbDate {
    color: var(--dim);
}

/* ═══════════════════════════════════════
   页脚
   ═══════════════════════════════════════ */

.footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    border-top: 1px solid var(--border);
    background: var(--panel-bar);
    font-size: 11.5px;
    color: var(--dim);
    flex-shrink: 0;
    letter-spacing: 0.2px;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease,
    opacity 0.25s ease;
}
.footer .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--hover-bg);
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.4px;
    border: 1px solid var(--border);
}
.footer .badge .dot-mini {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}
.footer .spacer { flex: 1; }
.footer a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.16s, text-shadow 0.16s;
    white-space: nowrap;
}
.footer a:hover {
    color: var(--link-hi);
    text-shadow: 0 0 10px var(--glow);
}

/* ═══════════════════════════════════════
   配置加载失败提示
   ═══════════════════════════════════════ */

.config-error {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: #05070a;
    color: #c9d1d9;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.8;
    z-index: 999;
}
.config-error .box {
    max-width: 560px;
    padding: 24px 28px;
    border: 1px solid rgba(255, 95, 87, 0.4);
    border-radius: 10px;
    background: rgba(13, 17, 23, 0.95);
}
.config-error h2 { color: #ff5f57; margin-bottom: 12px; font-size: 15px; }
.config-error code {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    color: #7ee787;
}

/* ═══════════════════════════════════════
   响应式
   ═══════════════════════════════════════ */

/* 中等屏：隐藏侧栏，中间列撑到 920px */
@media (max-width: 1180px) {
    .stage {
        grid-template-columns: minmax(0, 1fr);
        max-width: 920px;
    }
    .side-panel { display: none; }
}

/* 手机 */
@media (max-width: 720px) {
    .wrap { padding: 12px 10px; }
    .layout { gap: 9px; }
    .hero { gap: 8px; padding: 2px 0 4px; }
    .avatar { width: 56px; height: 56px; border-radius: 14px; }
    .banner { font-size: 5.6px; }
    .hero-sign { font-size: 11px; letter-spacing: 2px; }

    .social-link { width: 30px; height: 30px; border-radius: 8px; }
    .social-link svg { width: 14px; height: 14px; }

    .theme-bar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 2px 0;
    }

    /* 主题触发器与操作按钮保持等高 */
    .theme-trigger { padding: 8px 11px 8px 10px; font-size: 12px; border-radius: 10px; }
    .trigger-icon { width: 12px; height: 12px; }
    .trigger-arrow { font-size: 9px; }

    .theme-menu { min-width: 150px; }
    .theme-item { padding: 7px 9px; font-size: 11.5px; }

    .action-btn { padding: 8px 14px 8px 12px; font-size: 12px; }
    .action-btn .action-dot { width: 13px; height: 13px; }

    .titlebar { padding: 8px 12px; gap: 10px; }
    .dot { width: 10px; height: 10px; }
    .title { font-size: 11px; }
    .title-spacer { width: 40px; }
    .terminal.minimized { max-height: 42px; }

    .screen { font-size: 12px; padding: 14px 14px 18px; line-height: 1.75; }
    .link .name { min-width: 88px; }
    .link .desc { font-size: 11.5px; }

    .status-bar { font-size: 10px; padding: 4px 10px; gap: 8px; }
    .sb-center { display: none; }
    .sb-online span:not(.sb-online-dot) { display: none; }

    .footer { font-size: 10.5px; padding: 7px 12px; gap: 7px; }
    .footer .hide-mobile { display: none; }

    .exit-game-btn { top: 14px; right: 14px; padding: 8px 12px; font-size: 12px; }

    .loading-box { padding: 22px 18px; gap: 12px; }
    .loading-cursor { font-size: 28px; }
}