:root {
  color-scheme: light;
  --page: #c4ceda;
  --page-deep: #aebdce;
  --surface: rgba(232, 238, 245, 0.9);
  --surface-solid: #dce4ec;
  --surface-soft: rgba(244, 247, 250, 0.7);
  --surface-hover: rgba(248, 251, 253, 0.94);
  --line: rgba(35, 69, 107, 0.16);
  --line-strong: rgba(35, 105, 204, 0.3);
  --text: #182b42;
  --muted: #526980;
  --faint: #6e8296;
  --primary: #176fe3;
  --primary-deep: #0c56bc;
  --primary-soft: rgba(23, 111, 227, 0.12);
  --cyan: #137d91;
  --cyan-soft: rgba(19, 125, 145, 0.12);
  --success: #137a61;
  --success-soft: rgba(19, 122, 97, 0.13);
  --warning: #a86813;
  --warning-soft: rgba(191, 124, 28, 0.14);
  --danger: #c73551;
  --danger-soft: rgba(199, 53, 81, 0.12);
  --shadow: 0 18px 55px rgba(21, 43, 75, 0.18);
  --small-shadow: 0 10px 28px rgba(21, 43, 75, 0.13);
  --topbar: rgba(224, 232, 241, 0.94);
  --backdrop: rgba(12, 26, 46, 0.58);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --content: 1120px;
  --tabbar-height: 70px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #07101f;
  --page-deep: #030914;
  --surface: rgba(12, 25, 46, 0.92);
  --surface-solid: #101f35;
  --surface-soft: rgba(27, 45, 72, 0.7);
  --surface-hover: rgba(31, 53, 84, 0.92);
  --line: rgba(154, 190, 235, 0.15);
  --line-strong: rgba(91, 158, 255, 0.38);
  --text: #f4f8ff;
  --muted: #b6c6d9;
  --faint: #8ca2bb;
  --primary: #6ba7ff;
  --primary-deep: #2d78e8;
  --primary-soft: rgba(93, 158, 255, 0.15);
  --cyan: #67ccdc;
  --cyan-soft: rgba(67, 181, 202, 0.14);
  --success: #64dfbd;
  --success-soft: rgba(100, 223, 189, 0.14);
  --warning: #f0b75d;
  --warning-soft: rgba(240, 183, 93, 0.14);
  --danger: #ff7d93;
  --danger-soft: rgba(255, 112, 135, 0.14);
  --shadow: 0 22px 66px rgba(0, 0, 0, 0.42);
  --small-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  --topbar: rgba(5, 12, 23, 0.94);
  --backdrop: rgba(0, 4, 12, 0.76);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 0;
  min-height: 100%;
  letter-spacing: 0;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: linear-gradient(145deg, var(--page), var(--page-deep));
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  min-width: 0;
  color: inherit;
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

button:not(:disabled),
a,
select {
  cursor: pointer;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.page-atmosphere {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--page-deep);
}

.page-atmosphere::before {
  content: "";
  position: absolute;
  inset: -3%;
  background: url("/assets/weather/sky-clear-2048.jpg") 50% 38% / cover no-repeat;
  filter: saturate(0.56) brightness(0.7);
  transform: scale(1.03);
}

.page-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(220, 230, 242, 0.24), rgba(181, 199, 220, 0.86) 54%, var(--page) 100%);
}

.page-grid {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(36, 79, 126, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 79, 126, 0.2) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 62%);
  mask-image: linear-gradient(180deg, #000, transparent 62%);
}

html[data-theme="dark"] .page-atmosphere::before {
  filter: saturate(0.58) brightness(0.21) contrast(1.15);
}

html[data-theme="dark"] .page-light {
  background: linear-gradient(180deg, rgba(3, 10, 22, 0.3), rgba(5, 15, 30, 0.87) 54%, var(--page) 100%);
}

html[data-theme="dark"] .page-grid {
  opacity: 0.2;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  box-shadow: 0 8px 25px rgba(26, 49, 78, 0.08);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
  backdrop-filter: blur(20px) saturate(1.08);
}

.topbar-inner {
  width: min(var(--content), 100%);
  min-height: 76px;
  margin: 0 auto;
  padding: 10px 24px;
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.back-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.back-link:hover {
  color: var(--primary);
}

.back-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 18px;
  line-height: 1;
}

