:root {
  --student-bg: #f3f6f5;
  --student-surface: #ffffff;
  --student-soft: #f7f9f8;
  --student-text: #17231f;
  --student-muted: #60716b;
  --student-line: #d8e1de;
  --student-primary: #0b6b60;
  --student-primary-dark: #07584f;
  --student-primary-soft: #e7f3f0;
  --student-amber: #a56a12;
  --student-amber-soft: #fff5e3;
  --student-danger: #b6493c;
  --student-danger-soft: #fff0ed;
  --student-success: #247455;
  --student-disabled-bg: #e9eeec;
  --student-disabled-text: #66736f;
  --student-shadow: 0 8px 24px rgba(21, 51, 45, 0.08);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--student-bg);
  color: var(--student-text);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--student-bg);
  color: var(--student-text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

body.quiz-screen-active {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
.option:has(input:focus-visible) {
  outline: 3px solid var(--student-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--student-primary-soft);
}

button:disabled {
  cursor: not-allowed;
}

.hidden,
[hidden] {
  display: none !important;
}

.student-app {
  position: relative;
  min-height: 100vh;
  background: var(--student-bg);
}

.student-main {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
}

.student-page {
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.app-header,
.quiz-header {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--student-line);
  background: var(--student-surface);
}

.app-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.app-title > span,
.page-kicker,
.section-label {
  color: var(--student-primary);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
}

.app-title strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 21px;
  line-height: 1.35;
  font-weight: 800;
}

.header-action {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 76px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-primary);
  font-size: 16px;
  font-weight: 700;
}

.home-focus-card {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--student-line);
  background: var(--student-surface);
}

#homeView.single-practice-home {
  display: grid;
  height: calc(100vh - 66px - env(safe-area-inset-bottom));
  min-height: 0;
  grid-template-rows: 64px minmax(0, 1fr);
  padding-bottom: 0;
  overflow: hidden;
  background: var(--student-surface);
}

#homeView.single-practice-home .home-header {
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

#homeView.single-practice-home .home-focus-card {
  min-height: 0;
  border-bottom: 0;
}

.home-focus-card h1,
.mine-header h1,
.quiz-header h1,
.result-panel h1 {
  margin: 5px 0 4px;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 800;
}

.home-focus-card > p,
.quiz-header p,
.modal-subtitle,
.bank-empty-card p,
.note {
  margin: 0;
  color: var(--student-muted);
  font-size: 16px;
  line-height: 1.6;
}

/* The protected script still contains legacy support wording; keep it out of the visible UI. */
#activePracticeMeta {
  display: none;
}

.primary-start-btn {
  display: grid;
  width: 100%;
  min-height: 82px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--student-primary);
  color: #ffffff;
  text-align: left;
  box-shadow: 0 8px 18px rgba(11, 102, 92, 0.18);
}

.primary-start-btn:not(:disabled):active,
.btn:not(:disabled):active,
.study-tile:not(:disabled):active,
.mine-menu button:not(:disabled):active,
.settings-row:not(:disabled):active,
.practice-card:not(:disabled):active {
  transform: translateY(1px);
}

.primary-start-btn.disabled,
.primary-start-btn:disabled {
  background: #8a9995;
  box-shadow: none;
  opacity: 1;
}

.primary-start-btn.is-wrong-locked {
  background: var(--student-amber);
}

.button-copy {
  min-width: 0;
}

.primary-start-btn strong {
  display: block;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 800;
}

.primary-start-btn em {
  display: none;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-style: normal;
  line-height: 1.45;
}

.button-arrow,
.row-chevron {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.button-arrow::before,
.row-chevron::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.home-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.study-tile {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-text);
}

.study-tile strong {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
}

.wrong-action {
  color: var(--student-amber);
}

.record-action {
  color: var(--student-primary);
}

.practice-area {
  padding: 20px 20px 28px;
}

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

