:root {
    --bg-color: #050505;
    --screen-bg: #0a0f0a;
    --text-primary: #a8c7e0;
    --text-secondary: #5c7a99;
    --green: #00ff41;
    --red: #ff3333;
    --yellow: #ffcc00;
    --blue: #66ccff;
    --font-mono: 'Courier New', Courier, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    overflow: hidden;
    height: 100vh;
}

/* ============ CRT ============ */
#crt-overlay {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    background:
        linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.28) 50%),
        linear-gradient(90deg, rgba(255,0,0,0.06), rgba(0,255,0,0.02), rgba(0,0,255,0.06));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 999;
    animation: flicker 0.15s infinite;
}
@keyframes flicker { 0%{opacity:.96} 50%{opacity:1} 100%{opacity:.97} }

/* 危险时的红色暗角 */
#danger-vignette {
    position: fixed; top:0; left:0; width:100vw; height:100vh;
    pointer-events: none; z-index: 998;
    background: radial-gradient(circle, transparent 40%, rgba(255,0,0,0.55) 100%);
    opacity: 0;
    transition: opacity .3s;
}
#danger-vignette.on { animation: heartbeat 0.9s infinite; }
@keyframes heartbeat {
    0%   { opacity: .25; }
    15%  { opacity: .85; }
    30%  { opacity: .35; }
    45%  { opacity: .95; }
    100% { opacity: .25; }
}

.hidden { display: none !important; }

/* ============ 开始界面 ============ */
#start-screen {
    position: fixed; top:0; left:0; width:100vw; height:100vh;
    overflow-y: auto;
    display: flex; justify-content: center; align-items: flex-start;
    padding: 30px 20px;
    background: radial-gradient(circle at 50% 0%, #0d1a0d 0%, #050505 70%);
    z-index: 500;
}
.start-box { width: 100%; max-width: 860px; }

.title {
    text-align: center; font-size: 3em; margin: 0 0 5px;
    color: var(--green);
    text-shadow: 0 0 12px var(--green), 0 0 40px rgba(0,255,65,.35);
    letter-spacing: 8px;
}
.subtitle { text-align:center; color: var(--text-secondary); margin: 0 0 25px; font-size: .95em; }

