/* ============================================================
   初中理科全科AI学习教练 · 深色护眼主题 (PC 专用)
   主背景深炭黑 / 面板深灰蓝 / 强调青蓝 + 浅橙
   ============================================================ */

:root {
  --bg-main: #0c1016;          /* 主背景 深炭黑 */
  --bg-panel: #141b26;         /* 次级面板 深灰蓝 */
  --bg-panel-2: #18212f;       /* 卡片面板 */
  --bg-panel-3: #1e293b;       /* 悬浮/激活 */
  --line: rgba(148, 178, 214, .10);
  --line-strong: rgba(148, 178, 214, .22);
  --txt-main: #dbe4f0;
  --txt-sub: #8fa2ba;
  --txt-dim: #5d6f88;
  --accent: #38bdf8;           /* 青蓝 */
  --accent-deep: #0e9ad1;
  --accent-bg: rgba(56, 189, 248, .12);
  --orange: #fbbf6d;           /* 浅橙 */
  --orange-deep: #f0964a;
  --orange-bg: rgba(251, 191, 109, .10);
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --fs: 15px;
}

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

/* 关键修复: hidden 属性强制生效。
   否则 .modal-mask / .sysmenu-pop 的 display:flex 会覆盖浏览器默认的
   [hidden]{display:none}, 导致空弹窗常驻屏幕、挡住整个页面且关不掉 */
[hidden] { display: none !important; }

html { font-size: var(--fs); }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--txt-main);
  overflow: hidden;
  height: 100vh;
  user-select: text;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:active { transform: scale(.97); }
input, textarea, select {
  font-family: inherit; color: var(--txt-main);
  background: var(--bg-panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

::selection { background: rgba(56, 189, 248, .35); }

/* 细滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2a3850; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a68; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶部通栏 ============ */
#topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--bg-panel);
  border-bottom: 1px solid var(--line); position: relative; z-index: 50;
}
.tb-left { display: flex; align-items: center; gap: 12px; min-width: 330px; }
.tb-logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent-deep), #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; font-weight: bold;
  box-shadow: 0 0 14px rgba(56, 189, 248, .35);
}
.tb-title h1 { font-size: 1.15rem; letter-spacing: .5px; }
.tb-title p { font-size: .72rem; color: var(--txt-sub); letter-spacing: 1px; }

.tb-right { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }

.tb-search { display: flex; align-items: center; width: min(520px, 42vw); }
.tb-search input {
  flex: 1; height: 36px; padding: 0 14px; border-radius: 8px 0 0 8px; font-size: .86rem;
  border-right: none;
}
.tb-search input::placeholder { color: var(--txt-dim); }
.tb-search button {
  height: 36px; padding: 0 16px; border-radius: 0 8px 8px 0;
  background: var(--accent-deep); color: #fff; font-size: .95rem;
  transition: background .15s;
}
.tb-search button:hover { background: var(--accent); }

.status-light {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: var(--bg-panel-2); border: 1px solid var(--line);
  font-size: .75rem; cursor: default; flex: none;
}
.status-light .dot { width: 9px; height: 9px; border-radius: 50%; }
.status-light.green .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-light.yellow .dot { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-light.red .dot { background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1s infinite; }
.status-light .txt { color: var(--txt-sub); }
@keyframes blink { 50% { opacity: .35; } }

.tb-btn {
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); font-size: .82rem;
  background: var(--bg-panel-2); border: 1px solid var(--line-strong); color: var(--txt-main);
  transition: all .15s;
}
.tb-btn:hover { background: var(--bg-panel-3); border-color: var(--accent); }

.tb-menu-wrap { position: relative; }
.sysmenu-pop {
  position: absolute; right: 0; top: 44px; z-index: 60;
  background: var(--bg-panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); min-width: 190px; padding: 6px; display: flex; flex-direction: column;
}
.sysmenu-pop button {
  text-align: left; padding: 9px 12px; border-radius: 6px; font-size: .84rem; color: var(--txt-main);
}
.sysmenu-pop button:hover { background: var(--bg-panel-3); color: var(--accent); }

