/* 数学书桌 UI · 参考语文书桌：大字号、易点、结构清晰 · 天蓝主色 */
:root {
  --bg: #eef7fc;
  --ink: #12344a;
  --muted: #5a7a8c;
  --line: #cfe6f4;
  --card: #ffffff;
  --brand: #4ba3d9;
  --brand-deep: #1e7eb8;
  --brand-dark: #0f5f8a;
  --soft: #e8f4fc;
  --ok: #16a34a;
  --bad: #dc2626;
  --shadow: 0 2px 0 rgba(30, 126, 184, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html {
  /* 语文根字号 17px；数学再抬一档，首页观感对齐 */
  font-size: 19px;
}
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, #c5e6f7 0%, transparent 55%),
    var(--bg);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 88px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
}
.brand {
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: var(--brand-deep);
}
.icon-btn {
  width: 48px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--card);
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.icon-btn:active { transform: translateY(1px); box-shadow: none; }

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 20px 28px;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}
.hero-mark {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: linear-gradient(145deg, #7ec8e8, var(--brand-deep));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2.2rem;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(30, 126, 184, 0.18);
  animation: popIn 0.45s var(--ease);
}
.mascot-line {
  margin: 0 auto 10px;
  max-width: 22em;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--ink);
}
.streak {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 18px;
}
.streak strong {
  color: var(--brand-deep);
  font-size: 1.35rem;
  font-weight: 800;
}

.today-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 22px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: 0 4px 0 rgba(30, 126, 184, 0.1);
  animation: popIn 0.45s var(--ease);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.today-card .eyebrow {
  display: inline-block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand-deep);
  background: var(--soft);
  padding: 8px 14px;
  border-radius: 999px;
  line-height: 1.35;
  margin: 0 0 14px;
}
.today-card h1 {
  margin: 0 0 10px;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-family: "Noto Serif SC", serif;
  color: var(--ink);
}
.today-card .meta {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
}

.home-cta-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.btn-start,
.btn-secondary,
.btn-answer {
  display: block;
  width: 100%;
  padding: 16px 14px 18px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1.12rem;
  text-align: center;
  transition: transform 0.12s var(--ease);
}
.btn-start {
  background: var(--brand);
  color: #fff;
  border-bottom: 4px solid var(--brand-deep);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-start:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.btn-secondary,
.btn-answer {
  background: #fff;
  color: var(--brand-deep);
  border: 2px solid var(--brand);
  border-bottom-width: 4px;
}
.btn-secondary:active,
.btn-answer:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.btn-path {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  background: #fff;
  color: var(--brand-deep);
  text-decoration: none;
}
.btn-path:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.unit-line,
.path-summary {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  margin: 16px 0 0;
}
.path-summary { margin-top: 8px; }

/* —— path / records —— */
.path-top,
.records-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
}
.path-top h1,
.records-top h1 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  font-family: "Noto Serif SC", serif;
  color: var(--brand-deep);
}
.path-meta {
  margin: 14px 18px 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 1rem;
}
.path-scroll {
  flex: 1;
  overflow: auto;
  padding: 14px 18px 28px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.path-unit {
  margin: 18px 4px 6px;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--brand-deep);
}
.path-node {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 16px;
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
}
.path-node:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.path-node.is-current {
  border-color: var(--brand);
  background: var(--soft);
}
.path-node.is-done {
  border-color: #86efac;
  background: #f0fdf4;
}
.path-badge {
  min-width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.path-node.is-done .path-badge {
  background: #dcfce7;
  color: #166534;
}
.path-node.is-current .path-badge {
  background: var(--brand-deep);
  color: #fff;
}
.path-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
}
.path-copy small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

/* —— overlays —— */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 52, 74, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
.overlay.is-center { align-items: center; }
.sheet {
  width: min(440px, 100%);
  background: var(--card);
  border-radius: 22px;
  padding: 22px 20px;
  border: 2px solid var(--line);
  box-shadow: 0 8px 32px rgba(18, 52, 74, 0.12);
  max-height: 85vh;
  overflow: auto;
}
.sheet.wide { width: min(560px, 100%); }
.sheet h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: "Noto Serif SC", serif;
  color: var(--brand-deep);
  line-height: 1.35;
}
.sheet .meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}
.help-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.65;
}
.help-copy b { color: var(--brand-dark); font-weight: 800; }
.mod-grid { display: grid; gap: 12px; margin-top: 18px; }
.mod-btn {
  text-align: left;
  padding: 18px;
  border-radius: 16px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.35;
}
.mod-btn small {
  display: block;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.mod-btn:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
  border-color: var(--brand);
}

