/* ===========================================================
   甲子园100问 · 视觉：常春藤绿 / 内野红土 / 米白纸张
   =========================================================== */
:root {
  --paper: #f6f2e7;
  --paper-2: #fffdf7;
  --ink: #1b2b23;
  --ink-2: #4a5a51;
  --ink-3: #7d8a82;
  --green: #14513c;
  --green-2: #1f6b4f;
  --green-tint: #e8f0ea;
  --clay: #b04a26;
  --clay-tint: #f7e9e2;
  --gold: #b8912f;
  --line: rgba(27, 43, 35, 0.13);
  --line-2: rgba(27, 43, 35, 0.07);
  --shadow: 0 1px 2px rgba(27, 43, 35, 0.04), 0 12px 32px -12px rgba(27, 43, 35, 0.18);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.field-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 460px at 50% -10%, rgba(20, 81, 60, 0.18), transparent 68%),
    radial-gradient(900px 420px at 50% 112%, rgba(176, 74, 38, 0.13), transparent 70%),
    repeating-linear-gradient(90deg, rgba(20, 81, 60, 0.028) 0 1px, transparent 1px 34px);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(20px, calc((100vw - 760px) / 2));
  background: rgba(246, 242, 231, 0.82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-txt {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.brand-txt em {
  font-style: normal;
  color: var(--clay);
  font-size: 21px;
  padding: 0 1px;
}
.ball {
  width: 26px;
  height: 26px;
  display: block;
  flex: none;
  object-fit: contain;
}

.nav { display: flex; gap: 4px; }
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.18s, color 0.18s;
}
.nav-btn:hover { background: rgba(20, 81, 60, 0.08); color: var(--green); }
.nav-btn.on { color: var(--green); background: rgba(20, 81, 60, 0.1); font-weight: 600; }
.nav-share { color: var(--green); box-shadow: inset 0 0 0 1px rgba(20, 81, 60, 0.28); }
.nav-share:hover { background: rgba(20, 81, 60, 0.1); }

/* ---------------- 布局 ---------------- */
main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}
.view { animation: rise 0.34s cubic-bezier(0.22, 0.68, 0.36, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
[hidden] { display: none !important; }

/* ---------------- 首页 ---------------- */
.hero { padding: 12px 0 26px; }
.hero-eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--clay);
  font-weight: 600;
}
.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 9vw, 58px);
  line-height: 1.1;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.hero-title .num { color: var(--green); margin: 0 0.08em; }
.hero-sub {
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  max-width: 30em;
}
.sp { display: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.72);
  overflow: hidden;
  margin: 8px 0 26px;
}
.stat {
  padding: 18px 10px;
  text-align: center;
  border-right: 1px solid var(--line-2);
}
.stat:last-child { border-right: 0; }
.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.15;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.nick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.nick-row label {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.nick-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.nick-row input:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(31, 107, 79, 0.12);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: transform 0.14s, background 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--green);
  color: #fbf8ee;
  box-shadow: 0 8px 22px -10px rgba(20, 81, 60, 0.7);
}
.btn-primary:hover { background: var(--green-2); }
.btn-primary:disabled {
  background: rgba(27, 43, 35, 0.16);
  color: rgba(27, 43, 35, 0.42);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn-ghost:hover { color: var(--green); box-shadow: inset 0 0 0 1px rgba(20, 81, 60, 0.4); }
.btn-lg {
  width: 100%;
  padding: 16px 24px;
  font-size: 17px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}

.rules {
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px solid var(--line-2);
}
.rules h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  font-weight: 600;
}
.rules ul { margin: 0; padding: 0; list-style: none; }
.rules li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 14.5px;
  color: var(--ink-2);
}
.rules li:last-child { border-bottom: 0; }
.rules b {
  display: inline-block;
  min-width: 5.2em;
  color: var(--ink);
  font-weight: 600;
}

/* ---------------- 答题 ---------------- */
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dots { display: flex; gap: 6px; }
.dot {
  width: 26px;
  height: 5px;
  border-radius: 3px;
  background: rgba(27, 43, 35, 0.14);
  transition: background 0.25s;
}
.dot.done { background: var(--green-2); }
.dot.now { background: var(--clay); }
.quiz-meta {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.qcard {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow);
}
.qcat {
  margin: 0 0 10px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--clay);
}
.qtext {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(19px, 4.4vw, 22px);
  line-height: 1.55;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.options { display: grid; gap: 10px; }
.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
}
.opt:hover { border-color: rgba(20, 81, 60, 0.35); }
.opt:active { transform: scale(0.995); }
.opt-key {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  margin-top: 1px;
  transition: all 0.16s;
}
.opt-txt { flex: 1; font-size: 15.5px; line-height: 1.55; }
.opt.sel {
  border-color: var(--green);
  background: var(--green-tint);
  box-shadow: 0 0 0 1px var(--green) inset;
}
.opt.sel .opt-key { background: var(--green); border-color: var(--green); color: #fff; }

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.quiz-actions .btn-ghost { flex: none; }
.quiz-actions .btn-primary { flex: 1; }

/* ---------------- 结果 ---------------- */
.result-head { text-align: center; padding: 8px 0 4px; }
.score-ring {
  width: 176px;
  height: 176px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) calc(var(--p, 0) * 1%), rgba(27, 43, 35, 0.1) 0);
  position: relative;
  animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes pop { from { transform: scale(0.86); opacity: 0; } to { transform: none; opacity: 1; } }
