:root {
    --bg:       #0e0e12;
    --surface:  #16161e;
    --border:   #2a2a38;
    --accent:   #7c6af7;
    --green:    #3ddc84;
    --red:      #ff5c5c;
    --yellow:   #f5c542;
    --text:     #e0e0e8;
    --muted:    #6b6b80;
    --gold:     #f5c542;
    --silver:   #a0a8b8;
    --bronze:   #cd7f32;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
}

/* Nav */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.nav-brand { font-size: 18px; font-weight: 700; color: var(--accent); }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
    padding: 6px 14px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    transition: all .15s;
}
.nav-links a:hover, .nav-links a.active {
    background: var(--border);
    color: var(--text);
}
.nav-links a.logout { color: var(--red); }
.nav-sep { color: var(--border); padding: 0 4px; }

/* Main */
main { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* Flash */
.flash {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
.flash.success { background: rgba(61,220,132,.15); border: 1px solid var(--green); color: var(--green); }
.flash.error   { background: rgba(255,92,92,.15);  border: 1px solid var(--red);   color: var(--red); }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Status bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
}
.status-indicator {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--muted);
}
.status-indicator.online  { background: var(--green);  box-shadow: 0 0 8px var(--green); }
.status-indicator.offline { background: var(--red);    box-shadow: 0 0 8px var(--red); }
.status-info { flex: 1; display: flex; gap: 12px; align-items: center; font-size: 15px; }
.sep { color: var(--border); }
.server-controls { display: flex; gap: 8px; }

/* Buttons */
.btn {
    padding: 7px 16px;
    background: #1c1c2e;
    color: #9898c0;
    border: 1px solid #30304a;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: #24243e; color: var(--text); border-color: #4a4a72; }
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn-green  { background: var(--green);  color: #000; border-color: var(--green); }
.btn-red    { background: var(--red);    color: #fff; border-color: var(--red); }
.btn-yellow { background: var(--yellow); color: #000; border-color: var(--yellow); }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr.gold   td:first-child { color: var(--gold); font-weight: 700; }
tr.silver td:first-child { color: var(--silver); }
tr.bronze td:first-child { color: var(--bronze); }
.empty { color: var(--muted); text-align: center; padding: 20px; }

/* Badges */
.badge {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.live-tag {
    font-size: 10px;
    background: var(--red);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Stat cards */
.stat-card { text-align: center; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }

/* Modal */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal.hidden { display: none; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    min-width: 400px;
    max-width: 600px;
}
.modal-box h3 { margin-bottom: 12px; }
.modal-box pre {
    background: var(--bg);
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    color: var(--green);
    white-space: pre-wrap;
}
.modal-box button { margin-top: 8px; }

/* Config Editor */
.editor-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}
.file-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    overflow-y: auto;
}
.file-list h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
}
.file-item {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 2px;
    transition: all .15s;
}
.file-item:hover, .file-item.active {
    background: var(--border);
    color: var(--text);
}
.editor-main {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.editor-header h3 { font-size: 14px; color: var(--text); margin: 0; }
#editor-area {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: none;
    padding: 16px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    outline: none;
}
.editor-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--muted);
}

/* Logs */
.logs-browser {}
.logs-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; height: calc(100vh - 130px); }
.logs-file-list { overflow-y: auto; padding: 16px; }
.logs-content-card { display: flex; flex-direction: column; overflow: hidden; }
.logs-content-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.log-output {
    flex: 1;
    background: var(--bg);
    padding: 16px;
    font-size: 12px;
    line-height: 1.5;
    overflow-y: auto;
    color: #a0f0a0;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    border-radius: 0;
}