.hk-hint {
  position: absolute; right: 16px; top: 62px; font-size: .7rem; color: var(--txt-dim);
  opacity: .55; pointer-events: none; letter-spacing: .3px;
}

/* ============ 主体布局 ============ */
#main { display: flex; height: calc(100vh - 60px); overflow: hidden; }

/* ---------- 左侧边栏 ---------- */
#sidebar {
  width: 236px; flex: none; background: var(--bg-panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  transition: width .22s ease; overflow: hidden;
}
#sidebar.collapsed { width: 58px; }
#sidebar.collapsed .sb-title, #sidebar.collapsed .sb-sec-title,
#sidebar.collapsed .sb-item span, #sidebar.collapsed .sb-foot-grid,
#sidebar.collapsed .sb-sec { display: none; }
#sidebar.collapsed .sb-item { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .sb-toggle { transform: rotate(180deg); }

.sb-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 12px;
  border-bottom: 1px solid var(--line); flex: none;
}
.sb-logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--orange-deep), #d97706);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff; font-weight: bold;
}
.sb-title { flex: 1; min-width: 0; }
.sb-title b { display: block; font-size: .88rem; white-space: nowrap; }
.sb-status { font-size: .7rem; color: var(--txt-sub); white-space: nowrap; }
.sb-status.on { color: var(--green); }
.sb-status.idle { color: var(--yellow); }
.sb-status.off { color: var(--red); }
.sb-toggle {
  flex: none; width: 24px; height: 24px; border-radius: 6px; color: var(--txt-sub);
  background: var(--bg-panel-2); font-size: .8rem; transition: transform .2s;
}
.sb-toggle:hover { color: var(--accent); }

.sb-body { flex: 1; overflow-y: auto; padding: 8px; }

.sb-sec { margin-bottom: 6px; }
.sb-sec-title {
  font-size: .68rem; color: var(--txt-dim); letter-spacing: 2px;
  padding: 10px 8px 6px; white-space: nowrap;
}

.sb-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: .82rem;
  color: var(--txt-main); text-align: left; transition: background .13s;
  white-space: nowrap; overflow: hidden;
}
.sb-item i { font-style: normal; flex: none; width: 20px; text-align: center; }
.sb-item:hover { background: var(--bg-panel-3); }
.sb-item.active { background: var(--accent-bg); color: var(--accent); }

/* 学科分组 */
.subject-group { margin-bottom: 4px; }
.subject-head {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 8px;
  border-radius: var(--radius-sm); font-size: .86rem; font-weight: bold; color: var(--txt-main);
}
.subject-head:hover { background: var(--bg-panel-3); }
.subject-head .sg-icon {
  width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: .9rem; flex: none; color: #fff;
}
.subject-head .sg-arrow { margin-left: auto; color: var(--txt-dim); font-size: .7rem; transition: transform .18s; }
.subject-group.open .sg-arrow { transform: rotate(90deg); }
#sidebar.collapsed .subject-head .sg-name, #sidebar.collapsed .sg-arrow, #sidebar.collapsed .grade-group { display: none; }
#sidebar.collapsed .subject-head { justify-content: center; }

