/* ============================================================
   学生课堂行为智能检测系统 - 全新界面样式
   教育科技风 · 玻璃拟态 · 数据看板
   ============================================================ */

:root {
    --bg-0: #0a0f1e;
    --bg-1: #0e1530;
    --panel: rgba(20, 28, 54, 0.72);
    --panel-solid: #141c36;
    --stroke: rgba(125, 156, 255, 0.16);
    --stroke-strong: rgba(125, 156, 255, 0.32);
    --text: #eef2ff;
    --text-dim: #9aa6cc;
    --text-faint: #6b76a0;
    --accent: #6d8bff;
    --accent-2: #38e0c8;
    --warn: #ffb454;
    --danger: #ff6b8b;
    --ok: #4ade80;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px rgba(2, 6, 23, 0.55);
    --font: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    --font-display: 'Outfit', 'PingFang SC', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-0);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---------- 背景 ---------- */
.bg-layer { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
    radial-gradient(1200px 700px at 12% -10%, rgba(109, 139, 255, 0.18), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(56, 224, 200, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 70%);
}
.bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(125, 156, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 156, 255, 0.05) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 78%);
}
.bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; }
.orb-a { width: 480px; height: 480px; background: #3b53d8; top: -160px; left: -120px; }
.orb-b { width: 420px; height: 420px; background: #16a394; bottom: -180px; right: -100px; }

/* ---------- 布局 ---------- */
.shell { max-width: 1500px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 34px) 40px; }

.topbar {
    display: flex; align-items: center; gap: 18px;
    padding: 16px 22px; margin-bottom: 22px;
    background: var(--panel); border: 1px solid var(--stroke);
    border-radius: var(--radius); backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}
.logo {
    width: 46px; height: 46px; flex: none; border-radius: 13px;
    background: linear-gradient(145deg, var(--accent), var(--accent-2));
    display: grid; place-items: center; font-size: 24px;
    box-shadow: 0 8px 24px rgba(109, 139, 255, 0.4);
}
.topbar-main { flex: 1; min-width: 0; }
.topbar-main .kicker {
    font-size: 0.7rem; letter-spacing: 0.32em; text-transform: uppercase;
    color: var(--accent-2); font-weight: 600;
}
.topbar-main h1 {
    font-family: var(--font-display); font-size: clamp(1.25rem, 2.4vw, 1.75rem);
    font-weight: 800; letter-spacing: 0.01em; margin-top: 2px;
}
.topbar-meta { display: flex; align-items: center; gap: 12px; flex: none; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 15px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
    background: rgba(125, 156, 255, 0.1); border: 1px solid var(--stroke-strong);
    color: var(--text-dim);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 1.8s infinite; }
.chip.clock { font-family: var(--font-mono); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.grid { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }

/* ---------- 卡片通用 ---------- */
.panel {
    background: var(--panel); border: 1px solid var(--stroke);
    border-radius: var(--radius); backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}
.card { padding: 18px; border-radius: var(--radius-sm); background: rgba(13, 19, 41, 0.55); border: 1px solid var(--stroke); }
.card + .card { margin-top: 14px; }
.card-title {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-dim);
}
.card-title::before { content: ''; width: 4px; height: 15px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2)); }

/* ---------- 侧栏 ---------- */
.sidebar { padding: 18px; }

.model-select {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--panel-solid); color: var(--text); font-size: 0.92rem;
    border: 1px solid var(--stroke-strong); cursor: pointer; font-family: var(--font);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239aa6cc' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.model-select:focus { outline: none; border-color: var(--accent); }