.section-heading h2 {
  margin: 0;
  color: var(--student-text);
  font-size: 19px;
  line-height: 1.4;
  font-weight: 800;
}

.section-heading span {
  max-width: 58%;
  overflow-wrap: anywhere;
  color: var(--student-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.bank-empty-card {
  display: flex;
  min-height: 108px;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
}

.bank-empty-card h3 {
  margin: 0 0 3px;
  color: var(--student-text);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 800;
}

.empty-icon {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid #c8ded9;
  border-radius: 8px;
  background: var(--student-primary-soft);
  color: var(--student-primary);
}

.empty-icon::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 9px;
  width: 18px;
  height: 23px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.empty-icon::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 17px;
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.practice-switch-trigger {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-text);
  font-size: 16px;
}

.practice-switch-trigger strong {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.practice-switch-trigger > span:not(.button-icon, .row-chevron) {
  color: var(--student-primary);
  font-size: 15px;
  font-weight: 700;
}

.practice-sheet-card {
  max-height: min(72vh, 560px);
}

#practiceChoices {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.practice-card {
  display: flex;
  width: 100%;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
  color: var(--student-text);
  text-align: left;
}

.practice-card.selected {
  border-color: var(--student-primary);
  box-shadow: inset 4px 0 0 var(--student-primary);
}

.practice-card.disabled {
  color: var(--student-muted);
  background: #eef2f0;
  opacity: 1;
}

.bank-card-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.bank-card-main h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 800;
}

.bank-card-main h2 em {
  display: inline;
  color: var(--student-primary);
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
}

.bank-card-main p {
  display: none;
}

.mine-header {
  align-items: flex-start;
  padding-top: 22px;
  padding-bottom: 22px;
}

.mine-header h1 {
  margin-bottom: 0;
}

.mine-header #mineRole {
  margin: 2px 0 0;
  color: var(--student-muted);
  font-size: 16px;
  line-height: 1.5;
}

.mine-info,
.mine-menu {
  margin: 16px 20px 0;
  overflow: hidden;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
}

.mine-info > div {
  display: grid;
  min-height: 64px;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--student-line);
}

.mine-info > div:last-child {
  border-bottom: 0;
}

.mine-info span {
  color: var(--student-muted);
  font-size: 16px;
}

.mine-info strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}

.mine-menu button,
.settings-row {
  display: flex;
  width: 100%;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border: 0;
  border-bottom: 1px solid var(--student-line);
  background: var(--student-surface);
  color: var(--student-text);
  text-align: left;
}

.mine-menu button:last-child,
.settings-row:last-child {
  border-bottom: 0;
}

.mine-menu strong,
.settings-row strong {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
}

.mine-menu .row-chevron,
.settings-row .row-chevron {
  color: #87938f;
}

.logout-panel-btn {
  display: flex;
  width: calc(100% - 40px);
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 16px 20px 0;
  padding: 10px 16px;
  border: 1px solid #e5c7c2;
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-danger);
  font-size: 16px;
  font-weight: 700;
}

#quizView.quiz-page {
  display: grid;
  width: 100%;
  height: 100vh;
  min-height: 0;
  grid-template-rows: calc(52px + env(safe-area-inset-top)) 36px minmax(0, 1fr) calc(60px + env(safe-area-inset-bottom));
  padding: 0;
  overflow: hidden;
  background: var(--student-bg);
}

.quiz-toolbar {
  display: grid;
  height: calc(52px + env(safe-area-inset-top));
  min-height: calc(52px + env(safe-area-inset-top));
  grid-template-columns: 68px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 8px;
  padding: env(safe-area-inset-top) 12px 0;
  border-bottom: 1px solid var(--student-line);
  background: var(--student-surface);
}

.quiz-toolbar h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--student-text);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-tool-button,
.quiz-submit-button {
  display: inline-flex;
  height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--student-text);
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
}

.quiz-tool-button {
  width: 44px;
  justify-self: start;
}

