:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9ded8;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --ok: #1f8a5b;
  --warn: #b7791f;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(28, 38, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.page {
  min-height: 100dvh;
  padding: 18px 16px calc(94px + env(safe-area-inset-bottom));
}

.page.narrow {
  max-width: 560px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  min-width: 0;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.plain-panel {
  padding: 4px 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

.start-title {
  margin-bottom: 14px;
  font-size: 21px;
  line-height: 1.3;
}

h1,
h2 {
  margin: 0;
  line-height: 1.22;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

p {
  margin: 0;
}

.lead {
  margin-top: 12px;
  color: #344054;
  font-size: 17px;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  margin-top: 16px;
  border-left: 4px solid var(--ok);
  background: #effaf3;
  padding: 10px 12px;
  color: #174a33;
  border-radius: 6px;
  font-size: 14px;
}

.warning {
  border-left-color: var(--warn);
  background: #fff8e6;
  color: #60440b;
}

.danger-note {
  border-left-color: var(--danger);
  background: #fff1f0;
  color: var(--danger);
  font-weight: 700;
}

.example-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.scroll-reminder {
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.inline-danger {
  color: var(--danger);
  font-weight: 800;
}

.inline-example-image {
  width: 34px;
  height: 34px;
  object-fit: contain;
  vertical-align: middle;
  background: #fff;
  border: 1px solid #f2c4bf;
  border-radius: 6px;
  padding: 2px;
}

.error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

.identity-form,
.question-form {
  margin-top: 20px;
}

.identity-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.field:first-child {
  margin-top: 0;
}

.identity-line > .field:nth-child(2) {
  margin-top: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field span,
.field legend {
  color: #344054;
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d0d8;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 46px;
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice,
.check-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid #c8d0d8;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.choice input,
.check-choice input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.choice span,
.check-choice span {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.consent {
  margin-top: 16px;
}

.action-bar {
  position: fixed;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(247, 247, 243, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.action-bar.two {
  grid-template-columns: 0.9fr 1.1fr;
}

.primary,
.secondary,
.danger {
  min-height: 48px;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 750;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:active {
  background: var(--accent-dark);
}

.secondary {
  border: 1px solid #b9c3cf;
  background: #fff;
  color: var(--text);
}

.danger {
  background: var(--danger);
  color: #fff;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.step-list b {
  display: block;
  margin-bottom: 3px;
}

.record-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}

.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b8c0ca;
}

.record-status.active .record-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.12);
}

.audio-task {
  text-align: center;
}

.audio-player {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.audio-button {
  width: 100%;
  margin-top: 18px;
}

.audio-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.audio-actions .audio-button {
  margin-top: 0;
}

.answer-recorder {
  margin-top: 18px;
}

.record-answer-button {
  width: min(100%, 360px);
  min-height: 78px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.record-answer-button.recording {
  background: #8f1d14;
  box-shadow: 0 0 0 8px rgba(180, 35, 24, 0.12);
}

.recording-cue {
  position: fixed;
  z-index: 30;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -12px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 32px rgba(126, 32, 24, 0.24);
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 900;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.recording-cue.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.42);
}

.modal-panel {
  width: min(100%, 520px);
  max-height: min(86dvh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(28, 38, 48, 0.18);
  padding: 20px;
}

.modal-close {
  width: 100%;
  margin-top: 18px;
}

.word-grid,
.digit-grid,
.picture-grid {
  display: grid;
  gap: 8px;
  margin: 18px auto 0;
  width: min(100%, 430px);
}

.word-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.word-cell {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid #d0d6dd;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 34px;
  line-height: 1;
}

.word-cell.marked {
  border-bottom-color: #f2c4bf;
  background: #fff1f0;
  color: var(--danger);
  font-weight: 800;
}

.word-cell:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.2);
  outline-offset: 2px;
}

.digit-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 12px;
}

.digit-cell {
  display: grid;
  place-items: center;
  min-height: 48px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

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

.picture-cell {
  display: grid;
  place-items: center;
  min-height: 48px;
  background: #fff;
}

.picture-cell img {
  display: block;
  max-width: 95%;
  max-height: 45px;
  object-fit: contain;
}

.timer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.timer b {
  font-size: 30px;
  line-height: 1;
}

.compact-timer b {
  font-size: 24px;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

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

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

.question-title {
  margin: 0 0 10px;
  font-weight: 720;
}

.required {
  color: var(--danger);
}

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

.checkbox-grid {
  display: grid;
  gap: 8px;
}

.complete-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--ok);
  font-size: 30px;
  font-weight: 800;
}

.summary-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: #344054;
}

.loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(31, 138, 91, 0.22);
  border-top-color: var(--ok);
  border-radius: 999px;
  vertical-align: -4px;
  animation: spin 0.8s linear infinite;
}

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

@media (min-width: 640px) {
  .page {
    padding-top: 28px;
  }

  .action-bar {
    right: calc((100vw - 560px) / 2);
    left: calc((100vw - 560px) / 2);
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 25px;
  }

  .word-cell {
    min-height: 49px;
    font-size: 31px;
  }

  .digit-cell {
    min-height: 44px;
    font-size: 35px;
  }

  .picture-cell {
    min-height: 44px;
  }

  .picture-cell img {
    max-height: 41px;
  }
}
