/* SILLYB —— 一张不及格的试卷
   黑板绿 / 试卷白 / 印刷黑 / 圆珠笔蓝 / 批改红 / 2B 铅笔灰 */
@font-face {
  font-family: "Caveat Brush";
  src: url("assets/caveat-brush.woff2") format("woff2");
  font-display: swap;
}

:root {
  --board: #1e4a3a;
  --chalk: #eef3ea;
  --paper: #fafaf5;
  --print: #1a1a1a;
  --ink: #1d3fa8;
  --red: #e0261b;
  --graphite: #3b3f46;
  --rule: #c9c9bd;

  --f-print: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --f-title: "PingFang SC", "Microsoft YaHei", "Heiti SC", "Noto Sans CJK SC", sans-serif;
  --f-hand: "Caveat Brush", "KaiTi", "STKaiti", "Kaiti SC", "楷体", cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--board);
  color: var(--print);
  font-family: var(--f-print);
  font-size: 17px;
  line-height: 1.8;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--ink); }
b { font-family: var(--f-title); font-weight: 700; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── 黑板（顶栏） ── */
.board {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--board);
  border-bottom: 6px solid #6b4a2b; /* 黑板木边 */
  color: var(--chalk);
}
.board a { color: inherit; text-decoration: none; }
.board :focus-visible { outline-color: var(--chalk); }
.board-brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-hand); font-size: 30px; line-height: 1; letter-spacing: 1px; }
.board-dog { width: 38px; height: 38px; color: var(--chalk); --dog-fill: transparent; --dog-patch: transparent; --dog-tongue: transparent; }
.board-nav { display: flex; gap: clamp(10px, 2.4vw, 26px); font-family: var(--f-hand); font-size: 20px; white-space: nowrap; overflow-x: auto; }
.board-nav a { padding: 4px 2px; border-bottom: 2px solid transparent; }
.board-nav a:hover { border-bottom-color: var(--chalk); }

/* ── 试卷 ── */
.sheet {
  position: relative;
  max-width: 900px;
  margin: 28px auto 48px;
  padding: 44px clamp(20px, 5vw, 64px) 32px clamp(20px, 5vw, 64px);
  padding-left: calc(clamp(20px, 5vw, 64px) + 44px);
  background: var(--paper);
  box-shadow: 0 2px 0 #d9d9cf, 6px 8px 0 rgba(0, 0, 0, 0.25);
}
.seal {
  position: absolute; left: 0; top: 0; bottom: 0; width: 44px;
  border-right: 2px dashed #8d8d82;
  display: flex; justify-content: center; padding-top: 180px;
  font-family: var(--f-title); font-size: 13px; color: #6d6d64;
}
.seal span { writing-mode: vertical-rl; letter-spacing: 6px; position: sticky; top: 120px; height: max-content; }

.sheet section { margin-top: 44px; }
.sheet h2 {
  margin: 0 0 14px;
  font-family: var(--f-title); font-size: 22px; font-weight: 700; line-height: 1.4;
}
.sheet h2 small { font-family: var(--f-print); font-size: 15px; font-weight: 400; margin-left: 6px; }

/* 卷头 */
.sheet .paper-head { margin-top: 0; }
.secret { margin: 0 0 6px; font-family: var(--f-title); font-weight: 700; font-size: 15px; }
h1 {
  margin: 0 0 26px; text-align: center;
  font-family: var(--f-title); font-weight: 800; font-size: clamp(28px, 5.2vw, 44px); line-height: 1.3; letter-spacing: 2px;
}
.h1-sub { display: block; font-family: var(--f-print); font-weight: 700; font-size: clamp(18px, 3vw, 24px); letter-spacing: 1px; margin-top: 4px; }