.quiz-submit-button {
  width: 68px;
  justify-self: end;
  color: var(--student-primary);
}

body.quiz-screen-active #quizView #submitBtn.quiz-submit-button {
  height: 44px;
  min-height: 44px;
  flex: none;
  margin: 0;
}

.quiz-tool-button:active,
.quiz-submit-button:active {
  background: var(--student-primary-soft);
}

.quiz-tool-button .button-icon,
.quiz-submit-button .button-icon {
  width: 20px;
  height: 20px;
}

.question-head {
  --question-progress: 0%;
  position: relative;
  display: flex;
  height: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 0;
  background: var(--student-bg);
}

.question-head::before,
.question-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  pointer-events: none;
}

.question-head::before {
  background: var(--student-line);
}

.question-head::after {
  right: auto;
  width: clamp(0%, var(--question-progress), 100%);
  background: var(--student-primary);
}

body.quiz-screen-active #quizView .question-head {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 16px;
  border-radius: 0;
}

.question-head span,
.question-head em {
  min-width: 0;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.question-head span {
  color: var(--student-text);
}

.question-head em {
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid var(--student-line);
  border-radius: 4px;
  background: var(--student-surface);
  color: var(--student-muted);
  font-size: 13px;
  font-style: normal;
  text-overflow: ellipsis;
}

.question-head em.error {
  border-color: var(--student-danger);
  background: var(--student-surface);
  color: var(--student-danger);
}

.quiz-content {
  min-height: 0;
  padding: 10px 16px 8px;
  overflow: visible;
  background: var(--student-bg);
}

#quizForm {
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: visible;
}

.question-card {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.question-content {
  flex: 0 0 auto;
  padding: 13px 15px;
  overflow: visible;
  overflow-wrap: anywhere;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
  color: var(--student-text);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 600;
}

.option-list {
  display: grid;
  flex: 0 0 auto;
  align-content: start;
  gap: 12px;
  padding: 0;
  overflow: visible;
}

.option {
  position: relative;
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
  color: var(--student-text);
  cursor: pointer;
}

.option:hover {
  border-color: var(--student-line);
  background: var(--student-surface);
}

.option:has(input:checked) {
  border-color: var(--student-primary);
  background: var(--student-primary-soft);
  color: var(--student-text);
}

.option.is-correct,
.option.is-correct:hover {
  border-color: var(--student-primary);
  background: var(--student-primary-soft);
  color: var(--student-text);
}

.option.is-incorrect,
.option.is-incorrect:hover {
  border-color: var(--student-danger);
  background: var(--student-amber-soft);
  color: var(--student-danger);
}

.option:has(input:disabled) {
  cursor: default;
}

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.option-state-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.option-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.45;
}

.question-card.compact {
  gap: 8px;
}

.question-card.wrong-review {
  padding-bottom: 4px;
}

.question-card.compact .question-content {
  padding: 9px 11px;
  font-size: 16px;
  line-height: 1.4;
}

.question-card.compact .option-list {
  gap: 8px;
}

.question-card.compact .option {
  min-height: 48px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.question-card.compact .option-label {
  font-size: 15px;
  line-height: 1.4;
}

.quiz-content:has(.question-card.compact) {
  padding-top: 6px;
  padding-bottom: 6px;
}

.wrong-feedback {
  position: relative;
  display: flex;
  height: 36px;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding-right: 116px;
  color: var(--student-muted);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 700;
}

.wrong-feedback.correct {
  color: var(--student-primary);
}

.wrong-feedback.incorrect {
  color: var(--student-danger);
}

.wrong-feedback.failed {
  color: var(--student-danger);
}

.analysis-trigger {
  position: absolute;
  top: 50%;
  right: 0;
  display: inline-flex;
  width: 108px;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  transform: translateY(-50%);
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-primary);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.analysis-trigger .button-icon {
  width: 18px;
  height: 18px;
}

.quiz-nav {
  display: grid;
  height: calc(60px + env(safe-area-inset-bottom));
  min-height: calc(60px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  margin: 0;
  padding: 5px 12px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--student-line);
  background: var(--student-surface);
}

.quiz-nav .btn {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 12px;
}

.quiz-nav .btn:not(.ghost) {
  color: var(--student-surface);
}

.quiz-nav .btn:disabled {
  border-color: var(--student-line);
  background: var(--student-bg);
  color: var(--student-muted);
}

body.quiz-screen-active #quizNav .btn:not(:disabled):hover,
body.quiz-screen-active #quizNav .btn:not(:disabled):focus-visible {
  border-color: var(--student-primary);
  background-color: var(--student-primary);
  background-image: none;
  color: var(--student-surface);
  box-shadow: none;
}

