/*
  落筆：白底、紅色強調、粉圓標題的學習 App 風格。
  - 紅色是唯一的強調色：主要按鈕、分數、進度條、時事題標籤。
  - 卡片是圓角白底，底下一條實色陰影，按鈕有按下去的立體感。
  - 作答區照學測答題卷：國寫是綠色方格、由右至左直式書寫；英文是紅色橫線。
  - 標題用粉圓（Huninn，台灣標準字形），內文與作答用思源黑體。
*/
:root {
  --s-25: 2px;
  --s-50: 4px;
  --s-75: 8px;
  --s-100: 12px;
  --s-200: 16px;
  --s-300: 24px;
  --s-400: 32px;
  --s-500: 40px;
  --s-600: 48px;
  --s-700: 64px;
  --s-800: 80px;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --round: 'Huninn', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;

  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f6f5f7;
  --surface-2: #f6f5f7;
  --line: #ebe8ee;
  --line-2: #dcd7e0;
  --text: #2d2a32;
  --muted: #6f6876;
  --red: #e02b38;
  --red-press: #b81d29;
  --red-ink: #c41f2b;
  --on-red: #ffffff;
  --pink: #ffe4e6;
  --pink-2: #fff4f5;
  --amber: #b86e00;
  --amber-soft: #fff1d6;
  --blue: #2f6fd0;
  --blue-soft: #e4eeff;
  --violet: #7a4bd0;
  --violet-soft: #efe7ff;
  --good: #18935a;
  --good-soft: #dff5e9;
  --backdrop: rgba(45, 42, 50, 0.45);
  /* 答題卷的印刷色 */
  --sheet: #ffffff;
  --grid-col: #7fd2a8;
  --grid-row: #c2ead5;
  --rule-red: #ffb2b2;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151a;
    --surface: #211e25;
    --soft: #2a2630;
    --surface-2: #2a2630;
    --line: #34303a;
    --line-2: #46404d;
    --text: #f2eef4;
    --muted: #aaa3b1;
    --red-ink: #ff7a84;
    --pink: #43242a;
    --pink-2: #2e1e22;
    --amber: #f0b44c;
    --amber-soft: #3a2f1b;
    --blue: #8ab4ff;
    --blue-soft: #1f2a40;
    --violet: #c0a3ff;
    --violet-soft: #2e2540;
    --good: #5fd197;
    --good-soft: #1b3528;
    --backdrop: rgba(0, 0, 0, 0.6);
    --sheet: #1c1a1f;
    --grid-col: #2f7454;
    --grid-row: #22473a;
    --rule-red: #6e3438;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-synthesis-weight: none;
}
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--round);
  font-weight: 400;
  line-height: 1.3;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--red) 50%, transparent);
}
a:hover {
  text-decoration-color: var(--red);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--red) 55%, transparent);
  outline-offset: 2px;
}
.ph {
  font-size: 1.15em;
  line-height: 1;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}

.skip {
  position: absolute;
  left: var(--s-200);
  top: var(--s-200);
  z-index: 50;
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-sm);
  background: var(--red);
  color: var(--on-red);
  transform: translateY(-200%);
}
.skip:focus {
  transform: none;
}

/* ── 頂欄 ── */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--s-50);
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--s-100) var(--s-200);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-100);
  margin-right: var(--s-200);
  font-family: var(--round);
  font-size: 22px;
  line-height: 1;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--red);
  box-shadow: 0 3px 0 var(--red-press);
  color: var(--on-red);
  font-family: var(--round);
  font-size: 18px;
}
.nav-link {
  padding: var(--s-75) var(--s-200);
  border-radius: var(--r-full);
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color 200ms var(--ease),
    color 200ms var(--ease);
}
.nav-link:hover {
  background: var(--soft);
  color: var(--text);
}
.nav-link[aria-current='page'] {
  background: var(--pink);
  color: var(--red-ink);
}
#account {
  margin-left: auto;
}
#account:empty {
  display: none;
}
.account-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
}
#account .account-btn:not(:has(.avatar)) {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 2px var(--line),
    0 2px 0 var(--line);
  color: var(--text);
  font-weight: 700;
}
.nav > .chip {
  margin-left: var(--s-75);
}
.nav-link,
.account-btn {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .nav {
    gap: var(--s-25);
    padding: var(--s-100) var(--s-100);
  }
  .brand > span:last-child,
  .nav > .chip {
    display: none;
  }
  .brand {
    margin-right: var(--s-50);
  }
  .nav-link {
    padding: var(--s-75) 10px;
  }
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--s-500) var(--s-200) var(--s-700);
  outline: none;
}
.view {
  animation: fade 160ms linear both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

/* 寬度與分隔線都對齊 main 的內容區（1120px 扣掉左右留白） */
.foot {
  width: calc(100% - 2 * var(--s-200));
  max-width: calc(1120px - 2 * var(--s-200));
  margin: 0 auto;
  padding: var(--s-300) 0 var(--s-600);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75) var(--s-200);
  margin-top: var(--s-100);
}
.foot-links a {
  color: var(--muted);
}