.hint { font-size: 0.76rem; color: var(--text-faint); line-height: 1.6; margin-top: 8px; }
.hint code { font-family: var(--font-mono); color: var(--accent-2); background: rgba(56,224,200,.1); padding: 1px 5px; border-radius: 5px; }
.fixed-tag {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
    font-size: 0.74rem; color: var(--warn); font-weight: 600;
}
.fixed-tag::before { content: '🔒'; font-size: 0.8rem; }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; font-family: var(--font);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    color: var(--text); user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(140deg, var(--accent), #5a73e0); box-shadow: 0 8px 22px rgba(109,139,255,.32); }
.btn-accent { background: linear-gradient(140deg, var(--accent-2), #1fbfa8); color: #042b26; box-shadow: 0 8px 22px rgba(56,224,200,.28); }
.btn-danger { background: linear-gradient(140deg, var(--danger), #e0556f); box-shadow: 0 8px 22px rgba(255,107,139,.28); }
.btn-ghost { background: rgba(125,156,255,.08); border-color: var(--stroke-strong); color: var(--text-dim); }
.btn-block { width: 100%; }

/* ---------- 滑块 ---------- */
.slider-row { display: flex; justify-content: space-between; font-size: 0.84rem; margin-bottom: 8px; color: var(--text-dim); }
.slider-row .val { font-family: var(--font-mono); color: var(--accent-2); font-weight: 700; }
.slider-row.spaced { margin-top: 18px; }
input[type="range"] {
    -webkit-appearance: none; width: 100%; height: 6px; border-radius: 6px;
    background: rgba(125,156,255,.18); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 3px solid #0a0f1e;
    box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(109,139,255,.6);
}

/* ---------- 示例图 ---------- */
.samples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--stroke); cursor: pointer; padding: 0; background: none; transition: border-color .2s, transform .15s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { transform: scale(1.04); }
.thumb.active { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(56,224,200,.4); }
.samples-more { margin-top: 10px; }
.samples-more summary { cursor: pointer; font-size: 0.8rem; color: var(--text-dim); }

/* ---------- 主显示区 ---------- */
.stage { padding: 18px; display: flex; flex-direction: column; gap: 16px; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi {
    position: relative; padding: 16px 18px; border-radius: var(--radius-sm); overflow: hidden;
    background: rgba(13, 19, 41, 0.6); border: 1px solid var(--stroke);
}
.kpi .kpi-label { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.kpi .kpi-value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.kpi .kpi-unit { font-size: 0.85rem; font-weight: 500; color: var(--text-faint); margin-left: 4px; }
.kpi.kpi-people { background: linear-gradient(150deg, rgba(56,224,200,.18), rgba(13,19,41,.5)); border-color: rgba(56,224,200,.4); }
.kpi.kpi-people .kpi-value { color: var(--accent-2); text-shadow: 0 0 22px rgba(56,224,200,.4); }
.kpi.kpi-people[data-state="disabled"] { background: rgba(40,48,72,.4); border-color: var(--stroke); }
.kpi.kpi-people[data-state="disabled"] .kpi-value { color: var(--text-faint); text-shadow: none; }
.kpi-people .kpi-spark { position: absolute; right: 14px; top: 14px; font-size: 1.3rem; opacity: .8; }

/* 画面 */
.viewer { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #060a16; border: 1px solid var(--stroke); aspect-ratio: 16/9; display: grid; place-items: center; }
.viewer canvas { max-width: 100%; max-height: 100%; display: block; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--text-faint); pointer-events: none; gap: 10px; padding: 20px; }
.viewer-empty .big { font-size: 2.6rem; opacity: .5; }
.viewer-overlay { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.ov-chip { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: .1em; padding: 6px 11px; border-radius: 8px; background: rgba(6,10,22,.6); border: 1px solid var(--stroke-strong); color: var(--text-dim); backdrop-filter: blur(4px); }
.ov-chip.live { color: var(--accent-2); border-color: rgba(56,224,200,.4); }
.viewer-toolbar { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 8px; }

/* 行为统计 */
.behaviors { display: flex; flex-direction: column; gap: 10px; }
.beh-row { display: grid; grid-template-columns: 96px 1fr 42px; align-items: center; gap: 12px; }
.beh-name { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; }
.beh-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.beh-bar { height: 9px; border-radius: 6px; background: rgba(125,156,255,.1); overflow: hidden; }
.beh-bar > span { display: block; height: 100%; border-radius: 6px; width: 0; transition: width .4s ease; }
.beh-count { font-family: var(--font-mono); font-weight: 700; text-align: right; font-size: 0.92rem; }

/* 详情 + 状态 */
.detail { font-size: 0.86rem; line-height: 1.85; color: var(--text-dim); background: rgba(13,19,41,.5); border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 14px; min-height: 64px; }
.detail strong { color: var(--text); font-weight: 600; }
.statusbar { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--text-dim); padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(13,19,41,.5); border: 1px solid var(--stroke); }
.status-prefix { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 0.74rem; background: rgba(74,222,128,.16); color: var(--ok); }
.statusbar[data-state="error"] .status-prefix { background: rgba(255,107,139,.16); color: var(--danger); }
.statusbar[data-state="loading"] .status-prefix { background: rgba(255,180,84,.16); color: var(--warn); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(125,156,255,.25); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 入口提示 */
.modal { position: fixed; inset: 0; background: rgba(6,10,22,.8); display: none; align-items: center; justify-content: center; z-index: 999; backdrop-filter: blur(6px); }
.modal .box { width: min(92vw, 440px); padding: 26px; border-radius: var(--radius); background: linear-gradient(165deg, #131b38, #0d1430); border: 1px solid var(--stroke-strong); }
.modal h3 { font-size: 1.25rem; margin-bottom: 10px; }
.modal p { color: var(--text-dim); line-height: 1.75; margin-bottom: 18px; }

@media (max-width: 1080px) {
    .grid { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .btn-row { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; }
    .beh-row { grid-template-columns: 80px 1fr 36px; }
}