.candidate { display: grid; grid-template-columns: 1fr auto; gap: 12px 28px; align-items: end; }
.fields p { margin: 0 0 6px; display: flex; align-items: flex-end; gap: 10px; }
.label { font-family: var(--f-title); font-size: 16px; white-space: nowrap; padding-bottom: 6px; }
.blank {
  display: inline-block; min-width: 3em; padding: 0 12px; text-align: center;
  border-bottom: 1.5px solid var(--print); line-height: 1.25;
}
.hand { font-family: var(--f-hand); color: var(--ink); font-size: 1.35em; font-weight: 400; }
b.hand { font-family: var(--f-hand); font-weight: 400; }
.fields .blank { min-width: 180px; font-size: 34px; }
.fields .blank.big { font-size: clamp(64px, 13vw, 112px); line-height: 0.95; letter-spacing: 2px; min-width: 0; padding: 0 16px 0 8px; transform: rotate(-2deg); transform-origin: left bottom; border-bottom-width: 2px; }

.doodle { position: relative; width: 240px; padding-bottom: 4px; }
.doodle-dog { display: block; width: 150px; height: 150px; color: var(--ink); --dog-fill: var(--paper); --dog-patch: #dfe5f6; transform: rotate(4deg); }
.score { position: absolute; right: -6px; top: -26px; width: 104px; height: 104px; transform: rotate(8deg); }
.score-ring { fill: none; stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 330; stroke-dashoffset: 0; }
.score text { font-family: var(--f-hand); font-size: 72px; fill: var(--red); }
.teacher { margin: 2px 0 0; font-family: var(--f-hand); color: var(--red); font-size: 21px; line-height: 1.25; transform: rotate(-3deg); white-space: nowrap; }

.lede { margin: 26px 0 0; max-width: 36em; font-size: 18px; }
.lede + .lede { margin-top: 12px; }

/* 阅读材料：agent 答题实录 */
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.case { margin: 0; padding: 12px 14px 10px; border: 1.5px solid var(--print); background: #fff; display: flex; flex-direction: column; }
.case .ask { margin: 0 0 6px; font-family: var(--f-title); font-size: 15px; line-height: 1.5; }
.case .ans { margin: 0 0 10px; font-size: 20px; line-height: 1.35; flex: 1; }
.case .ans::before { content: "答："; font-family: var(--f-title); font-size: 15px; color: var(--print); }
.case figcaption { margin: 0; white-space: normal; display: flex; align-items: center; gap: 6px; font-size: 19px; line-height: 1.2; transform: rotate(-1.5deg); }
.case .mark { font-size: 34px; line-height: 1; }
.note { margin: 10px 0 0; font-size: 13px; color: #55554d; }

/* 考生须知 */
.notice { border: 1.5px solid var(--print); padding: 16px 22px 12px; }
.sheet .notice h2 { font-size: 18px; text-align: center; letter-spacing: 6px; margin-bottom: 6px; }
.notice ol { margin: 0; padding-left: 1.4em; }
.notice li { margin: 4px 0; }

/* ── 答题卡 ── */
.answer { border: 2px solid var(--red); padding: 20px clamp(14px, 3vw, 26px) 24px; background: #fff; }
.answer-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet .answer h2 { color: var(--red); margin: 0; letter-spacing: 4px; }
.state { margin: 0; font-family: var(--f-title); font-size: 15px; color: var(--red); }
.state.on { color: #12703f; }

.bubbles { display: grid; grid-template-columns: repeat(25, 1fr); gap: 5px 4px; margin: 16px 0 8px; }
.bubbles i { display: block; height: 14px; border: 1.5px solid var(--red); border-radius: 3px; }
.bubbles i.on { background: var(--graphite); border-color: var(--graphite); background-image: repeating-linear-gradient(115deg, transparent 0 2px, rgba(255,255,255,0.14) 2px 3px); }
.progress-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; font-family: var(--f-title); font-size: 15px; }

.qty { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 18px; font-family: var(--f-title); font-size: 16px; }
.qty .label { padding: 0; }
.stepper { display: inline-flex; border: 1.5px solid var(--print); }
.stepper button { width: 42px; height: 42px; border: 0; background: var(--paper); font-size: 22px; cursor: pointer; color: var(--print); }
.stepper button:hover { background: #ecece2; }
.stepper input {
  width: 64px; height: 42px; border: 0; border-left: 1.5px solid var(--print); border-right: 1.5px solid var(--print);
  text-align: center; font-family: var(--f-hand); font-size: 28px; color: var(--ink); background: #fff; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.scan { padding: 16px 0 14px; border-top: 1.5px solid var(--rule); }
.scan h3 { margin: 0 0 4px; font-family: var(--f-title); font-size: 17px; }
.scan p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.scan .link { margin-left: 12px; }
.dlg { width: min(420px, calc(100vw - 32px)); padding: 22px 24px 20px; border: 2px solid var(--print); border-radius: 0; background: var(--paper); color: var(--print); box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.3); }
.dlg::backdrop { background: rgba(20, 40, 32, 0.72); }
.dlg h3 { margin: 0 0 12px; font-family: var(--f-title); font-size: 20px; text-align: center; }
.qr-box { width: 220px; height: 220px; margin: 0 auto 10px; border: 1.5px solid var(--print); background: #fff; display: flex; align-items: center; justify-content: center; }
.qr-box img { width: 100%; height: 100%; display: block; }
.dlg-st { margin: 0 0 8px; text-align: center; font-family: var(--f-title); font-size: 15px; }
.dlg-pc { margin: 0 0 10px; text-align: center; font-family: var(--f-title); font-size: 15px; line-height: 1.5; }
.dlg-pc b { font-size: 34px; letter-spacing: 3px; }
.dlg-warn { color: var(--red); font-size: 13px; }
.dlg-help { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: #44443e; }
.dlg-act { margin: 0 0 10px; font-family: var(--f-title); font-size: 17px; line-height: 1.6; }
.dlg-sim { margin: 10px 0 14px; padding: 8px 10px; font-family: var(--f-title); font-size: 14px; border-left: 4px solid #12703f; background: #f1faf4; word-break: break-word; }
.dlg-sim.bad { border-left-color: var(--red); background: #fde9e7; color: var(--red); }
.dlg-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.ways { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1.5px solid var(--rule); }
.way { padding: 16px 0 0; }
.way + .way { padding-left: 24px; margin-left: 24px; border-left: 1.5px dashed var(--rule); }
.way h3 { margin: 0 0 4px; font-family: var(--f-title); font-size: 17px; }
.way p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.way pre {
  margin: 0 0 12px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--f-title); font-size: 14px; line-height: 1.6;
  background: var(--paper); border: 1.5px solid var(--rule); border-left: 4px solid var(--ink);
}
.mine { font-family: var(--f-title); }
.ref-line { margin: -8px 0 16px; padding: 6px 10px; font-family: var(--f-title); font-size: 14px; background: #fff8c9; border-left: 4px solid var(--ink); }
.ref-line.bad { background: #fde9e7; border-left-color: var(--red); }
.invite { margin-top: 18px; padding-top: 16px; border-top: 1.5px dashed var(--rule); }
.invite h3 { margin: 0 0 4px; font-family: var(--f-title); font-size: 17px; }
.invite p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.invite-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.invite-row code { flex: 1 1 260px; min-width: 0; padding: 9px 12px; background: var(--paper); border: 1.5px solid var(--rule); border-left: 4px solid var(--ink); }
.msg { min-height: 1.6em; margin: 8px 0 0 !important; font-family: var(--f-title); font-size: 14px; color: var(--red); word-break: break-word; }
.msg.good { color: #12703f; }

.btn {
  display: inline-block; padding: 10px 20px; cursor: pointer; text-decoration: none;
  font-family: var(--f-title); font-size: 16px; font-weight: 700; line-height: 1.4;
  color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 2px;
  box-shadow: 3px 3px 0 var(--ink);
}
/* 悬停和按下只改颜色和阴影，不移动按钮：按钮一动，鼠标压在边缘时会来回闪 */
.btn:hover { background: #eef1fb; }
.btn:active { box-shadow: 1px 1px 0 var(--ink); }
.btn-ink { background: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--print); }
.btn-ink:hover { background: #2a50c4; }
.btn-ink:active { box-shadow: 1px 1px 0 var(--print); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn[disabled]:hover { background: #fff; }
.btn-ink[disabled]:hover { background: var(--ink); }
.link { border: 0; background: none; padding: 0 4px; color: var(--ink); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.done-text { font-family: var(--f-title); font-size: 17px; margin: 6px 0 14px; }

/* ── 填空题 ── */
.fill { margin: 0; padding-left: 1.6em; }
.fill li { margin: 10px 0; }
.fill .blank { margin: 0 4px; }
.red { font-family: var(--f-hand); font-style: normal; color: var(--red); font-size: 20px; margin-left: 8px; white-space: nowrap; display: inline-block; transform: rotate(-2deg); }

/* ── 应用题 ── */
.question { margin: 0 0 10px; }
.solution { padding: 6px 0 2px 18px; border-left: 3px solid var(--ink); font-size: 23px; line-height: 1.5; }
.solution p { margin: 2px 0; }
.solution b { font-family: inherit; font-weight: 400; background: linear-gradient(transparent 62%, #ffe94d 62%); padding: 0 2px; }
.solution span { font-family: inherit; }

/* ── 判断题 ── */
.tf { list-style: none; margin: 0; padding: 0; counter-reset: tf; }
.tf li { counter-increment: tf; display: grid; grid-template-columns: 1fr 56px; column-gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.tf .q { margin: 0; }
.tf .q::before { content: counter(tf) ". "; }
.tf .mark { grid-row: 1 / span 2; grid-column: 2; align-self: start; text-align: center; font-family: var(--f-hand); font-size: 44px; line-height: 1; transform: rotate(-6deg); }
.tf .mark.ok { color: var(--red); }
.tf .mark.no { color: var(--red); }
.tf .a { margin: 2px 0 0; font-family: var(--f-hand); color: var(--ink); font-size: 21px; line-height: 1.4; }

/* ── 附加题 ── */
.facts { margin: 0; }
.facts > div { display: grid; grid-template-columns: 8.5em 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--rule); }
.facts dt { font-family: var(--f-title); }
.facts dd { margin: 0; min-width: 0; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 14px; word-break: break-all; }

.paper-foot { margin-top: 40px; padding-top: 14px; border-top: 1.5px solid var(--print); font-size: 14px; line-height: 1.7; color: #44443e; }
.paper-foot p { margin: 0 0 8px; }
.page-no { text-align: center; font-family: var(--f-title); color: var(--print); }

/* 唯一一处开场动画：老师画圈打 0 分 */
@media (prefers-reduced-motion: no-preference) {
  .score-ring { animation: ring 0.7s 0.5s ease-out backwards; }
  .score text { animation: pop 0.25s 1.15s ease-out backwards; }
  .teacher { animation: pop 0.3s 1.45s ease-out backwards; }
  @keyframes ring { from { stroke-dashoffset: 330; } }
  @keyframes pop { from { opacity: 0; transform: scale(1.5) rotate(-3deg); } }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .sheet { margin: 0 0 24px; padding: 28px 18px 24px; box-shadow: none; }
  .seal { display: none; }
  .board-brand span { display: none; }
  .candidate { grid-template-columns: 1fr; }
  .doodle { justify-self: end; margin-top: -8px; }
  .fields .blank { min-width: 120px; font-size: 30px; }
  .cases { grid-template-columns: 1fr; gap: 12px; }
  .ways { grid-template-columns: 1fr; }
  .way + .way { padding-left: 0; margin-left: 0; border-left: 0; border-top: 1.5px dashed var(--rule); margin-top: 16px; }
  .bubbles { gap: 4px 3px; }
  .facts > div { grid-template-columns: 1fr; gap: 0; }
  .red { white-space: normal; }
}