/* ── 共用元件 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-75);
  padding: var(--s-100) var(--s-300);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow:
    inset 0 0 0 2px var(--line),
    0 4px 0 var(--line);
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 120ms var(--ease),
    box-shadow 120ms var(--ease),
    background-color 200ms var(--ease),
    opacity 200ms var(--ease);
}
.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    inset 0 0 0 2px var(--line),
    0 1px 0 var(--line);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--red);
  box-shadow: 0 4px 0 var(--red-press);
  color: var(--on-red);
}
.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 92%, #000);
}
.btn-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--red-press);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--soft);
}
.btn-sm {
  padding: 6px var(--s-100);
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 20px;
  box-shadow:
    inset 0 0 0 2px var(--line),
    0 3px 0 var(--line);
}
.btn.danger {
  color: var(--red-ink);
}
.btn.danger:hover:not(:disabled) {
  background: var(--pink-2);
}
.card {
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line);
}
.eyebrow,
.q-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  padding: 0 var(--s-75);
  border-radius: var(--r-full);
  background: var(--soft);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 22px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
.err {
  display: flex;
  gap: var(--s-75);
  align-items: flex-start;
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  background: var(--pink);
  color: var(--red-ink);
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
}
.err .ph {
  margin-top: 3px;
  flex: none;
}

/* ── 首頁 ── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s-600);
  align-items: center;
  margin-bottom: var(--s-800);
}
.hero h1 {
  font-size: 60px;
  line-height: 1.2;
}
.hero-lead {
  max-width: 28em;
  margin-top: var(--s-300);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-100);
  margin-top: var(--s-400);
}
.hero-cta .btn {
  padding: 14px var(--s-300);
  font-size: 17px;
}
.hero-note {
  max-width: 32em;
  margin-top: var(--s-300);
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-500);
    margin-bottom: var(--s-700);
  }
}
@media (max-width: 640px) {
  .hero h1 {
    font-size: 40px;
  }
  .hero-lead {
    font-size: 16px;
  }
}

/* 批改示範卡 */
.demo {
  margin: 0;
  padding: var(--s-400);
  border: 2px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 6px 0 var(--line);
}
.demo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  color: var(--muted);
  font-size: 14px;
}
.demo-badge {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-75);
  padding: var(--s-50) var(--s-200);
  border-radius: var(--r-full);
  background: var(--red);
  box-shadow: 0 3px 0 var(--red-press);
  color: var(--on-red);
  font-family: var(--round);
  font-size: 30px;
  line-height: 1.2;
}
.demo-badge small {
  font-size: 15px;
  opacity: 0.9;
}
.demo-essay {
  margin: var(--s-300) 0 var(--s-100);
  padding: var(--s-200) var(--s-300);
  border-radius: var(--r-lg);
  background: var(--soft);
  font-size: 18px;
  line-height: 2;
}
.demo-err {
  text-decoration: underline wavy var(--red);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
}
.demo-note {
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 6px;
  background: var(--pink);
  font-size: 15px;
  line-height: 1.7;
}
.demo-note b {
  color: var(--red-ink);
}

/* 題庫 */
.bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-200);
  margin-bottom: var(--s-300);
  scroll-margin-top: 88px;
}
.bank-head h2 {
  font-size: 34px;
}
.kinds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-300);
}
@media (max-width: 800px) {
  .kinds {
    grid-template-columns: minmax(0, 1fr);
  }
}
.kind {
  display: flex;
  flex-direction: column;
  padding: var(--s-300);
}
.kind-head {
  display: flex;
  align-items: center;
  gap: var(--s-100);
}
.kind h2 {
  font-size: 24px;
}
.kind-blurb {
  margin-top: var(--s-25);
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.kind-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--pink);
  color: var(--red);
  font-size: 24px;
}
.qgroup {
  margin-top: var(--s-200);
  color: var(--red-ink);
  font-size: 13px;
  line-height: 20px;
  font-weight: 700;
}
.qgroup:empty {
  display: none;
}
.qlist {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
  margin: var(--s-75) 0 0;
  padding: 0;
  list-style: none;
}
.qitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  padding: 10px var(--s-200);
  border-radius: var(--r-md);
  background: var(--soft);
  text-decoration: none;
  transition: background-color 200ms var(--ease);
}
.qitem:hover {
  background: var(--pink-2);
}
.qitem-title {
  font-weight: 500;
}
.qitem-title .chip {
  margin-right: var(--s-75);
  background: var(--surface);
}
.qitem-title .chip.news {
  background: var(--red);
  color: var(--on-red);
}
.qitem-meta {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s-75);
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.best {
  color: var(--red-ink);
  font-weight: 700;
}
.more {
  margin-top: var(--s-300);
  color: var(--muted);
}

/* 常見問題 */
.faq {
  margin-top: var(--s-800);
}
.faq h2 {
  margin-bottom: var(--s-200);
  font-size: 30px;
}
.faq details {
  border-radius: var(--r-lg);
  background: var(--soft);
}
.faq details + details {
  margin-top: var(--s-75);
}
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: var(--s-200);
  padding: var(--s-200) var(--s-300);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '＋';
  flex: none;
  color: var(--red);
  font-weight: 700;
}
.faq details[open] summary::after {
  content: '－';
}
.faq details p {
  max-width: 40em;
  padding: 0 var(--s-300) var(--s-200);
  color: var(--muted);
}

