@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Noto+Sans+TC:wght@400;500;700&display=swap");

/* ================= TOKENS ================= */
:root {
  --font-main: "Baloo 2", "Noto Sans TC", sans-serif;
  --bg: #fef9f0;
  --bg-card: #ffffff;
  --text: #3a2f24;
  --text-muted: #8a7e73;
  --primary: #ff8c42;
  --primary-dark: #e67530;
  --primary-light: #fff1e6;
  --accent-green: #51c87d;
  --accent-blue: #56b4f9;
  --accent-purple: #b07de8;
  --accent-pink: #f589b6;
  --danger: #ef5350;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-btn: 0 4px 14px rgba(255, 140, 66, 0.35);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= RESET ================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Top bar: logo | flex | sound wave (practice only) | language */
.locale-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 16px 0;
  gap: 10px;
}

.locale-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
}

.locale-bar__badge {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.25;
  min-width: 0;
}

.locale-bar__fill {
  flex: 1;
  min-width: 0;
}

.locale-bar__viz-wrap {
  display: none;
  flex-shrink: 0;
  align-items: flex-end;
  height: 40px;
  padding-bottom: 2px;
}

body[data-dict-step="practice"] .locale-bar__viz-wrap {
  display: flex;
}

.locale-bar__home {
  font-family: inherit;
  background: none;
  border: none;
  padding: 2px 4px;
  margin: -2px -4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 0;
}

.locale-bar__logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(155px, 42vw);
}

@media (min-width: 480px) {
  .locale-bar__logo {
    height: 56px;
  }
}

.locale-bar__home:hover .locale-bar__logo {
  opacity: 0.92;
}

.locale-bar__home:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lang-switch__select {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid #e8dfd4;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.lang-switch__select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ================= UTILITY ================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ================= LAYOUT ================= */
.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Subtle enter animation on setup only — avoids shifting practice controls */
#stepSetup {
  animation: fadeUp 0.35s ease both;
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Passage photo → OCR (setup) */
.passage-import {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.btn--import-passage {
  width: 100%;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 700;
}

.passage-import__hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  min-height: 1.2em;
}

/* ================= CARD ================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}

.setup-top-strip {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(232, 223, 212, 0.95);
}

.setup-hero--minimal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: none;
}

.setup-hero__mascot {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.setup-heading {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}

.setup-flow {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-panel {
  padding: 12px 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #ebe3d8;
  background: linear-gradient(180deg, #fffefb 0%, #faf7f2 100%);
}

.setup-panel--1 {
  border-color: rgba(255, 140, 66, 0.35);
}

.setup-panel--2 {
  border-color: rgba(86, 180, 249, 0.35);
}

.setup-panel--3 {
  border-color: rgba(81, 200, 125, 0.35);
}

.setup-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.setup-panel__num {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.setup-panel--1 .setup-panel__num {
  background: var(--primary-dark);
}

.setup-panel--2 .setup-panel__num {
  background: #3a9ad9;
}

.setup-panel--3 .setup-panel__num {
  background: #3aab6e;
}

.setup-panel__title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}

.setup-panel__hint {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 10px;
  line-height: 1.35;
}

.speed-section--inline {
  margin: 0;
  padding: 0;
  gap: 0;
}

.speed-row--reading-voice {
  flex-wrap: wrap;
}

.speed-row--reading-voice .speed-chip {
  flex: 1 1 28%;
  min-width: 5rem;
}

.speed-chip.speed-chip--reading-voice-hidden {
  display: none !important;
}

.setup-panel--2 .speed-chip.speed-chip--reading-voice-disabled {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.62;
}

.setup-panel--2 .speed-chip.speed-chip--reading-voice-disabled span {
  border-color: #e4dcd3;
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-muted);
}

.setup-panel--2 .speed-chip.speed-chip--reading-voice-disabled input:checked + span {
  background: rgba(86, 180, 249, 0.1);
  border-color: rgba(58, 154, 217, 0.4);
  color: var(--text-muted);
}

.setup-panel--2 .speed-chip.speed-chip--reading-voice-disabled:hover span {
  border-color: #e4dcd3;
}


/* ================= FIELDS ================= */
.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

textarea {
  width: 100%;
  font-family: var(--font-main);
  font-size: 1rem;
  padding: 12px 14px;
  border: 2px solid #e8dfd4;
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

textarea:focus {
  border-color: var(--primary);
}

/* ================= SPEED CHIPS ================= */
.speed-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speed-row {
  display: flex;
  gap: 8px;
}

.speed-chip {
  flex: 1;
  cursor: pointer;
}

.speed-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.speed-chip span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  border: 2px solid #e8dfd4;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
}

.speed-chip input:checked + span {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.speed-chip:hover span {
  border-color: var(--primary);
}

/* Panel 2 / 3: selected + hover use blue & green (not orange — avoids looking like step 1) */
.setup-panel--2 .speed-chip input:checked + span {
  background: rgba(86, 180, 249, 0.16);
  border-color: #3a9ad9;
  color: #1a5a8a;
}

.setup-panel--2 .speed-chip:hover span {
  border-color: rgba(58, 154, 217, 0.65);
}

.setup-panel--2 .speed-chip input:checked:hover + span {
  border-color: #2d8bc9;
}

.setup-panel--3 .speed-chip input:checked + span {
  background: rgba(81, 200, 125, 0.16);
  border-color: #3aab6e;
  color: #1e5c3a;
}

.setup-panel--3 .speed-chip:hover span {
  border-color: rgba(58, 171, 110, 0.7);
}

.setup-panel--3 .speed-chip input:checked:hover + span {
  border-color: #329a60;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 700;
  border-radius: 60px;
  transition: box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none !important;
}

.btn:active:not(:disabled) {
  opacity: 0.92;
}

/* Start Practice */
.btn--start {
  width: 100%;
  padding: 16px;
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: var(--shadow-btn);
}

.btn--start:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(255, 140, 66, 0.45);
}

/* Continue / Finish (primary action during dictation) */
.btn--continue {
  width: 100%;
  padding: 18px;
  font-size: 1.35rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-green), #3bb56a);
  box-shadow: 0 4px 16px rgba(81, 200, 125, 0.4);
}