.score-inner {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  align-content: center;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.score-num {
  font-family: var(--serif);
  font-size: 54px;
  line-height: 1;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.score-unit { font-size: 12px; color: var(--ink-3); letter-spacing: 0.2em; margin-top: 4px; }
.result-line {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.result-sub { margin: 6px 0 0; font-size: 14px; color: var(--ink-3); }

.review { margin-top: 30px; display: grid; gap: 12px; }
.rev {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green-2);
  border-radius: 12px;
  padding: 16px 18px;
}
.rev.wrong { border-left-color: var(--clay); }
.rev-top { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.rev-no {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.rev-q { font-size: 15px; font-weight: 600; line-height: 1.55; }
.rev-ans { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.rev-ans .k { color: var(--ink-3); }
.rev-ans .ok { color: var(--green-2); font-weight: 600; }
.rev-ans .no { color: var(--clay); font-weight: 600; text-decoration: line-through; }
.rev-exp {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line-2);
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.7;
}
.result-actions { display: flex; gap: 12px; margin-top: 26px; }
.result-actions .btn { flex: 1; }

/* ---------------- 榜单 ---------------- */
.section-head { margin-bottom: 18px; }
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.section-sub { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); letter-spacing: 0.06em; }

.rank-board {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
}
.rank-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.rank-row:last-child { border-bottom: 0; }
.rank-row.me { background: var(--green-tint); }
.rank-no {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.rank-row.top1 .rank-no, .rank-row.top2 .rank-no, .rank-row.top3 .rank-no {
  color: #fff;
  width: 26px;
  height: 26px;
  line-height: 26px;
  border-radius: 50%;
  margin: 0 auto;
  font-size: 14px;
}
.rank-row.top1 .rank-no { background: var(--gold); }
.rank-row.top2 .rank-no { background: #9aa5a0; }
.rank-row.top3 .rank-no { background: #b87a4e; }
.rank-name { font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row.me .rank-name { font-weight: 700; color: var(--green); }
.rank-score {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.rank-score small { font-size: 11px; color: var(--ink-3); margin-left: 3px; font-family: var(--sans); }
.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.empty b { display: block; font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }

/* ---------------- 关于 ---------------- */
.prose p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; line-height: 1.8; }
.follow {
  margin-top: 28px;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.7);
}
.qr-wrap {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.qr-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.5;
  background: repeating-linear-gradient(45deg, #faf7ee 0 6px, #f2ede0 6px 12px);
}
.follow-txt h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.follow-txt p { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.7; }

/* ---------------- 页脚 / 提示 ---------------- */
.foot {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 20px 46px;
  border-top: 1px solid var(--line-2);
  text-align: center;
}
.foot-brand {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--ink-2);
}
.foot-note { margin: 3px 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 60;
  transform: translate(-50%, 14px);
  max-width: min(88vw, 420px);
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(27, 43, 35, 0.94);
  color: #fbf8ee;
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 分享引导蒙层 */
.share-guide {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(27, 43, 35, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.share-guide[hidden] { display: none; }
.sg-tip {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 12px 16px;
  background: #fffdf7;
  color: var(--ink);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.sg-dots {
  display: inline-block;
  color: var(--green);
  font-size: 20px;
  line-height: 0;
  vertical-align: -2px;
  letter-spacing: 1px;
}
.sg-close {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  border: 0;
  background: #fffdf7;
  color: var(--green);
  font-size: 14px;
  padding: 10px 28px;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

@media (max-width: 560px) {
  main { padding: 24px 16px 52px; }
  .topbar { padding: 10px 16px; }
  .brand-txt { font-size: 17px; }
  .nav-btn { padding: 6px 9px; font-size: 13px; }
  .stat { padding: 14px 6px; }
  .stat-num { font-size: 25px; }
  .stat-label { font-size: 11px; }
  .qcard { padding: 20px 17px 18px; border-radius: 16px; }
  .score-ring { width: 152px; height: 152px; }
  .score-inner { width: 128px; height: 128px; }
  .score-num { font-size: 46px; }
  .rules b { min-width: 4.6em; }
  .sp { display: inline; }
  .follow { flex-direction: column; text-align: center; }
  .review { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
