:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --ink: #172033;
  --muted: #647086;
  --line: #dfe6ef;
  --panel: rgba(255, 255, 255, 0.92);
  --blue: #1769ff;
  --cyan: #0fb7c9;
  --green: #13a66b;
  --orange: #f59f00;
  --red: #e44b5f;
  --shadow: 0 18px 55px rgba(30, 45, 78, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(15, 183, 201, 0.18), transparent 26rem),
    linear-gradient(135deg, #f9fbff 0%, #eef4f8 45%, #fff8ee 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 56px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 0 28px;
}

.project-tag,
.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1.02;
}

h2 {
  font-size: 26px;
}

.hero-copy {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.status-board {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(245, 159, 0, 0.14);
}

.control-band,
.coach-area,
.practice-area,
.wrongbook-area,
.export-area,
.history-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-band {
  display: grid;
  grid-template-columns: 140px 140px 140px 1fr auto;
  align-items: end;
  gap: 18px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.field span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
.student-profile input,
.question-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

select:focus,
.student-profile input:focus,
.question-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(23, 105, 255, 0.12);
}

.student-profile input {
  min-height: 44px;
  padding: 0 12px;
}

.operation-field {
  min-width: 300px;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
}

.operation-grid label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.operation-grid input {
  accent-color: var(--blue);
}

.disabled-option {
  opacity: 0.46;
  cursor: not-allowed;
}

.disabled-option input {
  cursor: not-allowed;
}

.profile-note {
  margin: 10px 0 0;
  padding: 12px 16px;
  border: 1px solid rgba(15, 183, 201, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.student-profile {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 0.7fr);
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-fields {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 14px;
  align-items: end;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-stats div {
  padding: 12px;
  border-radius: 8px;
  background: #f7fafc;
}

.profile-stats strong,
.profile-stats span {
  display: block;
}

.profile-stats strong {
  font-size: 22px;
}

.profile-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  padding: 0 24px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  box-shadow: 0 12px 26px rgba(23, 105, 255, 0.24);
}

.secondary-action {
  padding: 0 20px;
  background: var(--ink);
  color: #fff;
}

.secondary-action:disabled {
  cursor: not-allowed;
  background: #aeb7c5;
}

.ghost-action {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.export-actions {
  display: flex;
  gap: 10px;
}

.practice-actions {
  display: flex;
  gap: 10px;
}

.wrongbook-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(360px, 1fr) minmax(260px, 0.8fr);
  gap: 18px;
  margin: 18px 0;
}

.timer-panel,
.result-panel,
.insight-panel {
  min-height: 128px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.timer-panel p,
.result-panel p,
.insight-panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.timer-panel strong {
  display: block;
  color: var(--blue);
  font-size: 44px;
  line-height: 1;
}

.timer-panel span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.result-grid div {
  padding: 14px;
  border-radius: 8px;
  background: #f7fafc;
}

.result-grid strong,
.result-grid span {
  display: block;
}

.result-grid strong {
  font-size: 28px;
}

.result-grid span {
  margin-top: 4px;
  color: var(--muted);
}

.insight-panel {
  background: linear-gradient(135deg, rgba(23, 105, 255, 0.08), rgba(15, 183, 201, 0.1)), #fff;
}

.insight-panel strong,
.insight-panel span {
  display: block;
}

.insight-panel strong {
  font-size: 24px;
  line-height: 1.25;
}

.insight-panel span {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.coach-area,
.practice-area,
.wrongbook-area,
.export-area,
.history-area {
  padding: 20px;
}

.coach-area,
.wrongbook-area,
.export-area,
.history-area {
  margin-top: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.coach-summary {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
}

.weakness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.recommendation-panel {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 0.72fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(23, 105, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 105, 255, 0.09), rgba(19, 166, 107, 0.08)),
    #fff;
}

.recommendation-main h3,
.recommendation-main p {
  margin: 0;
}

.recommendation-main h3 {
  margin-top: 6px;
  font-size: 24px;
}

.recommendation-main p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.recommendation-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.recommendation-meta div {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.recommendation-meta strong,
.recommendation-meta span {
  display: block;
}

.recommendation-meta strong {
  color: var(--blue);
  font-size: 20px;
  line-height: 1.2;
}

.recommendation-meta span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recommendation-actions {
  display: grid;
  gap: 10px;
}

.adaptive-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) 1.2fr auto;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 18px;
  border: 1px solid rgba(19, 166, 107, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(19, 166, 107, 0.09), rgba(245, 159, 0, 0.1)),
    #fff;
}

.adaptive-copy h3,
.adaptive-copy p {
  margin: 0;
}

.adaptive-copy h3 {
  margin-top: 6px;
  font-size: 24px;
}

.adaptive-copy p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.adaptive-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.adaptive-steps div {
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.adaptive-steps span,
.adaptive-steps strong,
.adaptive-steps em {
  display: block;
}

.adaptive-steps span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.adaptive-steps strong {
  margin-top: 5px;
  color: var(--green);
  font-size: 20px;
  line-height: 1.2;
}

.adaptive-steps em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.weakness-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.weakness-card strong,
.weakness-card span {
  display: block;
}

.weakness-card strong {
  font-size: 24px;
}

.weakness-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.weakness-meter {
  overflow: hidden;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #eef3f8;
}

.weakness-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.question-card {
  display: grid;
  gap: 12px;
  min-height: 134px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-card.correct {
  border-color: rgba(19, 166, 107, 0.45);
  background: #f1fbf6;
}

.question-card.wrong {
  border-color: rgba(228, 75, 95, 0.45);
  background: #fff4f5;
}

.question-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.formula {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.question-card input {
  min-height: 42px;
  padding: 0 12px;
  font-size: 18px;
}

.answer-mark {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.correct .answer-mark {
  color: var(--green);
}

.wrong .answer-mark {
  color: var(--red);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 44px 18px;
  border: 1px dashed #c7d3e2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #f8fbff;
}

.empty-state strong {
  color: var(--ink);
  font-size: 20px;
}

.wrongbook-list {
  display: grid;
  gap: 10px;
}

.wrongbook-empty {
  padding: 22px;
  border: 1px dashed #c7d3e2;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  text-align: center;
}

.wrongbook-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 130px 150px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wrongbook-formula {
  font-size: 20px;
  font-weight: 900;
}

.wrongbook-meta,
.wrongbook-answer {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.wrongbook-answer strong {
  color: var(--red);
}

.preview-frame {
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(100, 112, 134, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(100, 112, 134, 0.08) 25%, transparent 25%),
    #eef3f8;
  background-size: 18px 18px;
}

.print-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.print-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 51, 0.46);
  backdrop-filter: blur(6px);
}

.print-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(980px, 100%);
  max-height: min(92vh, 960px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(23, 32, 51, 0.28);
}

.print-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.print-modal-header h2 {
  margin-top: 4px;
}

.print-modal .preview-frame {
  max-height: calc(92vh - 128px);
}

.worksheet-preview {
  width: min(794px, 100%);
  min-height: 1123px;
  margin: 0 auto;
  padding: 42px 46px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(23, 32, 51, 0.16);
}

.worksheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #172033;
}

.worksheet-header p,
.worksheet-header h3 {
  margin: 0;
}

.worksheet-header p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.worksheet-header h3 {
  margin-top: 6px;
  font-size: 30px;
}

.worksheet-info {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  text-align: right;
  white-space: nowrap;
}

.student-line {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 24px;
  color: var(--ink);
  font-weight: 700;
}

.worksheet-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 38px;
  row-gap: 18px;
  margin: 0;
  padding-left: 24px;
}

.worksheet-list li {
  padding-left: 6px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.7;
}

.history-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

th {
  color: var(--muted);
  background: #f4f7fb;
  font-weight: 800;
}

td {
  background: #fff;
}

.stars {
  color: var(--orange);
  letter-spacing: 2px;
}

.blank-history {
  color: var(--muted);
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .hero,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .control-band,
  .student-profile,
  .profile-fields,
  .workbench {
    grid-template-columns: 1fr;
  }

  .operation-grid,
  .profile-stats,
  .result-grid,
  .weakness-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .recommendation-panel {
    grid-template-columns: 1fr;
  }

  .adaptive-panel {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
  }

  .export-actions,
  .recommendation-actions,
  .practice-actions,
  .wrongbook-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .print-modal {
    padding: 12px;
  }

  .print-modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .coach-summary {
    text-align: left;
  }

  .wrongbook-item {
    grid-template-columns: 1fr;
  }

  .worksheet-preview {
    min-height: auto;
    padding: 28px 22px;
  }

  .worksheet-header,
  .student-line {
    display: grid;
    grid-template-columns: 1fr;
  }

  .worksheet-info {
    text-align: left;
    white-space: normal;
  }

  .worksheet-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  :root {
    --bg: #f4f7ff;
    --ink: #182033;
    --muted: #6b7280;
    --line: #d9e1ea;
    --panel: #ffffff;
    --blue: #2368d9;
    --cyan: #4fb88c;
    --green: #56b78b;
    --shadow: 0 8px 22px rgba(24, 32, 51, 0.08);
  }

  body {
    background: #f5f7fc;
  }

  .app-shell {
    width: 100%;
    padding: 0 10px 28px;
  }

  .hero {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    margin: 0 -10px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #e7ebf2;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
  }

  .project-tag,
  .hero-copy {
    display: none;
  }

  h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
  }

  .status-board {
    min-width: auto;
    padding: 8px 10px;
    border: 0;
    box-shadow: none;
    background: #f1f5f9;
    font-size: 12px;
  }

  .status-dot {
    width: 8px;
    height: 8px;
  }

  .control-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-radius: 6px;
    box-shadow: none;
  }

  .field {
    gap: 5px;
  }

  .field label,
  .field span {
    font-size: 13px;
  }

  select,
  .student-profile input,
  .question-card input {
    border-radius: 6px;
  }

  select {
    min-height: 36px;
    padding: 0 8px;
    font-size: 15px;
  }

  .operation-field {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .operation-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .operation-grid label {
    min-height: 36px;
    border-color: #cfe0d8;
    color: #263241;
    font-size: 14px;
  }

  .primary-action {
    grid-column: 1 / -1;
    min-height: 42px;
    background: #2368d9;
    box-shadow: none;
  }

  .profile-note,
  .student-profile,
  .eyebrow,
  .history-area {
    display: none;
  }

  .workbench {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0;
  }

  .timer-panel,
  .result-panel,
  .insight-panel {
    min-height: auto;
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: none;
  }

  .timer-panel {
    display: flex;
    align-items: baseline;
    gap: 10px;
    border: 0;
    background: transparent;
  }

  .timer-panel p {
    margin: 0;
    color: #c23a6c;
    font-size: 18px;
  }

  .timer-panel strong {
    color: #c23a6c;
    font-size: 26px;
  }

  .timer-panel span {
    display: none;
  }

  .practice-area,
  .coach-area,
  .wrongbook-area {
    padding: 12px;
    border-radius: 6px;
    box-shadow: none;
  }

  .section-heading {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .practice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
    min-height: 40px;
    border-radius: 6px;
    font-size: 15px;
  }

  .secondary-action {
    background: #182033;
  }

  .question-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .question-card {
    gap: 8px;
    min-height: 132px;
    padding: 12px 10px;
    border: 2px solid #67bb93;
    border-radius: 8px;
    box-shadow: none;
  }

  .question-title {
    font-size: 13px;
  }

  .operation-badge {
    color: #5f6775;
    font-size: 16px;
    font-weight: 900;
  }

  .formula {
    display: flex;
    justify-content: center;
    gap: 5px;
    min-height: 31px;
    font-size: clamp(22px, 7vw, 32px);
    text-align: center;
    white-space: nowrap;
  }

  .question-card input {
    min-height: 36px;
    padding: 0 8px;
    border: 2px solid #9aa2ad;
    font-size: 20px;
    text-align: center;
  }

  .question-card input:focus {
    border-color: #2368d9;
    box-shadow: 0 0 0 3px rgba(35, 104, 217, 0.14);
  }

  .answer-mark {
    min-height: 17px;
    font-size: 12px;
    text-align: center;
  }

  .empty-state {
    min-height: 130px;
    padding: 24px 12px;
  }

  .empty-state strong {
    font-size: 17px;
  }

  .result-grid,
  .weakness-grid,
  .recommendation-meta,
  .adaptive-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-grid strong {
    font-size: 22px;
  }

  .insight-panel strong,
  .recommendation-main h3,
  .adaptive-copy h3 {
    font-size: 20px;
  }

  .recommendation-panel,
  .adaptive-panel {
    padding: 12px;
  }

  .wrongbook-actions {
    grid-template-columns: 1fr 1fr;
  }

  .print-modal-panel {
    padding: 12px;
  }

  .export-actions {
    grid-template-columns: 1fr 1fr;
  }
}