/* ── 作答頁 ── */
.back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  margin-bottom: var(--s-300);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
}
.back:hover {
  color: var(--red-ink);
}
.write {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s-300);
  align-items: start;
}
@media (max-width: 900px) {
  .write {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* 國寫：答題卷有 38 行寬，放不進題目旁邊，改成題目在上、作答區在下 */
.write.stack {
  grid-template-columns: minmax(0, 1fr);
}
.write.stack .material {
  position: static;
  max-height: none;
  overflow: visible;
}
.write.stack .material-text {
  max-width: 44em;
}
.material {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: var(--s-400);
}
@media (max-width: 900px) {
  .material {
    position: static;
    max-height: none;
    padding: var(--s-300);
  }
}
.material h1 {
  margin: var(--s-50) 0 var(--s-200);
  font-size: 30px;
}
.material-text {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.9;
}
.material table {
  width: 100%;
  margin-top: var(--s-200);
  border-collapse: collapse;
  font-size: 14px;
  line-height: 20px;
}
.material td {
  padding: var(--s-75) var(--s-100);
  border: 1px solid var(--line-2);
}
.source {
  display: flex;
  gap: var(--s-75);
  margin-top: var(--s-200);
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.source .ph {
  margin-top: 3px;
  flex: none;
}
.answers {
  display: flex;
  flex-direction: column;
  gap: var(--s-300);
}
.part {
  padding: var(--s-300);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line);
}
.part-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  margin-bottom: var(--s-50);
}
.part-head h2 {
  font-size: 22px;
}
.part-ask {
  margin-bottom: var(--s-200);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
/* 作答區：照學測答題卷 */
.part textarea {
  display: block;
  width: 100%;
  border-radius: 4px;
  background-color: var(--sheet);
  background-attachment: local;
  transition: box-shadow 200ms var(--ease);
}
.part textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 22%, transparent);
}
.part textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}
/* 國寫答題卷：照 115 學測答題卷，綠色方格、每行 22 格、由右至左直式書寫，
   一個字一格（標點、數字、英文字母也各佔一格）。長答案 38 行，短答案的行數寫在 --cols。
   格子大小跟著作答區寬度走，讓 38 行剛好放滿（24～30px）；放不下時（手機）左右捲動。 */
.sheet-scroll {
  container-type: inline-size;
  overflow-x: auto;
  direction: rtl; /* 從右邊第 1 行開始；放不下時往左捲 */
}
.part textarea:lang(zh) {
  --rows: 22;
  --c: 30px;
  --f: 20px;
  --gap: calc((var(--c) - var(--f)) / 2);
  direction: ltr;
  width: calc(var(--cols, 38) * var(--c) + 1px);
  /* 每行最後一個字後面的字距也算進行長，所以底下多留半格；格線只畫到第 22 格，不會出現被截斷的格子 */
  height: calc(var(--rows) * var(--c) + var(--gap));
  padding: var(--gap) 0 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image:
    linear-gradient(var(--grid-col), var(--grid-col)),
    linear-gradient(var(--grid-col), var(--grid-col)),
    linear-gradient(to left, var(--grid-col) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-row) 1px, transparent 1px),
    linear-gradient(var(--sheet), var(--sheet));
  background-size:
    100% 1px,
    100% 1px,
    var(--c) calc(var(--rows) * var(--c)),
    var(--c) var(--c),
    100% calc(var(--rows) * var(--c) + 1px);
  background-position:
    0 0,
    0 calc(var(--rows) * var(--c)),
    right 0 top 0,
    right 0 top 0,
    0 0;
  background-repeat: repeat-x, repeat-x, repeat-x, repeat, repeat-x;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font: 400 var(--f) / var(--c) var(--sans);
  letter-spacing: calc(var(--c) - var(--f));
  resize: none;
}
@supports (width: round(down, 10px, 1px)) {
  .part textarea:lang(zh) {
    /* 用 cqw 不用 cqi：作答區是直書，cqi 會變成量高度 */
    --c: clamp(24px, round(down, (100cqw - 1px) / 38, 1px), 30px);
    --f: round(down, var(--c) * 0.68, 1px);
  }
}
/* 英文答題卷：紅色橫線。高度一定是整數行（--lines 由 app.js 依內容調整，寫滿會自動多一行），
   不留底部空白、不在框裡捲動、不能拖拉大小，所以最後一行的橫線不會被截斷 */
.part textarea:lang(en) {
  --lh: 40px;
  --lines: 4;
  height: calc(var(--lh) * var(--lines) + 2px);
  padding: 0 var(--s-200);
  border: 1px solid var(--rule-red);
  background-image: linear-gradient(transparent calc(var(--lh) - 1px), var(--rule-red) calc(var(--lh) - 1px));
  background-size: 100% var(--lh);
  font-size: 18px;
  line-height: var(--lh);
  overflow-y: hidden;
  resize: none;
}
.part textarea.tall:lang(en) {
  --lines: 10;
}
.part-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-100);
  margin-top: var(--s-200);
}
.count {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.count.over {
  color: var(--red-ink);
  font-weight: 700;
}
.ocr-note {
  margin-top: var(--s-100);
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  background: var(--blue-soft);
  font-size: 14px;
  line-height: 22px;
}
.ocr-skel {
  height: 300px;
}
.submit-bar {
  display: flex;
  flex-direction: column;
  gap: var(--s-200);
  padding: var(--s-300);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line);
}
.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-75);
}
.mode {
  display: flex;
  gap: var(--s-100);
  align-items: flex-start;
  padding: var(--s-100) var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition:
    border-color 200ms var(--ease),
    background-color 200ms var(--ease);
}
.mode:hover {
  background: var(--soft);
}
.mode:has(input:checked) {
  border-color: var(--red);
  background: var(--pink-2);
}
.mode input {
  margin-top: 5px;
  accent-color: var(--red);
}
.mode b {
  display: block;
  font-weight: 700;
}
.mode span {
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
@media (max-width: 420px) {
  .modes {
    grid-template-columns: minmax(0, 1fr);
  }
}
.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-200);
}
.submit-row .btn-primary {
  padding: 14px var(--s-300);
  font-size: 17px;
}
.ai-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