.checks { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
  font-size: 1.02rem;
}
.check:has(input:checked) {
  border-color: var(--brand);
  background: var(--soft);
}
.hint {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font-weight: 800;
  font-size: 1.05rem;
  border-radius: 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: #fff;
  color: var(--brand-dark);
  padding: 12px 16px;
}
.btn.primary {
  background: var(--brand-deep);
  color: #fff;
  border-color: var(--brand-deep);
  border-bottom-color: var(--brand-dark);
}
.btn:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.btn:disabled { opacity: 0.45; }

.records-score {
  margin: 14px 18px;
  padding: 18px 16px;
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 1.05rem;
  font-weight: 600;
}
.records-actions {
  display: grid;
  gap: 10px;
  padding: 0 18px 10px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.rec-card {
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: #fff;
  width: 100%;
  font-size: 1.05rem;
}
.rec-card strong {
  color: var(--brand-dark);
  font-size: 1.12rem;
}
.rec-card:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.mistake-form {
  margin: 0 auto 14px;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  max-width: 520px;
  width: calc(100% - 36px);
  background: var(--card);
}
.mark-cta-wrap {
  margin: 0 auto 14px;
  max-width: 520px;
  width: calc(100% - 36px);
}
.btn-mark-cta {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px 18px 16px;
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, var(--soft) 100%);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 1.2rem;
  text-align: left;
  box-shadow: var(--shadow);
}
.btn-mark-cta small {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
.btn-mark-cta:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
  box-shadow: none;
}
.mistake-advanced {
  margin: 0 auto 16px;
  max-width: 520px;
  width: calc(100% - 36px);
}
.mistake-advanced > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
  padding: 8px 4px;
  list-style: none;
}
.mistake-advanced > summary::-webkit-details-marker { display: none; }
.mistake-advanced[open] > summary {
  color: var(--brand-dark);
  margin-bottom: 8px;
}
.mistake-advanced .mistake-form {
  width: 100%;
  margin: 0;
}

.mark-sheet {
  width: min(760px, 100%);
  max-height: min(94vh, 960px);
  overflow: auto;
}
.mark-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.mark-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 8px;
}
.mark-filters label {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--brand-dark);
}
.mark-filters select {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 1rem;
}
.mark-paper-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.mark-page-label {
  font-weight: 800;
  color: var(--muted);
  font-size: 0.95rem;
  min-width: 4.5rem;
  text-align: center;
}
.mark-photo-btn { padding: 10px 14px; font-size: 0.95rem; }
.mark-stage-wrap {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #dbeaf4;
  overflow: auto;
  max-height: min(58vh, 560px);
  -webkit-overflow-scrolling: touch;
}
.mark-stage {
  position: relative;
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  touch-action: none;
  user-select: none;
}
.mark-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.mark-stage #markInk {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.mark-paper-hint {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}
.mark-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
@media (max-width: 520px) {
  .mark-filters { grid-template-columns: 1fr; }
  .mark-stage-wrap { max-height: min(52vh, 480px); }
}
.mistake-form .form-lead {
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--brand-dark);
  font-size: 1.05rem;
}
.mistake-form .soft {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.88rem;
}
.mistake-form label {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 10px 0 6px;
}
.mistake-form select,
.mistake-form input,
.mistake-form textarea {
  width: 100%;
  padding: 12px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 1.05rem;
}
.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.photo-btn,
.photo-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  background: #fff;
  font-weight: 800;
  color: var(--brand-dark);
  cursor: pointer;
}
.photo-btn:active,
.photo-btn-inline:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.photo-preview {
  margin-top: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f7fbff;
}
.photo-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}
.photo-full img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
}
.item-nos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.item-nos label {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.item-nos input {
  width: auto;
  padding: 0;
}
.mistake-item {
  background: var(--card);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 1.05rem;
}
.mistake-item .row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.mistake-item .thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px solid var(--line);
  object-fit: cover;
  background: #eef6fc;
  flex: 0 0 auto;
}
.mistake-item .thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 4px;
}
.mistake-item .kind {
  color: var(--brand-deep);
  font-size: 0.95rem;
  font-weight: 800;
}
.mistake-item .ops {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.mistake-item .ops button {
  font-size: 0.92rem;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
}
.mistake-item .ops button.del {
  color: var(--bad);
}

.app-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--card);
  border-top: 2px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 0 rgba(30, 126, 184, 0.06);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.88rem;
}
.nav-item.is-on {
  color: var(--brand-deep);
  background: var(--soft);
}
.nav-emoji { font-size: 1.45rem; line-height: 1; }
.nav-label { letter-spacing: 0.02em; }