.grade-group { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.subject-group.open .grade-group { max-height: 2600px; }
.grade-title { font-size: .7rem; color: var(--orange); padding: 6px 8px 3px; letter-spacing: 1px; }
.kp-link {
  display: block; width: 100%; text-align: left; padding: 6px 10px 6px 26px;
  border-radius: 6px; font-size: .78rem; color: var(--txt-sub); transition: all .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kp-link:hover { color: var(--txt-main); background: var(--bg-panel-3); }
.kp-link.active { color: var(--accent); background: var(--accent-bg); }

.sb-foot {
  flex: none; border-top: 1px solid var(--line); padding: 10px 12px;
  font-size: .68rem; color: var(--txt-sub);
}
.sb-foot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; }
.sb-foot-grid b { color: var(--txt-main); font-weight: normal; }

/* ---------- 右侧 ---------- */
#right-col { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* 专题指导栏 */
#topic-panel {
  height: 38%; min-height: 140px; display: flex; flex-direction: column;
  background: var(--bg-main); border-bottom: 1px solid var(--line); overflow: hidden;
}
.tp-head {
  flex: none; display: flex; align-items: baseline; gap: 14px;
  padding: 12px 20px 8px; border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
#tp-title { font-size: 1.02rem; font-weight: bold; color: var(--accent); }
#tp-sub { font-size: .74rem; color: var(--txt-sub); }
#tp-body { flex: 1; overflow-y: auto; padding: 14px 20px; }

.tp-welcome { max-width: 980px; }
.tp-welcome-card {
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 26px; line-height: 1.9;
}
.tp-welcome-card h3 { color: var(--orange); margin-bottom: 10px; }
.tp-welcome-card ul { margin: 10px 0 0 20px; }
.tp-welcome-card li { color: var(--txt-sub); font-size: .88rem; margin: 4px 0; }
.tp-welcome-card b { color: var(--txt-main); }
.hl-c { color: var(--accent); font-weight: bold; }
.hl-o { color: var(--orange); font-weight: bold; }

/* 知识点卡片 */
.kp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.kp-card {
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color .15s, background .15s;
}
.kp-card:hover { border-color: var(--line-strong); background: var(--bg-panel-3); }
.kp-card .kp-card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: .86rem; font-weight: bold;
}
.kp-card .tag {
  font-size: .62rem; padding: 2px 8px; border-radius: 999px; flex: none;
  background: var(--accent-bg); color: var(--accent);
}
.kp-card.type-concept .tag { background: var(--accent-bg); color: var(--accent); }
.kp-card.type-formula .tag { background: var(--orange-bg); color: var(--orange); }
.kp-card.type-exam .tag { background: rgba(52, 211, 153, .12); color: var(--green); }
.kp-card.type-mistake .tag { background: rgba(248, 113, 113, .12); color: var(--red); }
.kp-card ul { list-style: none; }
.kp-card li {
  font-size: .82rem; color: var(--txt-main); line-height: 1.85;
  padding: 3px 0 3px 16px; position: relative; border-bottom: 1px dashed rgba(148, 178, 214, .07);
}
.kp-card li:last-child { border-bottom: none; }
.kp-card li::before {
  content: "▪"; position: absolute; left: 0; color: var(--txt-dim); font-size: .7rem; top: 5px;
}
.kp-card .ka-inline { color: var(--accent); }

.kp-hero {
  grid-column: 1 / -1; background: linear-gradient(135deg, rgba(56, 189, 248, .08), rgba(251, 191, 109, .05));
  border: 1px solid var(--line-strong);
}
.kp-hero .kp-hero-name { font-size: 1.15rem; font-weight: bold; }
.kp-hero .kp-hero-meta { display: flex; gap: 10px; margin-top: 8px; font-size: .72rem; color: var(--txt-sub); }
.kp-hero .kp-hero-meta span { background: var(--bg-panel-3); padding: 3px 10px; border-radius: 999px; }

/* 拖动条 */
#drag-bar {
  height: 6px; flex: none; cursor: row-resize; background: transparent; position: relative; z-index: 5;
}
#drag-bar::after {
  content: ""; position: absolute; left: 50%; top: 2px; transform: translateX(-50%);
  width: 64px; height: 2px; border-radius: 2px; background: var(--line-strong);
}
#drag-bar:hover::after { background: var(--accent); }

/* ============ AI 对话区 ============ */
#chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 200px; overflow: hidden; }
.cp-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg-panel); border-bottom: 1px solid var(--line);
}
.cp-title { font-size: .88rem; color: var(--txt-main); }
#chat-topic-tag { color: var(--orange); }
.cp-actions { display: flex; gap: 8px; }
.cp-btn {
  font-size: .74rem; padding: 5px 10px; border-radius: 6px;
  background: var(--bg-panel-2); border: 1px solid var(--line-strong); color: var(--txt-sub);
  transition: all .13s;
}
.cp-btn:hover { color: var(--txt-main); border-color: var(--accent); background: var(--bg-panel-3); }