/* ── 載入中 ── */
.skel {
  border-radius: var(--r-md);
  background: var(--soft);
  animation: pulse 1.4s ease-in-out infinite;
}
.grading {
  display: flex;
  flex-direction: column;
  gap: var(--s-300);
}
.grading-status {
  display: flex;
  align-items: center;
  gap: var(--s-100);
  font-weight: 700;
}
.pulse {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--red);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* ── 批改結果 ── */
.result {
  display: flex;
  flex-direction: column;
  gap: var(--s-300);
}
.score-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-400);
  align-items: center;
  padding: var(--s-400);
  border: 2px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 6px 0 var(--line);
}
@media (max-width: 640px) {
  .score-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-200);
    padding: var(--s-300);
  }
}
/* 分數徽章：載入時彈出一次（全站唯一的自動動畫） */
.score-badge {
  display: grid;
  place-items: center;
  align-content: center;
  width: 140px;
  height: 140px;
  border-radius: var(--r-full);
  background: var(--red);
  box-shadow: 0 6px 0 var(--red-press);
  color: var(--on-red);
  animation: pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 80ms both;
}
.score-badge b {
  font-family: var(--round);
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
}
.score-badge span {
  margin-top: var(--s-50);
  font-size: 13px;
  line-height: 18px;
  opacity: 0.9;
}
@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
.score-side h1 {
  margin: var(--s-25) 0 var(--s-100);
  font-size: 36px;
}
.score-side .summary {
  max-width: 36em;
  font-size: 17px;
  line-height: 1.8;
}
.score-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75);
  margin-top: var(--s-200);
}
.ai-tag {
  background: var(--pink);
  color: var(--red-ink);
}
.level {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  padding: 0 var(--s-75);
  border-radius: var(--r-full);
  background: var(--pink);
  color: var(--red-ink);
  font-family: var(--round);
  font-size: 15px;
  line-height: 24px;
}
.delta {
  font-weight: 700;
}
.delta.up {
  background: var(--good-soft);
  color: var(--good);
}
.delta.down {
  background: var(--pink);
  color: var(--red-ink);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-300);
}
@media (max-width: 800px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
.panel {
  padding: var(--s-300);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--line);
}
.panel > h2 {
  display: flex;
  align-items: center;
  gap: var(--s-75);
  margin-bottom: var(--s-200);
  font-size: 22px;
}
.panel > ul + h2 {
  margin-top: var(--s-400);
}
.rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-300);
}
.rows .rows {
  gap: var(--s-200);
  padding: var(--s-200);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  margin-bottom: var(--s-75);
}
.row-head b {
  font-weight: 700;
}
.meter {
  height: 10px;
  border-radius: var(--r-full);
  background: var(--soft);
  overflow: hidden;
}
.rows .rows .meter {
  background: var(--surface);
}
.meter i {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--red);
}
.row p {
  margin-top: var(--s-75);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.aspects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-100);
}
@media (max-width: 640px) {
  .aspects {
    grid-template-columns: minmax(0, 1fr);
  }
}
.aspect {
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.aspect-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
.aspect p {
  margin-top: var(--s-50);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.rating-佳 {
  color: var(--good);
}
.rating-可 {
  color: var(--amber);
}
.rating-弱 {
  color: var(--red-ink);
}
.bullets {
  display: flex;
  flex-direction: column;
  gap: var(--s-100);
  margin: 0;
  padding: 0;
  list-style: none;
}
.bullets li {
  display: flex;
  gap: var(--s-75);
}
.bullets .ph {
  margin-top: 4px;
  flex: none;
}
.good-ic {
  color: var(--good);
}
.todo-ic {
  color: var(--red);
}
.notice {
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  background: var(--amber-soft);
  font-size: 14px;
  line-height: 22px;
}
.result > .notice + .notice {
  margin-top: calc(var(--s-300) * -1 + var(--s-75));
}

/* 逐句批改 */
.marked {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--s-300);
  align-items: start;
}
@media (max-width: 900px) {
  .marked {
    grid-template-columns: minmax(0, 1fr);
  }
}
.essay {
  padding: var(--s-200) var(--s-300);
  border-radius: var(--r-lg);
  background: var(--soft);
  white-space: pre-wrap;
  font-size: 18px;
  line-height: 2.1;
}
.essay + .essay {
  margin-top: var(--s-200);
}
.essay-label {
  display: block;
  margin-bottom: var(--s-50);
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  white-space: normal;
}
.mk {
  border-radius: 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  text-decoration: underline 2px var(--mk, var(--red));
  text-decoration-skip-ink: none;
  text-underline-offset: 6px;
  cursor: pointer;
  transition: background-color 200ms var(--ease);
}
.mk.t-red {
  text-decoration-style: wavy;
  text-decoration-thickness: 1.5px;
}
.mk:hover,
.mk.on {
  background-color: var(--mk-soft, var(--pink));
}
.mk.on {
  box-shadow: 0 0 0 2px var(--mk-soft, var(--pink));
}
/* 寫得好的地方：中文用傳統的圈點（畫成背景，不撐開行高），英文用雙底線 */
.mk.t-green {
  text-decoration-style: double;
}
.essay:lang(zh) .mk.t-green {
  text-decoration: none;
}
.essay:lang(zh) .mk.t-green .mk-t {
  padding-top: 0.45em;
  background-image: radial-gradient(circle, transparent 0.1em, var(--good) 0.11em, var(--good) 0.18em, transparent 0.19em);
  background-size: 1em 0.45em;
  background-repeat: repeat-x;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.mk sup {
  margin-left: 1px;
  color: var(--mk, var(--red));
  font-size: 11px;
  font-weight: 700;
  line-height: 0;
}
.notes {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
  margin: 0;
  padding: 0;
  list-style: none;
}
/* 亮點在最上面一組，要修改的在下面一組 */
.notes-h {
  margin: 0 0 var(--s-75);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.notes-h.good {
  color: var(--good);
}
.notes + .notes-h {
  margin-top: var(--s-300);
}
.chip-good {
  background: var(--good-soft);
  color: var(--good);
}
.note {
  padding: var(--s-100) var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition:
    border-color 200ms var(--ease),
    background-color 200ms var(--ease);
}
.note:hover {
  background: var(--soft);
}
.note.on {
  border-color: var(--mk, var(--red));
  background: var(--mk-soft, var(--pink));
}
.note-head {
  display: flex;
  align-items: center;
  gap: var(--s-75);
  margin-bottom: var(--s-50);
}
.note-n {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 var(--s-50);
  border-radius: var(--r-full);
  background: var(--mk, var(--red));
  color: var(--surface);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}
.note-type {
  color: var(--mk, var(--red));
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}
.note-deduct {
  margin-left: auto;
  color: var(--red-ink);
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}
.note-fix {
  font-size: 16px;
  line-height: 26px;
}
.note-fix s {
  color: var(--muted);
}
.note-fix b {
  color: var(--red-ink);
  font-weight: 700;
}
.note p {
  margin-top: var(--s-50);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.t-red {
  --mk: var(--red);
  --mk-soft: var(--pink);
}
.t-amber {
  --mk: var(--amber);
  --mk-soft: var(--amber-soft);
}
.t-blue {
  --mk: var(--blue);
  --mk-soft: var(--blue-soft);
}
.t-violet {
  --mk: var(--violet);
  --mk-soft: var(--violet-soft);
}
.t-green {
  --mk: var(--good);
  --mk-soft: var(--good-soft);
}

.sample {
  max-width: 40em;
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 2;
}
.sample + .sample {
  margin-top: var(--s-200);
  padding-top: var(--s-200);
  border-top: 2px dashed var(--line);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-100);
}
.meta-line {
  margin-top: calc(var(--s-300) * -1 + var(--s-75));
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

/* ── 紀錄 ── */
.page-head {
  max-width: 680px;
  margin-bottom: var(--s-400);
}
.page-head h1 {
  font-size: 40px;
}
.page-head p {
  margin-top: var(--s-75);
  color: var(--muted);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-200);
  margin-bottom: var(--s-300);
}
@media (max-width: 800px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat {
  padding: var(--s-200) var(--s-300);
}
.stat-name {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
.stat-val {
  margin-top: var(--s-50);
  font-family: var(--round);
  font-size: 36px;
  line-height: 1.1;
}
.stat-val small {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
}
.spark {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: var(--s-75);
}
.spark polyline {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spark circle {
  fill: var(--red);
}
.tagbars {
  display: flex;
  flex-direction: column;
  gap: var(--s-100);
}
.tagbar {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 32px;
  gap: var(--s-100);
  align-items: center;
  font-size: 14px;
  line-height: 20px;
}
.subs {
  display: flex;
  flex-direction: column;
  gap: var(--s-50);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-100);
  align-items: center;
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background-color 200ms var(--ease);
}
.sub:hover {
  background: var(--soft);
}
.sub-title {
  font-weight: 500;
}
.sub-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.sub-score {
  display: flex;
  align-items: center;
  gap: var(--s-75);
  font-family: var(--round);
  font-size: 24px;
  line-height: 1.2;
}
.sub-score small {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-200);
  padding: var(--s-700) var(--s-300);
  text-align: center;
}
.empty h2 {
  font-size: 26px;
}
.empty p {
  max-width: 420px;
  color: var(--muted);
}

/* ── 自訂題目：置中的窄欄 ── */
.narrow {
  max-width: 760px;
  margin-inline: auto;
}
.narrow > .page-head {
  max-width: none;
}
.form {
  display: flex;
  flex-direction: column;
  gap: var(--s-300);
}
.card.form {
  padding: var(--s-400);
}
@media (max-width: 640px) {
  .card.form {
    padding: var(--s-300) var(--s-200);
  }
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
}
.field > span {
  font-weight: 700;
}
.field small {
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.field input,
.field textarea,
.field select {
  padding: var(--s-100) var(--s-200);
  border: 2px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  line-height: 1.6;
  transition:
    border-color 200ms var(--ease),
    box-shadow 200ms var(--ease);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent);
}
.field textarea {
  min-height: 120px;
  resize: vertical;
}
.field .bad {
  color: var(--red-ink);
  font-weight: 500;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75);
}
.seg label {
  padding: var(--s-75) var(--s-200);
  border-radius: var(--r-full);
  background: var(--soft);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 200ms var(--ease),
    color 200ms var(--ease);
}
.seg label:hover {
  background: var(--pink-2);
}
.seg label:has(input:checked) {
  background: var(--red);
  color: var(--on-red);
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg label:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--red) 55%, transparent);
  outline-offset: 2px;
}

/* ── 對話框 ── */
.dialog {
  width: min(520px, calc(100vw - 32px));
  padding: var(--s-400);
  border-radius: 28px;
  color: var(--text);
}
.dialog::backdrop {
  background: var(--backdrop);
}
.dialog h2 {
  margin-bottom: var(--s-200);
  font-size: 26px;
}
.dialog .bullets {
  margin-bottom: var(--s-200);
  font-size: 14px;
  line-height: 22px;
}
.check {
  display: flex;
  gap: var(--s-100);
  align-items: flex-start;
  margin-bottom: var(--s-100);
  padding: var(--s-100) var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
}
.check:has(input:checked) {
  border-color: var(--red);
  background: var(--pink-2);
}
.check input {
  margin-top: 4px;
  accent-color: var(--red);
}
.dialog .actions {
  margin-top: var(--s-200);
}

/* ── 需要關心時的提醒 ── */
.care {
  padding: var(--s-300);
  border-color: var(--good);
  background: var(--good-soft);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--good) 35%, transparent);
}
.care h2 {
  display: flex;
  align-items: center;
  gap: var(--s-75);
  margin-bottom: var(--s-100);
  font-size: 22px;
  color: var(--good);
}
.care-lines {
  margin-top: var(--s-100);
  font-weight: 700;
}