/* A4 日常练习：比考前卷略放大一号，印刷更清晰 */
.print-root { display: none; }
.sheet-a4 {
  --sheet-ink: #111;
  --sheet-muted: #4a6678;
  box-sizing: border-box;
  width: 210mm;
  min-height: 297mm;
  margin: 12px auto;
  background: #fff;
  color: var(--sheet-ink);
  padding: 14mm 16mm;
  border: 1px solid var(--line);
  font-family: "宋体", SimSun, "Noto Serif SC", serif;
  font-size: 12pt;
  line-height: 1.8;
}
.sheet-head {
  text-align: center;
  margin: 0 0 10px;
  border-bottom: 1.5pt solid var(--brand-deep);
  padding-bottom: 8px;
}
.sheet-brand {
  margin: 0;
  color: var(--brand-deep);
  font-size: 11pt;
  font-weight: 700;
  font-family: "微软雅黑", "Microsoft YaHei", sans-serif;
}
.sheet-title {
  margin: 6px 0 0;
  color: var(--brand-dark);
  font-size: 18pt;
  font-weight: 700;
  font-family: "微软雅黑", "Microsoft YaHei", sans-serif;
  line-height: 1.35;
}
.sheet-meta {
  margin: 6px 0 0;
  font-size: 11pt;
  color: var(--sheet-muted);
  font-family: "宋体", SimSun, serif;
}
.sheet-info {
  margin: 10px 0 14px;
  text-align: center;
  font-size: 12pt;
  letter-spacing: 0.02em;
}
.sheet-foot {
  margin: 16px 0 0;
  padding-top: 8px;
  border-top: 0.75pt solid #cfe6f4;
  font-size: 11pt;
  color: var(--sheet-muted);
}
.block { margin: 0 0 12pt; }
.block h3 {
  margin: 0 0 6pt;
  color: var(--brand-dark);
  font-size: 13pt;
  font-weight: 700;
  font-family: "微软雅黑", "Microsoft YaHei", sans-serif;
  border-left: 3.5pt solid var(--brand);
  padding-left: 8pt;
  line-height: 1.4;
}
.block .sub {
  margin: 0 0 8pt;
  font-size: 10pt;
  color: var(--sheet-muted);
  line-height: 1.45;
}
.block .q { margin: 0; padding: 0; list-style: none; }
.block .q .q-item {
  margin: 0 0 9pt;
  font-size: 12pt;
  line-height: 1.8;
  page-break-inside: avoid;
  break-inside: avoid;
}
.block .q .q-stem { margin: 0; }
.block .q .q-fig {
  margin: 4pt 0 2pt;
  text-align: center;
}
.block .q .q-fig img {
  display: inline-block;
  vertical-align: top;
  border: 0;
}
.block.compact .q .q-item { margin: 0 0 5pt; }
.write-area {
  margin: 4pt 0 2pt 1.5em;
  display: grid;
  gap: 0;
}
.write-area span {
  display: block;
  height: 8mm;
  border-bottom: 0.75pt solid #9bb8cc;
}
.calc-box {
  margin: 4pt 0 2pt 1.5em;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
}
.calc-box::before,
.calc-box::after {
  content: "";
  display: block;
  height: 32mm;
  border: 0.75pt dashed #9bb8cc;
  border-radius: 2pt;
}
.draw-box {
  margin: 4pt 0 2pt 1.5em;
  height: 42mm;
  border: 0.75pt dashed #9bb8cc;
  border-radius: 2pt;
}
.page-break { break-before: page; page-break-before: always; }

@media print {
  html, body { background: #fff !important; margin: 0; font-size: initial; }
  html { font-size: 16px; }
  .no-print { display: none !important; }
  .print-root { display: block !important; padding: 0; }
  .sheet-a4 {
    width: auto;
    min-height: auto;
    margin: 0;
    border: none;
    padding: 0;
    box-shadow: none;
  }
  @page { size: A4; margin: 14mm 16mm; }
}

@media (min-width: 720px) {
  .home-main,
  .path-scroll { max-width: 500px; }
  .today-card h1 { font-size: 2rem; }
}