.btn--continue:hover:not(:disabled) {
  filter: brightness(1.03);
}

.btn--continue[data-finish="true"] {
  background: linear-gradient(135deg, var(--accent-purple), #9055d0);
  box-shadow: 0 4px 16px rgba(176, 125, 232, 0.4);
}

/* Say it again */
.btn--repeat {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  color: var(--accent-blue);
  background: #eef6ff;
  border: 2px solid var(--accent-blue);
}

.btn--repeat:hover:not(:disabled) {
  background: #dceeff;
}

.practice-row-btns {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.practice-row-btns .btn--repeat {
  width: auto;
  flex: 1;
  min-width: 0;
}

/* Small parent buttons */
.btn--sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg);
  border: 2px solid #ddd4c8;
}

.btn--sm:hover:not(:disabled) {
  border-color: var(--primary);
}

.btn--danger {
  color: var(--danger);
  border-color: var(--danger);
}

/* Mark */
.btn--mark {
  width: 100%;
  padding: 12px;
  font-size: 0.98rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue), #3895d3);
  margin-top: 10px;
}

/* Outline */
.btn--outline {
  padding: 12px 24px;
  font-size: 0.95rem;
  color: var(--primary-dark);
  background: transparent;
  border: 2px solid var(--primary);
}

.btn--outline:hover:not(:disabled) {
  background: var(--primary-light);
}

/* ================= BUDDY + “DONE READING” (one card, tight vertical grouping) ================= */
.buddy-status-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.buddy-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 14px 18px 6px;
}

/* Progress dots inside buddy card */
.buddy-status-card > .progress-dots {
  padding: 6px 18px 12px;
}

.buddy-avatar {
  font-size: 2.4rem;
  flex-shrink: 0;
}

.buddy-msg {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Write-now cue: same banner layout as listening; emphasis = colour + weight only */
.buddy-banner--write-now .buddy-msg {
  font-weight: 700;
  color: #218060;
}

/* ================= AUDIO VIZ ================= */
.viz {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 5px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
}

/* Compact bars in top bar (practice) */
.viz--toolbar {
  height: 32px;
  gap: 4px;
}

.viz span {
  width: 6px;
  height: 32px;
  border-radius: 3px;
  background: var(--primary);
  opacity: 0.45;
  transform-origin: bottom center;
  transform: scaleY(0.22);
  transition: opacity 0.06s ease-out;
  will-change: transform;
}

.viz--toolbar span {
  width: 4px;
  height: 22px;
  border-radius: 2px;
}

.viz.active span {
  opacity: 1;
}

/* ================= PROGRESS ================= */

.progress-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.progress-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e0d6cc;
  transition: all var(--transition);
}

