/* 日课 — 设计语言参照 claude.ai：羊皮纸暖色、衬线标题、ring 阴影、全暖灰
   深浅双主题：html[data-theme] 由 theme.js 控制，深色为近黑暖炭系 */

:root {
  --parchment: #f5f4ed;   /* 页面底色 */
  --ivory: #faf9f5;       /* 卡片表面 */
  --sand: #e8e6dc;        /* 次级按钮/强调底 */
  --terracotta: #c96442;  /* 品牌主色，仅用于主 CTA 与关键强调 */
  --terracotta-deep: #b05535;
  --coral: #d97757;
  --ink: #141413;         /* 主文字 */
  --charcoal: #4d4c48;
  --olive: #5e5d59;       /* 次级文字 */
  --stone: #87867f;       /* 三级文字 */
  --border: #f0eee6;
  --border-strong: #e8e6dc;
  --ring: #d1cfc5;
  --input-bg: #ffffff;
  --pick-bg: #faf1eb;     /* 多选已选底 */
  --crimson: #b53333;     /* 错误 */
  --crimson-bg: #f8ecea;
  --moss: #6f7f3f;        /* 答对/成功（暖橄榄绿） */
  --moss-bg: #f0f1e2;
  --amber-bg: #f3ead8;    /* 提醒底 */
  --amber-ink: #8a6116;
  --focus: #3898ec;       /* 唯一冷色：仅输入焦点 */
  --serif: Georgia, "Times New Roman", "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --shadow-whisper: 0 4px 24px rgba(20, 20, 19, 0.05);
  --ring-shadow: 0 0 0 1px var(--ring);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --parchment: #141413;
  --ivory: #201f1d;
  --sand: #34322d;
  --terracotta: #c96442;
  --terracotta-deep: #d97757;
  --coral: #d97757;
  --ink: #f0efe9;
  --charcoal: #d6d4cb;
  --olive: #b0aea5;
  --stone: #8a887f;
  --border: #2a2926;
  --border-strong: #3a3833;
  --ring: #4c4a43;
  --input-bg: #262523;
  --pick-bg: #372a22;
  --crimson: #d9705a;
  --crimson-bg: #362220;
  --moss: #a3b46b;
  --moss-bg: #2a2d1e;
  --amber-bg: #362d19;
  --amber-ink: #d9b36a;
  --shadow-whisper: 0 4px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

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

body {
  font-family: var(--sans);
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}

/* ---------- 深浅切换按钮（theme.js 注入） ---------- */

#theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: var(--charcoal);
  background: var(--sand);
  border: none;
  border-radius: 50%;
  box-shadow: var(--ring-shadow);
  cursor: pointer;
}

#theme-toggle:hover { background: var(--border-strong); color: var(--ink); }

/* ---------- 登录/改密的居中卡片 ---------- */

.card {
  width: 100%;
  max-width: 400px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 28px 32px;
  box-shadow: var(--shadow-whisper);
}

h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--stone);
  margin-bottom: 28px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--olive);
  margin: 18px 0 6px;
  letter-spacing: 0.02em;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: var(--sans);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(56, 152, 236, 0.15);
}

button {
  width: 100%;
  margin-top: 26px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--sans);
  color: #faf9f5;
  background: var(--terracotta);
  border: none;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--terracotta);
  cursor: pointer;
  transition: background 0.15s, transform 0.06s;
}

button:hover { background: var(--terracotta-deep); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; transform: none; }

.msg {
  margin-top: 14px;
  font-size: 14px;
  text-align: center;
  color: var(--crimson);
  min-height: 20px;
}

.msg.ok { color: var(--moss); }

.meta {
  margin-top: 18px;
  font-size: 14px;
  text-align: center;
  color: var(--stone);
}

.link {
  color: var(--coral);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.link:hover { border-bottom-color: var(--coral); }

/* ---------- 刷题页 ---------- */

body.practice {
  display: block;
  padding: 0;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.page-head { text-align: center; margin: 20px 0 28px; }

.hidden { display: none !important; }

.sync-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--amber-bg);
  color: var(--amber-ink);
  font-size: 14px;
  border-bottom: 1px solid var(--border-strong);
}

button.mini {
  width: auto;
  margin: 0;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

button.ghost {
  background: var(--sand);
  color: var(--charcoal);
  box-shadow: var(--ring-shadow);
}

button.ghost:hover { background: var(--border-strong); }

.bank-list { display: flex; flex-direction: column; gap: 12px; }

.bank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 20px 20px;
  font-size: 17px;
  font-weight: 500;
  font-family: var(--serif);
  text-align: left;
  color: var(--ink);
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-whisper);
  transition: box-shadow 0.15s, transform 0.1s;
}

.bank-item:hover {
  background: var(--ivory);
  box-shadow: var(--shadow-whisper), var(--ring-shadow);
  transform: translateY(-1px);
}

.bank-count {
  font-size: 13px;
  font-weight: 400;
  font-family: var(--sans);
  color: var(--stone);
  flex: none;
  margin-left: 12px;
}

