:root {
  --desk: #d5e2e8;
  --sheet: #fffefb;
  --ink: #1a3148;
  --muted: #5c7383;
  --mark: #c5341d;
  --ok: #1d6b56;
  --ok-bg: #e5f4ef;
  --warn-bg: #fff4d6;
  --line: #d3e0e7;
  --chip: #e7f1f5;
  --highlight: #ffe56a;
  --focus: #1a3148;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  background: var(--desk);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

#app { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 22px;
}

h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.en-line {
  margin: 0 0 4px;
  font-family: Newsreader, "Iowan Old Style", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
}

.stat {
  margin: 0;
  text-align: right;
  color: var(--muted);
  font-size: 15px;
}

.stat b { color: var(--ink); font-weight: 700; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-bottom: 18px;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav a[aria-current="page"] { border-bottom-color: var(--mark); }

.grades { margin-left: auto; display: flex; gap: 14px; }

.layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 18px;
  align-items: start;
}

.topics { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }

.topics a {
  color: var(--ink);
  text-decoration: none;
  padding: 7px 0;
  border-bottom: 1px solid transparent;
  line-height: 1.4;
}

.topics a small { display: block; color: var(--muted); font-size: 13px; }

.topics a[aria-current="page"] { border-bottom-color: var(--ink); }

.sheet {
  position: relative;
  background: #fffefb;
  border: 1px solid #c5d3db;
  padding: 28px 32px 40px 52px;
  min-height: 70vh;
}

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 24px;
  width: 2px;
  background: var(--mark);
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
}

h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; line-height: 1.25; }

.prompt {
  margin: 12px 0 16px;
  padding: 0;
  background-image: linear-gradient(var(--highlight), var(--highlight));
  background-repeat: no-repeat;
  background-size: 100% 0.42em;
  background-position: 0 88%;
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.points { margin: 14px 0 8px; padding-left: 1.2em; }

.points li { margin: 2px 0; }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

.btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

.btn.solid { background: var(--ink); color: #fffefb; }

.btn.mark { border-color: var(--mark); color: var(--mark); }

.steps { list-style: none; margin: 8px 0 0; padding: 0; }

.steps li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.steps .name { color: var(--mark); }

.en, .model, textarea.writer, .order-line {
  font-family: Newsreader, "Iowan Old Style", Georgia, serif;
  font-size: 20px;
  line-height: 1.55;
}

.cn { color: var(--muted); margin: 4px 0 0; }

.model {
  white-space: pre-wrap;
  margin: 8px 0;
  background-image: repeating-linear-gradient(to bottom, transparent, transparent 31px, var(--line) 32px);
  line-height: 32px;
  padding-bottom: 4px;
}

.pair {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.tip { margin: 6px 0 0; font-size: 14px; color: var(--ok); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }

.filters button[aria-pressed="true"] { background: var(--ink); color: #fffefb; }

.search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  padding: 8px 0;
  margin: 8px 0 12px;
  border-radius: 0;
}

textarea.writer {
  width: 100%;
  min-height: 180px;
  border: none;
  resize: vertical;
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent, transparent 31px, #c5d6e0 32px);
  line-height: 32px;
  padding: 0;
  margin-top: 8px;
}

.meta { color: var(--muted); font-size: 15px; }

.result { margin-top: 12px; padding: 12px 0; border-top: 1px solid var(--line); }

.result.good { color: var(--ok); }
.result.mid { color: #8a5a00; }
.result.low { color: var(--mark); }

.blank {
  width: 9em;
  border: none;
  border-bottom: 1px solid var(--mark);
  background: transparent;
  font-family: Newsreader, Georgia, serif;
  font-size: 20px;
  padding: 0 4px;
  border-radius: 0;
}

.pool, .picked { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; margin: 10px 0; }

.chip {
  border: 1px solid var(--ink);
  background: var(--chip);
  padding: 4px 10px;
  cursor: pointer;
  font-family: Newsreader, Georgia, serif;
  font-size: 18px;
}

.chip.punct { background: transparent; }

.order-line {
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.check { list-style: none; padding: 0; margin: 8px 0 0; }

.check li { margin: 6px 0; }

.note {
  background: var(--warn-bg);
  padding: 10px 12px;
  margin: 12px 0;
}

.frame {
  white-space: pre-wrap;
  font-family: Newsreader, Georgia, serif;
  font-size: 18px;
  line-height: 1.5;
  margin: 8px 0;
}

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fffefb;
  padding: 8px 14px;
  display: none;
}

.toast.show { display: block; }

.hide { display: none; }

@media (max-width: 800px) {
  h1 { font-size: 28px; }
  .top { display: block; }
  .stat { text-align: left; margin-top: 8px; }
  .grades { margin-left: 0; width: 100%; }
  .layout { display: block; }
  .topics {
    flex-direction: row;
    overflow-x: auto;
    gap: 14px;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  .topics a { white-space: nowrap; }
  .topics a small { display: none; }
  .sheet { padding: 22px 16px 32px 28px; }
  .sheet::before { left: 12px; }
  .steps li { grid-template-columns: 1fr; gap: 2px; }
  .en, .model, textarea.writer { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

@media print {
  body { background: white; }
  .nav, .topics, .row, .toast, .stat { display: none !important; }
  .layout { display: block; }
  .sheet { border: none; }
  #app { max-width: none; }
}
