:root {
  --ink: #1d3029;
  --green: #205846;
  --muted: #68776e;
  --line: #dce3dd;
  --red: #a63328;
  --paper: #f7f8f6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 20px;
  line-height: 1.65;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  background: none;
  color: inherit;
  min-height: 48px;
  border-radius: 8px;
  padding: 8px 14px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #427e62;
  outline-offset: 3px;
}
button:hover:enabled {
  background: #e8eee8;
}
.hidden {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
}
h3 {
  font-size: 22px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 17px;
}
.primary {
  background: var(--green);
  color: white;
  padding: 10px 24px;
}
.primary:hover:enabled {
  background: #164734;
}
.secondary {
  background: white;
  border: 1px solid var(--line);
  padding: 10px 24px;
}
header {
  max-width: 1240px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 8px 28px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 20px;
  white-space: nowrap;
}
header nav {
  display: flex;
  gap: 4px;
}
header nav .active {
  color: var(--green);
  background: #e2ece4;
  font-weight: 650;
}
#wrongCount {
  font-size: 14px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
#fullscreen {
  font-size: 27px;
}
.account {
  font-size: 16px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main {
  max-width: 1100px;
  margin: auto;
  padding: 18px 28px 32px;
}
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 17px;
  margin-bottom: 12px;
}
.lesson-meta #jump {
  margin-left: auto;
  white-space: nowrap;
  padding: 5px 8px;
}
.question-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.prompt-row {
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 80px;
}
.prompt-play {
  flex-shrink: 0;
  display: grid;
  place-content: center;
  width: 86px;
  height: 86px;
  background: #e4eee5;
  color: var(--green);
  font-size: 18px;
  line-height: 1.5;
}
.prompt-play #promptIcon {
  font-size: 29px;
}
.prompt-play.playing {
  background: #c7dfce;
}
.prompt-content {
  flex: 1;
  min-width: 0;
}
.english {
  font-size: 32px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.chinese {
  font-size: 24px;
  line-height: 1.6;
  color: #536458;
  margin-top: 6px;
}
.context {
  font-size: 22px;
  background: #f1f5ef;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
#promptTitle {
  font-size: 20px;
}
.prompt-content:has(.english:not(.hidden)) #promptTitle,
.prompt-content:has(.chinese:not(.hidden)) #promptTitle {
  display: none;
}
.audio-hint {
  color: #936522;
  font-size: 17px;
}
.audio-hint:empty {
  display: none;
}
.audio-hint:not(:empty) {
  margin-top: 12px;
}
.answers {
  display: grid;
  gap: 12px;
}
.answer {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  gap: 0;
  cursor: pointer;
  min-height: 86px;
}
.letter {
  font-size: 25px;
  font-weight: 650;
  flex-shrink: 0;
  width: 32px;
}
.answer-main {
  flex: 1;
  text-align: left;
  padding: 14px 18px;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 16px;
}
.answer-content {
  flex: 1;
  min-width: 0;
}
.answer-content .english,
.answer-content .chinese {
  display: block;
}
.option-play-icon {
  color: var(--green);
  font-size: 22px;
  flex-shrink: 0;
}
.answer-check {
  align-self: stretch;
  flex-shrink: 0;
  width: 72px;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
}
.answer-check:disabled {
  opacity: 1;
}
.check-box {
  width: 30px;
  height: 30px;
  border: 2px solid #879c8e;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  color: white;
}
.answer-check[aria-pressed="true"] .check-box {
  background: var(--green);
  border-color: var(--green);
}
.answer.chosen-wrong .answer-check[aria-pressed="true"] .check-box {
  background: var(--red);
  border-color: var(--red);
}
.answer-main:hover:enabled {
  background: transparent;
}
.answer-placeholder {
  font-size: 23px;
  color: #596a60;
}
.answer.correct {
  border: 2px solid #588563;
  background: #edf6ed;
}
.answer.chosen-wrong {
  border: 2px solid #b45547;
  background: #fff2ee;
}
.answer.correct .letter {
  color: #387343;
}
.answer.chosen-wrong .letter {
  color: var(--red);
}
.feedback {
  font-size: 19px;
  min-height: 8px;
  margin-top: 10px;
}
.feedback.wrong {
  color: var(--red);
}
.reveal-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 14px;
}
.reveal-bar button {
  font-size: 19px;
  border: 1px solid var(--line);
  background: white;
}
.reveal-bar button[aria-pressed="true"] {
  background: #dfebdf;
  color: var(--green);
  border-color: #88aa8a;
}
.analysis {
  background: #edf3e9;
  border-radius: 12px;
  padding: 22px;
  font-size: 22px;
  line-height: 1.8;
  margin: 14px 0;
}
.analysis h3 {
  margin: 16px 0 6px;
}
.lesson-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  gap: 12px;
}
#itemStats {
  font-size: 16px;
  text-align: center;
}
.utility {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 16px;
  color: var(--muted);
}
.utility button {
  font-size: 16px;
  padding: 5px 8px;
}
.utility details {
  position: relative;
}
.utility summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.settings {
  position: absolute;
  bottom: 48px;
  left: 0;
  min-width: 265px;
  background: white;
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 8px 24px #0001;
  display: grid;
  gap: 12px;
  z-index: 4;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 18px;
  height: 18px;
}
select,
input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px;
  color: var(--ink);
}
.sync {
  margin-left: auto;
  font-size: 15px;
}
.sync.offline {
  color: #95641c;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  gap: 16px;
}
#recordsSubtitle {
  font-size: 18px;
}
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.summary-cards > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 16px;
}
.summary-cards strong {
  display: block;
  font-size: 30px;
}
.table-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.table-toolbar input {
  flex: 1;
  min-width: 0;
}
.table-toolbar select {
  font-size: 17px;
}
.record-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 18px 2px;
  cursor: pointer;
}
.record-row:hover {
  background: #ecf2e9;
}
.record-title {
  font-size: 20px;
}
.record-text {
  font-size: 22px;
  color: #526757;
  overflow-wrap: anywhere;
}
.record-numbers {
  display: flex;
  gap: 20px;
  text-align: center;
  font-size: 15px;
}
.record-numbers strong {
  display: block;
  font-size: 25px;
}
.record-numbers .errors {
  color: var(--red);
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 10px;
}
.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}
.login-card {
  width: min(440px, 100%);
  padding: 30px;
}
.login-card label {
  display: block;
  margin-top: 18px;
}
.login-card input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 6px;
}
.login-card .primary {
  width: 100%;
  margin: 24px 0 14px;
}
.login-card .muted {
  font-size: 17px;
}
#loginError {
  color: var(--red);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  background: #244f3c;
  color: white;
  font-size: 18px;
  border-radius: 10px;
  padding: 12px 20px;
  max-width: 90%;
  z-index: 10;
}
.immersive header {
  justify-content: flex-end;
  min-height: 48px;
  border-bottom: 0;
}
.immersive header nav,
.immersive .brand,
.immersive #account {
  display: none;
}
.immersive main {
  padding-top: 12px;
}
@media (max-width: 760px) {
  header {
    padding: 6px 12px;
    gap: 8px;
    min-height: 58px;
  }
  .brand {
    display: none;
  }
  header nav {
    gap: 0;
  }
  header nav button {
    font-size: 18px;
    padding: 7px 11px;
  }
  .header-actions {
    gap: 0;
  }
  .account {
    font-size: 14px;
    max-width: 66px;
    padding: 5px 7px;
  }
  #fullscreen {
    padding: 5px 8px;
    min-width: 44px;
  }
  main {
    padding: 12px 14px max(22px, env(safe-area-inset-bottom));
  }
  .lesson-meta {
    font-size: 15px;
    gap: 9px;
    margin-bottom: 8px;
  }
  #stagePill {
    display: none;
  }
  .question-card {
    padding: 14px;
    margin-bottom: 12px;
  }
  .prompt-row {
    gap: 16px;
    min-height: 65px;
  }
  .prompt-play {
    height: 68px;
    width: 68px;
    font-size: 16px;
  }
  .prompt-play #promptIcon {
    font-size: 24px;
  }
  #promptTitle {
    font-size: 20px;
  }
  .english {
    font-size: 27px;
  }
  .chinese {
    font-size: 22px;
  }
  .context {
    font-size: 20px;
  }
  .answers {
    gap: 10px;
  }
  .answer {
    padding: 0;
    gap: 0;
    min-height: 76px;
  }
  .answer-main {
    padding: 12px;
    gap: 10px;
  }
  .answer-check {
    width: 60px;
  }
  .letter {
    width: 25px;
    font-size: 24px;
  }
  .answer-placeholder {
    font-size: 22px;
  }
  .reveal-bar {
    gap: 8px;
    margin: 10px 0 14px;
  }
  .reveal-bar button {
    font-size: 17px;
    padding: 8px 10px;
    flex: 1;
    white-space: nowrap;
  }
  .feedback {
    font-size: 18px;
  }
  .analysis {
    font-size: 21px;
    padding: 16px;
  }
  .analysis h3 {
    font-size: 21px;
  }
  .lesson-footer {
    gap: 8px;
    padding-top: 12px;
  }
  .lesson-footer button {
    font-size: 20px;
    padding: 9px 17px;
  }
  #itemStats {
    font-size: 14px;
    max-width: 110px;
  }
  .utility {
    gap: 10px;
    font-size: 14px;
  }
  .utility button {
    font-size: 15px;
  }
  .sync {
    font-size: 13px;
  }
  .settings {
    left: -70px;
    min-width: 250px;
  }
  .summary-cards {
    gap: 7px;
  }
  .summary-cards > div {
    padding: 10px;
  }
  .summary-cards .small {
    font-size: 14px;
  }
  .summary-cards strong {
    font-size: 26px;
  }
  .section-heading h1 {
    font-size: 27px;
  }
  .section-heading .primary {
    font-size: 18px;
    padding: 9px 14px;
  }
  #recordsSubtitle {
    font-size: 16px;
  }
  .table-toolbar {
    gap: 8px;
  }
  .table-toolbar input,
  .table-toolbar select {
    font-size: 15px;
  }
  .table-toolbar select {
    max-width: 132px;
  }
  .record-row {
    grid-template-columns: 30px 1fr;
    gap: 8px;
  }
  .record-numbers {
    grid-column: 2;
    justify-content: flex-start;
    gap: 24px;
  }
  .record-numbers strong {
    display: inline;
    margin-right: 5px;
    font-size: 20px;
  }
  .record-text {
    font-size: 23px;
  }
  .record-title {
    font-size: 17px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.analysis {
  scroll-margin-top: 20px;
}
.analysis h2 {
  font-size: 25px;
  margin-bottom: 12px;
}
