:root {
  --bg: #0b0e1a;
  --bg2: #121633;
  --card: #1a1f3d;
  --card2: #222a52;
  --line: #2c3566;
  --text: #e8ecff;
  --muted: #97a0d0;
  --accent: #7c5cff;
  --accent2: #29a3ff;
  --ok: #2ecc71;
  --bad: #ff5c7c;
  --warn: #ffb454;
  --grad: linear-gradient(135deg, #7c5cff 0%, #29a3ff 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2350 0%, var(--bg) 60%) fixed;
  color: var(--text);
  min-height: 100vh;
}
.topbar {
  background: var(--grad);
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: 2px; font-weight: 700; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: rgba(255,255,255,.12); color: #fff; border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 20px; font-size: 14px; transition: .15s;
}
.tab:hover { background: rgba(255,255,255,.25); }
.tab.active { background: #fff; color: #2a2f66; font-weight: 700; }

.container { max-width: 1080px; margin: 0 auto; padding: 20px; }
.section { display: none; }
.section.active { display: block; animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
label { font-size: 12px; color: var(--muted); }
input[type=text], input[type=number], select, textarea {
  background: #0e1230; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent2); }
button.btn {
  background: var(--grad); color: #fff; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; transition: .15s;
}
button.btn:hover { filter: brightness(1.1); }
button.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.btn.ghost:hover { border-color: var(--accent2); }
button.btn.ok { background: var(--ok); }
button.btn.bad { background: var(--bad); }
button.btn.warn { background: var(--warn); color:#222; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 16px;
  background: #0e1230; border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 13px; user-select: none;
}
.chip.on { background: var(--grad); color: #fff; border-color: transparent; }

/* 学习卡 */
.controls { margin-bottom: 16px; }
.queue-meta { display:flex; justify-content: space-between; align-items:center; margin-bottom: 10px; }
.progressbar { height: 8px; background: #0e1230; border-radius: 6px; overflow: hidden; border:1px solid var(--line); }
.progressbar > i { display:block; height:100%; background: var(--grad); width:0; transition: width .25s; }
.study-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px;
  position: relative;
}
.study-card.done-ok { border-color: var(--ok); }
.study-card.done-bad { border-color: var(--bad); }
.sc-index { position:absolute; top:12px; right:14px; font-size:12px; color: var(--muted); }
.sc-pinyin { font-size: 30px; letter-spacing: 4px; font-weight: 600; color: #fff; margin: 6px 0 12px; }
.sc-hint { background: #0e1230; border:1px solid var(--line); border-radius:10px; padding:12px; font-size: 14px; line-height: 1.6; }
.sc-hint .tag { color: var(--accent2); font-weight:700; margin-right:6px; }
/* 下拉揭示 */
.reveal {
  position: relative; margin-top: 10px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: #0e1230; user-select: none;
}
.reveal-text {
  font-size: 30px; font-weight: 700; letter-spacing: 6px; color: var(--warn);
  padding: 16px; line-height: 1.5; text-align: center;
}
.reveal-mask {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background: linear-gradient(180deg, #2b3170 0%, #181d3c 100%);
  cursor: grab; touch-action: none; display: flex; align-items: flex-start; justify-content: center;
}
.reveal-mask:active { cursor: grabbing; }
.reveal-handle {
  position: absolute; top: 0; left: 0; right: 0; height: 32px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  background: rgba(124, 92, 255, .28); border-bottom: 1px solid var(--accent);
}
.sc-actions { display:flex; gap:10px; margin-top:14px; flex-wrap: wrap; }
.sc-count { font-size: 12px; color: var(--muted); margin-left: auto; align-self:center; }

.pager { display:flex; justify-content: center; align-items:center; gap: 14px; margin-top: 16px; }
.pager .pg-info { font-size: 14px; color: var(--muted); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:hover td { background: rgba(255,255,255,.03); }
.py { color: var(--accent2); font-size: 13px; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.stat-box { background: linear-gradient(180deg,var(--card),var(--card2)); border:1px solid var(--line); border-radius:14px; padding:16px; text-align:center; }
.stat-box .num { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip:text; background-clip:text; color: transparent; }
.stat-box .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bar-row { display:flex; align-items:center; gap:10px; margin: 8px 0; font-size: 13px; }
.bar-row .name { width: 110px; color: var(--muted); }
.bar-track { flex:1; background:#0e1230; border:1px solid var(--line); border-radius:6px; height: 18px; overflow:hidden; }
.bar-track > i { display:block; height:100%; background: var(--grad); }
.bar-row .val { width: 40px; text-align:right; color: var(--text); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #222a52; border:1px solid var(--line); color:#fff; padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); z-index: 50; opacity:0; transition:.25s; pointer-events:none;
}
.toast.show { opacity:1; }

.switch { display:inline-flex; align-items:center; gap:8px; cursor:pointer; }
.empty { text-align:center; color: var(--muted); padding: 40px 0; }
.kbd { background:#0e1230; border:1px solid var(--line); border-radius:5px; padding:1px 7px; font-size:12px; color:var(--muted); }
.modal-bg { position: fixed; inset:0; background: rgba(0,0,0,.6); display:none; align-items:center; justify-content:center; z-index:40; }
.modal-bg.show { display:flex; }
.modal { background: var(--card2); border:1px solid var(--line); border-radius:14px; padding:22px; width: min(520px, 92vw); }
.modal h3 { margin: 0 0 12px; }