#chat-messages { flex: 1; overflow-y: auto; padding: 16px 20px; scroll-behavior: smooth; }
.msg-row { display: flex; margin-bottom: 14px; gap: 10px; }
.msg-row.user { justify-content: flex-end; }
.msg-ava {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 1rem;
}
.msg-row.ai .msg-ava { background: linear-gradient(135deg, var(--accent-deep), #1d4ed8); color: #fff; }
.msg-row.user .msg-ava { background: var(--bg-panel-3); color: var(--txt-sub); font-size: .8rem; }
.msg-main { max-width: 78%; min-width: 0; }
.msg-row.user .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.msg-bubble {
  padding: 10px 14px; border-radius: 12px; font-size: .86rem; line-height: 1.75;
  word-break: break-word; overflow-wrap: anywhere; white-space: normal;
}
.msg-row.ai .msg-bubble { background: var(--bg-panel-2); border: 1px solid var(--line); border-top-left-radius: 3px; }
.msg-row.user .msg-bubble { background: #1c3050; border: 1px solid rgba(56, 189, 248, .25); border-top-right-radius: 3px; }
.msg-time { font-size: .66rem; color: var(--txt-dim); margin-top: 4px; }
.msg-meta { display: flex; gap: 8px; margin-top: 5px; }
.msg-act {
  font-size: .68rem; color: var(--txt-dim); padding: 2px 8px; border-radius: 5px;
  border: 1px solid transparent;
}
.msg-act:hover { color: var(--accent); border-color: var(--line-strong); }

/* AI 输出内容排版 */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { font-size: .95rem; margin: 10px 0 6px; color: var(--accent); }
.msg-bubble h3:first-child, .msg-bubble h2:first-child { margin-top: 2px; }
.msg-bubble p { margin: 6px 0; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 6px 22px; }
.msg-bubble li { margin: 3px 0; }
.msg-bubble code {
  font-family: Consolas, "Courier New", monospace; background: rgba(56, 189, 248, .1);
  color: var(--accent); padding: 1px 6px; border-radius: 4px; font-size: .82rem;
}
.msg-bubble pre {
  background: #0a0e14; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; margin: 8px 0;
}
.msg-bubble pre code { background: none; padding: 0; color: var(--txt-main); }
.msg-bubble table { border-collapse: collapse; margin: 8px 0; font-size: .8rem; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--line-strong); padding: 5px 10px; }
.msg-bubble th { background: var(--bg-panel-3); color: var(--accent); }
.msg-bubble blockquote {
  border-left: 3px solid var(--orange); background: var(--orange-bg);
  padding: 6px 12px; margin: 8px 0; border-radius: 0 6px 6px 0; color: var(--txt-sub);
}
.msg-bubble .katex { font-size: 1.02em; }
.msg-bubble .katex-display { margin: 8px 0; overflow-x: auto; overflow-y: hidden; }
.msg-bubble .think-tip { color: var(--txt-dim); font-size: .78rem; font-style: italic; }
.msg-bubble .think-tip::before { content: "🧠 "; }

.typing-cursor { display: inline-block; width: 8px; height: 15px; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: cur-blink .8s infinite; border-radius: 1px; }
@keyframes cur-blink { 50% { opacity: 0; } }

.err-tip { color: var(--red); background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .3); border-radius: 8px; padding: 8px 12px; font-size: .8rem; }

/* 输入区 */
#chat-input-bar {
  flex: none; display: flex; gap: 12px; padding: 12px 16px;
  background: var(--bg-panel); border-top: 1px solid var(--line); align-items: flex-end;
}
#chat-input {
  flex: 1; resize: none; padding: 10px 14px; font-size: .86rem; line-height: 1.6;
  max-height: 160px; min-height: 62px; border-radius: 10px;
}
#chat-input::placeholder { color: var(--txt-dim); }
.ci-side { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; flex: none; }
.ci-tip { font-size: .64rem; color: var(--txt-dim); white-space: nowrap; }
.btn-send {
  padding: 10px 24px; border-radius: 10px; background: var(--accent-deep); color: #fff;
  font-size: .9rem; font-weight: bold; letter-spacing: 2px; transition: background .15s;
  box-shadow: 0 0 12px rgba(56, 189, 248, .25);
}
.btn-send:hover { background: var(--accent); }
.btn-send:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(2, 6, 12, .72); z-index: 200;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px);
}
.modal-box {
  width: min(760px, 92vw); max-height: 84vh; display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; animation: pop-in .18s ease;
}
@keyframes pop-in { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-panel-2), transparent);
}
.modal-head h3 { font-size: 1rem; }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px; color: var(--txt-sub);
  background: var(--bg-panel-2); font-size: .9rem;
}
.modal-close:hover { color: var(--red); }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px; }