body.quiz-screen-active #quizNav .btn:not(:disabled):active {
  border-color: var(--student-primary-dark);
  background-color: var(--student-primary-dark);
  background-image: none;
  color: var(--student-surface);
  box-shadow: none;
}

body.quiz-screen-active #quizNav .btn.ghost:not(:disabled):hover,
body.quiz-screen-active #quizNav .btn.ghost:not(:disabled):active,
body.quiz-screen-active #quizNav .btn.ghost:not(:disabled):focus-visible {
  border-color: var(--student-primary);
  background-color: var(--student-primary-soft);
  background-image: none;
  color: var(--student-primary-dark);
  box-shadow: none;
}

.result-actions {
  display: grid;
  gap: 10px;
  padding: 14px 20px 0;
}

.btn {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid var(--student-primary);
  border-radius: 6px;
  background: var(--student-primary);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  box-shadow: none;
  transition: transform 0.12s ease;
}

.btn:not(:disabled):hover,
.btn:not(:disabled):focus,
.btn:not(:disabled):focus-visible,
.btn:not(:disabled):active {
  border-color: var(--student-primary-dark);
  background-color: var(--student-primary-dark);
  background-image: none;
  color: #ffffff;
  box-shadow: none;
}

.btn.full {
  width: 100%;
}

.btn.ghost {
  border-color: var(--student-line);
  background: var(--student-surface);
  color: var(--student-text);
}

.btn.ghost:not(:disabled):hover,
.btn.ghost:not(:disabled):focus,
.btn.ghost:not(:disabled):focus-visible,
.btn.ghost:not(:disabled):active {
  border-color: var(--student-primary);
  background-color: var(--student-primary-soft);
  background-image: none;
  color: var(--student-primary-dark);
  box-shadow: none;
}

.btn.danger {
  border-color: var(--student-danger);
  background: var(--student-danger);
  color: #ffffff;
}

.btn.danger:not(:disabled):hover,
.btn.danger:not(:disabled):focus,
.btn.danger:not(:disabled):focus-visible,
.btn.danger:not(:disabled):active {
  border-color: #873028;
  background-color: #873028;
  background-image: none;
  color: #ffffff;
  box-shadow: none;
}

.btn:disabled {
  border-color: #d3dbd8;
  background: var(--student-disabled-bg);
  color: var(--student-disabled-text);
  opacity: 1;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.76;
}

.btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: student-spin 0.8s linear infinite;
}

@keyframes student-spin {
  to {
    transform: rotate(360deg);
  }
}

body.quiz-screen-active .student-tabbar {
  display: none !important;
}

body.quiz-screen-active .student-app,
body.quiz-screen-active .student-main,
body.quiz-screen-active .quiz-page {
  height: 100vh;
  min-height: 0;
}

body.quiz-screen-active .quiz-page {
  overflow: hidden;
}

.result-panel {
  margin: 0;
  padding: 28px 20px max(28px, env(safe-area-inset-bottom));
  background: var(--student-surface);
}