/* ── 說明頁（隱私權政策、服務條款、安全使用） ── */
.doc {
  max-width: 720px;
  margin: 0 auto;
}
.doc header {
  padding-bottom: var(--s-300);
  border-bottom: 2px solid var(--line);
}
.doc h1 {
  font-size: 40px;
}
.doc .sub {
  margin-top: var(--s-75);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.doc h2 {
  margin: var(--s-500) 0 var(--s-75);
  font-size: 26px;
}
.doc p,
.doc li {
  margin-top: var(--s-100);
  line-height: 1.85;
}
.doc ul {
  margin: 0;
  padding-left: var(--s-300);
}
.doc li::marker {
  color: var(--red);
}

/* 帳號 */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  background: var(--pink);
  color: var(--red-ink);
  font-family: var(--round);
  font-size: 15px;
  line-height: 1;
}
.account-btn:has(.avatar) {
  padding: var(--s-25);
}

@media (prefers-reduced-motion: reduce) {
  .view,
  .score-badge,
  .skel,
  .pulse {
    animation: none;
  }
  * {
    transition-duration: 0ms !important;
  }
}

/* ── 精批方案 ── */
.buy > h2 {
  margin-bottom: var(--s-100);
}
.buy-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-100);
  margin-bottom: var(--s-200);
}
.buy-price .num {
  font-family: var(--round);
  font-size: 40px;
  line-height: 48px;
  color: var(--red-ink);
}
.buy .bullets {
  margin-bottom: var(--s-200);
}
.buy-fine {
  margin-bottom: var(--s-200);
  font-size: 14px;
  line-height: 22px;
}
.buy .check a,
.notice a,
#careful-note a,
.count a {
  color: var(--red-ink);
}
.notice.good {
  background: var(--good-soft);
}
#order-state:not(:empty) {
  margin-bottom: var(--s-300);
}
.orders {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
  margin-top: var(--s-100);
  padding: 0;
  list-style: none;
}
.orders li {
  display: grid;
  grid-template-columns: 7.5em 6em minmax(0, 1fr) auto;
  gap: var(--s-100);
  align-items: center;
  padding: var(--s-75) 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 20px;
}
@media (max-width: 480px) {
  .orders li {
    grid-template-columns: 1fr auto;
  }
  .orders li > .muted {
    display: none;
  }
}