.form-row { margin-bottom: 14px; }
.form-row > label { display: block; font-size: .8rem; color: var(--txt-sub); margin-bottom: 6px; }
.form-row > label b { color: var(--txt-main); font-weight: normal; }
.form-row input[type="text"], .form-row input[type="password"],
.form-row input[type="number"], .form-row select {
  width: 100%; height: 36px; padding: 0 12px; font-size: .84rem;
}
.form-row textarea {
  width: 100%; padding: 9px 12px; font-size: .84rem; resize: vertical; min-height: 64px; line-height: 1.6;
}
.form-help { font-size: .7rem; color: var(--txt-dim); margin-top: 5px; line-height: 1.6; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { padding: 8px 18px; border-radius: 8px; font-size: .82rem; transition: all .14s; border: 1px solid var(--line-strong); background: var(--bg-panel-2); color: var(--txt-main); }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .4); color: var(--red); }
.btn-danger:hover { background: rgba(248, 113, 113, .2); }
.btn-orange { background: var(--orange-deep); border-color: var(--orange-deep); color: #fff; }
.btn-orange:hover { background: var(--orange); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: #2a3550; border-radius: 999px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #8fa2ba; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent-deep); }
.switch input:checked + .slider::before { transform: translateX(20px); background: #fff; }
.switch-label { display: flex; align-items: center; gap: 10px; font-size: .84rem; }

/* 滑杆 */
input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 5px; background: #2a3550;
  border-radius: 3px; border: none; padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 0 8px rgba(56, 189, 248, .5);
}

/* 快捷键列表 */
.hk-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  margin-bottom: 8px; background: var(--bg-panel-2);
}
.hk-row .hk-name { font-size: .84rem; }
.hk-row .hk-name small { display: block; color: var(--txt-dim); font-size: .7rem; margin-top: 2px; }
.hk-key {
  display: flex; align-items: center; gap: 5px; flex: none;
}
.hk-key kbd {
  background: #26314a; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 6px; padding: 3px 9px; font-size: .72rem; font-family: Consolas, monospace;
  color: var(--accent); white-space: nowrap;
}
.hk-btn {
  padding: 4px 10px; border-radius: 6px; font-size: .7rem;
  background: var(--bg-panel-3); border: 1px solid var(--line-strong); color: var(--txt-sub);
}
.hk-btn:hover { color: var(--orange); border-color: var(--orange); }
.hk-capture kbd { animation: hk-wait 1s infinite; border-color: var(--orange); }
@keyframes hk-wait { 50% { opacity: .4; } }

/* 日志 */
.log-list { font-family: Consolas, "Courier New", monospace; font-size: .74rem; }
.log-item {
  padding: 5px 10px; border-bottom: 1px dashed rgba(148, 178, 214, .08);
  display: flex; gap: 10px; line-height: 1.6; word-break: break-all;
}
.log-time { color: var(--txt-dim); flex: none; }
.log-item .lv { flex: none; width: 40px; }
.lv.info { color: var(--accent); } .lv.ok { color: var(--green); }
.lv.warn { color: var(--yellow); } .lv.error { color: var(--red); }

/* 历史记录列表 */
.hist-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px;
  background: var(--bg-panel-2); cursor: pointer; transition: border-color .13s;
}
.hist-item:hover { border-color: var(--accent); }
.hist-item.faved { border-color: var(--orange); background: var(--orange-bg); }
.hist-item .hi-title { flex: 1; min-width: 0; }
.hist-item .hi-title b { display: block; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: normal; }
.hist-item .hi-title span { font-size: .68rem; color: var(--txt-dim); }
.hist-item .hi-ops { display: flex; gap: 6px; flex: none; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; background: var(--bg-panel-3); color: var(--txt-sub);
}
.icon-btn:hover { color: var(--txt-main); }
.icon-btn.danger:hover { color: var(--red); }