/* ---------- 答题布局：手机单列，桌面侧栏 + 主区 ---------- */

.practice-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-bank {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-tabs { display: flex; gap: 6px; }

button.tab {
  width: auto;
  margin: 0;
  padding: 7px 15px;
  font-size: 14px;
  font-weight: 400;
  color: var(--olive);
  background: transparent;
  border-radius: 999px;
  box-shadow: none;
}

button.tab:hover { background: var(--sand); color: var(--charcoal); }

button.tab.active {
  color: var(--parchment);
  font-weight: 500;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

/* 进度：真进度条 + 统计格 */

.progress-box { min-height: 20px; }

.p-track {
  height: 6px;
  border-radius: 999px;
  background: var(--sand);
  overflow: hidden;
}

.p-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--terracotta);
  transition: width 0.35s ease;
}

.p-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--stone);
}

.p-stat { display: flex; align-items: baseline; gap: 6px; }

.p-stat b {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.p-stat .p-sub { font-size: 12px; color: var(--stone); font-weight: 400; }

.q-card {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: var(--shadow-whisper);
}

.q-meta { display: flex; gap: 8px; margin-bottom: 16px; }

.chip {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 999px;
  color: var(--charcoal);
  background: var(--sand);
  letter-spacing: 0.03em;
}

.chip.soft {
  color: var(--stone);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.stem {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.55;
  margin-bottom: 22px;
  color: var(--ink);
}

.options { display: flex; flex-direction: column; gap: 10px; }

button.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 400;
  text-align: left;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: none;
  line-height: 1.5;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

button.opt:hover { background: var(--input-bg); border-color: var(--ring); box-shadow: var(--ring-shadow); }
button.opt:disabled { opacity: 1; }
button.opt:disabled:hover { box-shadow: none; border-color: var(--border-strong); }

button.opt.judge {
  justify-content: center;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  padding: 17px;
}

.opt-letter {
  flex: none;
  width: 27px;
  height: 27px;
  line-height: 27px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--olive);
  background: var(--parchment);
  border-radius: 50%;
  transition: background 0.12s, color 0.12s;
}

button.opt.picked {
  border-color: var(--terracotta);
  background: var(--pick-bg);
  box-shadow: 0 0 0 1px var(--terracotta);
}

button.opt.picked .opt-letter { color: #fff; background: var(--terracotta); }

button.opt.right,
button.opt.right:disabled:hover {
  border-color: var(--moss);
  background: var(--moss-bg);
  box-shadow: 0 0 0 1px var(--moss);
}

button.opt.right .opt-letter { color: #fff; background: var(--moss); }

button.opt.wrong,
button.opt.wrong:disabled:hover {
  border-color: var(--crimson);
  background: var(--crimson-bg);
  box-shadow: 0 0 0 1px var(--crimson);
}

button.opt.wrong .opt-letter { color: #fff; background: var(--crimson); }

.feedback { margin-top: 20px; }

.feedback .ok { color: var(--moss); font-weight: 600; font-size: 16px; }
.feedback .bad { color: var(--crimson); font-weight: 600; font-size: 16px; }
.feedback .warn { color: var(--amber-ink); font-weight: 600; }

#fb-answer { margin-top: 6px; font-size: 14px; color: var(--olive); }

.expl {
  margin-top: 14px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--olive);
  background: var(--parchment);
  border-left: 3px solid var(--sand);
  border-radius: 10px;
}

.expl.empty { color: var(--stone); font-style: italic; border-left-color: var(--border); }

#next-btn { margin-top: 20px; }

.q-card.done { text-align: center; padding: 44px 22px 36px; }

.done-emoji { font-size: 44px; margin-bottom: 14px; line-height: 1; }

#done-text {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--ink);
}

/* ---------- 桌面端 ---------- */

@media (min-width: 720px) {
  .bank-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 900px) {
  .page {
    max-width: 1080px;
    padding: 48px 32px 72px;
  }

  #view-banks { max-width: 760px; margin: 0 auto; }

  .page-head { margin: 8px 0 36px; }
  .page-head h1 { font-size: 36px; }

  .practice-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .practice-side {
    position: sticky;
    top: 32px;
    margin-bottom: 0;
    gap: 20px;
    background: var(--ivory);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px 20px;
    box-shadow: var(--shadow-whisper);
  }

  .side-top { flex-direction: column; align-items: stretch; gap: 12px; }
  .side-top button { align-self: flex-start; }

  .side-bank {
    font-size: 19px;
    text-align: left;
    white-space: normal;
    line-height: 1.4;
  }

  .mode-tabs { flex-direction: column; gap: 4px; }

  button.tab {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 15px;
  }

  .p-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  .p-stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: var(--parchment);
    border-radius: 12px;
    padding: 12px 14px;
  }

  .p-stat b { font-size: 22px; }

  .q-card { padding: 40px 36px; border-radius: 24px; }
  .stem { font-size: 22px; line-height: 1.6; margin-bottom: 28px; }
  button.opt { padding: 16px 18px; font-size: 16px; }
  .q-card.done { padding: 72px 36px 60px; }
}
