:root {
  --ink: #1E3A5F;          /* 深墨蓝：标题、正文 */
  --ink-soft: #5A6E85;     /* 次级文字 */
  --ink-faint: #8A99AB;    /* 弱化文字 */
  --paper: #F5F7FB;        /* 冷纸白背景 */
  --card: #FFFFFF;
  --line: #E6EBF2;         /* 分隔线 */
  --green: #2E9E6B;        /* 成长绿：优秀、进步 */
  --green-soft: #E7F4EE;
  --blue: #4C7FD6;         /* 良好、主色 */
  --blue-soft: #EAF0FA;
  --amber: #DD9A3A;        /* 待加强 */
  --amber-soft: #FBF1E2;
  --red: #C0564F;          /* 需关注 */
  --shadow: 0 1px 2px rgba(30,58,95,0.05), 0 8px 24px rgba(30,58,95,0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* ===== 应用顶栏（浅色） ===== */
.topbar {
  display: flex; align-items: center;
  flex-wrap: wrap; gap: 12px;
  padding: 16px 20px; max-width: 1080px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--ink), #2E6BA8);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.brand h1 { font-size: 18px; font-weight: 700; color: var(--ink); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tab-btn {
  border: none; background: transparent; padding: 8px 16px;
  font-size: 14px; border-radius: 8px; cursor: pointer;
  color: var(--ink-soft); transition: all .15s;
}
.tab-btn:hover { background: #eef1f6; color: var(--ink); }
.tab-btn.active { background: var(--ink); color: #fff; }

main { max-width: 1080px; margin: 0 auto; padding: 8px 20px 60px; }
.tab { display: none; }
.tab.active { display: block; }

/* ===== 应用面板 / 表单 / 表格（学生管理、数据导入、维度配置） ===== */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
h2 { font-size: 20px; margin-bottom: 16px; }
h3 { font-size: 17px; margin: 20px 0 12px; }
h4 { font-size: 15px; margin-bottom: 8px; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }
.link { color: var(--blue); cursor: pointer; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
input[type="text"], select, textarea {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; min-width: 140px; color: var(--ink);
}
textarea { font-family: inherit; resize: vertical; min-width: 100%; box-sizing: border-box; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
.btn {
  padding: 9px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; cursor: pointer; color: var(--ink); transition: all .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2E6BA8; border-color: #2E6BA8; color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #fdf0ef; }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--ink-soft); font-weight: 600; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-bottom: 0; }
.word-table-wrap { max-height: 440px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.word-table-wrap .table { border-collapse: collapse; }
.word-table-wrap thead th { position: sticky; top: 0; background: var(--card); z-index: 1; box-shadow: 0 1px 0 var(--line); }
.word-table-wrap.collapsed { display: none; }
.upload-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mapping-item { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.mapping-item label { color: var(--ink-soft); }
#type-dim-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.type-dim-row { display: flex; align-items: center; gap: 10px; }
.type-dim-row .qtype-name { min-width: 160px; font-weight: 600; }
.result { margin-top: 16px; padding: 12px; border-radius: 8px; font-size: 14px; }
.result.ok { background: #f0fdf4; color: var(--green); }
.result.err { background: #fdf0ef; color: var(--red); }
.import-history { margin-top: 28px; }
.import-batch { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.batch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.batch-info { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.batch-info b { color: var(--ink); font-size: 14px; }
.batch-no { color: var(--ink-faint); font-size: 12px; }
.batch-actions { display: flex; gap: 8px; }
.batch-detail { border-top: 1px dashed var(--line); padding: 12px 16px; }
#dimension-list { display: flex; flex-direction: column; gap: 12px; }
.dim-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.dim-card .dim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dim-card .dim-name { font-weight: 700; font-size: 16px; }
.dim-card .dim-desc { color: var(--ink-soft); font-size: 13px; }
.dim-card .qtags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.qtags .qtag { background: #eef1fb; color: var(--blue); padding: 3px 10px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.qtag .x { cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.qtag .x:hover { color: var(--red); }
.add-qt { display: flex; gap: 8px; margin-top: 8px; }

/* ===== 报告区 ===== */
.report-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
#report-content { padding-top: 6px; }
.paper-status { font-size: 13px; padding: 3px 12px; border-radius: 999px; }
.paper-status.has { background: var(--green-soft); color: var(--green); }
.paper-status.none { background: #EEF1F6; color: var(--ink-faint); }
.paper-upload-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.paper-upload-item:last-child { border-bottom: none; }
.paper-stu-name { min-width: 120px; font-weight: 600; }

.report-brand { text-align: center; margin: 4px 0 20px; }
.report-brand-name { font-size: 22px; font-weight: 750; color: var(--ink); letter-spacing: 0.02em; }
.report-brand-sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; letter-spacing: 2px; }

/* 学生信息条 */
.student {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: center;
}
.student .name { font-size: 20px; font-weight: 700; }
.student .meta { font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 8px 22px; }
.student .meta b { color: var(--ink); font-weight: 600; }

/* 卡片通用 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; padding: 18px 22px 0; }
.card-sub { font-size: 12.5px; color: var(--ink-faint); padding: 2px 22px 0; }

/* 英雄区：综合指数 + 雷达图 */
.hero { display: grid; grid-template-columns: 340px 1fr; gap: 18px; margin-bottom: 18px; }
.overall { padding: 26px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.overall .label { font-size: 13px; color: var(--ink-soft); }
.gauge { position: relative; width: 190px; height: 190px; margin: 12px 0 4px; }
.gauge svg { width: 100%; height: 100%; }
.gauge .score-num { position: absolute; inset: 0; display: grid; place-items: center; }
.gauge .score-num .v { font-size: 46px; font-weight: 750; letter-spacing: -1px; }
.gauge .score-num .t { font-size: 12px; color: var(--ink-faint); margin-top: -8px; }
.delta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--green);
  background: var(--green-soft); border-radius: 999px; padding: 4px 12px; margin-bottom: 8px;
}
.delta.down { color: var(--amber); background: var(--amber-soft); }
.level-chip { font-size: 13px; font-weight: 600; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 4px 14px; }
.highlight { font-size: 12.5px; color: var(--ink-soft); margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; text-align: left; }
.highlight b { color: var(--ink); }

.radar-card { padding-bottom: 8px; }
.radar-wrap { padding: 6px 10px 2px; }
.radar-wrap svg { width: 100%; height: 340px; display: block; }
.radar-label { font-size: 12.5px; fill: var(--ink); font-weight: 600; }
.radar-val { font-size: 11px; fill: var(--green); font-weight: 700; }
.legend { display: flex; gap: 20px; padding: 4px 22px 16px; font-size: 12.5px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .dot { width: 12px; height: 12px; border-radius: 3px; }
.legend .dot.cur { background: var(--green); }
.legend .dot.prev { background: #B9C7DA; }

/* 趋势 */
.trend-card { margin-bottom: 18px; }
.trend-wrap { padding: 6px 18px 14px; }
.trend-wrap svg { width: 100%; height: auto; display: block; }
.trend-val { font-size: 11.5px; fill: var(--green); font-weight: 700; }
.trend-label { font-size: 12px; fill: var(--ink-soft); }
.trend-note { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; padding: 0 22px 18px; }

/* 维度分析 */
.analysis-title { font-size: 16px; font-weight: 700; margin: 22px 2px 12px; }
.analysis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.dim { padding: 20px 22px; margin-bottom: 0; }
.dim-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dim-name { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.dim-swatch { width: 10px; height: 10px; border-radius: 3px; }
.dim-score { font-size: 24px; font-weight: 750; letter-spacing: -0.5px; }
.dim-score small { font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.bars { margin-bottom: 12px; }
.bar-row { margin-bottom: 8px; }
.bar-row .bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.bar-row .bar-label b { color: var(--ink); font-weight: 600; }
.bar-track { height: 7px; background: #EEF1F6; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.dim p { font-size: 13px; margin-bottom: 6px; }
.dim p .tag { font-weight: 700; }
.tag.good { color: var(--green); }
.tag.weak { color: var(--amber); }
.dim .advice { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); border-left: 3px solid var(--line); padding-left: 10px; }

/* 给家长的建议 */
.advice { padding: 22px 24px; margin-bottom: 18px; background: linear-gradient(180deg, #F0F6F3, #fff); border: 1px solid #D8E8DF; }
.advice h3 { font-size: 15.5px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.advice h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.advice p { font-size: 14px; color: var(--ink); }

/* 脚注 */
.footnotes { font-size: 12px; color: var(--ink-faint); line-height: 1.9; padding: 4px 6px; }
.footnotes .lv { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0; }
.footnotes .lv span { display: inline-flex; align-items: center; gap: 6px; }
.footnotes .sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ===== 登录 / 注册 ===== */
.auth-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #E7F0FA 0%, var(--paper) 60%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark {
  width: 52px; height: 52px; border-radius: 14px; font-size: 26px;
  margin: 0 auto 12px;
}
.auth-brand h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-brand p { font-size: 13px; color: var(--ink-soft); }
.auth-card h2 { font-size: 17px; margin-bottom: 14px; color: var(--ink); }
.auth-card input, .auth-card select {
  width: 100%; padding: 11px 13px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 14px; color: var(--ink);
  background: #fff;
}
.auth-card input:focus, .auth-card select:focus { outline: none; border-color: var(--blue); }
.auth-card .btn.primary { width: 100%; padding: 12px; font-size: 15px; margin-top: 2px; }
.auth-switch { margin-top: 16px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.auth-switch a { color: var(--blue); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-error {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: #fdf0ef; color: var(--red); font-size: 13px; text-align: center;
}
.user-box { display: flex; align-items: center; gap: 10px; }
.user-box #current-username { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
#scope-select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink); background: #fff; max-width: 200px;
}
.acting-banner {
  max-width: 1080px; margin: 0 auto 8px; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--amber-soft); border: 1px solid #f0d9b4; border-radius: 10px;
  font-size: 14px; color: #8a5a1e;
}

.default-pwd-banner {
  max-width: 1080px; margin: 0 auto 8px; padding: 10px 20px;
  background: #fdf0ef; border: 1px solid var(--red); border-radius: 10px;
  font-size: 14px; color: #9c3b34;
}

/* ===== 公告 ===== */
#announcement-form { flex-direction: column; align-items: stretch; margin-bottom: 24px; }
#announcement-form input, #announcement-form textarea { min-width: 0; width: 100%; }
#announcement-form .btn.primary { align-self: flex-start; }
.announcement-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px;
  background: var(--card);
}
.announcement-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.announcement-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.announcement-meta { font-size: 12px; color: var(--ink-faint); }
.announcement-body { font-size: 14px; color: var(--ink-soft); white-space: pre-wrap; margin-bottom: 10px; }

/* ===== 账号中心 ===== */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 20px; }
.account-card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.account-card h3 { margin-top: 0; }
.account-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; }
.account-row label { min-width: 72px; color: var(--ink-soft); flex-shrink: 0; }
.account-row span { color: var(--ink); font-weight: 600; }
.account-row input, .account-row select {
  flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; color: var(--ink); background: #fff;
}
.account-row input:focus, .account-row select:focus { outline: none; border-color: var(--blue); }
.account-card .btn.primary { margin-top: 2px; }

/* ===== 弹窗 ===== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30, 58, 95, 0.35);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 24px; width: 100%; max-width: 420px;
}
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ===== 趣味游戏 ===== */
.games-menu { display: flex; gap: 12px; flex-wrap: wrap; }
.game-card { padding: 16px 28px; font-size: 16px; }
.game-mode { text-align: center; padding: 20px 0; }
.game-mode h3 { margin-bottom: 8px; }
.game-mode .btn { margin: 6px 8px; }
.game-box { border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: var(--card); margin-top: 12px; }
.game-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-toolbar h3 { flex: 1; margin: 0; font-size: 18px; }
.game-toolbar .tag { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-left: 4px; }
.game-status { margin-bottom: 14px; font-size: 15px; }
.game-custom-panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--paper); }
.game-custom-panel .hint { margin-bottom: 10px; }
.custom-cat { margin-bottom: 10px; }
.custom-cat-label { display: block; font-size: 15px; margin-bottom: 4px; cursor: pointer; }
.custom-cat-label input, .custom-unit input { margin-right: 6px; vertical-align: middle; }
.custom-units { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-left: 24px; }
.custom-unit { font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.q-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; background: var(--paper); }
.q-box.ok { background: var(--green-soft); border-color: #bfe3d0; color: var(--green); font-weight: 600; }
.q-prompt { margin-bottom: 12px; }
.q-word { font-size: 24px; font-weight: 700; }
.q-hint { font-size: 13px; color: var(--ink-soft); margin-left: 8px; }
.q-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.opt { width: 100%; }
.gomoku-board {
  display: grid; gap: 2px; max-width: 640px; margin: 0 auto;
  background: #E8C77A; border: 4px solid #D4A94F; border-radius: 8px; padding: 6px;
}
.cell {
  aspect-ratio: 1; background: #F6E3B6; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cell:hover { background: #F0D99E; }
.stone { width: 82%; height: 82%; border-radius: 50%; display: block; }
.stone.b { background: #23272f; }
.stone.w { background: #fff; border: 1px solid #b9c0ca; }
.poison-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.poison-config { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 12px 0 18px; }
.poison-config label { font-size: 14px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.poison-config input { min-width: 90px; width: 90px; text-align: center; }
.poison-card {
  position: relative; aspect-ratio: 1; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
}
.poison-card.face { background: var(--ink); color: #fff; cursor: pointer; border: none; font-size: 28px; padding: 0; }
.poison-card.face:hover { background: #2E6BA8; }
.poison-card.poison { background: #4a1f1f; font-size: 28px; }
.poison-card.faceup {
  aspect-ratio: auto; min-height: 56px; background: #fff; border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink);
  padding: 8px; word-break: break-all; line-height: 1.25;
  -webkit-tap-highlight-color: transparent; outline: none;
}
.poison-card.faceup:hover { border-color: var(--red); background: #fdf0ef; }
.poison-card.claimed { background: var(--green-soft); border: 1px solid #bfe3d0; color: var(--green); }
.poison-card.wrong { background: #f3f4f6; border: 1px solid var(--line); color: var(--ink-soft); }
.handoff { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 14px; background: var(--paper); }
.handoff p { font-size: 16px; color: var(--ink-soft); margin-bottom: 18px; }
.handoff .btn { font-size: 15px; padding: 12px 24px; }
.pc-word { font-size: 14px; font-weight: 600; text-align: center; word-break: break-all; padding: 0 6px; }
.owner { position: absolute; top: 6px; right: 8px; font-size: 11px; }
.owner-1 { color: #1E3A5F; }
.owner-2 { color: #C0564F; }

.hidden { display: none; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .analysis { grid-template-columns: 1fr; }
  .student { gap: 8px 20px; }
}

@media print {
  .topbar, .report-toolbar, .btn, .tabs { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card, .student, .advice { box-shadow: none; border-color: #d5dbe4; page-break-inside: avoid; }
  .hero { grid-template-columns: 300px 1fr; }
  .analysis { grid-template-columns: 1fr 1fr; }
  .footnotes { display: none; }
}
