@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --primary: #00ff41;      /* 正常绿 */
    --warning: #ffcc00;      /* 警告黄 */
    --danger: #ff003c;       /* 致命红 */
    --bg-dark: rgba(0, 10, 0, 0.85); 
    --border: 1px solid var(--primary);
    --glow: 0 0 5px var(--primary);
}

body {
    margin: 0;
    background: #000;
    color: var(--primary);
    font-family: 'Share Tech Mono', monospace;
    overflow: hidden;
    height: 100vh;
}

canvas {
    position: absolute;
    top: 0; left: 0; z-index: 0;
    display: block;
}

/* 视觉干扰层 */
.scanlines {
    position: fixed; inset: 0; z-index: 10; pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
    background-size: 100% 4px;
    opacity: 0.3;
}
.vignette {
    position: fixed; inset: 0; z-index: 9; pointer-events: none;
    background: radial-gradient(circle, transparent 50%, black 100%);
}

/* UI 布局 */
#ui-layer {
    position: relative; z-index: 5;
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none; 
}

/* 侧边栏通用样式 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.panel-block {
    background: var(--bg-dark);
    border: var(--border);
    padding: 15px;
    box-shadow: var(--glow);
    backdrop-filter: blur(4px);
}
h2 {
    font-size: 14px; margin: 0 0 10px 0;
    border-bottom: 1px solid var(--primary);
    opacity: 0.8;
}
.data-row { font-size: 12px; margin-bottom: 5px; display: flex; justify-content: space-between;}
.small-text { font-size: 10px; color: #888; margin-top: 5px; }

/* 中央区域 */
.center-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0;
}

#classification-box {
    text-align: center;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--primary);
    padding: 20px;
    width: 300px;
}
#classification-text {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
    text-shadow: var(--glow);
    min-height: 30px;
}
#confidence-bar { height: 4px; background: #333; width: 100%; }
#confidence-bar .fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.2s; }

#warning-banner {
    background: var(--danger);
    color: #000;
    padding: 10px 30px;
    font-weight: bold;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
#warning-banner.visible { opacity: 1; animation: shake 0.5s; }

/* 节奏游戏指示器 */
#rhythm-guide { text-align: center; margin-bottom: 50px; }
.beat-marker {
    width: 20px; height: 20px;
    background: transparent;
    border: 2px solid var(--primary);
    margin: 10px auto;
    transform: rotate(45deg);
    transition: all 0.1s;
}
.beat-active {
    background: var(--primary);
    box-shadow: 0 0 20px var(--primary);
    transform: scale(1.5) rotate(45deg);
}

/* 日志滚动 */
#log-container {
    height: 150px; overflow: hidden;
    font-size: 10px; color: #aaa;
    display: flex; flex-direction: column-reverse;
}
.log-item { margin-bottom: 4px; border-left: 2px solid #333; padding-left: 5px; }

/* 顺从度条 */
#score-val { font-size: 36px; text-align: right; font-weight: bold;}
.bar-bg { height: 10px; background: #333; margin-top: 5px; }
#score-bar { height: 100%; background: var(--primary); width: 100%; transition: width 0.5s; }

/* 危险状态 */
body.critical {
    --primary: #ff003c;
    --glow: 0 0 10px #ff003c;
}
body.critical .scanlines { background: rgba(255,0,0,0.1); }

/* 启动页 */
#start-screen {
    position: fixed; inset: 0; z-index: 100;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    background-image: radial-gradient(#111 20%, transparent 20%);
    background-size: 20px 20px;
}
.start-content { text-align: center; border: 1px solid var(--primary); padding: 40px; box-shadow: 0 0 30px rgba(0,255,65,0.2); max-width: 500px; }
button {
    margin-top: 30px; padding: 15px 30px;
    background: black; color: var(--primary); border: 1px solid var(--primary);
    font-family: inherit; font-size: 16px; cursor: pointer;
    transition: 0.3s;
}
button:hover { background: var(--primary); color: black; box-shadow: 0 0 20px var(--primary); }

/* --- 弹窗系统 --- */
#popup-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 50;
}
.popup-window {
    position: absolute; width: 300px;
    background: #050505; border: 1px solid var(--primary);
    box-shadow: 10px 10px 0px rgba(0, 255, 65, 0.2);
    pointer-events: auto;
    display: flex; flex-direction: column;
    animation: popup-appear 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.popup-window.error { border-color: var(--danger); box-shadow: 10px 10px 0px rgba(255, 0, 60, 0.2); }
.popup-header {
    background: var(--primary); color: #000; padding: 5px 10px;
    font-weight: bold; font-size: 12px; display: flex; justify-content: space-between;
}
.popup-window.error .popup-header { background: var(--danger); }
.popup-content { padding: 20px; font-size: 14px; line-height: 1.4; }
.popup-window.error .popup-content { color: var(--danger); }
.popup-actions { padding: 10px 20px 20px 20px; display: flex; justify-content: flex-end; }
.popup-btn {
    background: transparent; border: 1px solid var(--primary); color: var(--primary);
    padding: 5px 15px; cursor: pointer; font-family: inherit; text-transform: uppercase;
}
.popup-btn:hover { background: var(--primary); color: #000; }
.popup-window.error .popup-btn { border-color: var(--danger); color: var(--danger); }
.popup-window.error .popup-btn:hover { background: var(--danger); }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
@keyframes popup-appear {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.blink { animation: blinker 1s infinite; }
@keyframes blinker { 50% { opacity: 0; } }