.cost-table {
  width: 100%;
  margin-bottom: var(--s-100);
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}
.cost-table th,
.cost-table td {
  padding: var(--s-75) var(--s-100);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.cost-table thead th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.cost-table tbody th {
  font-weight: 500;
}
.cost-table td {
  text-align: right;
  white-space: nowrap;
}
.cost-table thead th:not(:first-child) {
  text-align: right;
}

/* ── 作答：拍照為主 ── */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.shoot {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-200);
  padding: var(--s-300);
  border: 2px dashed var(--red);
  border-radius: var(--r-lg);
  background: var(--pink-2);
  cursor: pointer;
  transition: background-color 200ms var(--ease);
}
.shoot:hover {
  background: var(--pink);
}
.shoot:focus-within {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}
.shoot > .ph {
  flex: none;
  font-size: 36px;
  color: var(--red-ink);
}
.shoot-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shoot-title {
  font-family: var(--round);
  font-size: 20px;
  line-height: 28px;
  color: var(--red-ink);
}
.shoot-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.shoot-quota {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}
.shoot-quota:empty {
  display: none;
}
.shoot.busy,
.shoot.off {
  opacity: 0.55;
  pointer-events: none;
}
.part.typing .shoot {
  padding: var(--s-100) var(--s-200);
  border-style: solid;
  background: var(--surface);
}
.part.typing .shoot > .ph {
  font-size: 22px;
}
.part.typing .shoot-title {
  font-size: 16px;
  line-height: 22px;
}
.part.typing .shoot-sub {
  display: none;
}
.type-alt {
  margin-top: var(--s-100);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--red-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.part:not(.typing) .type-area {
  display: none;
}
.part.typing .type-alt {
  display: none;
}
.type-area,
.part .ocr-skel {
  margin-top: var(--s-200);
}
@media (max-width: 480px) {
  .shoot {
    padding: var(--s-200);
  }
}

/* ── 老師代學生批改 ── */
.who {
  max-width: 320px;
}
.who-hint {
  font-size: 14px;
  line-height: 20px;
}
.who-hint a,
.page-head p a {
  color: var(--red-ink);
}
.page-head p a {
  margin-left: var(--s-100);
}
.who-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75);
  margin-bottom: var(--s-300);
}
.who-chip {
  padding: var(--s-25) var(--s-100);
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
}
.who-chip.on {
  background: var(--pink);
  color: var(--red-ink);
}
.stu-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  padding: var(--s-100) 0;
  border-top: 1px solid var(--line);
}
.stu:first-child {
  border-top: 0;
}
.stu-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stu-name .muted {
  font-size: 13px;
  line-height: 18px;
}
.stu-edit {
  padding: var(--s-50) var(--s-100);
  border: 2px solid var(--red);
  border-radius: var(--r-sm);
  font: inherit;
}
.share-box {
  margin-top: var(--s-200);
  padding: var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 22px;
}
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75);
  margin: var(--s-100) 0;
}
.share-row input {
  flex: 1 1 240px;
  min-width: 0;
  padding: var(--s-50) var(--s-100);
  border: 2px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--text);
  font: inherit;
}
.share-msg:empty {
  display: none;
}

