/* Viet Han UI v2: adult, content-first mobile learning workspace. */

:root {
  --bg: #f1f4f3;
  --surface: #ffffff;
  --surface-soft: #f6f8f7;
  --surface-strong: #e9efed;
  --text: #132521;
  --muted: #62716d;
  --line: #d9e1de;
  --green: #126655;
  --green-dark: #0b493f;
  --green-soft: #e5f1ed;
  --coral: #c94a38;
  --coral-soft: #fceeea;
  --yellow: #dda72d;
  --yellow-soft: #fff6dc;
  --blue: #356c84;
  --blue-soft: #e8f1f5;
  --danger: #a83229;
  --shadow-border:
    0 0 0 1px rgb(18 37 33 / 0.06),
    0 1px 2px -1px rgb(18 37 33 / 0.08),
    0 5px 16px rgb(18 37 33 / 0.05);
  --shadow-border-hover:
    0 0 0 1px rgb(18 37 33 / 0.1),
    0 2px 4px -1px rgb(18 37 33 / 0.1),
    0 9px 24px rgb(18 37 33 / 0.08);
  --shadow-raised:
    0 0 0 1px rgb(18 37 33 / 0.04),
    0 12px 30px rgb(18 37 33 / 0.11);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  scrollbar-color: #b7c4c0 transparent;
}

html {
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  background: var(--bg);
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: 0;
  text-wrap: balance;
}

p,
li,
small {
  letter-spacing: 0;
  text-wrap: pretty;
}

h1 {
  font-size: 28px;
  line-height: 1.17;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
}

button,
select,
summary {
  touch-action: manipulation;
}

button {
  min-height: 44px;
  border-color: transparent;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-border);
  transition-property: color, background-color, box-shadow, scale, opacity;
  transition-duration: 140ms;
  transition-timing-function: ease-out;
}

button:not(:disabled):active {
  scale: 0.96;
}

button:not(:disabled):hover {
  box-shadow: var(--shadow-border-hover);
}

button:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgb(18 102 85 / 0.28);
  outline-offset: 2px;
}

button.primary {
  border-color: transparent;
  color: #ffffff;
  background: var(--green);
  box-shadow:
    0 0 0 1px rgb(8 64 53 / 0.24),
    0 5px 14px rgb(8 64 53 / 0.18);
}

button.primary:not(:disabled):hover {
  background: var(--green-dark);
  box-shadow:
    0 0 0 1px rgb(8 64 53 / 0.3),
    0 8px 20px rgb(8 64 53 / 0.2);
}

button:disabled {
  box-shadow: none;
  opacity: 0.44;
}

.lucide-icon {
  display: block;
  flex: 0 0 auto;
  stroke: currentColor;
}

.button-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-with-icon .lucide-icon {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

.icon-button .lucide-icon {
  width: 20px;
  height: 20px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  translate: 0 -160%;
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--green-dark);
  font-weight: 700;
  transition: translate 140ms ease-out;
}

.skip-link:focus {
  translate: 0 0;
}

/* Account entry */
.auth-gate {
  display: grid;
  min-height: 100dvh;
  padding: calc(32px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
  background: var(--surface);
}

.auth-surface {
  width: 100%;
  max-width: 420px;
  margin: auto;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 44px;
}

.auth-brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  outline: 1px solid rgb(0 0 0 / 0.1);
  outline-offset: -1px;
}

.auth-brand div {
  display: grid;
  gap: 1px;
}

.auth-brand strong {
  font-size: 18px;
}

.auth-brand span {
  color: var(--muted);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 12px;
}

.auth-heading {
  margin-bottom: 24px;
}

.auth-heading h1 {
  max-width: 360px;
  margin-bottom: 10px;
}

.auth-heading > p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  border-radius: 8px;
  padding: 4px;
  background: var(--surface-strong);
}

.auth-tabs button {
  min-width: 0;
  box-shadow: none;
  color: var(--muted);
  background: transparent;
}