/* Login */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 360px;
    text-align: center;
}
.login-box h1 { font-size: 28px; margin-bottom: 4px; }
.login-box h2 { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.login-box input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.login-box button:hover { opacity: .9; }

/* Cvar editor */
.btn-blue   { background: var(--accent); color: #fff; }
.btn-sm     { padding: 4px 10px; font-size: 12px; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.cvar-group .group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 12px;
}
.cvar-name  { font-family: monospace; font-size: 13px; white-space: nowrap; }
.cvar-desc  { color: var(--muted); max-width: 320px; }
.cvar-val   { font-family: monospace; }
.cvar-default { font-family: monospace; }
.muted      { color: var(--muted); }
.badge-ok      { background: var(--green);  color: #000; }
.badge-drift   { background: var(--yellow); color: #000; }
.badge-missing { background: var(--red);    color: #fff; }
.badge-unreg   { background: var(--muted);  color: #fff; }
.cvar-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: monospace;
    outline: none;
}
.cvar-input:focus { border-color: var(--accent); }

/* Console */
.console-page {}
.console-layout { display: flex; gap: 20px; }
.console-layout.split .console-card { flex: 1; }
.console-layout:not(.split) .console-card { flex: 1; }
.console-card { display: flex; flex-direction: column; height: calc(100vh - 220px); }
.console-output {
    flex: 1;
    background: var(--bg);
    border-radius: 6px;
    padding: 14px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 10px;
}
.console-line       { color: var(--text); white-space: pre-wrap; word-break: break-all; }
.console-line.cmd   { color: var(--accent); }
.console-line.out   { color: #a8e8a8; }
.console-line.err   { color: var(--red); }
.console-line.info  { color: var(--muted); }
.console-input-row  { display: flex; align-items: center; gap: 8px; }
.console-prompt     { color: var(--accent); font-family: monospace; font-size: 16px; }
.console-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: monospace;
    outline: none;
}
.console-input:focus { border-color: var(--accent); }
.quick-cmds { display: flex; flex-wrap: wrap; gap: 8px; }
.console-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.log-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.log-status-dot.on  { background: var(--green); box-shadow: 0 0 5px var(--green); }
.log-status-dot.off { background: var(--muted); }
.log-output { color: #a8c8a8; }
.log-line   { color: #a8c8a8; }

/* Race track — real-time */
.race-card { overflow: hidden; position: relative; }
.race-track {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 4px 0;
}
.race-empty { color: var(--muted); text-align: center; padding: 20px; }
.race-lane {
    display: grid;
    grid-template-columns: 170px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.race-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.race-pos {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    width: 22px;
    flex-shrink: 0;
    text-align: right;
}
.race-leader .race-pos { font-size: 16px; }
.race-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.race-leader .race-name { color: #fff; font-weight: 700; }
.race-bg {
    height: 22px;
    background: rgba(255,255,255,.04);
    border-radius: 4px;
    overflow: visible;
    position: relative;
}
.race-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--color) 20%, transparent),
        var(--color));
    box-shadow: 0 0 10px var(--color), 0 0 22px color-mix(in srgb, var(--color) 35%, transparent);
    transition: width 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    min-width: 4px;
}
.race-weapon-pill {
    background: color-mix(in srgb, var(--color) 18%, #080810);
    border: 1px solid color-mix(in srgb, var(--color) 45%, transparent);
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    letter-spacing: .03em;
    transform-origin: center;
}
.race-weapon-pill.pill-pulse {
    animation: pill-levelup .55s ease-out;
}
@keyframes pill-levelup {
    0%   { transform: scale(1);    box-shadow: none; }
    25%  { transform: scale(1.18); box-shadow: 0 0 14px var(--color), 0 0 28px color-mix(in srgb, var(--color) 55%, transparent); }
    100% { transform: scale(1);    box-shadow: none; }
}
.race-leader .race-bar {
    animation: race-pulse 2s ease-in-out infinite alternate;
}
@keyframes race-pulse {
    from { filter: brightness(1);   box-shadow: 0 0 10px var(--color), 0 0 22px color-mix(in srgb, var(--color) 35%, transparent); }
    to   { filter: brightness(1.25); box-shadow: 0 0 16px var(--color), 0 0 36px color-mix(in srgb, var(--color) 55%, transparent); }
}
.race-level {
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
.race-level-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    margin-right: 1px;
}

/* Winner lane highlight */
.race-lane.race-winner {
    background: rgba(245,197,66,0.08);
    border-radius: 4px;
}
.race-lane.race-winner .race-bar {
    animation: race-winner-glow .9s ease-in-out infinite alternate !important;
}
@keyframes race-winner-glow {
    from { filter: brightness(1.1);  box-shadow: 0 0 16px #f5c542, 0 0 32px rgba(245,197,66,.5); }
    to   { filter: brightness(1.45); box-shadow: 0 0 30px #f5c542, 0 0 60px rgba(245,197,66,.7); }
}
.race-lane.race-winner .race-weapon-pill {
    background: rgba(245,197,66,.2) !important;
    border-color: #f5c542 !important;
    color: #f5c542 !important;
    font-size: 12px !important;
}
.race-lane.race-winner .race-name { color: #f5c542 !important; font-weight: 800 !important; }

/* Race event overlays — centered top of card */
.race-overlays {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 10;
    pointer-events: none;
    width: max-content;
    max-width: 90%;
}
.race-overlay {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    animation: overlay-in .18s ease-out;
    opacity: 1;
    transition: opacity .45s ease;
    line-height: 1.4;
    white-space: nowrap;
}
.race-overlay.fading { opacity: 0; }
.race-overlay.stolen {
    background: #1e0808;
    border: 1px solid #dc1e1e;
    color: #ff6b6b;
    text-shadow: 0 0 8px #dc1e1e;
}
.race-overlay.multilevel {
    background: #1e1000;
    border: 1px solid #ff9f43;
    color: #ff9f43;
    text-shadow: 0 0 8px #ff9f43;
}
.race-overlay.multikill {
    background: #00101a;
    border: 1px solid #00d4ff;
    color: #00d4ff;
    text-shadow: 0 0 8px #00d4ff;
}
@keyframes overlay-in {
    from { opacity:0; transform: translateY(-8px); }
    to   { opacity:1; transform: translateY(0); }
}

/* Warmup banner */
.warmup-banner {
    text-align: center;
    padding: 8px 16px;
    margin-bottom: 10px;
    background: #1a1400;
    border: 1px solid var(--yellow);
    border-radius: 6px;
    color: var(--yellow);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
    animation: warmup-pulse 1.2s ease-in-out infinite alternate;
}
.warmup-banner.hidden { display: none; }
@keyframes warmup-pulse {
    from { opacity: .7; }
    to   { opacity: 1; text-shadow: 0 0 12px var(--yellow); }
}

/* Level-up flash on lane */
.race-lane.levelup-flash {
    animation: lane-flash .8s ease-out;
}
@keyframes lane-flash {
    0%   { background: rgba(255,255,255,.22); box-shadow: 0 0 18px rgba(255,255,255,.18); }
    40%  { background: rgba(255,255,255,.10); }
    100% { background: transparent; box-shadow: none; }
}

/* Near-win pulsation (last 3 levels) */
.race-near-win .race-bar {
    animation: race-pulse-fast 0.7s ease-in-out infinite alternate !important;
}
@keyframes race-pulse-fast {
    from { filter: brightness(1.1);  box-shadow: 0 0 14px var(--color), 0 0 30px color-mix(in srgb, var(--color) 50%, transparent); }
    to   { filter: brightness(1.6);  box-shadow: 0 0 24px var(--color), 0 0 54px color-mix(in srgb, var(--color) 75%, transparent); }
}
.race-near-win .race-level { animation: near-win-text .7s ease-in-out infinite alternate; }
@keyframes near-win-text {
    from { opacity: .8; }
    to   { opacity: 1; text-shadow: 0 0 10px currentColor; }
}

/* Win screen overlay */
.win-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
}
.win-screen.hidden { display: none; }
.win-content {
    text-align: center;
    z-index: 1001;
    animation: win-pop .4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes win-pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.win-w {
    font-size: 60px;
    font-weight: 900;
    color: var(--yellow);
    line-height: 1;
    margin-top: 8px;
    letter-spacing: -.02em;
    text-shadow: 0 0 40px rgba(245,197,66,.9), 0 0 80px rgba(245,197,66,.5), 0 0 140px rgba(245,197,66,.3);
    animation: win-w-glow 1.4s ease-in-out infinite alternate;
}
@keyframes win-w-glow {
    from { text-shadow: 0 0 30px rgba(245,197,66,.7), 0 0 60px rgba(245,197,66,.4); }
    to   { text-shadow: 0 0 50px rgba(245,197,66,1),  0 0 100px rgba(245,197,66,.6), 0 0 180px rgba(245,197,66,.3); }
}
.win-trophy { font-size: 120px; line-height: 1; margin-bottom: 12px; }
.win-avatar {
    width: 96px; height: 96px; border-radius: 50%;
    border: 3px solid var(--yellow);
    box-shadow: 0 0 20px rgba(245,197,66,.7);
    margin-bottom: 14px; display: none; object-fit: cover;
}
#avatar-tip {
    position: fixed; z-index: 2000; pointer-events: none;
    background: rgba(15,15,20,.95); border: 1px solid rgba(245,197,66,.3);
    border-radius: 10px; padding: 8px;
    display: flex; align-items: center; gap: 10px;
    opacity: 0; transition: opacity .15s;
}
#avatar-tip.show { opacity: 1; }
#avatar-tip img { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--yellow); }
#avatar-tip span { font-size: 13px; font-weight: 700; color: var(--yellow); white-space: nowrap; }
.win-name {
    font-size: 48px; font-weight: 900; color: var(--yellow);
    text-shadow: 0 0 30px rgba(245,197,66,.8), 0 0 60px rgba(245,197,66,.4);
    letter-spacing: .02em; margin-bottom: 10px;
}
.win-label {
    font-size: 18px; font-weight: 800; letter-spacing: .25em;
    color: #fff; text-transform: uppercase; margin-bottom: 6px;
}
#confetti-canvas {
    position: fixed; inset: 0; z-index: 1000; pointer-events: none;
}

/* Leaderboard */
.lb-table { width:100%; border-collapse:collapse; font-size:13px; }
.lb-table th {
    text-align:left; font-size:10px; font-weight:600; color:var(--muted);
    text-transform:uppercase; letter-spacing:.08em; padding:0 8px 12px;
    border-bottom:1px solid var(--border);
}
.lb-table th:last-child { text-align:right; }
.lb-table td { padding:9px 8px; border-bottom:1px solid rgba(255,255,255,.04); }
.lb-table tr:last-child td { border-bottom:none; }
.lb-table tr:hover td { background: rgba(255,255,255,.03); }

/* Top-3 row highlights */
.lb-table tr.lb-row-gold   td { background: rgba(245,197,66,.06); }
.lb-table tr.lb-row-silver td { background: rgba(168,178,193,.04); }
.lb-table tr.lb-row-bronze td { background: rgba(205,127,50,.04); }

.lb-rank  { width:44px; font-size:16px; text-align:center; }
.lb-name  { font-weight:600; color:var(--text); }
.lb-wins  {
    font-weight:800; text-align:right; font-size:14px;
    font-variant-numeric: tabular-nums;
}
.lb-wins-val { color:var(--yellow); }
.lb-wins-label { font-size:9px; font-weight:500; color:var(--muted); margin-left:2px; }

.lb-rank-gold   { color:#f5c542; text-shadow: 0 0 10px rgba(245,197,66,.7); }
.lb-rank-silver { color:#c0c8d4; text-shadow: 0 0 8px rgba(192,200,212,.5); }
.lb-rank-bronze { color:#cd8a4a; text-shadow: 0 0 8px rgba(205,138,74,.5); }
.lb-name-gold   { color:#fff; font-weight:700; }
.lb-name-silver { color:#dde2e8; }
.lb-name-bronze { color:#d4b896; }

.lb-empty { color:var(--muted); text-align:center; padding:24px; }

/* Mapcycle editor */
.mc-page {}
.mc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; height: calc(100vh - 130px); }
.mc-pool-card, .mc-cycle-card { display: flex; flex-direction: column; overflow: hidden; }
.mc-pool-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mc-filter {
    width: 100%;
    padding: 7px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    margin-bottom: 8px;
}
.mc-filter:focus { border-color: var(--accent); }
.mc-pool {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.mc-pool-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: 13px;
    font-family: monospace;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.03);
    transition: background .1s;
}
.mc-pool-item:hover { background: var(--border); }
.mc-pool-item.in-cycle { opacity: .35; pointer-events: none; }
.mc-add-icon { color: var(--green); font-size: 16px; font-weight: 700; opacity: 0; transition: opacity .1s; }
.mc-pool-item:hover .mc-add-icon { opacity: 1; }
.mc-cycle-list { flex: 1; overflow-y: auto; }
.mc-cycle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255,255,255,.03);
    cursor: default;
    transition: background .1s;
}
.mc-cycle-item:hover { background: rgba(255,255,255,.03); }
.mc-cycle-item.dragging { opacity: .4; }
.mc-cycle-item.drag-over { border-top: 2px solid var(--accent); }
.mc-drag-handle { color: var(--muted); cursor: grab; font-size: 16px; flex-shrink: 0; }
.mc-cycle-name { flex: 1; font-family: monospace; font-size: 13px; }
.mc-cycle-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mc-arrow {
    background: none; border: 1px solid var(--border);
    color: var(--muted); border-radius: 4px;
    padding: 2px 6px; font-size: 11px; cursor: pointer;
}
.mc-arrow:hover { color: var(--text); border-color: var(--accent); }
.mc-remove {
    background: none; border: 1px solid var(--border);
    color: var(--muted); border-radius: 4px;
    padding: 2px 7px; font-size: 12px; cursor: pointer;
}
.mc-remove:hover { color: var(--red); border-color: var(--red); }
.mc-toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 10px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    z-index: 2000; transition: opacity .3s;
}
.mc-toast.hidden { display: none; }
.mc-toast.toast-ok  { background: rgba(61,220,132,.2); border: 1px solid var(--green); color: var(--green); }
.mc-toast.toast-err { background: rgba(255,92,92,.2);  border: 1px solid var(--red);   color: var(--red); }

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .editor-layout { grid-template-columns: 1fr; }
}

/* KV Config Editor */
.kv-page { }

.kv-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}

.kv-section summary,
.kv-section-summary {
    list-style: none;
    padding: 14px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
}
.kv-section summary::-webkit-details-marker { display: none; }
.kv-section summary::before {
    content: '▶';
    font-size: 10px;
    color: var(--muted);
    transition: transform .15s;
    display: inline-block;
}
.kv-section[open] > summary::before { transform: rotate(90deg); }
.kv-section summary:hover { color: var(--accent); }

.kv-section-body {
    padding: 0;
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
}
.kv-table tr:last-child td { border-bottom: none; }
.kv-table td {
    padding: 9px 20px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    vertical-align: middle;
}
.kv-key-cell { width: 40%; }
.kv-val-cell  { width: 60%; }

.kv-key {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text);
}

.kv-desc {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
    line-height: 1.4;
    max-width: 480px;
}

.kv-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kv-input {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: 'Fira Code', 'Consolas', monospace;
    outline: none;
    min-width: 0;
}
.kv-input:focus { border-color: var(--accent); }

.kv-save-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
}
.kv-save-btn:hover { opacity: .85; }
.kv-save-btn:disabled { opacity: .35; cursor: not-allowed; }

.kv-status {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 0;
}
.kv-status-ok  { color: var(--green); }
.kv-status-err { color: var(--red); }

/* Nested sections */
.kv-section-nested {
    border: 1px solid rgba(42,42,56,.6);
    border-radius: 8px;
    margin: 8px 20px 8px 20px;
    background: rgba(14,14,18,.4);
}
.kv-section-nested > summary,
.kv-section-nested > .kv-section-summary {
    font-size: 12px;
    padding: 10px 16px;
    background: transparent;
}
.kv-section-nested .kv-table td {
    padding: 7px 16px;
}
.kv-section-nested .kv-key { font-size: 12px; }
.kv-section-nested .kv-desc { font-size: 11px; }

/* Stats pages */
.tab-bar { display: flex; gap: 6px; }
.tab-btn {
    padding: 5px 14px; border-radius: 6px; font-size: 13px;
    font-weight: 600; text-decoration: none; color: var(--muted);
    border: 1px solid var(--border); transition: all .15s;
}
.tab-btn:hover, .tab-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.player-link { color: var(--text); text-decoration: none; }
.player-link:hover { color: var(--accent); text-decoration: underline; }
.empty { color: var(--muted); font-size: 14px; text-align: center; }
.muted { color: var(--muted); }

/* Hit distribution bars */
.body-diagram { max-width: 400px; }
.hit-region { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hit-label { width: 70px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.hit-bar-wrap { flex: 1; background: var(--border); border-radius: 3px; height: 12px; }
.hit-bar { background: var(--accent); border-radius: 3px; height: 100%; min-width: 2px; }
.hit-pct { width: 42px; font-size: 12px; font-weight: 600; text-align: right; }

/* Award cards */
.award-card { flex: 1; }
.award-list { list-style: none; padding: 0; margin: 0; }
.award-list li {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.award-list li:last-child { border-bottom: none; }
.award-stat { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent); }
.shame-card .award-stat { color: var(--red); }
.shame-card h3 { color: var(--red); }

/* Weapon grid */
.weapon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.weapon-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.weapon-name { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.weapon-top3 { list-style: none; padding: 0; margin: 0; }
.weapon-top3 li { font-size: 12px; padding: 3px 0; display: flex; align-items: center; }
.weapon-kills { margin-left: auto; font-size: 11px; color: var(--muted); }