/* ── 首頁題庫分頁 ── */
.bank-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s-50);
  padding: var(--s-50);
  border-radius: var(--r-full);
  background: var(--soft);
}
.bank-tabs button {
  padding: var(--s-75) var(--s-300);
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--muted);
  font: 700 15px/20px var(--sans);
  cursor: pointer;
  transition:
    background-color 200ms var(--ease),
    color 200ms var(--ease);
}
.bank-tabs button:hover {
  color: var(--text);
}
.bank-tabs button[aria-selected='true'] {
  background: var(--surface);
  box-shadow: 0 2px 0 var(--line-2);
  color: var(--red-ink);
}
.bank-tabs button:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}
.bank-note {
  margin: var(--s-100) 0 var(--s-300);
  font-size: 14px;
  line-height: 22px;
}
.kind-empty {
  margin-top: var(--s-200);
  font-size: 14px;
  line-height: 22px;
}
/* 自編練習題：卡片排版 */
.own-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--s-400);
}
.own-kind-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-50) var(--s-200);
  margin-bottom: var(--s-200);
}
.own-kind-head h3 {
  font-size: 22px;
}
.own-kind-head .muted {
  font-size: 13px;
  line-height: 20px;
}
.own-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-200);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 900px) {
  .own-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .own-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.own-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
  height: 100%;
  padding: var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 3px 0 var(--line);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 200ms var(--ease),
    transform 200ms var(--ease);
}
.own-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
}
.own-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-75);
  font-family: var(--round);
  font-size: 18px;
  line-height: 26px;
}
.own-text {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.own-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.own-add {
  display: flex;
  align-items: center;
  gap: var(--s-200);
  padding: var(--s-300);
  border-style: dashed;
  color: inherit;
  text-decoration: none;
}
.own-add > .ph {
  font-size: 32px;
  color: var(--red-ink);
}
.own-add > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.own-add .muted {
  font-size: 14px;
  line-height: 22px;
}
@media (prefers-reduced-motion: reduce) {
  .own-card:hover {
    transform: none;
  }
}

/* ── 評分標準、題庫、題目頁（scripts/seo.mjs 產生） ── */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-50) var(--s-75);
  margin-bottom: var(--s-300);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.crumbs a {
  color: var(--muted);
}
.doc .lead {
  margin-top: var(--s-300);
  font-size: 18px;
  line-height: 1.85;
}
.doc h3 {
  margin: var(--s-300) 0 0;
  font-size: 20px;
  line-height: 28px;
}
.doc ol {
  margin: 0;
  padding-left: var(--s-300);
}
.doc ol li::marker {
  color: var(--red-ink);
  font-weight: 700;
}
.table-wrap {
  margin-top: var(--s-200);
  overflow-x: auto;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
}
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.7;
}
.doc caption {
  padding: var(--s-100) var(--s-200);
  background: var(--soft);
  font-weight: 700;
  text-align: left;
}
.doc th,
.doc td {
  padding: var(--s-100) var(--s-200);
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.doc thead th {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.doc tbody th {
  color: var(--red-ink);
  font-family: var(--round);
  font-weight: 400;
  white-space: nowrap;
}
.doc td.num {
  white-space: nowrap;
}
.doc-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-100) var(--s-200);
  margin-top: var(--s-300);
}
.doc-start .muted {
  font-size: 14px;
  line-height: 20px;
}
.doc .material {
  margin-top: var(--s-100);
  padding: var(--s-75) var(--s-300) var(--s-200);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.doc .ask {
  padding-left: var(--s-200);
  border-left: 4px solid var(--pink);
}
.doc .asks strong {
  margin-right: var(--s-75);
}
.doc .refs li {
  font-size: 15px;
  line-height: 1.75;
}
.doc .doc-note,
.doc .doc-source {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}
.doc .doc-source {
  margin-top: var(--s-500);
  padding-top: var(--s-200);
  border-top: 1px solid var(--line);
}
.doc .q-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--s-400);
}
@media (max-width: 560px) {
  .doc .q-links {
    grid-template-columns: minmax(0, 1fr);
  }
}
.doc-cta {
  margin-top: var(--s-500);
  padding: var(--s-300);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--pink-2);
}
.doc .doc-cta h2 {
  margin-top: 0;
}
.doc-cta .btn {
  margin-top: var(--s-200);
}
/* 首頁給爬蟲看的摘要：有 JavaScript 時藏起來（app.js 會換成互動畫面） */
.js .prerender {
  display: none;
}
.prerender h1 {
  font-size: 32px;
}
.kind-guide {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.kind-guide:hover {
  color: var(--red-ink);
}
.guide-link {
  margin-top: var(--s-200);
  font-size: 14px;
  line-height: 20px;
}
.guide-link a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  color: var(--muted);
}
.foot-guide {
  margin-top: var(--s-200);
}
.doc .guide-list {
  list-style: none;
  padding-left: 0;
}
.doc .guide-list li {
  margin-top: var(--s-200);
  color: var(--muted);
  font-size: 15px;
}
.doc .guide-list strong {
  font-size: 17px;
}
/* 說明頁副標題沿用 .sub 這個名字，蓋掉練習紀錄列表 .sub 的留白與滑過效果 */
.doc .sub {
  display: block;
  padding: 0;
  border-radius: 0;
}
.doc .sub:hover {
  background: none;
}
@media (max-width: 560px) {
  .doc h1 {
    font-size: 30px;
  }
  .doc .lead {
    font-size: 17px;
  }
}
@media (max-width: 560px) {
  .doc table {
    font-size: 14px;
  }
  .doc th,
  .doc td {
    padding: var(--s-75) var(--s-100);
  }
}