.rules {
    background: #0d0d0d; border: 1px solid #2a2a2a;
    border-left: 3px solid var(--green);
    padding: 18px 22px; margin-bottom: 25px;
    font-size: .88em; line-height: 1.75;
}
.rules h3 { color: var(--green); margin: 14px 0 8px; font-size: 1em; letter-spacing: 1px; }
.rules h3:first-child { margin-top: 0; }
.rules ol, .rules ul { margin: 0; padding-left: 22px; }
.rules li { margin-bottom: 8px; }
.rules b { color: #fff; }
.roles li { margin-bottom: 12px; }
.r-name { font-weight: bold; }

.keys li { color: var(--text-secondary); }
.keys b { color: var(--yellow); }

.balance-note {
    font-size: .78em; color: #5a7a5a; line-height: 1.7;
    border-left: 2px solid #2a4a2a; padding: 8px 0 8px 12px; margin: 0 0 22px;
}
.balance-note b { color: var(--yellow); }

.diff-title { color: var(--green); letter-spacing: 2px; font-size: 1em; margin: 0 0 12px; }
.diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 25px;
}
.diff-card {
    background: #111; border: 1px solid #333;
    padding: 14px 12px; cursor: pointer;
    transition: all .2s; position: relative;
}
.diff-card:hover { background: #1a1a1a; border-color: #666; transform: translateY(-2px); }
.diff-card.selected {
    border-color: var(--green); background: #0a1a0a;
    box-shadow: 0 0 12px rgba(0,255,65,.25);
}
.d-name { font-size: 1.25em; font-weight: bold; color: #fff; margin-bottom: 8px; letter-spacing: 2px; }
.diff-card.selected .d-name { color: var(--green); text-shadow: 0 0 6px var(--green); }
.d-desc { font-size: .8em; color: var(--text-secondary); line-height: 1.5; min-height: 40px; }
.d-stat { font-size: .72em; color: #4a6a4a; margin-top: 8px; border-top: 1px dashed #333; padding-top: 6px; }

#btn-start {
    display: block; width: 100%;
    background: #0a1a0a; color: var(--green);
    border: 2px solid var(--green);
    padding: 16px; font-family: var(--font-mono);
    font-size: 1.3em; letter-spacing: 6px; cursor: pointer;
    transition: all .2s;
}
#btn-start:hover { background: var(--green); color: #000; box-shadow: 0 0 25px var(--green); }

/* ============ 游戏容器 ============ */
#game-container {
    position: relative;
    width: 100%; max-width: 1300px;
    height: 96vh; margin: 2vh auto;
    display: flex; flex-direction: column;
    background: #111; border: 1px solid #333;
    box-shadow: 0 0 25px rgba(0,255,65,.08);
}

/* ---- 状态栏 ---- */
#status-bar {
    height: 62px; background: #000; border-bottom: 2px solid #333;
    display: flex; align-items: center; gap: 22px;
    padding: 0 20px; font-weight: bold; letter-spacing: 1px;
    flex-shrink: 0;
}
.logo { color: var(--green); text-shadow: 0 0 6px var(--green); font-size: .95em; white-space: nowrap; }
.clock-box { font-size: 1.15em; color: #fff; white-space: nowrap; }
.clock-box .period { color: var(--text-secondary); font-size: .8em; margin-left: 4px; }

.meter { display: flex; align-items: center; gap: 8px; font-size: .8em; color: var(--text-secondary); white-space: nowrap; }
.bar { width: 110px; height: 13px; background: #222; border: 1px solid #444; }
.fill { height: 100%; width: 100%; background: var(--green); transition: width .25s, background-color .25s; box-shadow: 0 0 6px var(--green); }
.fill.cls { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.diff-label { margin-left: auto; font-size: .78em; color: #555; white-space: nowrap; }
.diff-label span { color: var(--yellow); }

/* ---- 监控区 ---- */
#monitor-screen { flex: 1; display: flex; background: var(--screen-bg); overflow: hidden; }

.cam-viewer {
    flex: 3; position: relative;
    border-right: 2px solid #333;
    display: flex; justify-content: center; align-items: center;
    background: radial-gradient(circle, #16201a 0%, #000 100%);
    min-width: 0;
}
.feed-content {
    width: 92%; height: 92%;
    border: 2px solid #444; position: relative; overflow: hidden;
    box-shadow: inset 0 0 60px rgba(0,0,0,.9);
    transition: background .4s;
}
.static-noise {
    position: absolute; inset: 0;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48ZmlsdGVyIGlkPSJnIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC42NSIgbnVtT2N0YXZlcz0iMyIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNnKSIgb3BhY2l0eT0iMC4xIi8+PC9zdmc+');
    opacity: .16; pointer-events: none; z-index: 3;
}
.cam-info {
    position: absolute; top: 10px; left: 10px; z-index: 5;
    background: rgba(0,0,0,.65); padding: 5px 12px;
    border-left: 3px solid var(--green);
}
.cam-info h2 { margin: 0; font-size: 15px; color: #fff; font-weight: normal; letter-spacing: 1px; }
.rec-dot { position: absolute; top: 10px; right: 10px; color: var(--red); font-weight: bold; z-index: 5; font-size: .85em; animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

#cam-log {
    position: absolute; bottom: 8px; left: 10px; right: 10px; z-index: 5;
    font-size: .72em; color: #6a8a6a; text-shadow: 0 0 4px #000;
    height: 34px; overflow: hidden; line-height: 1.5;
    pointer-events: none;
}
#cam-log div { opacity: .9; }
#cam-log div:last-child { color: #9fc; }

#cam-visuals { position: absolute; inset: 0; z-index: 2; }

/* ---- 副教练警告 ---- */
#sub-warning {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    z-index: 8; text-align: center;
    color: var(--red); font-weight: bold; font-size: 1.1em;
    background: rgba(0,0,0,.8); border: 2px solid var(--red);
    padding: 14px 26px; text-shadow: 0 0 8px var(--red);
    animation: warnpulse .5s infinite alternate;
}
@keyframes warnpulse { from { box-shadow: 0 0 10px var(--red);} to { box-shadow: 0 0 35px var(--red);} }
.sub-bar { width: 220px; height: 10px; background: #300; margin: 10px auto 6px; border: 1px solid #600; }
#sub-fill { height: 100%; width: 100%; background: var(--red); transition: width .2s linear; }
.sub-time { font-size: .85em; color: #fff; }

/* ---- 摄像头按钮 ---- */
#cam-map {
    flex: 1; min-width: 150px; max-width: 210px;
    background: #000; display: flex; flex-direction: column;
    padding: 10px; gap: 8px; border-left: 1px solid #333;
    overflow-y: auto;
}
.cam-btn {
    background: #111; border: 1px solid #333; color: #777;
    padding: 12px 10px; cursor: pointer; font-family: var(--font-mono);
    text-align: left; transition: all .2s; position: relative; overflow: hidden;
    font-size: .82em; line-height: 1.4;
}
.cam-btn b { color: #aaa; font-size: 1.1em; margin-right: 6px; }
.cam-btn:hover { background: #1e1e1e; color: #bbb; }
.cam-btn.active { background: #003300; color: var(--green); border-color: var(--green); box-shadow: 0 0 10px rgba(0,255,65,.2); }
.cam-btn.active b { color: var(--green); }
.cam-btn.active::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,.1) 50%, transparent 60%);
    animation: scan 2s infinite;
}
@keyframes scan { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }
.cam-btn .alert { color: var(--red); animation: blink .6s infinite; }

/* ---- 控制面板 ---- */
#control-panel {
    height: 76px; background: #000; border-top: 2px solid #333;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; flex-shrink: 0;
}
.btn-mode {
    background: #222; color: #fff; border: 1px solid #444;
    padding: 11px 22px; cursor: pointer; font-family: var(--font-mono); font-size: .9em;
}
.btn-mode:hover { background: #333; }
.panel-right { display: flex; gap: 14px; }
.btn-action {
    padding: 11px 26px; font-family: var(--font-mono); font-weight: bold;
    cursor: pointer; border: none; text-transform: uppercase; font-size: .9em;
    transition: all .2s;
}
.door-btn { background: #331111; color: #ff5555; border: 1px solid #552222; }
.door-btn.closed { background: #113311; color: #55ff55; border-color: #225522; }
.repair-btn { background: #333311; color: #ffff55; border: 1px solid #555522; }
.repair-btn:disabled, .door-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- 刷题界面 ---- */
#study-screen {
    position: absolute; top: 62px; bottom: 76px; left: 0; right: 0;
    background: #1e1e1e; z-index: 60;
    display: flex; justify-content: center; align-items: center;
}
.ide-container {
    width: 82%; height: 84%; background: #252526; border: 1px solid #333;
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
    display: flex; flex-direction: column;
}
.ide-header {
    height: 32px; background: #333; display: flex; justify-content: space-between;
    align-items: center; padding: 0 12px; font-size: 12px; color: #ccc;
}
.ide-controls { display: flex; align-items: center; gap: 12px; }
.exit-study-btn {
    background: var(--red); color: #fff; border: none; padding: 3px 10px;
    font-size: 10px; cursor: pointer; font-family: var(--font-mono); border-radius: 2px;
}
.exit-study-btn:hover { background: #ff5555; }
.ide-controls .dots { display: flex; gap: 5px; }
.ide-controls .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.red{background:#ff5f56} .yellow{background:#ffbd2e} .green{background:#27c93f}

.code-editor {
    flex: 1; padding: 20px; color: #d4d4d4;
    font-family: 'Consolas','Monaco',monospace; font-size: 14px; line-height: 1.65; overflow: auto;
}
.keyword{color:#569cd6} .string{color:#ce9178} .comment{color:#6a9955}
.function{color:#dcdcaa} .type{color:#4ec9b0} .boolean{color:#569cd6} .number{color:#b5cea8}

#study-progress-box { padding: 14px 20px; border-top: 1px solid #3a3a3a; background: #2a2a2b; }
.sp-label { font-size: .8em; color: var(--yellow); margin-bottom: 8px; }
.sp-bar { height: 14px; background: #222; border: 1px solid #555; }
#study-progress-fill { height: 100%; width: 0%; background: var(--yellow); transition: width .2s linear; box-shadow: 0 0 8px var(--yellow); }

/* ============ 场景装饰 ============ */
.dec { position: absolute; }

/* 教室 */
.dec-board { left:12%; top:14%; width:52%; height:26%; background:#0f1a12; border:4px solid #3a2f22; }
.dec-board::after { content:'#include <bits/stdc++.h>'; position:absolute; left:10px; top:10px; color:#4a6a4a; font-size:11px; }
.dec-banner { left:8%; top:4%; width:70%; height:7%; background:#3a1010; border:1px solid #6a2020; display:flex; align-items:center; justify-content:center; }
.dec-banner span { color:#c88; font-size:10px; letter-spacing:3px; }
.dec-desk { bottom:16%; width:16%; height:6%; background:#241a12; border-top:2px solid #3a2a1a; box-shadow:0 -6px 12px rgba(0,0,0,.5); }
.dec-desk.d1{left:6%} .dec-desk.d2{left:26%} .dec-desk.d3{left:46%} .dec-desk.d4{left:66%} .dec-desk.d5{left:86%}
.dec-chair { bottom:10%; width:7%; height:9%; background:#1a1410; border-radius:3px 3px 0 0; }
.dec-chair.c1{left:10%} .dec-chair.c2{left:30%} .dec-chair.c3{left:50%} .dec-chair.c4{left:70%}

/* 办公室 */
.dec-o-desk { left:20%; bottom:14%; width:56%; height:10%; background:#2a2018; border-top:3px solid #4a3828; }
.dec-monitor { left:38%; bottom:24%; width:20%; height:14%; background:#0a1015; border:2px solid #333; box-shadow:0 0 12px rgba(80,160,255,.25); }
.dec-monitor::after { content:''; position:absolute; inset:3px; background:linear-gradient(#123,#012); animation:screenflicker 3s infinite; }
@keyframes screenflicker { 0%,97%{opacity:.7} 98%{opacity:.3} 100%{opacity:.8} }
.dec-trophy { right:12%; bottom:24%; width:7%; height:12%; background:linear-gradient(#8a6a20,#4a3810); clip-path:polygon(30% 0,70% 0,70% 35%,90% 60%,60% 55%,60% 100%,40% 100%,40% 55%,10% 60%,30% 35%); }
.dec-shelf { right:8%; top:18%; width:20%; height:30%; border:2px solid #3a2a1a; background:#180f08; }
.dec-shelf::after { content:'奖状 · 奖状 · 奖状'; position:absolute; top:8px; left:4px; color:#6a5a3a; font-size:9px; }

/* 走廊 */
.dec-locker { top:22%; width:11%; height:52%; background:#1a2228; border:1px solid #2a3a42; }
.dec-locker::after { content:''; position:absolute; top:20%; left:70%; width:4px; height:4px; background:#6a8a9a; border-radius:50%; }
.dec-locker.l1{left:4%} .dec-locker.l2{left:16%} .dec-locker.l3{left:28%} .dec-locker.l4{left:64%} .dec-locker.l5{left:76%} .dec-locker.l6{left:88%}
.dec-hydrant { right:5%; top:30%; width:7%; height:16%; background:#8a1010; border:1px solid #c22; }
.dec-poster { right:16%; top:16%; width:13%; height:18%; background:#2a2a3a; border:1px solid #4a4a6a; transform:rotate(-2deg); }
.dec-poster::after { content:'NOIP\n加油'; position:absolute; top:6px; left:6px; color:#7a7aaa; font-size:9px; white-space:pre; }
.dec-emlight { left:46%; top:8%; width:8%; height:5%; background:#5a1010; border-radius:2px; animation:emblink 2.5s infinite; }
@keyframes emblink { 0%,88%{opacity:.35;box-shadow:none} 92%{opacity:1;box-shadow:0 0 14px #f33} 100%{opacity:.35} }
.dec-floorlamp { bottom:4%; left:10%; right:10%; height:3px; background:linear-gradient(90deg,transparent,#2a4a3a,#2a4a3a,transparent); box-shadow:0 0 10px rgba(0,255,65,.2); }
.dec-windowlight { left:34%; top:0; width:22%; height:40%; background:linear-gradient(rgba(140,180,255,.10),transparent); }

/* 门口 */
.dec-door { left:28%; top:12%; width:44%; height:76%; background:linear-gradient(#2a1a12,#1a0e08); border:4px solid #4a3020; }
.dec-door::after { content:''; position:absolute; right:8%; top:48%; width:5%; height:6%; background:#c8a040; border-radius:50%; box-shadow:0 0 6px #a80; }
.dec-door.closed { background:linear-gradient(#1a2a1a,#0e1a0e); border-color:#2a5a2a; }
.dec-sign { left:36%; top:5%; width:28%; height:6%; background:#111; border:1px solid #444; display:flex; align-items:center; justify-content:center; }
.dec-sign span { font-size:9px; color:#8aa; letter-spacing:2px; }
.dec-alarm { right:12%; top:14%; width:6%; height:6%; border-radius:50%; background:#3a0000; animation:emblink 1.4s infinite; }
.dec-mat { bottom:6%; left:24%; width:52%; height:6%; background:#1a1410; border:1px solid #2a2018; }

/* 窗户 */
.dec-frame { inset:8%; border:14px solid #2a221a; }
.dec-frame::before { content:''; position:absolute; left:48%; top:0; bottom:0; width:12px; background:#2a221a; }
.dec-frame::after { content:''; position:absolute; top:46%; left:0; right:0; height:12px; background:#2a221a; }
.dec-moon { right:16%; top:14%; width:9%; height:9%; border-radius:50%; background:#dde8ff; box-shadow:0 0 30px 10px rgba(180,210,255,.35); }
.dec-tree { left:10%; bottom:8%; width:26%; height:60%; background:#050a05; clip-path:polygon(50% 0,70% 30%,60% 30%,80% 62%,40% 100%,0 62%,20% 30%,10% 30%); animation:sway 5s ease-in-out infinite alternate; transform-origin: bottom center; }
@keyframes sway { from{transform:rotate(-1.5deg)} to{transform:rotate(1.5deg)} }
.dec-glass { inset:8%; background:linear-gradient(115deg, rgba(255,255,255,.06) 0%, transparent 35%, transparent 60%, rgba(255,255,255,.04) 100%); }

/* 身后 */
.dec-wall { inset:0; background:repeating-linear-gradient(90deg,#0a0a0a 0 40px,#0d0d0d 40px 42px); }
.dec-chairback { left:36%; bottom:6%; width:28%; height:34%; background:#14100c; border-radius:6px 6px 0 0; border:1px solid #221a12; }
.dec-dark { inset:0; background:radial-gradient(circle at 50% 60%, transparent 10%, rgba(0,0,0,.85) 75%); }

/* 角色 */
.sprite { position:absolute; z-index:4; transition: left .4s ease, top .4s ease; }
.sprite .head { width:34px; height:34px; border-radius:50%; margin:0 auto; }
.sprite .body { width:46px; height:52px; border-radius:8px 8px 4px 4px; margin-top:3px; }
.sprite.main .head { background:#3a1010; box-shadow:0 0 12px rgba(255,0,0,.5); }
.sprite.main .body { background:#4a1414; box-shadow:0 0 14px rgba(255,0,0,.4); }
.sprite.sub  .head { background:#2a2a10; box-shadow:0 0 12px rgba(255,220,0,.4); }
.sprite.sub  .body { background:#3a3a14; box-shadow:0 0 14px rgba(255,220,0,.3); }
.sprite.mate .head { background:#102a3a; box-shadow:0 0 10px rgba(100,200,255,.4); }
.sprite.mate .body { background:#143a4a; box-shadow:0 0 12px rgba(100,200,255,.3); }
.sprite.angry { animation: shake .35s infinite; }
@keyframes shake { 0%,100%{transform:translateX(0)} 50%{transform:translateX(3px)} }
.sprite .tag {
    position:absolute; top:-16px; left:50%; transform:translateX(-50%);
    font-size:10px; color:#fff; background:rgba(0,0,0,.7); padding:1px 5px; white-space:nowrap;
}
.sprite.main .tag { color:#ff6666; }
.sprite.sub  .tag { color:#ffdd55; }
.sprite.mate .tag { color:#88ddff; }

/* 惊吓闪影 */
.ghost {
    position:absolute; z-index:6; width:70px; height:110px;
    background:radial-gradient(circle at 50% 25%, rgba(255,255,255,.5), transparent 70%);
    filter:blur(3px);
    animation: ghostflash .7s forwards;
}
@keyframes ghostflash {
    0%{opacity:0; transform:scale(.8)} 20%{opacity:.55} 45%{opacity:.1} 70%{opacity:.4} 100%{opacity:0; transform:scale(1.15)}
}

/* ============ 弹窗 ============ */
#modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.96);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: #111; border: 2px solid var(--red);
    padding: 40px 50px; text-align: center; max-width: 560px;
    box-shadow: 0 0 35px var(--red);
}
.modal-content.success { border-color: var(--green); box-shadow: 0 0 35px var(--green); }
.modal-content h2 { font-size: 2.2em; margin: 0 0 18px; letter-spacing: 6px; }
.fail h2 { color: var(--red); text-shadow: 0 0 14px var(--red); }
.success h2 { color: var(--green); text-shadow: 0 0 14px var(--green); }
#modal-msg { font-size: .95em; line-height: 1.8; color: #ccc; }
.modal-stat { font-size: .8em; color: #666; margin: 16px 0 20px; border-top: 1px dashed #333; padding-top: 12px; }
.btn-restart {
    background: #333; color: #fff; border: 1px solid #555;
    padding: 10px 28px; cursor: pointer; font-family: var(--font-mono); margin: 0 6px;
}
.btn-restart:hover { background: #555; }
.btn-back { background: #1a1a1a; color: #888; }

@media (max-width: 900px) {
    #status-bar { gap: 12px; flex-wrap: wrap; height: auto; padding: 8px 12px; }
    .cam-viewer { flex: 2; }
    .title { font-size: 2em; letter-spacing: 4px; }
}

/* ============ 成就墙 / 最佳成绩 ============ */
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.panel { background: #0d0d0d; border: 1px solid #2a2a2a; border-left: 3px solid #2a5a2a; padding: 14px 16px; }
.p-title { color: var(--green); font-size: .95em; letter-spacing: 2px; margin: 0 0 12px; }

.ach-wall { display: flex; flex-direction: column; gap: 7px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.ach-card { border: 1px solid #222; background: #111; padding: 7px 10px; font-size: .74em; line-height: 1.45; }
.ach-card.locked { opacity: .38; }
.ach-card.locked .a-lvl { color: #444; }
.a-top { display: flex; align-items: baseline; gap: 8px; }
.a-lvl { font-weight: bold; font-size: 1.15em; }
.a-name { color: #ddd; font-size: 1.05em; }
.a-desc { color: #6a7a6a; margin-top: 3px; }

/* 等级配色 */
.lv-C .a-lvl, .ach-card.got.lv-C { border-color: #4a4a4a; }
.lv-C .a-lvl { color: #9a9a9a; }
.lv-B .a-lvl { color: #66ccff; }
.lv-A .a-lvl { color: #ffcc00; }
.lv-S .a-lvl { color: #ff5555; text-shadow: 0 0 8px rgba(255,60,60,.6); }
.ach-card.got.lv-B { border-left: 3px solid #66ccff; }
.ach-card.got.lv-A { border-left: 3px solid #ffcc00; }
.ach-card.got.lv-S { border-left: 3px solid #ff5555; box-shadow: 0 0 10px rgba(255,60,60,.15); }

.best-table { font-size: .78em; margin-bottom: 12px; }
.b-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #222; }
.b-diff { color: var(--text-secondary); }
.b-score { color: var(--yellow); }
.b-sum { margin-top: 10px; color: #5a7a5a; font-size: .9em; line-height: 1.6; }
.btn-clear {
    background: #1a1a1a; color: #777; border: 1px solid #333;
    padding: 6px 14px; font-family: var(--font-mono); font-size: .74em; cursor: pointer;
}
.btn-clear:hover { background: #3a1a1a; color: #ff7777; border-color: #552; }

/* ============ 结算评分 ============ */
.score-box { margin: 16px 0 6px; padding: 14px; border: 1px solid #333; background: #0c0c0c; }
.s-num { font-size: 2.6em; font-weight: bold; letter-spacing: 2px; line-height: 1; }
.s-rank { font-size: 1.1em; letter-spacing: 4px; margin-top: 4px; }
.s-formula { font-size: .68em; color: #6a7a6a; margin-top: 10px; line-height: 1.8; }
.s-formula b { color: #fff; }
.s-new { color: var(--yellow); font-size: .8em; margin-top: 8px; text-shadow: 0 0 8px rgba(255,204,0,.5); }
.s-old { color: #555; font-size: .72em; margin-top: 6px; }
.rank-D  .s-num, .rank-D  .s-rank { color: #777; }
.rank-C  .s-num, .rank-C  .s-rank { color: #9ab; }
.rank-B  .s-num, .rank-B  .s-rank { color: #66ccff; }
.rank-A  .s-num, .rank-A  .s-rank { color: #ffcc00; }
.rank-S  .s-num, .rank-S  .s-rank { color: #ff8833; text-shadow: 0 0 12px rgba(255,136,51,.5); }
.rank-SS .s-num, .rank-SS .s-rank { color: #ff5555; text-shadow: 0 0 14px rgba(255,85,85,.5); }
.rank-SSS .s-num, .rank-SSS .s-rank { color: #ff33cc; text-shadow: 0 0 18px rgba(255,51,204,.6); }

.run-ach { margin: 8px 0 18px; font-size: .78em; }
.ra-title { color: var(--yellow); margin-bottom: 8px; }
.ra-item { display: inline-block; margin: 3px 5px 3px 0; padding: 3px 10px; border: 1px solid #333; background: #141414; }
.ra-item.lv-S { border-color: #ff5555; color: #ff8888; }
.ra-item.lv-A { border-color: #ffcc00; color: #ffdd66; }
.ra-item.lv-B { border-color: #66ccff; color: #88ddff; }
.ra-item.lv-C { border-color: #666; color: #aaa; }
.ra-none { color: #4a5a4a; font-size: .9em; }

/* ============ 成就弹窗 ============ */
#ach-toast { position: fixed; top: 18px; right: 18px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; }
.ach-toast-item {
    background: #0f0f0f; border: 1px solid #555; border-left: 4px solid #888;
    padding: 10px 16px; min-width: 230px; box-shadow: 0 4px 18px rgba(0,0,0,.8);
    animation: toastin .3s ease-out; transition: opacity .5s, transform .5s;
}
.ach-toast-item.out { opacity: 0; transform: translateX(30px); }
@keyframes toastin { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.ach-toast-item.lv-S { border-left-color: #ff5555; box-shadow: 0 0 20px rgba(255,60,60,.3); }
.ach-toast-item.lv-A { border-left-color: #ffcc00; }
.ach-toast-item.lv-B { border-left-color: #66ccff; }
.ach-toast-item.lv-C { border-left-color: #999; }
.t-lvl { font-weight: bold; font-size: 1.2em; margin-right: 8px; }
.lv-S .t-lvl { color: #ff5555; } .lv-A .t-lvl { color: #ffcc00; }
.lv-B .t-lvl { color: #66ccff; } .lv-C .t-lvl { color: #999; }
.t-name { color: #fff; font-size: .95em; }
.t-desc { display: block; color: #6a7a6a; font-size: .72em; margin-top: 4px; line-height: 1.45; }

@media (max-width: 760px) {
    .panel-row { grid-template-columns: 1fr; }
}

/* ============ 题目进度 ============ */
.fill.prog { background: #66ccff; box-shadow: 0 0 6px #66ccff; }
.prog-text { font-size: .78em; color: #8ab; margin-left: 4px; white-space: nowrap; }

.goal-note {
    font-size: .82em; color: #7a9a7a; line-height: 1.8;
    border-left: 2px solid #2a5a2a; padding: 8px 0 8px 12px; margin: 0 0 12px;
}
.goal-note b { color: #fff; }
.warn-note { border-left-color: #5a4a2a; color: #9a8a6a; }
.warn-note b.g { color: var(--green); }
.warn-note b.r { color: var(--red); }

/* 刷题界面：题目进度 + 心流 */
#study-info { padding: 12px 20px; border-top: 1px solid #3a3a3a; background: #232324; }
.si-line { font-size: .85em; color: #bbb; margin-bottom: 7px; }
.si-line b { color: var(--blue); font-size: 1.15em; }
.si-goal { color: #5a6a5a; font-size: .9em; margin-left: 6px; }
.si-bar { height: 10px; background: #1a1a1a; border: 1px solid #444; }
#sp-bar-fill { height: 100%; width: 0%; background: var(--blue); transition: width .2s; box-shadow: 0 0 6px var(--blue); }
.flow-tag { font-size: .74em; color: #5a6a5a; margin-top: 7px; transition: color .3s; }
.flow-tag.on { color: var(--yellow); text-shadow: 0 0 8px rgba(255,204,0,.5); font-weight: bold; }

/* ============ 三结局：熬了个寂寞 ============ */
.modal-content.hollow { border-color: var(--yellow); box-shadow: 0 0 35px var(--yellow); }
.hollow h2 { color: var(--yellow); text-shadow: 0 0 14px var(--yellow); }

/* ============ 断电 ============ */
#status-bar.blackout { filter: brightness(.45) saturate(.3); }
.blackout-screen {
    position: absolute; inset: 0; z-index: 7;
    background: #000;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; gap: 6px;
    animation: boin .25s;
}
@keyframes boin { from { opacity: 0 } to { opacity: 1 } }
.bo-icon { font-size: 3em; color: #554400; animation: boflick 1.2s infinite; }
@keyframes boflick { 0%,92%{opacity:.25} 95%{opacity:1} 100%{opacity:.25} }
.bo-title { font-size: 1.6em; color: #886600; letter-spacing: 6px; text-shadow: 0 0 14px rgba(255,180,0,.35); }
.bo-sub { font-size: .78em; color: #554; }
.bo-count { font-size: 2.4em; color: #ffcc00; margin-top: 8px; text-shadow: 0 0 12px rgba(255,204,0,.5); }
.bo-hint { font-size: .72em; color: #4a4a3a; margin-top: 4px; }

/* ============ 评级图例 ============ */
.rank-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.rl { font-size: .74em; padding: 5px 12px; border: 1px solid #333; background: #111; }
.rl b { margin-right: 6px; font-size: 1.1em; }
.rl.rank-D b { color:#777 } .rl.rank-C b { color:#9ab }
.rl.rank-B b { color:#66ccff } .rl.rank-A b { color:#ffcc00 }
.rl.rank-S  { border-color:#ff8833 } .rl.rank-S b { color:#ff8833 }
.rl.rank-SS { border-color:#ff5555 } .rl.rank-SS b { color:#ff5555 }
.rl.rank-SSS{ border-color:#ff33cc; box-shadow: 0 0 10px rgba(255,51,204,.2) }
.rl.rank-SSS b { color:#ff33cc }

/* ============ 排行榜 ============ */
.board-panel { border-left-color: #5a4a2a; margin-bottom: 22px; }
.board-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.bd-row {
    display: grid; grid-template-columns: 34px 52px 62px 44px 1fr;
    align-items: center; gap: 8px;
    font-size: .76em; padding: 6px 10px;
    background: #111; border: 1px solid #222;
}
.bd-row.rank-SSS { border-color: #ff33cc; box-shadow: 0 0 8px rgba(255,51,204,.12); }
.bd-row.rank-SS  { border-color: #ff5555; }
.bd-row.rank-S   { border-color: #ff8833; }
.bd-row.rank-A   { border-color: #ffcc00; }
.bd-row.rank-B   { border-color: #66ccff; }
.bd-no { text-align: center; font-size: 1.1em; }
.bd-diff { color: var(--text-secondary); }
.bd-score { color: #fff; font-weight: bold; font-size: 1.05em; }
.bd-rank { font-weight: bold; }
.bd-row.rank-SSS .bd-rank { color:#ff33cc } .bd-row.rank-SS .bd-rank { color:#ff5555 }
.bd-row.rank-S .bd-rank { color:#ff8833 } .bd-row.rank-A .bd-rank { color:#ffcc00 }
.bd-row.rank-B .bd-rank { color:#66ccff } .bd-row.rank-C .bd-rank { color:#9ab }
.bd-row.rank-D .bd-rank { color:#777 }
.bd-info { color: #555; font-size: .9em; text-align: right; }
.bd-empty { color: #4a5a4a; font-size: .8em; padding: 8px 0; }

@media (max-width: 760px) {
    .bd-row { grid-template-columns: 30px 46px 56px 40px 1fr; font-size: .7em; }
}

/* ============ 提示设置面板 ============ */
.opt-panel { border-left-color: #5a4a2a; margin-bottom: 20px; }
.opt-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0;
           border-bottom: 1px dashed #222; cursor: pointer; }
.opt-row:last-of-type { border-bottom: none; }
.opt-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: #3fb950; cursor: pointer; }
.opt-row b { color: #ddd; font-size: .88em; display: block; }
.opt-row em { display: block; color: #6a7a6a; font-size: .74em; font-style: normal;
              line-height: 1.6; margin-top: 3px; }
.opt-row em.warn-em { color: #9a7a4a; }
.opt-note { font-size: .74em; color: #5a6a5a; line-height: 1.7; margin: 10px 0 0;
            border-left: 2px solid #3a3a2a; padding-left: 10px; }
.opt-note b { color: #8ab; }

/* ============ 同学状态模糊提示 ============ */
.cls-warn { font-size: .74em; padding: 2px 8px; margin-left: 8px; white-space: nowrap; }
.cls-warn.off { display: none; }
.cls-warn.lv1 { color: #4a5a4a; }
.cls-warn.lv2 { color: #aa8822; }
.cls-warn.lv3 { color: var(--red); font-weight: bold; animation: blink 1s infinite; }

/* ============ 新机制说明用高亮 ============ */
b.hot { color: var(--red) !important; text-shadow: 0 0 8px rgba(255,60,60,.4); }
.rl span { display: block; font-size: .85em; color: #555; margin-top: 2px; }
.rl.rank-SSS span { color: #8a5a7a; }