.auth-tabs button[aria-selected="true"] {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.auth-form,
.account-password-form {
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.auth-field label {
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.auth-field input:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(18 102 85 / 0.16);
}

.auth-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.auth-status {
  min-height: 20px;
  margin: -2px 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
}

.auth-status[data-tone="success"] {
  color: var(--green);
}

.auth-form button[type="submit"] {
  margin-top: 2px;
}

.auth-form [aria-busy="true"],
.account-password-form [aria-busy="true"] {
  cursor: wait;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  background: var(--surface);
}

.top-bar {
  height: calc(62px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.94);
  backdrop-filter: blur(14px);
}

.brand-button {
  gap: 9px;
  min-height: 44px;
}

.brand-button img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  outline: 1px solid rgb(0 0 0 / 0.1);
  outline-offset: -1px;
}

.brand-button strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 760;
}

.brand-button small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.top-actions {
  gap: 10px;
}

.network-state {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 700;
}

.network-state i {
  width: 7px;
  height: 7px;
  border: 0;
  box-shadow: 0 0 0 3px var(--green-soft);
}

.network-state[data-online="false"] {
  color: var(--danger);
  background: var(--coral-soft);
}

.network-state[data-online="false"] i {
  box-shadow: 0 0 0 3px rgb(201 74 56 / 0.12);
}

.compact-action {
  min-height: 44px;
  padding: 0 12px;
  font-size: 12px;
}

.app-content {
  width: 100%;
  min-height: calc(100dvh - 62px);
  padding: 22px 16px calc(92px + env(safe-area-inset-bottom));
}

.app-view {
  max-width: 720px;
  margin: 0 auto;
}