/* ── 作答頁：寫作流程步驟卡（審題、規劃、寫作、檢查） ── */
.flow {
  overflow: hidden;
}
.flow > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-25) var(--s-100);
  padding: var(--s-200) var(--s-300);
  cursor: pointer;
  list-style: none;
}
.flow > summary::-webkit-details-marker {
  display: none;
}
.flow-title {
  font-family: var(--round);
  font-size: 20px;
  line-height: 28px;
}
.flow-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.flow > summary .ph {
  margin-left: auto;
  align-self: center;
  color: var(--muted);
  transition: transform 200ms var(--ease);
}
.flow[open] > summary .ph {
  transform: rotate(180deg);
}
.flow-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-200);
  margin: 0;
  padding: 0 var(--s-300) var(--s-300);
  list-style: none;
  counter-reset: step;
}
.flow-steps > li {
  position: relative;
  padding-left: 44px;
  counter-increment: step;
}
.flow-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  background: var(--pink);
  color: var(--red-ink);
  font-family: var(--round);
  font-size: 16px;
}
.flow-steps b {
  font-size: 16px;
  line-height: 30px;
}
.flow-steps p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.plan-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--s-100);
  margin-top: var(--s-100);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.plan-label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.plan {
  display: block;
  width: 100%;
  margin-top: var(--s-75);
  padding: var(--s-100) var(--s-200);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: 15px/1.7 var(--sans);
  resize: vertical;
}
.plan:focus {
  outline: none;
  border-color: var(--red);
}
.flow-checks {
  display: flex;
  flex-direction: column;
  gap: var(--s-50);
  margin: var(--s-75) 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 22px;
}
.flow-checks li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-75);
  color: var(--muted);
}
.flow-checks li .ph {
  flex: none;
  margin-top: 3px;
}
.flow-checks li.ok {
  color: var(--good);
}
@media (prefers-reduced-motion: reduce) {
  .flow > summary .ph {
    transition: none;
  }
}
/* 結果頁：大綱與結構 */
.plan-panel h2 .ph {
  color: var(--red-ink);
}
.plan-panel > p {
  margin-top: var(--s-100);
  line-height: 1.8;
}
.plan-panel details {
  margin-top: var(--s-100);
}
.plan-panel summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}
.plan-text {
  margin-top: var(--s-75);
  padding: var(--s-100) var(--s-200);
  border-radius: var(--r-md);
  background: var(--soft);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
}
.doc pre.outline {
  margin-top: var(--s-100);
  padding: var(--s-200) var(--s-300);
  border-left: 4px solid var(--pink);
  border-radius: var(--r-md);
  background: var(--soft);
  font: 15px/1.9 var(--sans);
  white-space: pre-wrap;
}
/* 作答頁：送出前檢查、大綱按鈕 */
.send-checks {
  padding: var(--s-200);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.send-checks-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.plan-open {
  margin-top: var(--s-100);
}
/* 首頁：寫作指南 */
.guide-home {
  margin-top: var(--s-800);
}
.more-link {
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
}
.guide-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-200);
}
@media (max-width: 900px) {
  .guide-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-75);
  padding: var(--s-300);
  color: inherit;
  text-decoration: none;
  transition: border-color 200ms var(--ease);
}
.guide-card:hover {
  border-color: var(--red);
}
.guide-card > .ph {
  color: var(--red-ink);
  font-size: 28px;
}
.guide-card b {
  font-family: var(--round);
  font-size: 20px;
  line-height: 28px;
  font-weight: 400;
}
.guide-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.guide-rubrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-75);
  margin-top: var(--s-200);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.guide-rubrics > span {
  margin-right: var(--s-50);
}
.guide-rubrics .chip:hover {
  color: var(--red-ink);
}
@media (max-width: 560px) {
  .guide-card {
    padding: var(--s-200);
  }
}
/* 收起時箭頭固定在右邊，不跟文字一起換行 */
.flow > summary {
  position: relative;
  padding-right: 56px;
}
.flow > summary .ph {
  position: absolute;
  right: var(--s-300);
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
}
.flow[open] > summary .ph {
  transform: translateY(-50%) rotate(180deg);
}
/* 首頁常見問題下方：LINE 客服 */
.faq-more {
  display: flex;
  align-items: flex-start;
  gap: var(--s-75);
  margin-top: var(--s-200);
  color: var(--muted);
  font-size: 15px;
  line-height: 24px;
}
.faq-more .ph {
  flex: none;
  margin-top: 3px;
  color: #06c755;
}