.result-score {
  margin: 14px 0 4px;
  color: var(--student-primary);
  font-size: 48px;
  line-height: 1.2;
  font-weight: 800;
}

#answerReview {
  margin-top: 20px;
}

.result-actions {
  padding-right: 0;
  padding-left: 0;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  padding: 16px;
  border: 1px solid #e4c9c4;
  border-left: 4px solid var(--student-danger);
  border-radius: 8px;
  background: var(--student-surface);
}

.review-item h3 {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 17px;
  line-height: 1.6;
}

.review-line {
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 16px;
  line-height: 1.6;
}

.analysis-box {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #ead7b8;
  border-radius: 6px;
  background: var(--student-amber-soft);
  color: var(--student-text);
  font-size: 16px;
  line-height: 1.65;
}

.analysis-modal-card {
  max-height: min(76vh, 560px);
}

.leave-quiz-card {
  max-width: 420px;
}

.analysis-body {
  margin-top: 16px;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 16px;
  line-height: 1.7;
}

.analysis-answer {
  margin: 0 0 10px;
  color: var(--student-primary);
  font-weight: 700;
}

.analysis-copy {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px max(16px, env(safe-area-inset-bottom));
  background: rgba(14, 29, 26, 0.46);
}

.modal-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
  box-shadow: 0 18px 48px rgba(12, 32, 27, 0.22);
}

.modal-card h2 {
  margin: 0;
  color: var(--student-text);
  font-size: 22px;
  line-height: 1.4;
  font-weight: 800;
}

.modal-subtitle {
  margin-top: 8px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field > span {
  color: var(--student-text);
  font-size: 16px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid #aebbb7;
  border-radius: 6px;
  background: #ffffff;
  color: var(--student-text);
  font-size: 17px;
}

.field input::placeholder {
  color: #7d8b87;
}

.field em {
  color: var(--student-muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.5;
}

.button-row.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--student-primary);
  font-size: 16px;
  line-height: 1.5;
}

.status.error,
.record-empty.error {
  color: var(--student-danger);
}

.modal-head {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-surface);
  color: var(--student-text);
}

.student-record-card {
  width: min(100%, 620px);
}

.student-record-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-soft);
}

.student-record-summary > div {
  display: grid;
  min-height: 78px;
  place-items: center;
  align-content: center;
  padding: 10px;
  border-right: 1px solid var(--student-line);
  border-bottom: 1px solid var(--student-line);
  text-align: center;
}

.student-record-summary > div:nth-child(2n) {
  border-right: 0;
}

.student-record-summary > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.student-record-summary strong {
  color: var(--student-primary);
  font-size: 22px;
  line-height: 1.3;
}

.student-record-summary span {
  color: var(--student-muted);
  font-size: 14px;
}

.record-tip {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--student-amber);
  background: var(--student-amber-soft);
  color: var(--student-text);
  font-size: 16px;
  line-height: 1.55;
}

.record-tip strong {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.student-record-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.student-record-item {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-surface);
}

.student-record-item > div:first-child {
  min-width: 0;
}

.student-record-item h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--student-text);
  font-size: 16px;
  line-height: 1.5;
}

.student-record-item p {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--student-muted);
  font-size: 14px;
  line-height: 1.5;
}

