:root {
  --ink: #183153;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --cyan: #0ea5a4;
  --cream: #fffaf0;
  --line: #dbe5f2;
  --danger: #c2410c;
  --success: #047857;
  --shadow: 0 14px 36px rgba(24,49,83,.12);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #edf7ff; }
body {
  margin: 0; color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 5%, rgba(14,165,164,.14), transparent 26rem),
    radial-gradient(circle at 96% 1%, rgba(37,99,235,.14), transparent 28rem),
    linear-gradient(180deg, #f8fcff 0, #edf7ff 48%, #f9fbfd 100%);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { max-width: 1100px; margin: 0 auto; padding: 24px 18px 64px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: white; border-radius: 14px; background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 8px 20px rgba(37,99,235,.24); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card { background: rgba(255,255,255,.94); border: 1px solid rgba(219,229,242,.94); border-radius: 22px; box-shadow: var(--shadow); }
.login-wrap { max-width: 520px; margin: 7vh auto; }
.login-hero { padding: 34px 36px 12px; }
.login-hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.18; margin: 24px 0 12px; }
.login-hero p { color: var(--muted); line-height: 1.8; margin: 0; }
.login-form { padding: 24px 36px 36px; }
label.field { display: block; font-weight: 700; margin: 0 0 18px; }
.field span { display: block; margin-bottom: 8px; }
input[type="text"], input[type="password"], input[type="file"] { width: 100%; border: 1px solid #bfcfe2; border-radius: 13px; padding: 13px 14px; color: var(--ink); background: white; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 800; color: white; background: var(--blue); transition: .16s transform, .16s background; }
.btn:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.secondary { color: var(--ink); background: #e8f0fa; }
.btn.secondary:hover { background: #dbe8f7; }
.btn.warn { background: var(--danger); }
.wide { width: 100%; padding: 14px 18px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.65; }
.message { min-height: 24px; margin: 12px 0 0; color: var(--danger); font-weight: 700; }
.hero { padding: 28px; display: flex; justify-content: space-between; gap: 20px; align-items: center; background: linear-gradient(120deg, white, #f0fbff); }
.hero h1 { margin: 0 0 10px; font-size: clamp(25px, 4vw, 38px); }
.hero p { margin: 0; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 99px; padding: 7px 11px; background: #e8f4ff; color: var(--blue-dark); font-size: 13px; font-weight: 800; }
.pill.test { background: #fff3d6; color: #9a5a00; }
.exercise-card { margin-top: 18px; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.exercise-card h2 { margin: 0 0 8px; }
.quiz-layout { display: grid; grid-template-columns: 1fr 250px; gap: 18px; align-items: start; }
.paper { padding: 28px; }
.paper-head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 22px; }
.paper-head h1 { margin: 0 0 8px; }
.question { border: 1px solid var(--line); border-radius: 17px; padding: 20px; margin: 0 0 16px; background: white; scroll-margin-top: 18px; }
.question h3 { margin: 0 0 16px; font-size: 18px; line-height: 1.65; }
.qmeta { color: var(--blue-dark); font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.option { display: flex; gap: 11px; align-items: flex-start; padding: 12px 13px; border: 1px solid #d8e3ef; border-radius: 12px; margin: 9px 0; cursor: pointer; line-height: 1.5; transition: .14s; }
.option:hover { border-color: #8bb3ea; background: #f6faff; }
.option.selected { border-color: var(--blue); background: #edf5ff; box-shadow: inset 4px 0 var(--blue); }
.option input { margin-top: 4px; transform: scale(1.2); }
.offline { background: var(--cream); border-color: #f5d69a; }
.offline .offline-note { display: inline-block; margin-top: 12px; padding: 9px 12px; border-radius: 10px; color: #8a5500; background: #fff0c7; font-weight: 800; }
.image-placeholder { padding: 18px; margin-bottom: 14px; border: 1px dashed #9bb2cc; border-radius: 12px; color: var(--muted); text-align: center; background: #f8fafc; }
.question-image { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbff; text-align: center; }
.question-image img { display: block; max-width: 100%; max-height: 330px; width: auto; height: auto; margin: 0 auto; border-radius: 8px; object-fit: contain; }
.question-image figcaption { margin-top: 8px; color: var(--muted); font-size: 13px; }
.side { position: sticky; top: 18px; padding: 18px; }
.side h3 { margin: 0 0 12px; }
.progress { height: 10px; overflow: hidden; border-radius: 99px; background: #e5edf6; }
.progress > i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--blue)); transition: width .2s; }
.number-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 16px 0; }
.number-grid button { border: 1px solid var(--line); border-radius: 9px; padding: 8px 0; background: white; color: var(--ink); }
.number-grid button.done { color: white; background: var(--success); border-color: var(--success); }
.save-state { margin: 12px 0; min-height: 22px; color: var(--success); font-size: 13px; font-weight: 700; }
.complete { max-width: 620px; margin: 9vh auto; padding: 42px; text-align: center; }
.complete .big-check { width: 76px; height: 76px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; font-size: 42px; color: white; background: var(--success); }
.complete h1 { margin: 0 0 12px; }
.complete p { color: var(--muted); line-height: 1.8; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.metric { padding: 18px; }
.metric b { display: block; font-size: 29px; margin-top: 6px; }
.metric span { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; margin-bottom: 16px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 17px 18px; border: 2px solid #fdba9a; background: #fff7ed; box-shadow: 0 10px 24px rgba(194,65,12,.08); }
.danger-zone b { color: #9a3412; font-size: 16px; }
.danger-zone p { margin: 5px 0 0; color: #9a3412; font-size: 13px; line-height: 1.5; }
.danger-zone .btn { flex: 0 0 auto; }
.refresh-icon { display: inline-block; margin-right: 5px; font-size: 18px; line-height: 1; vertical-align: -1px; }
.refreshing .refresh-icon { animation: spin .75s linear infinite; }
.refresh-feedback { min-width: 74px; color: var(--muted); font-size: 13px; font-weight: 700; }
.refresh-feedback.success { color: var(--success); }
.refresh-feedback.error { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.table-card { overflow: hidden; }
.section-title { margin: 28px 4px 12px; }
.wrap-cell { white-space: normal; min-width: 280px; line-height: 1.5; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 13px; background: #f7fafc; }
.status { font-size: 12px; font-weight: 800; border-radius: 99px; padding: 5px 9px; background: #eef2f7; }
.status.submitted { color: var(--success); background: #def7ec; }
.status.in_progress { color: #965d00; background: #fff1cc; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.55); }
.modal-card { width: min(820px, 100%); max-height: 88vh; overflow: auto; padding: 24px; }
.detail-row { border-bottom: 1px solid var(--line); padding: 15px 0; }
.detail-row p { margin: 6px 0; line-height: 1.55; }
.ok { color: var(--success); font-weight: 800; }
.bad { color: var(--danger); font-weight: 800; }
@media (max-width: 820px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .hero, .exercise-card { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .shell { padding: 14px 10px 42px; }
  .login-hero, .login-form, .paper, .complete { padding-left: 20px; padding-right: 20px; }
  .topbar { align-items: flex-start; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .number-grid { grid-template-columns: repeat(6, 1fr); }
  .danger-zone { align-items: stretch; flex-direction: column; }
}