/* 错题卡片 */
.wrong-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel-2);
  padding: 14px 16px; margin-bottom: 12px;
}
.wrong-card .wc-tags { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.wrong-card .wc-tag { font-size: .66rem; padding: 2px 9px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); }
.wrong-card .wc-q { font-size: .84rem; line-height: 1.7; margin-bottom: 8px; white-space: pre-wrap; }
.wrong-card .wc-a {
  font-size: .78rem; color: var(--txt-sub); line-height: 1.7; background: rgba(56, 189, 248, .05);
  border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 8px 8px 0;
}
.wrong-card .wc-ops { display: flex; gap: 8px; margin-top: 10px; }

/* 训练配置 */
.train-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }

/* 代理测试结果 */
.proxy-result {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: .8rem; line-height: 1.7; border: 1px solid var(--line-strong);
}
.proxy-result.ok { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .07); color: var(--green); }
.proxy-result.fail { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .07); color: var(--red); }

/* 管理面板密钥掩码 */
.key-mask {
  font-family: Consolas, monospace; background: #0a0e14; border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 9px 12px; font-size: .82rem; color: var(--orange); letter-spacing: 1px;
}

/* Toast */
#toast-root { position: fixed; top: 74px; right: 20px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 18px; border-radius: 10px; font-size: .8rem; color: var(--txt-main);
  background: var(--bg-panel-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  animation: toast-in .25s ease; max-width: 380px; line-height: 1.6;
}
.toast.ok { border-color: rgba(52, 211, 153, .55); } .toast.ok::before { content: "✅ "; }
.toast.warn { border-color: rgba(251, 191, 109, .55); } .toast.warn::before { content: "⚠️ "; }
.toast.error { border-color: rgba(248, 113, 113, .55); } .toast.error::before { content: "❌ "; }
.toast.info::before { content: "💬 "; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } }

/* 搜索下拉建议 */
.search-suggest {
  position: absolute; top: 96px; z-index: 90; width: min(560px, 46vw);
  background: var(--bg-panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); overflow: hidden; max-height: 340px; overflow-y: auto;
}
.sug-item { padding: 9px 14px; cursor: pointer; font-size: .82rem; display: flex; gap: 10px; align-items: center; }
.sug-item:hover, .sug-item.hover { background: var(--bg-panel-3); }
.sug-item .sug-sub { font-size: .68rem; color: var(--txt-dim); margin-left: auto; flex: none; }
.sug-item b { color: var(--accent); font-weight: normal; }

/* 收藏知识点 */
.fav-kp-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--bg-panel-2);
}
.fav-kp-item .fk-name { flex: 1; font-size: .84rem; }

.empty-tip {
  text-align: center; color: var(--txt-dim); font-size: .8rem; padding: 40px 0; line-height: 2;
}
.empty-tip .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* 高亮标记 */
mark { background: rgba(251, 191, 109, .22); color: var(--orange); padding: 0 3px; border-radius: 3px; }