.app-view.is-active {
  animation: view-enter 220ms ease-out both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-heading {
  gap: 14px;
  margin-bottom: 18px;
}

.view-heading h1 {
  margin-bottom: 7px;
}

.view-heading p:not(.eyebrow) {
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.eyebrow {
  margin-bottom: 6px !important;
  color: var(--green) !important;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.today-progress {
  flex: 0 0 72px;
  justify-items: center;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.today-progress strong {
  color: var(--text);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.today-progress span {
  font-size: 11px;
}

.view-step,
.level-badge,
.lesson-time {
  border: 1px solid rgb(18 102 85 / 0.12);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

/* Home: the dark lesson surface is the single strong visual signature. */
.daily-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--green-dark);
  box-shadow: var(--shadow-raised);
}

.daily-card::after {
  position: absolute;
  top: 18px;
  right: -22px;
  width: 88px;
  height: 88px;
  border: 16px solid rgb(255 255 255 / 0.05);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.daily-card .level-badge,
.daily-card .lesson-time {
  border-color: rgb(255 255 255 / 0.14);
  color: #ffffff;
  background: rgb(255 255 255 / 0.1);
}

.daily-card .daily-zh {
  margin: 22px 0 4px;
  color: #ffb5a8;
  font-size: 14px;
}

.daily-card h2 {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 23px;
}

.daily-card > p:not(.daily-zh) {
  position: relative;
  z-index: 1;
  color: #d8e6e2;
  font-size: 14px;
  line-height: 1.55;
}

.daily-card .step-progress {
  position: relative;
  z-index: 1;
  margin: 17px 0;
  border-color: rgb(255 255 255 / 0.14);
}

.daily-card .step-progress span {
  gap: 7px;
  color: #bfd2cd;
  font-size: 12px;
}

.daily-card .step-progress .lucide-icon {
  width: 16px;
  height: 16px;
  color: #a9c2bc;
}

.daily-card .step-progress span[data-done="true"] {
  color: #ffffff;
}

.daily-card .step-progress span[data-done="true"] .lucide-icon {
  color: #ffd066;
}

.daily-card .primary {
  position: relative;
  z-index: 1;
  color: var(--green-dark);
  background: #ffffff;
  box-shadow: 0 5px 18px rgb(0 0 0 / 0.16);
}

.daily-card .primary:not(:disabled):hover {
  color: var(--green-dark);
  background: #f4f8f6;
}

.module-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.module-tile {
  position: relative;
  align-content: start;
  min-width: 0;
  min-height: 134px;
  padding: 14px;
  border: 0;
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.module-tile:hover {
  translate: 0 -1px;
  box-shadow: var(--shadow-border-hover);
}

.module-icon,
.practice-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.module-icon.coral,
.practice-icon.coral {
  color: var(--coral);
  background: var(--coral-soft);
}

.module-icon.yellow {
  color: #76570d;
  background: var(--yellow-soft);
}

.module-icon.ink,
.practice-icon.ink {
  color: var(--blue);
  background: var(--blue-soft);
}

.module-icon .lucide-icon,
.practice-icon .lucide-icon {
  width: 20px;
  height: 20px;
}

.module-tile strong {
  margin-top: 14px;
  padding-right: 24px;
  font-size: 15px;
}

.module-tile small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.module-arrow {
  position: absolute;
  top: 17px;
  right: 13px;
  width: 18px;
  height: 18px;
  color: #8a9995;
}

/* Shared content surfaces */
.task-card,
.passage-card,
.recorder-card,
.result-section,
.assessment-block,
.report-panel,
.question-card,
.scene-stage,
.character-stage,
.quiz-stage,
.lesson-result,
.usage-section,
.language-focus-stage,
.shadowing-stage {
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.task-card,
.passage-card,
.recorder-card,
.result-section {
  padding: 18px;
}

.task-number {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.listen-visual {
  position: relative;
  height: 88px;
  border-radius: 8px;
  background: var(--green-soft);
}

.listen-visual::before {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--green-dark);
  content: "Tốc độ thường";
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.58;
}

.listen-visual span {
  width: 5px;
  background: var(--green);
}

.listen-visual span:nth-child(4) {
  background: var(--coral);
}

.listen-controls,
.record-controls {
  gap: 10px;
}

.listen-controls button {
  flex: 1 1 140px;
}

.listen-status,
.hint {
  font-size: 12px;
  line-height: 1.5;
}

.answer-options {
  gap: 10px;
}

.answer-options button,
.quiz-options button {
  min-height: 50px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

.answer-options button:hover,
.quiz-options button:hover {
  border-color: rgb(18 102 85 / 0.34);
  background: var(--surface-soft);
}

.comprehension-feedback,
.translation-block,
.focus-block,
.low-confidence-banner,
.upload-state,
.quiz-feedback,
.sample-notice,
.prerequisite-note {
  border: 0;
  border-left: 3px solid var(--green);
  border-radius: 0 6px 6px 0;
  background: var(--green-soft);
}

.focus-block {
  border-left-color: var(--yellow);
  background: var(--yellow-soft);
}

.low-confidence-banner,
.upload-state.error,
.quiz-feedback[data-correct="false"] {
  border-left-color: var(--coral);
  background: var(--coral-soft);
}

.passage-heading h2 {
  font-size: 21px;
}

.chinese-passage {
  margin-top: 20px;
  color: var(--text);
  font-family: "Songti SC", "Microsoft YaHei", "SimSun", serif;
  font-size: 22px;
  line-height: 1.85;
}

.pinyin {
  color: var(--coral);
  font-size: 14px;
}

.vocabulary-list article,
.communication-list article,
.comparison-list article,
.stack .info-item {
  border-color: var(--line);
}

.tag-list span {
  border: 1px solid rgb(18 102 85 / 0.11);
  color: var(--green-dark);
  background: var(--green-soft);
}

.timer,
.score-hero,
.lesson-score,
.today-progress strong,
.metric-grid strong,
.learning-overview strong,
.status-strip strong,
.character-status-summary strong {
  font-variant-numeric: tabular-nums;
}

#daily-meter,
#meter {
  height: 78px;
  border-radius: 8px;
  background: #152824;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
}

.metric-grid > div,
.dimension-card,
.progress-summary article {
  border: 0;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgb(18 37 33 / 0.06);
}

.technical-details {
  border-color: var(--line);
  background: var(--surface-soft);
}

.technical-details summary {
  min-height: 44px;
}

/* Bookshelf */
.bookshelf-section-heading {
  margin-bottom: 10px;
}

.current-learning-section,
.recommended-book-section {
  margin: 18px 0;
}

.current-learning-card,
.recommended-book-card {
  border: 0;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.recommended-book-card {
  border-left-color: var(--yellow);
}

.book-progress-line,
.study-track,
.progress-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
}

.book-progress-line span,
.study-track span,
.progress-track span {
  border-radius: inherit;
  background: var(--green);
}

.book-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 12px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.book-category-tabs button {
  min-width: 0;
  min-height: 46px;
  border: 0;
  padding: 7px 6px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  line-height: 1.25;
}

.book-category-tabs button[aria-selected="true"] {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.bookshelf-filters {
  grid-template-columns: 1fr;
  gap: 9px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.bookshelf-filters label {
  gap: 5px;
}

.bookshelf-filters label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.bookshelf-filters select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 36px 0 12px;
  color: var(--text);
  background-color: var(--surface);
  font-size: 13px;
}

.bookshelf-list,
.chapter-list,
.lesson-list,
.book-progress-list {
  gap: 10px;
}

.book-row {
  gap: 13px;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-border);
  transition-property: box-shadow, translate;
  transition-duration: 150ms;
}

.book-row:hover {
  translate: 0 -1px;
  box-shadow: var(--shadow-border-hover);
}

.book-cover {
  width: 96px;
  min-height: 136px;
  border: 0;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.16);
}

.book-cover.cover-jade {
  background: #145c4e;
}

.book-cover.cover-coral {
  background: #a94738;
}

.book-cover.cover-ink {
  background: #2f4640;
}

.book-cover.cover-gold {
  color: #28200e;
  background: #d6a83b;
}

.book-cover.cover-blue {
  background: #376b82;
}

.book-cover small,
.book-cover strong {
  color: inherit;
}

.book-cover strong {
  font-family: "Songti SC", "Microsoft YaHei", serif;
  font-size: 19px;
  line-height: 1.35;
}

.book-copy h2,
.book-copy h3 {
  margin-bottom: 4px;
}

.book-copy p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.book-meta,
.sample-badge,
.content-status-badge {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.book-stat-grid span {
  color: var(--muted);
  font-size: 10px;
}

.book-stat-grid strong {
  font-variant-numeric: tabular-nums;
}

.book-row-actions button {
  min-height: 44px;
}

.book-detail-head {
  gap: 14px;
}

.book-detail-head > .book-cover {
  width: 100px;
  min-height: 146px;
}

.back-link {
  min-height: 44px;
  margin-bottom: 14px;
  padding-right: 13px;
  padding-left: 11px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.chapter-block {
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.lesson-row {
  min-height: 64px;
  border-color: var(--line);
  box-shadow: none;
}

.lesson-order {
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.lesson-order .lucide-icon {
  width: 17px;
  height: 17px;
}

.row-arrow {
  width: 18px;
  height: 18px;
  color: #8a9995;
}

/* Lesson and review */
.lesson-toolbar {
  position: sticky;
  z-index: 10;
  top: calc(62px + env(safe-area-inset-top));
  margin: -22px -16px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.96);
  backdrop-filter: blur(12px);
}

.lesson-toolbar > span {
  min-width: 46px;
  font-variant-numeric: tabular-nums;
}

.study-track {
  height: 5px;
  margin-bottom: 12px;
}

.study-step-label {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.scene-stage,
.character-stage,
.quiz-stage,
.lesson-result,
.usage-section,
.language-focus-stage,
.shadowing-stage {
  padding: 18px;
}

.scene-zh,
.quiz-hanzi,
.hanzi-speaker {
  font-family: "Songti SC", "Microsoft YaHei", "SimSun", serif;
}

.scene-zh {
  font-size: 25px;
}

.dialogue-turn,
.usage-row,
.focus-vocabulary-list article,
.shadowing-list article {
  border-color: var(--line);
}

.dialogue-turn > span,
.shadowing-list article > span {
  border-radius: 8px;
  background: var(--green-soft);
}

.audio-button {
  min-height: 46px;
}

.hanzi-speaker {
  position: relative;
  border: 0;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgb(18 37 33 / 0.06);
}

.hanzi-speaker small {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
}

.hanzi-speaker small .lucide-icon {
  width: 16px;
  height: 16px;
}

.usage-row .icon-button,
.focus-vocabulary-list .icon-button,
.pattern-title .icon-button,
.shadowing-list .icon-button,
.dialogue-turn .icon-button {
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: none;
}

.quiz-kind {
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.quiz-audio {
  width: 58px;
  min-width: 58px;
  height: 58px;
  color: #ffffff;
  background: var(--green);
}

.quiz-audio .lucide-icon {
  width: 24px;
  height: 24px;
}

.result-symbol {
  border-radius: 50%;
  background: var(--green);
}

.result-symbol .lucide-icon {
  width: 30px;
  height: 30px;
}

.status-strip,
.character-status-summary {
  gap: 7px;
}

.status-strip span,
.character-status-summary article {
  border: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgb(18 37 33 / 0.06);
}

/* Practice and profile */
.account-panel {
  margin-bottom: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.sync-state {
  min-width: 108px;
  justify-content: center;
  white-space: nowrap;
}

.sync-state[data-state="offline"] {
  color: var(--danger);
  background: var(--coral-soft);
}

.sync-state[data-state="syncing"] i {
  box-shadow: 0 0 0 3px rgb(209 154 38 / 0.14);
}

.sync-state[data-state="offline"] i {
  box-shadow: 0 0 0 3px rgb(201 74 56 / 0.12);
}

@media (max-width: 390px) {
  .sync-state span {
    display: inline;
  }
}

.account-summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--green);
  font-size: 14px;
  font-weight: 800;
}

.account-summary > div {
  min-width: 0;
}

.account-summary h2,
.account-summary p {
  margin-bottom: 0;
}

.account-summary h2 {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.account-summary > div > p:last-child {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.account-password-form {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  margin-top: 18px;
}

.account-password-form .auth-status {
  grid-column: 1 / -1;
  grid-row: 2;
}

.account-password-form button {
  min-width: 126px;
}

.practice-list,
.recent-learning-list {
  gap: 10px;
}

.practice-list > button {
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  min-height: 78px;
  border: 0;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-border);
}

.practice-list > button:hover {
  box-shadow: var(--shadow-border-hover);
}

.practice-list small {
  font-size: 11px;
}

.secondary-module {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.secondary-module > summary {
  min-height: 48px;
}

.learning-overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.learning-overview article {
  position: relative;
  min-height: 104px;
  border: 0;
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px rgb(18 37 33 / 0.06);
}

.learning-overview article > .lucide-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  color: var(--green);
}

.learning-overview article:nth-child(2) > .lucide-icon {
  color: var(--blue);
}

.learning-overview article:nth-child(3) > .lucide-icon {
  color: var(--coral);
}

.learning-overview article:nth-child(4) > .lucide-icon {
  color: #8a650b;
}

.learning-overview span {
  min-height: 0;
  padding-right: 22px;
}

.learning-overview strong {
  margin-top: 13px;
  font-size: 28px;
}

.progress-section {
  margin-top: 24px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 0 0;
  background: transparent;
}

.recent-learning-list article,
.progress-book-row {
  border-color: var(--line);
}

.reading-history-actions .icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: none;
}

.history-item button {
  min-height: 44px;
}

.app-toast {
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 8px;
  background: var(--text);
  box-shadow: var(--shadow-raised);
}

/* Bottom navigation */
.bottom-nav {
  min-height: calc(70px + env(safe-area-inset-bottom));
  padding: 4px 4px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 0.96);
  backdrop-filter: blur(14px);
}

.tab-button {
  display: grid;
  grid-template-rows: 27px auto;
  place-items: center;
  gap: 1px;
  min-height: 64px;
  padding: 5px 2px 3px;
  color: #74827e;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  font-weight: 680;
}

.tab-button::before {
  top: 2px;
  left: 50%;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  translate: -50% 0;
}

.tab-button .lucide-icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.tab-button.is-active {
  color: var(--green-dark);
}

.tab-button.is-active::before {
  background: var(--green);
}

.tab-button.is-active .lucide-icon {
  stroke-width: 2.2;
}

.settings-action::after {
  content: none !important;
}

@media (min-width: 640px) {
  .app-content {
    padding-right: 24px;
    padding-left: 24px;
  }

  .app-view {
    max-width: 820px;
  }

  .module-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .module-tile {
    min-height: 146px;
  }

  .bookshelf-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .learning-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .book-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .book-row > .book-cover {
    width: 112px;
    min-height: 154px;
  }
}

@media (min-width: 900px) {
  body {
    padding: 0;
  }

  .app-shell {
    min-height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  .top-bar {
    top: 0;
    padding-right: 28px;
    padding-left: 28px;
  }

  .app-content {
    width: min(100% - 176px, 1040px);
    margin-right: auto;
    margin-left: auto;
    padding-top: 34px;
    padding-right: 0;
    padding-bottom: 48px;
    padding-left: 0;
  }

  .app-view {
    max-width: 100%;
  }

  .bottom-nav {
    top: 88px;
    right: auto;
    bottom: auto;
    left: 22px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 82px;
    height: auto;
    min-height: 0;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-border);
    transform: none;
  }

  .tab-button {
    grid-template-rows: 28px auto;
    width: 66px;
    min-height: 62px;
    border-radius: 6px;
  }

  .tab-button::before {
    top: 50%;
    left: -8px;
    width: 3px;
    height: 28px;
    translate: 0 -50%;
  }

  .tab-button.is-active {
    background: var(--green-soft);
  }

  .app-toast {
    bottom: 24px;
  }

  .home-heading {
    margin-top: 4px;
  }

  .daily-card {
    padding: 24px;
  }

  .lesson-toolbar {
    top: 62px;
    margin-right: 0;
    margin-left: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .feedback-columns,
  .question-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 390px) {
  .app-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-tile {
    min-height: 136px;
  }

  .auth-gate {
    padding-right: 16px;
    padding-left: 16px;
  }

  .auth-brand {
    margin-bottom: 32px;
  }

  .account-summary {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .account-summary > button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .account-password-form {
    grid-template-columns: 1fr;
  }

  .account-password-form .auth-status {
    grid-column: auto;
    grid-row: auto;
  }

  .account-password-form button {
    width: 100%;
  }

  .metric-grid,
  .dimension-grid,
  .feedback-columns {
    grid-template-columns: 1fr;
  }

  .book-row {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 11px;
  }

  .book-row > .book-cover,
  .book-detail-head > .book-cover {
    width: 88px;
    min-height: 128px;
  }

  .book-cover strong {
    font-size: 17px;
  }

  .scene-stage,
  .character-stage,
  .quiz-stage,
  .lesson-result,
  .usage-section,
  .language-focus-stage,
  .shadowing-stage {
    padding-right: 15px;
    padding-left: 15px;
  }
}

@media (max-width: 345px) {
  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-tile {
    min-height: 108px;
  }

  .module-tile strong {
    margin-top: 10px;
  }

  .book-category-tabs button {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  button:not(:disabled):active {
    scale: 1;
  }
}