.record-score {
  display: grid;
  flex: 0 0 auto;
  gap: 2px;
  color: var(--student-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.record-score strong {
  font-size: 22px;
  line-height: 1.2;
}

.record-score.pass {
  color: var(--student-success);
}

.record-score.fail {
  color: var(--student-danger);
}

.record-page-actions {
  min-height: 0;
  margin-top: 12px;
}

.record-load-more {
  width: 100%;
  min-height: 48px;
}

.record-page-error {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 16px;
  border: 1px solid var(--student-line);
  background: var(--student-soft);
  color: var(--student-text);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

.record-page-error .btn {
  min-width: 128px;
  min-height: 46px;
}

.record-empty {
  padding: 24px 14px;
  border: 1px solid var(--student-line);
  border-radius: 8px;
  background: var(--student-soft);
  color: var(--student-muted);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
}

.wrong-empty-state {
  display: grid;
  height: 100%;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--student-muted);
  text-align: center;
}

.wrong-empty-state > .button-icon {
  width: 42px;
  height: 42px;
  color: var(--student-primary);
}

.wrong-empty-state h2 {
  margin: 0;
  color: var(--student-text);
  font-size: 20px;
  line-height: 1.4;
}

.wrong-empty-state .btn {
  min-width: 156px;
  min-height: 48px;
}

.settings-list {
  overflow: hidden;
  border: 1px solid var(--student-line);
  border-radius: 8px;
}

.settings-row.danger {
  color: var(--student-danger);
  background: var(--student-danger-soft);
}

.student-tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: grid;
  width: min(100%, 640px);
  min-height: calc(66px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--student-line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -6px 18px rgba(21, 51, 45, 0.06);
}

.student-tabbar button {
  display: grid;
  min-width: 0;
  min-height: 66px;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: #667670;
}

.student-tabbar button.active {
  color: var(--student-primary);
}

.student-tabbar strong {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 700;
}

.button-icon {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  color: currentColor;
  font-size: 0;
  line-height: 1;
}

.button-icon::before,
.button-icon::after {
  box-sizing: border-box;
}

.primary-start-btn > .button-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
}

.button-icon[data-icon="user-profile"]::before {
  content: "";
  position: absolute;
  top: 3px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.button-icon[data-icon="user-profile"]::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 16px;
  height: 9px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.button-icon[data-icon="home"]::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  width: 14px;
  height: 12px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 2px;
}

.button-icon[data-icon="home"]::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}

.button-icon[data-icon="id-shield"]::before,
.button-icon[data-icon="shield-check"]::before {
  content: "";
  width: 17px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 5px 5px 8px 8px;
}

.button-icon[data-icon="id-shield"]::after,
.button-icon[data-icon="shield-check"]::after,
.button-icon[data-icon="send-check"]::after,
.button-icon[data-icon="check-circle"]::after,
.button-icon[data-icon="book-check"]::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 8px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.button-icon[data-icon="wrong-book"]::before {
  content: "!";
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 5px;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
}

.button-icon[data-icon="history-list"]::before,
.button-icon[data-icon="clipboard-list"]::before,
.button-icon[data-icon="clipboard-check"]::before {
  content: "";
  width: 17px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.button-icon[data-icon="history-list"]::after,
.button-icon[data-icon="clipboard-list"]::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.button-icon[data-icon="clipboard-check"]::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 8px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.button-icon[data-icon="gear"]::before {
  content: "⚙";
  width: auto;
  height: auto;
  border: 0;
  color: currentColor;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 25px;
  line-height: 1;
  font-weight: 400;
}

.button-icon[data-icon="gear"]::after {
  content: none;
}

.button-icon[data-icon="log-out"]::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 11px;
  height: 16px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 3px 0 0 3px;
}

.button-icon[data-icon="log-out"]::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 8px;
  width: 10px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.button-icon[data-icon="x-close"]::before,
.button-icon[data-icon="x-close"]::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.button-icon[data-icon="x-close"]::before {
  transform: rotate(45deg);
}

.button-icon[data-icon="x-close"]::after {
  transform: rotate(-45deg);
}

.button-icon[data-icon="send-check"]::before {
  content: "";
  width: 19px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.button-icon[data-icon="arrow-left"]::before,
.button-icon[data-icon="arrow-right"]::before {
  content: "";
  width: 15px;
  border-top: 2px solid currentColor;
}

.button-icon[data-icon="arrow-left"]::after,
.button-icon[data-icon="arrow-right"]::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.button-icon[data-icon="arrow-left"]::after {
  left: 4px;
  transform: rotate(-45deg);
}

.button-icon[data-icon="arrow-right"]::after {
  right: 4px;
  transform: rotate(135deg);
}

.button-icon[data-icon="flag-check"]::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: currentColor;
}

