:root {
  --bg: #faf7f0; --card: #ffffff; --ink: #16130c; --muted: #7a7263;
  --gold: #c9a227; --gold-bg: #f3c94c; --line: #e8e1d0;
  --good: #1e9e5a; --bad: #d64545; --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.brand .gold { color: var(--gold); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.lang-toggle, .nav-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink);
}
main { max-width: 560px; margin: 0 auto; padding: 16px 14px 48px; }
.view h2 { margin: 6px 0 12px; font-size: 22px; }
.hidden { display: none !important; }
.slogan { font-size: 14.5px; color: var(--muted); margin: 2px 0 12px; display: flex; align-items: center; gap: 7px; }
.slogan .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.status-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; width: 100%; text-align: left; font: inherit; color: inherit;
}
button.card { cursor: pointer; }
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.card.daily { border-color: var(--gold); background: #fffdf4; }
.big-action {
  width: 100%; border: none; border-radius: var(--radius); padding: 22px 18px; cursor: pointer;
  margin-bottom: 14px; text-align: left; font: inherit; color: #16130c;
}
.gold-bg { background: linear-gradient(135deg, var(--gold-bg), #e7b93c); }
.big-title { font-size: 21px; font-weight: 800; }
.big-sub { font-size: 13.5px; opacity: .75; margin-top: 4px; }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 11px 16px; font-size: 15px; cursor: pointer; font: inherit;
}
.btn.primary { background: #16130c; color: #fff; border-color: #16130c; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #f0caca; }
.btn.block { display: block; width: 100%; }
.btn.big { padding: 15px; font-size: 17px; margin-top: 10px; }
.btn:disabled { opacity: .5; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.mt { margin-top: 10px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  font-size: 16px; font: inherit; background: #fff; margin-bottom: 10px; color: var(--ink);
}
.row input, .row select { margin-bottom: 0; }
.code-input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; text-align: center; }
.cost-input { width: 92px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--bad); font-size: 14px; }
.chip {
  display: inline-block; background: #fdf3d7; border: 1px solid #ecd27a; color: #6d5410;
  border-radius: 999px; padding: 5px 12px; font-size: 13.5px; margin: 0 6px 6px 0; font-weight: 600;
}
.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .title { font-weight: 600; }
.list-row button { flex: none; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font: inherit; cursor: pointer; }
.tab.active { background: #16130c; color: #fff; border-color: #16130c; font-weight: 700; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.file-btn { text-align: center; margin-bottom: 12px; }
.check-row { display: flex; gap: 9px; align-items: flex-start; font-size: 14.5px; margin: 6px 0 12px; }
.check-row input { width: auto; margin: 3px 0 0; }
.field-label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.share-code-big { font-size: 34px; font-weight: 800; letter-spacing: 6px; text-align: center; padding: 8px 0 2px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; flex: none; }
details.fold { border-bottom: 1px solid #eee5cd; }
details.fold:last-child { border-bottom: none; }
details.fold > summary { cursor: pointer; font-weight: 700; padding: 10px 0; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '▸'; float: right; color: var(--gold); }
details.fold[open] > summary::after { content: '▾'; }
.progress { height: 8px; background: #eee5cd; border-radius: 99px; overflow: hidden; margin: 8px 0 16px; }
.progress > div { height: 100%; background: var(--gold); width: 0; transition: width .25s; }
.q-stem { font-size: 18.5px; font-weight: 650; line-height: 1.5; margin: 4px 0 12px; white-space: pre-wrap; }
.q-code {
  background: #16130c; color: #f5eeda; border-radius: 12px; padding: 13px; overflow-x: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55; margin-bottom: 12px; white-space: pre;
}
.opt {
  display: block; width: 100%; text-align: left; padding: 15px; margin-bottom: 10px;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: 16.5px; cursor: pointer; font: inherit;
}
.opt.correct { border-color: var(--good); background: #eafaf1; }
.opt.wrong { border-color: var(--bad); background: #fdeeee; }
.opt.dim { opacity: .55; }
.verdict { font-weight: 800; margin: 6px 0 4px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.explain { background: #fdf8ea; border: 1px solid #f0e3b2; border-radius: 12px; padding: 11px 13px; font-size: 14.5px; line-height: 1.55; }
.score-ring {
  width: 148px; height: 148px; border-radius: 50%; margin: 8px auto 14px;
  border: 10px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 800; background: #fff;
}
.coins-note { text-align: center; font-weight: 800; color: #8a6d10; margin: 0 0 12px; }
.leader-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.leader-row:last-child { border-bottom: none; }
.leader-row.me { font-weight: 800; background: #fdf8ea; }
.leader-row .rank { width: 26px; color: var(--muted); }
.leader-row .score { margin-left: auto; font-weight: 700; }
.hist-bar { height: 7px; background: var(--gold); border-radius: 99px; min-width: 4px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #16130c; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50;
}
.preview-q { border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin-bottom: 10px; background: #fff; }
.preview-q .stem { font-weight: 650; margin-bottom: 7px; white-space: pre-wrap; }
.preview-q .opt-line { font-size: 14.5px; padding: 3px 0; color: var(--muted); }
.preview-q .opt-line.right { color: var(--good); font-weight: 700; }
select.grow { width: auto; }