.brand {
  width: max-content;
  max-width: 100%;
  min-height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  justify-self: start;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark,
.loading-mark {
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(113, 177, 255, 0.45);
  border-radius: 13px;
  background: linear-gradient(145deg, #559fff, #135dbd);
  box-shadow: 0 8px 20px rgba(23, 111, 227, 0.23);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
  display: grid;
  line-height: 1.25;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
}

.topbar-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.stats-pill {
  min-height: 44px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.stat {
  min-width: 54px;
  padding: 0 9px;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: baseline;
  border-right: 1px solid var(--line);
  line-height: 1.15;
}

.stat:last-child {
  border-right: 0;
}

.stat small {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
}

.stat b {
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
}

.stat i {
  margin-left: 2px;
  color: var(--faint);
  font-size: 8px;
  font-style: normal;
}

.theme-control {
  min-height: 44px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
}

.theme-control select {
  width: 82px;
  min-height: 32px;
  padding: 3px 6px;
  border: 0;
  border-radius: 9px;
  outline: 0;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
}

.mobile-theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: none;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.mobile-theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.user-chip-wrap {
  flex: 0 1 auto;
  min-width: 0;
}

.user-chip {
  max-width: 150px;
  min-height: 44px;
  padding: 6px 12px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip small {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
}

.user-chip-name {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-mobile {
  display: none;
}

.app {
  width: min(var(--content), 100%);
  min-height: calc(100dvh - 154px);
  margin: 0 auto;
  padding: 28px 24px calc(var(--tabbar-height) + 46px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 16px;
}

.app > * {
  min-width: 0;
  grid-column: 1 / -1;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-solid), var(--surface));
  box-shadow: var(--small-shadow);
}

.glass-panel,
.glass-chip {
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  backdrop-filter: blur(16px) saturate(1.05);
}

.initial-loading {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.initial-loading strong {
  display: block;
  font-size: 16px;
}

.initial-loading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.loading-mark {
  animation: loading-pulse 1.6s ease-in-out infinite;
}

@keyframes loading-pulse {
  50% { transform: scale(0.94); opacity: 0.72; }
}

.section-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
}

.muted {
  color: var(--muted);
  font-size: 11px;
}

.eyebrow,
.mode-tag,
.ai-badge,
.badge {
  width: max-content;
  max-width: 100%;
  min-height: 25px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hero-pet {
  grid-column: span 7;
  min-height: 272px;
  position: relative;
  padding: 27px 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  align-content: center;
  overflow: hidden;
}

.hero-pet::before {
  content: "TODAY";
  position: absolute;
  right: 24px;
  bottom: -20px;
  color: var(--primary-soft);
  font-size: 84px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.hero-pet > *:not(.pet-stage) {
  grid-column: 1;
  position: relative;
  z-index: 1;
}

.pet-stage {
  width: 112px;
  height: 112px;
  grid-column: 2;
  grid-row: 1 / span 8;
  align-self: center;
  justify-self: end;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 50px;
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, 0.04);
}

.pet-name {
  margin-top: 7px;
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.3;
}

.pet-greet,
.pet-meta,
.account-line {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.free-access-badge,
.free-access-note {
  width: max-content;
  max-width: 100%;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(19, 122, 97, 0.22);
  border-radius: 9px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 9px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.xp-bar,
.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(91, 116, 145, 0.18);
}

.xp-bar {
  width: min(360px, 100%);
  margin: 17px 0 7px;
}

.xp-bar > i,
.progress-track > i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-deep), var(--primary), #55b9d2);
  transition: width 0.3s ease;
}

.ai-plan {
  grid-column: span 5;
  min-height: 272px;
  display: flex;
  flex-direction: column;
}

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-lines {
  margin: 13px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.plan-lines li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.plan-lines li::before {
  content: "";
  width: 6px;
  height: 6px;
  position: absolute;
  left: 0;
  top: 0.62em;
  border-radius: 2px;
  background: var(--primary);
}

.ai-encourage {
  margin: 11px 0 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.ai-tip {
  margin-top: 9px;
  padding: 9px 11px;
  border-left: 3px solid var(--cyan);
  border-radius: 4px 9px 9px 4px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 10px;
  line-height: 1.55;
}

.notice-strip {
  padding: 14px;
  border: 1px solid rgba(19, 125, 145, 0.25);
  border-radius: var(--radius-md);
  background: var(--cyan-soft);
}

.app > .notice-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 15px;
}

.app > .notice-strip > .section-title,
.app > .notice-strip > .muted {
  grid-column: 1;
}

.app > .notice-strip > .btn {
  min-width: 190px;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.ai-plan .btn:last-child {
  margin-top: auto !important;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.action-card {
  min-height: 126px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.action-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  box-shadow: 0 10px 24px rgba(21, 43, 75, 0.1);
  transform: translateY(-2px);
}

.action-card.primary {
  border-color: rgba(23, 111, 227, 0.34);
  background: var(--primary-soft);
}

.action-card .ico {
  width: 38px;
  height: 38px;
  margin-bottom: auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--primary);
  font-size: 19px;
}

.action-card strong {
  margin-top: 15px;
  color: var(--text);
  font-size: 13px;
}

.action-card > span:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.btn,
.speak-btn,
.choice,
.mode-chip {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px;
  font-weight: 900;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover:not(:disabled),
.speak-btn:hover:not(:disabled),
.choice:hover:not(:disabled),
.mode-chip:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 8px 20px rgba(23, 111, 227, 0.25);
  color: #fff;
}

html[data-theme="dark"] .btn-primary {
  color: #fff;
}

.btn-sky,
.btn-ghost,
.speak-btn {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.btn-sky {
  border-color: rgba(19, 125, 145, 0.27);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.btn-ghost:hover:not(:disabled),
.speak-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.btn-block {
  width: 100%;
}

.btn-row {
  margin-top: 12px;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.btn-row > * {
  min-width: 0;
  flex: 1;
}

.search-input,
.spell-input,
.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: var(--surface-solid);
  color: var(--text);
}

.search-input {
  margin-top: 14px;
  padding-left: 42px;
  background-image:
    radial-gradient(circle at 20px 20px, transparent 5px, var(--faint) 5.5px, var(--faint) 7px, transparent 7.5px),
    linear-gradient(45deg, transparent 46%, var(--faint) 48%, var(--faint) 57%, transparent 59%);
  background-position: 0 2px, 27px 30px;
  background-size: 40px 40px, 8px 8px;
  background-repeat: no-repeat;
}

.search-input:focus,
.spell-input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

input::placeholder {
  color: var(--faint);
  opacity: 0.9;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding-right: 3px;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.book-item {
  min-width: 0;
  min-height: 78px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.book-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.book-item.is-on {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.book-dot {
  width: 10px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 5px;
}

.book-item > span:not(.book-dot) {
  min-width: 0;
}

.book-item strong,
.book-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-item strong {
  font-size: 12px;
  white-space: nowrap;
}

.book-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.mode-row,
.mode-chips {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mode-chip {
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.mode-chip.on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.list-card {
  min-width: 0;
  min-height: 75px;
  margin-top: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.list-card > div {
  min-width: 0;
}

.en {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.zh,
.phon {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.stage-row {
  width: 132px;
  max-width: 100%;
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.stage-cell {
  height: 4px;
  border-radius: 2px;
  background: rgba(91, 116, 145, 0.2);
}

.stage-cell.on {
  background: var(--primary);
}

.empty {
  min-height: 92px;
  padding: 20px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.me-stats {
  margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.me-stat {
  min-height: 78px;
  padding: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  border-right: 1px solid var(--line);
  text-align: center;
}

.me-stat:last-child {
  border-right: 0;
}

.me-stat b {
  color: var(--text);
  font-size: 21px;
}

.me-stat span {
  color: var(--faint);
  font-size: 9px;
}

.lesson-top {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.lesson-top .progress-track {
  flex: 1;
}

.hearts {
  min-height: 28px;
  padding: 4px 9px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(19, 125, 145, 0.24);
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.mode-tag {
  margin: 10px auto 0;
  display: flex;
}

.combo,
.feedback {
  min-height: 27px;
  margin-top: 6px;
  display: grid;
  place-items: center;
  color: var(--success);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.feedback.bad {
  color: var(--danger);
}

.word-art,
.word-bubble {
  width: min(620px, 100%);
  min-height: 166px;
  margin: 11px auto 0;
  padding: 22px;
  display: grid;
  place-items: center;
  align-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  text-align: center;
}

.word-art .emoji,
.word-art > span:first-child {
  font-size: 47px;
  line-height: 1.2;
}

.word-art-img-wrap {
  width: min(300px, 100%);
  aspect-ratio: 3 / 2;
  margin-bottom: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
}

.word-art-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.word-art-img.photo {
  object-fit: cover;
}

.word-art .en,
.word-bubble .en {
  max-width: 100%;
  font-size: 30px;
  text-align: center;
}

.zh-big {
  max-width: 100%;
  color: var(--text);
  font-size: 23px;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.word-meta,
.cloze-line,
.spell-hint-ok {
  width: min(620px, 100%);
  margin: 10px auto 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.result-big {
  width: min(680px, 100%);
  min-height: 410px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.result-big > .emoji {
  width: 84px;
  height: 84px;
  margin-bottom: 15px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--primary-soft);
  font-size: 42px;
}

.result-big h2 {
  font-size: 25px;
}

.result-big > .muted {
  margin-top: 5px;
}

.reward-row {
  margin: 18px 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reward-row span {
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.stage-hint {
  margin-bottom: 15px;
  text-align: center;
}

.estimate-num {
  margin: 15px 0 8px;
  color: var(--primary);
  font-size: 42px;
  font-weight: 900;
  line-height: 1.15;
}

.meta-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.meta-row:last-child {
  border-bottom: 0;
}

.meta-k {
  color: var(--faint);
  font-size: 9px;
  font-weight: 900;
}

.meta-v {
  min-width: 0;
  color: var(--text);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.mnemonic {
  color: var(--cyan);
}

.speak-btn {
  width: min(250px, 100%);
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.choices {
  width: min(700px, 100%);
  min-height: 116px;
  margin: 13px auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
}

.choice {
  min-height: 54px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  text-align: left;
  overflow-wrap: anywhere;
}

.choice:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.choice.ok,
.choice.correct,
.choice[data-result="correct"] {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.choice.bad,
.choice.wrong,
.choice[data-result="wrong"] {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.spell-input {
  width: min(620px, 100%);
  min-height: 56px;
  margin: 13px auto 0;
  display: block;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.spell-input.ok {
  border-color: var(--success);
  background: var(--success-soft);
}

.spell-input.bad {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-wrong-banner {
  width: min(620px, 100%);
  margin: 10px auto 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 4px 10px 10px 4px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-weight: 800;
}

.grid-row {
  width: min(620px, 100%);
  margin: 13px auto 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.grid-cell {
  min-height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--faint);
  font-size: 8px;
  font-weight: 900;
}

.grid-cell.on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.grid-cell.done {
  border-color: rgba(19, 122, 97, 0.24);
  background: var(--success-soft);
  color: var(--success);
}

.cloze-line {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

.spell-hint-ok {
  border-color: rgba(19, 122, 97, 0.25);
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  text-align: center;
}

.tabbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(680px, calc(100% - 28px));
  min-height: var(--tabbar-height);
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--topbar);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  backdrop-filter: blur(22px) saturate(1.12);
}

.tab {
  min-width: 0;
  min-height: 56px;
  padding: 5px 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.tab:hover,
.tab.is-on {
  background: var(--surface-soft);
  color: var(--primary);
}

.tab-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 7px 17px rgba(23, 111, 227, 0.24);
}

.tab-primary:hover,
.tab-primary.is-on {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

body[data-words-view="lesson"] .tabbar,
body[data-words-view="test"] .tabbar {
  display: none;
}

body[data-words-view="lesson"] .app,
body[data-words-view="test"] .app {
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

body[data-words-view="lesson"] .toast,
body[data-words-view="test"] .toast {
  bottom: max(20px, env(safe-area-inset-bottom));
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(var(--tabbar-height) + max(27px, env(safe-area-inset-bottom)));
  width: max-content;
  max-width: calc(100% - 32px);
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
}

.modal {
  position: fixed;
  z-index: 70;
  inset: 0;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.modal-card {
  width: min(470px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 23px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-solid), var(--surface));
  box-shadow: var(--shadow);
}

.modal-symbol {
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}

.modal-card > h2,
.dialog-head h2 {
  font-size: 18px;
  line-height: 1.35;
}

.modal-card > p {
  margin: 8px 0 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.dialog-head .eyebrow {
  margin-bottom: 7px;
}

.icon-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 23px;
  line-height: 1;
}

.dialog-intro {
  margin: 12px 0 17px !important;
}

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

.field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.field > small {
  color: var(--faint);
  font-size: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-message {
  min-height: 23px;
  margin: 8px 0 2px;
  color: var(--danger);
  font-size: 10px;
}

.noscript-note {
  margin: 25px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--danger);
}

@media (max-width: 930px) {
  .topbar-inner {
    grid-template-columns: auto minmax(170px, 1fr) auto;
    gap: 12px;
  }

  .theme-control > span,
  .stats-pill .stat small,
  .stats-pill .stat i {
    display: none;
  }

  .stat {
    min-width: 37px;
    display: block;
    padding: 0 7px;
    text-align: center;
  }

  .hero-pet,
  .ai-plan {
    grid-column: 1 / -1;
    min-height: 0;
  }

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

@media (max-width: 700px) {
  :root {
    --tabbar-height: 66px;
  }

  .topbar-inner {
    min-height: 68px;
    padding: 9px 16px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .back-link > span:last-child,
  .brand-copy small,
  .theme-control,
  .stats-pill {
    display: none;
  }

  .mobile-theme-toggle {
    display: grid;
  }

  .brand {
    justify-self: start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .user-chip {
    max-width: 116px;
    min-height: 40px;
    padding: 5px 9px;
  }

  .app {
    min-height: calc(100dvh - 136px);
    padding: 17px 16px calc(var(--tabbar-height) + 38px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .panel {
    padding: 17px;
    border-radius: 16px;
  }

  .app > .notice-strip {
    grid-template-columns: 1fr;
  }

  .app > .notice-strip > .section-title,
  .app > .notice-strip > .muted,
  .app > .notice-strip > .btn {
    min-width: 0;
    grid-column: 1;
    grid-row: auto;
  }

  .hero-pet {
    padding: 20px;
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .hero-pet::before {
    right: 10px;
    font-size: 58px;
  }

  .pet-stage {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    font-size: 34px;
  }

  .pet-name {
    font-size: 22px;
  }

  .book-list {
    grid-template-columns: 1fr;
  }

  .book-list {
    max-height: none !important;
  }

  .lesson-top {
    align-items: flex-start;
  }

  .word-art,
  .word-bubble {
    min-height: 148px;
    padding: 17px;
  }

  .word-art .en,
  .word-bubble .en {
    font-size: 26px;
  }

  .choices {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .choice {
    min-height: 50px;
  }

  .tabbar {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    padding: 5px;
    border-radius: 17px;
  }

  .tab {
    min-height: 54px;
    border-radius: 12px;
  }

  .toast {
    bottom: calc(var(--tabbar-height) + max(17px, env(safe-area-inset-bottom)));
  }
}

@media (max-width: 430px) {
  .topbar-inner {
    gap: 8px;
    padding-inline: 11px;
  }

  .back-icon {
    width: 38px;
    height: 38px;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    font-size: 12px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .user-chip {
    max-width: 72px;
    width: 72px;
    font-size: 9px;
    text-align: center;
  }

  .user-chip small,
  .user-chip-name {
    display: none;
  }

  .user-chip-mobile {
    display: block;
  }

  .app {
    padding-inline: 11px;
  }

  .panel {
    padding: 15px;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .action-card {
    min-height: 115px;
    padding: 12px;
  }

  .hero-pet {
    grid-template-columns: 1fr;
  }

  .hero-pet > *:not(.pet-stage) {
    grid-column: 1;
  }

  .pet-stage {
    display: none;
  }

  .free-access-badge,
  .free-access-note {
    width: 100%;
  }

  .btn-row {
    flex-direction: column;
  }

  .me-stats {
    grid-template-columns: 1fr;
  }

  .me-stat {
    min-height: 62px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .me-stat:last-child {
    border-bottom: 0;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .grid-row {
    gap: 3px;
  }

  .grid-cell {
    min-height: 29px;
    padding-inline: 2px;
    font-size: 7px;
  }

  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card {
    max-height: calc(100dvh - 24px);
    padding: 18px;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .panel,
  .tabbar,
  .modal-card,
  .book-item,
  .action-card,
  .choice,
  .btn,
  .speak-btn {
    border: 1px solid ButtonText;
  }
}