.button-icon[data-icon="flag-check"]::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 11px;
  height: 8px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 2px 2px 0;
}

.button-icon[data-icon="refresh"]::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-30deg);
}

.button-icon[data-icon="refresh"]::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 2px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.button-icon[data-icon="option-circle"]::before,
.button-icon[data-icon="check-circle"]::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.button-icon[data-icon="practice-pencil"]::before {
  content: "";
  width: 5px;
  height: 19px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.button-icon[data-icon="book-check"]::before {
  content: "";
  width: 18px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.option .option-state-icon {
  width: 24px;
  height: 24px;
  color: var(--student-muted);
  opacity: 0;
  visibility: hidden;
}

.option .option-key-badge {
  width: 30px;
  height: 30px;
  border: 1px solid var(--student-line);
  border-radius: 6px;
  background: var(--student-bg);
  color: var(--student-muted);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.option:has(input:checked) .option-key-badge,
.option.is-correct .option-key-badge {
  border-color: var(--student-primary);
  background: var(--student-primary);
  color: var(--student-surface);
}

.option:has(input:checked) .option-state-icon {
  color: var(--student-primary);
  opacity: 1;
  visibility: visible;
}

.option.is-correct .option-state-icon,
.option.is-correct:has(input:disabled) .option-state-icon {
  color: var(--student-primary);
  opacity: 1;
  visibility: visible;
}

.option.is-incorrect .option-key-badge {
  border-color: var(--student-danger);
  background: var(--student-danger);
  color: var(--student-surface);
}

.option.is-incorrect .option-state-icon,
.option.is-incorrect:has(input:checked) .option-state-icon {
  color: var(--student-danger);
  opacity: 1;
  visibility: visible;
}

.button-icon[data-icon="layers"]::before,
.button-icon[data-icon="layers"]::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: inherit;
}

.button-icon[data-icon="layers"]::before {
  left: 3px;
  top: 4px;
}

.button-icon[data-icon="layers"]::after {
  left: 6px;
  top: 8px;
}

.button-icon[data-icon="x-circle"]::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.button-icon[data-icon="x-circle"]::after {
  content: "×";
  position: absolute;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
}

@media (max-width: 380px) {
  .app-header,
  .home-focus-card,
  .practice-area {
    padding-right: 16px;
    padding-left: 16px;
  }

  .mine-info,
  .mine-menu {
    margin-right: 16px;
    margin-left: 16px;
  }

  .logout-panel-btn {
    width: calc(100% - 32px);
    margin-right: 16px;
    margin-left: 16px;
  }

  .primary-start-btn {
    padding-right: 13px;
    padding-left: 13px;
  }

  .primary-start-btn strong {
    font-size: 18px;
  }

  .primary-start-btn em {
    font-size: 14px;
  }
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
    padding: 24px;
  }

  .modal-card {
    max-height: calc(100vh - 48px);
  }

  .home-focus-card,
  .practice-area,
  .app-header,
  .result-panel {
    padding-right: 28px;
    padding-left: 28px;
  }

  .mine-info,
  .mine-menu {
    margin-right: 28px;
    margin-left: 28px;
  }

  .logout-panel-btn {
    width: calc(100% - 56px);
    margin-right: 28px;
    margin-left: 28px;
  }
}

@supports (height: 100dvh) {
  .student-app,
  .student-main,
  .student-page {
    min-height: 100dvh;
  }

  body.quiz-screen-active,
  body.quiz-screen-active .student-app,
  body.quiz-screen-active .student-main,
  body.quiz-screen-active .quiz-page {
    height: 100dvh;
  }

  #quizView.quiz-page {
    height: 100dvh;
  }

  .modal-card {
    max-height: calc(100dvh - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
