/* 主题色沿用 logo：蓝 #007cff → 紫 #802aca → 红 #ff2847 */
:root {
  --primary: #007cff;
  --accent: #ff2847;
  --violet: #802aca;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #10131a;
  --muted: #6a7387;
  --line: #e3e7ef;
  --shadow: 0 1px 2px rgba(16,19,26,.06), 0 8px 24px rgba(16,19,26,.06);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017; --surface: #161a24; --text: #eef1f7;
    --muted: #8b94a8; --line: #262c3a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
/* 带 display 的类会盖掉浏览器默认的 [hidden]{display:none}，兜一层 */
[hidden] { display: none !important; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.view { max-width: 720px; margin: 0 auto; padding: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.label { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.error { margin: 10px 0 0; font-size: 14px; color: var(--accent); }
.notice { margin: 10px 0 0; font-size: 13px; color: var(--primary); }

/* ---- 登录 ---- */
.login-card { margin-top: 10vh; text-align: center; max-width: 420px; margin-inline: auto; }
.login-logo { width: 80px; height: 80px; }
.login-card h1 { margin: 6px 0 22px; font-size: 20px; }
.login-card label { display: block; text-align: left; margin-bottom: 14px; }
.login-card label span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input, .select, .input, textarea.code {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px; outline: none;
}
input:focus, .select:focus, textarea.code:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,124,255,.16);
}
textarea.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; resize: vertical; margin-bottom: 12px;
}
.file { padding: 10px 0; background: none; border: 0; }

/* ---- 按钮 ---- */
.btn {
  font: inherit; font-weight: 600; padding: 11px 16px; min-height: 42px;
  border-radius: 11px; border: 1px solid transparent; cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn:active { filter: brightness(.93); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 130%); }
.btn-outline { color: var(--primary); background: transparent; border-color: var(--primary); }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: 13px; min-height: 32px; }
.wide { width: 100%; }

/* ---- 顶栏与标签页 ---- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.brand { width: 28px; height: 28px; }
.who { font-weight: 600; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  font: inherit; font-size: 14px; padding: 7px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
.row-card { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-card .select, .row-card .input { flex: 1; min-width: 140px; }
.lbl { font-size: 13px; color: var(--muted); flex: none; }
.counts { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.switch { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); flex: none; }
.switch input { width: 17px; height: 17px; accent-color: var(--primary); }

/* ---- 复习 ---- */
.review-card { text-align: center; }
.face {
  padding: 26px 14px; font-size: 22px; line-height: 1.45;
  overflow-wrap: anywhere;
}
.face.back { border-top: 1px solid var(--line); font-size: 17px; text-align: left; }
.face.small { padding: 12px; font-size: 15px; text-align: left; background: var(--bg); border-radius: 11px; min-height: 60px; }
.empty { text-align: center; padding: 40px 16px; }
.empty-title { margin: 0; font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent; }

.rating { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.rate { display: flex; flex-direction: column; gap: 2px; padding: 10px 2px; font-size: 13px;
        border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.rate small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rate-1 { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.rate-3 { border-color: color-mix(in srgb, var(--primary) 45%, transparent); color: var(--primary); }

/* ---- 列表 ---- */
/* 窄屏时整行不换行，改成左右滑动：德语词加标签很容易撑爆一行，
   换行会让列表纵向拉得很长，反而更难扫读。 */
.list {
  list-style: none; margin: 0; padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.list li {
  display: flex; gap: 14px; align-items: baseline; padding: 9px 0;
  border-top: 1px solid var(--line); font-size: 14px;
  white-space: nowrap;           /* 关键：不换行 */
  width: max-content;
  min-width: 100%;
}
.list li:first-child { border-top: 0; }
.list .key { flex: 1 0 auto; min-width: 10ch; }
.list .tags, .list .cards { font-size: 12px; color: var(--muted); flex: none; }
/* 滑到右边时左侧渐隐，提示还有内容 */
.list::-webkit-scrollbar { height: 6px; }
.list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

/* ---- 批量进度条 ---- */
.batch-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.batch-bar .counts { flex: none; font-weight: 600; }
.pending { flex: 1; font-size: 12px; color: var(--muted); }
.done-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---- 模板预览 ---- */
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .preview-grid { grid-template-columns: 1fr; } }

/* ---- 导入 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stat-num { margin: 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-num.primary { color: var(--primary); }
.stat-num.violet { color: var(--violet); }
.stat-num.accent { color: var(--accent); }
.stat-num.muted { color: var(--muted); }
.stat-label { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.details { margin-top: 12px; }
.details summary { cursor: pointer; }