.progress-dots .dot.done {
  background: var(--accent-green);
}

.progress-dots .dot.current {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.35);
}


/* Practice step: fill viewport without extra bounce from flex */
.step-practice {
  flex: 1;
  min-height: 0;
}

/* ================= STEP PAGE HEADER (upload + result) ================= */
.step-upload,
.step-result {
  gap: 12px;
}

.step-page-header {
  text-align: center;
  padding: 4px 4px 2px;
}

.step-page-header__row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step-page-header__emoji {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.step-page-header__title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.step-page-header__sub {
  margin: 4px auto 0;
  max-width: 22rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.35;
}

.upload-mark-status {
  margin-top: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-dark);
  min-height: 1.2em;
  text-align: center;
  line-height: 1.35;
}

.upload-mark-status.upload-mark-status--busy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  min-height: 2.75rem;
  font-size: 1.08rem;
  font-weight: 800;
  text-align: left;
}

.marking-spinner {
  box-sizing: border-box;
  width: 1.35em;
  height: 1.35em;
  flex-shrink: 0;
  border: 3px solid rgba(255, 140, 66, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: marking-spin 0.65s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .marking-spinner {
    animation: none;
    border-color: rgba(255, 140, 66, 0.35);
    border-top-color: var(--primary);
    opacity: 0.92;
  }
}

.file-upload .btn.btn--file-pick[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.62;
  cursor: not-allowed;
}

/* Custom file picker (hides ugly default "Choose file") */
.file-upload {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
}

/* High-specificity: match visual weight of other primary .btn actions (orange vs blue Mark) */
.file-upload__native:focus-visible + .btn.btn--file-pick {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 6px rgba(255, 140, 66, 0.55);
}

.file-upload .btn.btn--file-pick {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;
  margin: 0;
  font-family: var(--font-main);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
  border-radius: 60px;
  cursor: pointer;
  color: #fff;
  text-align: center;
  text-decoration: none;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 16px rgba(255, 140, 66, 0.42);
  transition: box-shadow 0.2s ease, filter 0.2s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.file-upload .btn.btn--file-pick:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 22px rgba(255, 140, 66, 0.5);
}

.file-upload .btn.btn--file-pick:active {
  transform: scale(0.98);
  filter: brightness(0.96);
}

.file-upload__name {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

/* ================= RESULT ACTIONS ================= */
.done-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.step-result .mark-result--panel {
  margin-top: 4px;
}

.mark-result {
  margin-top: 12px;
  font-size: 0.78rem;
  background: var(--bg);
  padding: 10px;
  border-radius: var(--radius-sm);
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

/* Rich marking UI: grow with content; page scrolls — no inner scroll frame. */
.mark-result.mark-result--panel {
  max-height: none;
  overflow: visible;
}

.mark-result--panel {
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 2px 4px 10px;
  background: transparent;
}

.mark-result--panel > .mark-rich {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mark-result--celebrate .mark-hero::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  pointer-events: none;
  background: radial-gradient(
      circle at 20% 20%,
      rgba(255, 214, 120, 0.45) 0%,
      transparent 45%
    ),
    radial-gradient(circle at 80% 30%, rgba(120, 200, 255, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(255, 160, 200, 0.25) 0%, transparent 45%);
  animation: markSparkle 2.2s ease-in-out infinite alternate;
}

@keyframes markSparkle {
  from {
    opacity: 0.65;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.mark-hero {
  position: relative;
  text-align: center;
  padding: 14px 12px 12px;
  border-radius: var(--radius-md, 14px);
  border: 2px solid var(--primary-soft, rgba(139, 90, 60, 0.2));
  background: linear-gradient(165deg, #fff9f0 0%, #ffe8f5 48%, #e8f4ff 100%);
  overflow: hidden;
}

.mark-hero--amazing {
  border-color: rgba(234, 179, 8, 0.45);
  background: linear-gradient(165deg, #fffbeb 0%, #fef3c7 40%, #ffedd5 100%);
}

.mark-hero--great {
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(165deg, #f0fdf4 0%, #dcfce7 45%, #e0f2fe 100%);
}

.mark-hero--good {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(165deg, #f8fafc 0%, #e0f2fe 50%, #fae8ff 100%);
}

.mark-hero--keep {
  border-color: rgba(244, 114, 182, 0.35);
  background: linear-gradient(165deg, #fff1f2 0%, #ffe4e6 40%, #fef3c7 100%);
}

.mark-hero-score-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.mark-hero-score {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary-dark);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.6);
}

.mark-hero-suffix {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.85;
}

.mark-hero-tier {
  margin: 6px 0 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.mark-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.mark-banner--review {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.mark-unclear-section {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.45) 0%, rgba(255, 251, 235, 0.35) 100%);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: var(--radius-md, 14px);
  padding: 4px 12px 14px;
  margin-top: 4px;
}

.mark-unclear-sub {
  margin: -4px 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.mark-unclear-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mark-unclear-item {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(120, 80, 20, 0.06);
}

.mark-unclear-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 6px;
}

.mark-unclear-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  flex-shrink: 0;
}

.mark-unclear-expected {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}

.mark-unclear-meta {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mark-unclear-meta-label {
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}

.mark-unclear-obs {
  font-weight: 700;
  color: #b45309;
}

.mark-unclear-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.mark-section {
  margin: 0;
}

/* Aligns with step-page-header: same title weight, readable case (小提醒 / From your coach). */
.mark-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--primary-dark);
  margin: 14px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(139, 90, 60, 0.12);
  text-align: center;
}

.mark-rich .mark-section:first-of-type .mark-section-title {
  margin-top: 6px;
}

.mark-empty {
  margin: 0;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(139, 90, 60, 0.25);
}

.mark-mistake-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mark-mistake {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md, 14px);
  padding: 14px;
  box-shadow: 0 2px 8px rgba(80, 50, 40, 0.06);
}

.mark-mistake-head {
  margin-bottom: 10px;
}

.mark-mistake-type {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Two-column body: compare (left) + note & actions (right) */
.mark-mistake__main {
  display: grid;
  gap: 12px 18px;
  align-items: start;
}

@media (min-width: 420px) {
  .mark-mistake__main:not(.mark-mistake__main--solo) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.mark-mistake__main--solo {
  grid-template-columns: 1fr;
}

/* Expected vs you wrote — side by side on wide cards, stacked on very narrow */
.mark-mistake__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}

@media (max-width: 340px) {
  .mark-mistake__compare {
    grid-template-columns: 1fr;
  }
}

.mark-compare-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 248, 240, 0.65);
  border: 1px solid rgba(254, 215, 170, 0.45);
  min-width: 0;
}

.mark-diff-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.mark-diff-val {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.35;
  word-break: break-all;
}

.mark-diff-val--obs {
  color: #b45309;
}

.mark-mistake__aside {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 2px;
}

@media (max-width: 419px) {
  .mark-mistake__aside {
    padding-top: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 2px;
    padding-top: 12px;
  }
}

.mark-mistake-note {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.mark-mistake__lex {
  flex-shrink: 0;
}

.mark-mistake__lex .mark-lexlist-hk-btn {
  width: 100%;
}

.mark-lexlist-hk-btn--busy {
  opacity: 0.72;
  cursor: wait;
}

.mark-feedback {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md, 14px);
  padding: 14px;
}

.mark-feedback-body {
  margin-top: 8px;
}

.mark-feedback-body p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.mark-feedback-body p:last-child {
  margin-bottom: 0;
}

.mark-result-fallback {
  margin: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ================= KUDOO EMBED (iframe in main app) ================= */
body[data-embed="1"] .locale-bar {
  display: none !important;
}

.embed-back-bar {
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 16px 8px;
  width: 100%;
  box-sizing: border-box;
}

.embed-back-bar[hidden] {
  display: none !important;
}

.btn--embed-back {
  font-size: 0.9rem;
  padding: 8px 14px;
}

/* ================= FILE INPUT ================= */
input[type="file"] {
  font-family: var(--font-main);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ================= RESPONSIVE: TABLET+ ================= */
@media (min-width: 640px) {
  .locale-bar {
    max-width: 580px;
    padding: 12px 20px 0;
  }

  .embed-back-bar {
    max-width: 580px;
    padding: 12px 20px 8px;
  }

  .app {
    max-width: 580px;
    padding: 28px 20px;
  }

  .btn--continue {
    font-size: 1.5rem;
    padding: 20px;
  }
}

/* ================= LANDSCAPE / LARGE ================= */
@media (min-width: 900px) {
  .locale-bar {
    max-width: 640px;
    padding: 14px 24px 0;
  }

  .embed-back-bar {
    max-width: 640px;
    padding: 14px 24px 8px;
  }

  .app {
    max-width: 640px;
    padding: 36px 24px;
  }
}
