:root {
    --bg-dark: #0a0e14;
    --bg-panel: #131820;
    --bg-card: #1a2028;
    --bg-hover: #232b35;
    --border: #2a3440;
    --text-primary: #e0e0e0;
    --text-secondary: #8a9099;
    --accent: #4caf50;
    --accent-dim: #2e7d32;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
    --t-color: #ff6b6b;
    --ct-color: #4fc3f7;
}

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

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
    padding-top: 52px;
}

#app {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 52px);
}

/* ===== 索沛全站关联导航 ===== */
.sp-global-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(15, 12, 41, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 20px;
}
.sp-global-nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}
.sp-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: #f093fb;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.sp-nav-brand .sp-logo {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    font-weight: 900;
}
.sp-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.sp-nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    color: #b9b3ff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.sp-nav-links a:hover {
    color: #fff;
    background: rgba(124, 117, 217, 0.15);
}
.sp-nav-links a.active {
    color: #fff;
    background: rgba(124, 117, 217, 0.25);
    font-weight: 600;
}
.sp-nav-links a .icon {
    font-size: 14px;
}
.sp-nav-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #b9b3ff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    align-items: center;
    justify-content: center;
}

@media (max-width: 992px) {
    .sp-nav-toggle { display: flex; }
    .sp-nav-links {
        position: absolute;
        top: 52px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0;
        background: rgba(15, 12, 41, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 8px;
        display: none;
    }
    .sp-nav-links.open { display: flex; }
    .sp-nav-links a {
        padding: 12px 16px;
        border-radius: 10px;
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    height: 56px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.logo span {
    color: var(--text-primary);
    font-weight: 400;
    margin-left: 8px;
}

.status-dot {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.status-dot.connected {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent);
}

.status-dot.disconnected {
    background: rgba(244, 67, 54, 0.15);
    color: var(--danger);
}

.main-layout {
    display: grid;
    grid-template-columns: 280px minmax(220px, 0.72fr) minmax(420px, 1.45fr);
    gap: 1px;
    background: var(--border);
    flex: 1;
    overflow: hidden;
}

.left-panel, .center-panel, .right-panel {
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.center-panel {
    min-width: 0;
}

.right-panel {
    min-width: 0;
}

.right-panel .chat-section {
    flex: 0.85;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.right-panel .chat-section .chat-box {
    flex: 1;
    min-height: 140px;
    height: auto;
    max-height: none;
}

.right-panel .console-section {
    flex: 1.15;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.right-panel .console-section .console-box {
    flex: 1;
    min-height: 160px;
}

.panel-section {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.panel-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

.btn-primary {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent);
}

.btn-danger {
    background: #c62828;
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger);
}

.input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

.add-form {
    margin-top: 10px;
}

.form-actions {
    display: flex;
    gap: 8px;
}

.hidden {
    display: none !important;
}

.empty-hint {
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    padding: 16px 0;
}

.badge {
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.server-list, .task-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.server-item {
    padding: 10px;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.server-item:hover {
    border-color: var(--border);
    background: var(--bg-hover);
}

.server-item.selected {
    border-color: var(--accent);
    background: rgba(76, 175, 80, 0.08);
}

.server-item-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.server-item-addr {
    font-size: 11px;
    color: var(--text-secondary);
}

.server-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.task-item {
    padding: 10px;
    background: var(--bg-card);
    border-radius: 6px;
    border-left: 3px solid var(--text-secondary);
}

.task-item.running {
    border-left-color: var(--accent);
}

.task-item.completed {
    border-left-color: var(--info);
}

.task-item.failed {
    border-left-color: var(--danger);
}

.task-item.pending {
    border-left-color: var(--warning);
}

.task-item-player {
    font-weight: 600;
    font-size: 13px;
}

.task-item-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-item-actions {
    margin-top: 6px;
}

.server-info {
    display: flex;
    gap: 12px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.player-item .player-online {
    flex: 1 1 100%;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
}

.player-item:hover {
    border-color: var(--border);
    background: var(--bg-hover);
}

.player-item .team-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}

.player-item .team-tag.T {
    background: rgba(255, 107, 107, 0.15);
    color: var(--t-color);
}

.player-item .team-tag.CT {
    background: rgba(79, 195, 247, 0.15);
    color: var(--ct-color);
}

.player-item .player-name {
    flex: 1;
    font-size: 13px;
}

.player-item .player-kd {
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.player-item .player-kd.muted {
    opacity: 0.65;
}

.player-item .player-score {
    font-size: 11px;
    color: var(--text-secondary);
}

.recording-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.recording-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

#recording-target {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.recording-job-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.recording-job-status.is-active {
    color: var(--accent);
}

.recording-job-status.is-queued {
    color: var(--warning);
}

.recording-job-status.is-failed {
    color: var(--danger);
}

.recording-indicator,
#recording-timer {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.section-subhint {
    font-size: 11px;
    color: var(--text-secondary);
    margin: -4px 0 8px;
}

.scoreboard-panel {
    max-height: 220px;
    overflow-y: auto;
}

.player-cards-panel,
.highlights-panel,
.suspicion-panel {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pcard {
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.pcard:hover { border-color: #8b949e; }
.pcard-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.pcard-name { flex: 1; font-weight: 600; }
.pcard-kd { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pcard-kd small { margin-left: 4px; opacity: 0.8; }
.pcard-row { color: var(--text-secondary); line-height: 1.4; }

.hl-item {
    padding: 7px 9px;
    border-left: 3px solid #58a6ff;
    background: var(--bg-card);
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 12px;
}
.hl-item.sev-suspect { border-left-color: #e3b341; }
.hl-item.sev-highlight_high { border-left-color: #f85149; }
.hl-time { font-size: 11px; color: var(--text-secondary); }
.hl-title { font-weight: 600; margin: 2px 0; }
.hl-detail { color: var(--text-secondary); word-break: break-all; }

.analysis-note {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0 0 6px;
    line-height: 1.4;
}
.analysis-note.warn { color: #e3b341; }
.econ-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
}
.econ-row, .risk-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}
.econ-miss {
    color: var(--text-secondary);
    min-width: 72px;
}
.econ-who { min-width: 100px; }
.econ-ctx { color: var(--text-secondary); flex: 1; word-break: break-all; }
.risk-row.level-high span:last-child { color: #f85149; font-weight: 700; }
.risk-row.level-medium span:last-child { color: #e3b341; font-weight: 600; }
.flag-item {
    padding: 6px 8px;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 12px;
}
.flag-item.level-high { border-left: 3px solid #f85149; }
.flag-item.level-medium { border-left: 3px solid #e3b341; }
.flag-item.level-low { border-left: 3px solid #8b949e; }
.flag-title { font-weight: 600; }
.flag-detail { color: var(--text-secondary); margin-top: 2px; }

.scoreboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.scoreboard-table th,
.scoreboard-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.scoreboard-table th {
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: var(--bg-panel);
}

.scoreboard-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: Consolas, monospace;
}

.scoreboard-table .rank {
    color: var(--text-secondary);
    width: 28px;
}

.scoreboard-table .name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.scoreboard-table .name-cell .nm {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreboard-table .name-cell .nm.T { color: var(--t-color); }
.scoreboard-table .name-cell .nm.CT { color: var(--ct-color); }

.kill-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100vh - 420px);
    min-height: 180px;
    overflow-y: auto;
}

.kill-entry {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    border-left: 3px solid var(--border);
    font-size: 13px;
    animation: slideIn 0.3s ease;
}

.kill-entry.is-hs {
    border-left-color: #e53935;
    background: rgba(229, 57, 53, 0.06);
}

.kill-entry.is-suicide {
    border-left-color: var(--warning);
}

.kill-entry .kill-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.45;
}

.kill-entry .kill-name {
    font-weight: 700;
    color: var(--text-primary);
}

.kill-entry .kill-name.T {
    color: var(--t-color);
}

.kill-entry .kill-name.CT {
    color: var(--ct-color);
}

.kill-entry .kill-mid {
    color: var(--text-secondary);
    font-size: 12px;
}

.kill-entry .kill-mid b {
    color: #ffcc80;
    font-weight: 700;
}

.kill-entry .kill-action {
    color: var(--text-secondary);
    font-size: 12px;
}

.kill-entry .kill-action.hs {
    color: #ef5350;
    font-weight: 700;
}

.kill-entry .kill-weapon {
    color: var(--text-secondary);
    font-size: 12px;
}

.kill-entry .kill-meta {
    display: flex;
    justify-content: flex-end;
}

.kill-entry .kill-time {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.chat-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 140px;
    overflow-y: auto;
}

.chat-entry {
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 12px;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-entry .chat-line {
    word-break: break-word;
}

.chat-entry .chat-name {
    font-weight: 600;
    color: var(--info);
}

.chat-entry .chat-name.T {
    color: var(--t-color);
}

.chat-entry .chat-name.CT {
    color: var(--ct-color);
}

.chat-entry .chat-message {
    color: var(--text-primary);
}

.chat-entry .chat-team-tag {
    font-size: 10px;
    color: var(--text-secondary);
}

.chat-entry .chat-time {
    align-self: flex-end;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.console-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    font-family: Consolas, 'Courier New', monospace;
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px;
}

.console-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 3px 4px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 2px;
}

.console-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.console-entry .console-time {
    flex: 0 0 auto;
    color: #6a737d;
    white-space: nowrap;
    font-size: 11px;
}

.console-entry .console-msg {
    flex: 1;
    color: #c9d1d9;
    word-break: break-word;
    white-space: pre-wrap;
}

.console-entry.source-textmsg .console-msg {
    color: #7ee787;
}

.console-entry.source-print .console-msg {
    color: #79c0ff;
}

.console-entry.source-op .console-msg {
    color: #e3b341;
    font-weight: 500;
}

.event-log {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 200px;
    overflow-y: auto;
}

.event-entry {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-left: 2px solid var(--border);
}

.event-entry.round {
    border-left-color: var(--warning);
    color: var(--warning);
}

.event-entry.player {
    border-left-color: var(--info);
}

/* Demo Upload */
.demo-upload-area {
    margin-bottom: 8px;
}

.upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-label:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(76, 175, 80, 0.05);
}

.upload-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    min-height: 16px;
}

.upload-status.success { color: var(--accent); }
.upload-status.error { color: var(--danger); }
.upload-status.loading { color: var(--warning); }

.demo-info {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 8px;
}

.demo-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 2px 0;
}

.demo-info-row > span:first-child {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.demo-info-row > span:last-child {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.demo-map-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 72%;
}

.demo-map-cell #demo-map {
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.map-rec-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

.map-rec-badge.hidden {
    display: none;
}

.map-rec-badge.ok {
    color: #0f3d24;
    background: #b8f0cf;
}

.map-rec-badge.missing {
    color: #5c1a1a;
    background: #f5c2c2;
}

.map-rec-badge.pending {
    color: #5a4200;
    background: #f3e0a0;
}

.map-rec-badge.offline {
    color: #333;
    background: #d0d0d0;
}

/* Player List from Demo */
.demo-player-list {
    margin-top: 8px;
}

.demo-player-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-card);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.demo-player-item:hover {
    border-color: var(--border);
    background: var(--bg-hover);
}

.demo-player-item.selected {
    border-color: var(--accent);
    background: rgba(76, 175, 80, 0.08);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}


.protocol-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 700;
    background: #2a3440;
}
.protocol-badge.p47 { background: #1b4d89; color: #fff; }
.protocol-badge.p48 { background: #6a1b9a; color: #fff; }
.player-item.selected {
    outline: 1px solid var(--accent);
    background: var(--bg-hover);
}
#worker-status { margin-right: 10px; }

.recent-demo-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
}
.recent-demo-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.recent-demo-item:hover { background: var(--bg-hover); }
.recent-demo-item.active {
    border-color: var(--accent);
    background: rgba(76, 175, 80, 0.08);
}
.recent-demo-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.recent-demo-name {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-demo-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}
.recent-demo-status {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 11px;
    flex-wrap: wrap;
    align-items: center;
}
.retain-countdown {
    color: #e3b341;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}
.retain-countdown.expired { color: #f85149; }
.vs-pending { color: var(--warning); }
.vs-recording { color: var(--info); }
.vs-completed { color: var(--accent); }
.vs-failed { color: var(--danger); }
.vs-none { color: var(--text-secondary); }
.vs-mp4 {
    color: #fff;
    background: #2e7d32;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 10px;
}
.progress-bar {
    margin-top: 6px;
    height: 4px;
    background: #2a3440;
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #4caf50);
    transition: width .4s ease;
}

/* ===== 强制新手教程 ===== */
body.tour-lock #app {
    pointer-events: none;
    user-select: none;
}
body.tour-lock .sp-global-nav {
    pointer-events: none;
}
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
}
.tour-overlay.hidden { display: none; }
.tour-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
}
.tour-spotlight {
    position: absolute;
    border: 2px solid #7c75d9;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(124, 117, 217, 0.35);
    background: transparent;
    pointer-events: none;
    transition: top .2s, left .2s, width .2s, height .2s;
    z-index: 1;
}
.tour-card {
    position: absolute;
    z-index: 2;
    width: min(420px, calc(100vw - 32px));
    background: #16122e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 18px 18px 14px;
    color: #eee;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.tour-step-badge {
    display: inline-block;
    font-size: 11px;
    color: #b9b3ff;
    background: rgba(124, 117, 217, 0.2);
    border-radius: 999px;
    padding: 2px 10px;
    margin-bottom: 10px;
}
.tour-card h3 {
    font-size: 17px;
    margin-bottom: 8px;
    color: #f093fb;
}
.tour-card p {
    font-size: 13px;
    line-height: 1.65;
    color: #cfc9ff;
    margin-bottom: 14px;
    white-space: pre-wrap;
}
.tour-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.tour-actions .btn {
    min-width: 120px;
}
.tour-target-active {
    position: relative;
    z-index: 100001 !important;
}

/* 语言切换 */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 10px;
    background: #1a2028;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}
.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
}
.lang-btn:hover { color: #fff; }
.lang-btn.active {
    background: rgba(124, 117, 217, 0.35);
    color: #fff;
    font-weight: 600;
}

/* ===== 手机端适配（响应式 + 移动设备识别增强） ===== */
@media (max-width: 992px) {
    html { height: auto; }

    body {
        height: auto;
        min-height: calc(var(--vh, 1vh) * 100);
        overflow-y: auto;
        overflow-x: hidden;
        padding-top: 52px;
        padding-bottom: env(safe-area-inset-bottom, 0);
        -webkit-tap-highlight-color: transparent;
    }

    #app {
        height: auto;
        min-height: 0;
    }

    .sp-global-nav { padding: 0 12px; }

    /* 头部：允许换行，吸顶在全局导航下方 */
    .header {
        height: auto;
        min-height: 52px;
        padding: 10px 14px;
        gap: 8px;
        flex-wrap: wrap;
        position: sticky;
        top: 52px;
        z-index: 500;
        background: var(--bg-panel);
    }
    .header-left { min-width: 0; }
    .header-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        margin-left: auto;
    }
    .logo { font-size: 16px; }
    .logo span { margin-left: 4px; }
    .status-dot { padding: 5px 10px; font-size: 12px; }
    .lang-switch { margin-right: 0; }
    .lang-btn { padding: 6px 10px; min-height: 30px; }

    /* 三栏布局 -> 单列自然滚动 */
    .main-layout {
        display: block;
        height: auto;
        flex: none;
        overflow: visible;
        background: var(--bg-dark);
    }
    .left-panel,
    .center-panel,
    .right-panel {
        overflow: visible;
        height: auto;
        min-height: 0;
    }
    .panel-section { padding: 12px 14px; }

    /* 触控友好的按钮与输入 */
    .btn {
        min-height: 38px;
        padding: 8px 14px;
        font-size: 14px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .btn-sm { min-height: 34px; padding: 6px 12px; }
    .input {
        min-height: 42px;
        font-size: 15px;
        padding: 10px 12px;
    }
    .upload-label { min-height: 48px; font-size: 15px; }
    .form-actions { gap: 8px; }
    .form-actions .btn { flex: 1 1 auto; }

    /* 取消内部固定高度，改为整页滚动 */
    .player-list,
    .scoreboard-panel,
    .player-cards-panel,
    .highlights-panel,
    .suspicion-panel,
    .kill-panel,
    .event-log,
    .recent-demo-list {
        max-height: none;
        overflow: visible;
    }
    .right-panel .chat-section,
    .right-panel .console-section {
        flex: none;
    }
    .right-panel .chat-section .chat-box,
    .right-panel .console-section .console-box {
        max-height: none;
        overflow: visible;
        flex: none;
    }
    .chat-box { max-height: none; }

    .scoreboard-panel { overflow-x: auto; }
    .scoreboard-table th,
    .scoreboard-table td { padding: 8px; }
    .scoreboard-table .name-cell { min-width: 120px; }

    .demo-player-item,
    .player-item,
    .recent-demo-item,
    .pcard,
    .hl-item,
    .kill-entry,
    .chat-entry { padding: 10px 12px; }

    .kill-entry { font-size: 14px; }
    .kill-entry .kill-main { flex-wrap: wrap; }

    body,
    .main-layout { -webkit-overflow-scrolling: touch; }
}

/* 极窄屏（<480px）微调 */
@media (max-width: 480px) {
    .header { padding: 8px 10px; }
    .header-right { gap: 6px; }
    .status-dot { padding: 4px 8px; }
    .recent-demo-meta { flex-wrap: wrap; }
    .demo-info-row { flex-wrap: wrap; }
}

