:root {
  color-scheme: light;
  --ink: #302738;
  --muted: #655b6d;
  --paper: #f8f5fa;
  --white: #fff;
  --line: #e8e0eb;
  --pink: #f9e0ea;
  --pink-text: #83254f;
  --accent: #942a60;
  --accent-hover: #701d47;
  --green: #e0f2e8;
  --green-text: #185c3c;
  --amber: #fff1d7;
  --amber-text: #794c11;
  --purple: #eae1fa;
  --radius: 18px;
  font-family: "Segoe UI", system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 1rem; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a, select, input[type=radio] { cursor: pointer; }
button { touch-action: manipulation; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #a74375; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.026em; }
h1 { font-size: clamp(2.15rem, 5vw, 3.65rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.64rem); }
h3 { font-size: 1.12rem; }
small, .secondary { color: var(--muted); font-size: .92rem; }
.loading { padding: 4rem 1.5rem; text-align: center; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: var(--accent); background: var(--pink); border-radius: 13px; font-weight: 850; }
.brand-mark::before { content: "法"; }
.login-wrap { margin: auto; min-height: 100vh; max-width: 1120px; padding: 28px; display: grid; place-items: center; }
.login-grid { width: 100%; display: grid; grid-template-columns: 1fr .9fr; gap: 20px; align-items: stretch; }
.cover { background: #eadcf7; border-radius: 28px; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(26px, 5vw, 56px); min-height: 490px; overflow: hidden; position: relative; isolation: isolate; }
.cover::after { content: "习"; display: grid; place-items: center; width: 240px; height: 240px; transform: rotate(-15deg); border-radius: 50px; background: #d8c2ed; font-weight: 800; color: #644283; font-size: 6.5rem; position: absolute; right: -50px; bottom: -85px; z-index: -1; }
.cover-copy { margin: 42px 0; max-width: 390px; }
.cover-copy p { margin-top: 14px; max-width: 255px; color: #554367; }
.login-panel { padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 28px; background: var(--white); display: flex; justify-content: center; flex-direction: column; }
.login-panel h2 { font-size: 2rem; margin-bottom: 20px; }
.login-panel .setup-link { margin-top: 18px; display: inline-block; font-size: .93rem; }
.top { border-bottom: 1px solid var(--line); background: var(--white); }
.top-inner, .content { max-width: 1180px; padding-inline: clamp(16px, 4vw, 40px); margin: auto; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.content { padding-block: 32px 66px; }
.page-hero { background: #eadcf7; padding: clamp(22px, 4vw, 38px); border-radius: 24px; margin-bottom: 20px; }
.page-hero > p { color: #513b63; margin-top: 8px; }
.page-hero h1 { font-size: clamp(2rem, 5vw, 3.15rem); }
.student-hero { background: #f7e2ea; }
.student-hero > p { color: #664452; }
.nav { display: flex; gap: 8px; margin-bottom: 22px; overflow-x: auto; padding: 2px 3px 5px; }
.nav button { white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat, .panel, .task, fieldset.question { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { padding: 16px 20px; }
.stat strong { display: block; font-size: 1.74rem; line-height: 1.2; }
.panel { padding: clamp(16px, 3vw, 25px); }
.panel h2 + p { margin-top: 8px; }
.panel > .stack, .panel > .table-wrap, .panel > form { margin-top: 18px; }
.columns { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(245px,1fr); align-items: start; gap: 16px; }
.stack { display: grid; gap: 13px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { color: var(--muted); font-size: .9rem; font-weight: 650; }
td, th { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
.badge { padding: 4px 9px; display: inline-block; font-size: .87rem; font-weight: 690; border-radius: 30px; white-space: nowrap; color: #544368; background: var(--purple); }
.badge.done { color: var(--green-text); background: var(--green); }
.badge.started { color: var(--amber-text); background: var(--amber); }
.btn { min-height: 42px; border-radius: 12px; padding: 8px 15px; border: 1px solid transparent; font-weight: 680; background: var(--accent); color: white; }
.btn:hover { background: var(--accent-hover); }
.btn.alt { background: #faf6fb; color: var(--ink); border-color: var(--line); }
.btn.alt:hover, .btn.tab-active { background: var(--pink); color: var(--pink-text); border-color: #e6bdd0; }
.btn.small { font-size: .9rem; min-height: 37px; padding: 6px 11px; }
.btn:disabled { cursor: default; opacity: .57; }
label { font-weight: 650; }
.field { display: grid; gap: 5px; min-width: 0; }
.field .secondary { font-weight: 400; }
input:not([type=radio],[type=checkbox]), select, textarea { width: 100%; min-height: 43px; border: 1px solid #d8cbdc; border-radius: 10px; background: white; color: var(--ink); padding: 8px 11px; }
textarea { min-height: 92px; resize: vertical; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23655b6d' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.error { margin: 0; color: #9c1745; font-size: .95rem; }
.error:empty { display: none; }
.empty { padding: 14px 0; color: var(--muted); }
fieldset.question { min-width: 0; margin: 0; padding: 16px; display: grid; gap: 12px; }
fieldset.question legend { padding: 0 6px; font-weight: 750; }
fieldset.question .question-grid { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fcf9fd; }
.choice input { accent-color: var(--accent); width: 20px; height: 20px; flex: 0 0 20px; }
.choice:has(input:checked) { background: var(--pink); border-color: #e3b4ca; }
.answer-good { color: var(--green-text); }
.answer-review { color: #85501a; white-space: pre-wrap; overflow-wrap: anywhere; }
.passages { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.13rem; }
.progress-info { color: var(--muted); font-size: .94rem; }
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.task { display: grid; align-content: start; gap: 12px; padding: 21px; }
.task h2, td, .detail h1 { overflow-wrap: anywhere; }
.task .row-actions { margin-top: 3px; }
progress { width: 100%; accent-color: var(--accent); height: 12px; }
.detail { max-width: 780px; margin: auto; }
.detail h1 { font-size: clamp(1.85rem, 5vw, 3.25rem); }
.detail-hero { margin-top: 13px; }
.detail-hero h1 { font-size: clamp(1.85rem, 5vw, 3.25rem); }
.detail .passages { margin-top: 8px; }
dialog { width: min(94vw, 540px); max-height: 92vh; padding: 24px; border: 1px solid var(--line); border-radius: 21px; color: var(--ink); }
dialog::backdrop { background: #26163480; }
dialog form { margin-top: 15px; }
#toast:not(:empty) { position: fixed; bottom: 18px; right: 18px; z-index: 10; max-width: min(420px, 91vw); border-radius: 14px; padding: 13px 17px; background: var(--ink); color: white; }
@media (max-width: 850px) { .task-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 690px) {
  .login-wrap { padding: 15px; }
  .login-grid, .columns, .task-grid { grid-template-columns: 1fr; }
  .cover { min-height: 0; padding: 24px; }
  .cover-copy { margin: 23px 0 0; }
  .cover::after { width: 150px; height: 150px; bottom: -65px; right: -35px; font-size: 4rem; }
  .cover-copy p { margin: 6px 0 0; }
  .content { padding-block: 16px 50px; }
  .stats { gap: 7px; }
  .stat { padding: 10px; }
  .stat strong { font-size: 1.45rem; }
  .stat .secondary { font-size: .86rem; }
}
@media (max-width: 400px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
