/* ==========================================================================
   ภาษาไทย · 泰语学习 App
   Design tokens follow the supplied product specification.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-soft: #f4f5f1;
  --surface-tint: #f0f6f2;
  --primary: #0e8a5f;
  --primary-deep: #08734f;
  --primary-soft: #e3f4ec;
  --ink: #1f2328;
  --ink-2: #5c6470;
  --ink-3: #8b94a1;
  --line: #eceef1;
  --border: #d9dddf;
  --tone: #d97706;
  --tone-soft: #fff5e6;
  --danger: #d63b2f;
  --danger-soft: #fceae7;
  --gold: #bd8b2f;
  --gold-soft: #fbf2dc;
  --blue: #4f7899;
  --blue-soft: #eaf2f8;
  --orange: #c47425;
  --orange-soft: #fbefe1;
  --slate: #68727f;
  --slate-soft: #edf0f3;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 20px;
  --r-card: 16px;
  --shadow-xs: 0 1px 2px rgba(25, 38, 31, 0.03);
  --shadow-sm: 0 6px 20px rgba(25, 47, 36, 0.06);
  --shadow: 0 18px 44px rgba(20, 49, 35, 0.11);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-height: 64px;
  --tabbar-space: calc(var(--tab-height) + var(--safe-bottom));
  --font-thai: "Leelawadee UI", "Noto Sans Thai", Tahoma, "Segoe UI", sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Leelawadee UI", "Noto Sans Thai",
    Tahoma, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC",
    "Noto Sans SC", "Microsoft YaHei", "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-soft: #242424;
  --surface-tint: #18271f;
  --primary: #0e8a5f;
  --primary-deep: #0b6c4b;
  --primary-soft: #173d2f;
  --ink: #e6e6e6;
  --ink-2: #aab2bc;
  --ink-3: #7c8692;
  --line: #2b2b2b;
  --border: #3a3a3a;
  --tone-soft: #322615;
  --danger-soft: #341c19;
  --gold-soft: #2d2718;
  --blue-soft: #1b262e;
  --orange-soft: #2f2418;
  --slate-soft: #26292c;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.24);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e9efe9;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

[data-theme="dark"] html,
html[data-theme="dark"] {
  background: #090b0a;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.9), transparent 32%),
    radial-gradient(circle at 93% 94%, rgba(132, 183, 155, 0.22), transparent 36%),
    #e8efe9;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 5%, rgba(14, 138, 95, 0.08), transparent 30%),
    #090b0a;
}

::selection {
  color: #fff;
  background: var(--primary);
}

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

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

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

img,
svg {
  display: block;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

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

.icon {
  flex: none;
}

.app-shell {
  position: relative;
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: clip;
}

#view {
  min-height: 100dvh;
}

#view > section {
  animation: page-enter 0.32s cubic-bezier(0.22, 0.8, 0.35, 1);
}

#view > .lesson-page,
#view > .dialogue-page {
  animation: fade-enter 0.24s ease both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (min-width: 780px) {
  .app-shell {
    box-shadow: 0 0 0 1px rgba(26, 50, 38, 0.04), 0 30px 80px rgba(21, 54, 38, 0.13);
  }
}

/* -------------------------------------------------------------------------- */
/* Type & primitives                                                          */
/* -------------------------------------------------------------------------- */

.tone {
  color: var(--tone);
  font-weight: 760;
}

.eyebrow {
  display: inline-block;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 12px;
}

.section-heading h2 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.section-heading h2 .icon {
  color: var(--primary);
}

.section-hint {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.text-link-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

/* Buttons */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-m);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0.01em;
  transition:
    transform 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.48;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 9px 20px rgba(14, 138, 95, 0.2);
}

.btn-primary:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
}

.btn-soft {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn-soft:hover {
  background: var(--line);
}

.btn-ghost {
  color: var(--ink-2);
  background: transparent;
  border-color: var(--border);
}

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

.btn-block {
  width: 100%;
}

.btn.is-loading {
  gap: 10px;
}

.button-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease,
    color 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: transparent;
}

.text-button {
  min-height: 40px;
  padding: 4px 2px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 620;
}

.text-button.is-primary {
  color: var(--primary);
  font-weight: 700;
}

.text-button.is-danger {
  color: var(--danger);
  padding-inline: 10px;
}

.inline-link {
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  font-weight: 650;
}

.hidden {
  display: none !important;
}

/* Audio */

.audio-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--audio-size, 40px);
  height: var(--audio-size, 40px);
  padding: 0;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.audio-button:active {
  transform: scale(0.91);
}

.audio-button:hover {
  background: var(--primary-soft);
  border-color: transparent;
}

.audio-button-solid {
  color: #fff;
  background: var(--primary);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(14, 138, 95, 0.24);
}

.audio-button-solid:hover {
  color: #fff;
  background: var(--primary-deep);
}

/* Tags, labels, avatars */

.word-pos {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 1px 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 9px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.subtle-tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 9px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--avatar-size, 64px);
  height: var(--avatar-size, 64px);
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: calc(var(--avatar-size, 64px) * 0.3);
  font-weight: 760;
  letter-spacing: 0.02em;
}

/* Progress */

.linear-progress {
  position: relative;
  width: 100%;
  height: var(--progress-height, 6px);
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.linear-progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 0.35s cubic-bezier(0.22, 0.8, 0.35, 1);
}

.linear-progress.on-green {
  background: rgba(255, 255, 255, 0.32);
}

.linear-progress.on-green > span {
  background: #fff;
}

.progress-ring {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: var(--ring-size, 52px);
  height: var(--ring-size, 52px);
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--ring-fill), var(--line) 0);
  transition: background 0.3s ease;
}

.progress-ring-inner {
  display: grid;
  place-items: center;
  width: calc(var(--ring-size, 52px) - var(--ring-stroke, 4px) * 2);
  height: calc(var(--ring-size, 52px) - var(--ring-stroke, 4px) * 2);
  color: var(--primary);
  background: var(--surface);
  border-radius: 50%;
}

.progress-ring-inner strong {
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}

/* Avatars / switches / misc */

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 27px;
  padding: 0;
  background: var(--border);
  border: 0;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s cubic-bezier(0.22, 0.8, 0.35, 1);
}

.switch.is-on {
  background: var(--primary);
}

.switch.is-on::after {
  transform: translateX(17px);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  color: #bcc4c0;
  background: var(--surface-soft);
  border-radius: 50%;
}

.empty-state h3 {
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.empty-state p {
  max-width: 300px;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.7;
}

.empty-state .btn {
  min-height: 46px;
  margin-top: 20px;
  padding-inline: 22px;
  font-size: 14px;
}

/* Top navigation */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  min-height: calc(56px + var(--safe-top));
  padding: calc(6px + var(--safe-top)) 10px 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.top-bar-side {
  display: flex;
  align-items: center;
  min-width: 44px;
}

.top-bar-right {
  justify-content: flex-end;
}

.top-bar .icon-btn {
  width: 42px;
  height: 42px;
  background: transparent;
  border-color: transparent;
}

.top-bar .icon-btn:hover {
  background: var(--primary-soft);
}

.top-bar-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-spacer {
  display: block;
  width: 42px;
  height: 42px;
}

.top-bar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-right: 8px;
  padding: 2px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Tabbar */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 680px);
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding: 5px 8px calc(5px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 34px rgba(28, 49, 38, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateX(-50%);
}

.tabbar.is-hidden {
  display: none;
}

.tab-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  color: var(--ink-3);
  border-radius: 14px;
  transition: color 0.16s ease;
}

.tab-item:active {
  transform: scale(0.96);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  border-radius: 10px;
  transition:
    color 0.16s ease,
    background-color 0.16s ease;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.tab-item.is-active {
  color: var(--primary);
}

.tab-item.is-active .tab-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.tab-item.is-active .tab-label {
  font-weight: 700;
}

/* Toast */

.toast-root {
  position: fixed;
  top: 18%;
  left: 50%;
  z-index: 300;
  width: min(calc(100% - 40px), 420px);
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 11px 16px;
  color: #fff;
  background: rgba(31, 35, 40, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-5px) scale(0.98);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  backdrop-filter: blur(12px);
}

.toast.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-dot {
  flex: none;
  width: 6px;
  height: 6px;
  background: #7ed7b3;
  border-radius: 50%;
}

.toast-success .toast-dot {
  background: #7ed7b3;
}

.toast-error .toast-dot {
  background: #ff8a7d;
}

/* Dialogs & sheets */

.dialog-layer,
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 24px;
}

.dialog-backdrop,
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 22, 16, 0.46);
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  width: min(100%, 360px);
  padding: 24px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.dialog-layer.is-open .dialog-backdrop,
.sheet-layer.is-open .sheet-backdrop {
  opacity: 1;
}

.dialog-layer.is-open .dialog-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dialog-card h3 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.4;
}

.dialog-card p {
  margin-top: 9px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-line;
}

.dialog-field {
  display: block;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 620;
}

.dialog-input {
  display: block;
  width: 100%;
  height: 49px;
  margin-top: 7px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  outline: 0;
  font-size: 16px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.dialog-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.09);
}

.dialog-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(214, 59, 47, 0.09);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.dialog-actions .btn {
  min-height: 46px;
  padding-inline: 18px;
  font-size: 15px;
}

.sheet-layer {
  align-items: end;
  padding: 0;
}

.bottom-sheet {
  position: relative;
  width: min(100%, 560px);
  max-height: 84dvh;
  overflow: hidden auto;
  padding: 0 20px calc(20px + var(--safe-bottom));
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.sheet-layer.is-open .bottom-sheet {
  opacity: 1;
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 10px auto 4px;
  background: var(--border);
  border-radius: 999px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
}

.sheet-head h3 {
  font-size: 18px;
  font-weight: 750;
}

/* Splash */

.splash-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.13), transparent 30%),
    radial-gradient(circle at 80% 84%, rgba(217, 119, 6, 0.18), transparent 36%),
    var(--primary);
  cursor: pointer;
}

.splash-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.13) 0.8px, transparent 0.8px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, transparent 8%, #000 40%, transparent 94%);
  opacity: 0.35;
}

.splash-decoration {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.splash-decoration-a {
  top: -110px;
  right: -100px;
  width: 340px;
  height: 340px;
}

.splash-decoration-b {
  bottom: -140px;
  left: -100px;
  width: 360px;
  height: 360px;
  background: rgba(255, 255, 255, 0.035);
}

.splash-script {
  position: absolute;
  top: 20%;
  left: 50%;
  color: rgba(255, 255, 255, 0.06);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(120px, 38vw, 260px);
  font-style: italic;
  line-height: 1;
  transform: translateX(-50%) rotate(-7deg);
  pointer-events: none;
}

.splash-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -30px;
  animation: splash-in 0.8s cubic-bezier(0.22, 0.8, 0.35, 1) both;
}

.splash-logo {
  width: 96px;
  height: 96px;
  padding: 0;
  border-radius: 28px;
  box-shadow:
    0 22px 50px rgba(4, 43, 29, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.splash-brand {
  margin-top: 26px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.35;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
}

.splash-tagline {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.splash-bottom {
  position: absolute;
  bottom: calc(38px + var(--safe-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateX(-50%);
}

.splash-line {
  width: 18px;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Onboarding */

.onboarding-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(8px + var(--safe-top)) 20px calc(18px + var(--safe-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 7%, rgba(227, 244, 236, 0.9), transparent 28%),
    var(--bg);
}

.onboarding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.onboarding-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.onboarding-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}

.onboarding-brand strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 0.03em;
}

.onboarding-viewport {
  display: flex;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  flex: 1;
}

.onboarding-track {
  display: flex;
  flex: 1;
  width: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 0.8, 0.35, 1);
  will-change: transform;
}

.onboarding-slide {
  display: flex;
  flex: 0 0 100%;
  width: 100%;
  align-self: stretch;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 0 16px;
}

.onboarding-art {
  position: relative;
  width: min(280px, 82vw);
  margin: 0 auto;
  border-radius: var(--r-l);
  box-shadow: 0 24px 50px rgba(37, 69, 51, 0.11);
}

.onboarding-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-l);
}

.onboarding-art-tag {
  position: absolute;
  right: 14px;
  bottom: 13px;
  padding: 4px 8px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(27, 42, 34, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  backdrop-filter: blur(10px);
}

.onboarding-copy {
  width: min(100%, 330px);
  margin-top: 30px;
  text-align: center;
}

.onboarding-copy .eyebrow {
  color: var(--primary);
  letter-spacing: 0.17em;
}

.onboarding-copy h1 {
  margin-top: 9px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.38;
  letter-spacing: -0.01em;
}

.onboarding-copy p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.65;
}

.onboarding-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
}

.dot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 16px;
}

.dot {
  position: relative;
  width: 8px;
  height: 8px;
  padding: 0;
  background: #d9dddf;
  border: 0;
  border-radius: 999px;
  transition:
    width 0.2s ease,
    background-color 0.2s ease;
}

.dot::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

.dot.is-active {
  width: 22px;
  background: var(--primary);
}

.onboarding-next {
  width: 100%;
}

.onboarding-login {
  min-height: 32px;
  padding: 7px 10px;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.onboarding-login span {
  color: var(--primary);
  font-weight: 700;
}

/* Auth */

.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(14px + var(--safe-top)) 22px calc(18px + var(--safe-bottom));
  background:
    radial-gradient(circle at 106% -6%, rgba(227, 244, 236, 0.94), transparent 34%),
    radial-gradient(circle at -8% 92%, rgba(255, 245, 230, 0.7), transparent 25%),
    var(--bg);
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.auth-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
}

.auth-brand > span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.auth-brand strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
  letter-spacing: 0.03em;
}

.auth-brand small {
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.auth-step {
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.auth-main {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: clamp(24px, 8vh, 62px) 0 16px;
}

.auth-heading .eyebrow {
  color: var(--primary);
  letter-spacing: 0.14em;
}

.auth-heading h1 {
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.auth-heading p {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 28px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 620;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.input-shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.09);
}

.input-shell > .icon {
  color: var(--ink-3);
}

.input-shell input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
}

.input-shell input::placeholder {
  color: var(--ink-3);
}

.input-action {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.input-action:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.form-message {
  padding: 9px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.form-message.is-shaking {
  animation: shake 0.32s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(3px);
  }
}

.auth-submit {
  margin-top: 2px;
}

.auth-local-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.4;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 5px 0 1px;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.third-party-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.third-party {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  font-size: 13px;
  font-weight: 600;
}

.third-party:active {
  transform: scale(0.98);
}

.third-party-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
}

.third-party-icon.wechat {
  color: #199841;
  background: #e8f7ed;
}

.third-party-icon.apple {
  color: var(--ink);
  background: var(--surface-soft);
}

.third-party.is-coming {
  position: relative;
  color: var(--ink-3);
  opacity: 0.72;
}

.third-party.is-coming small {
  position: absolute;
  top: 5px;
  right: 8px;
  color: var(--tone);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .third-party-icon.apple {
  color: #fff;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 22px;
  color: var(--ink-3);
  font-size: 13px;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 700;
}

.guest-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  font-size: 12px;
}

.guest-link span {
  color: var(--primary);
  font-size: 15px;
  line-height: 1;
}

.auth-footer {
  margin-top: auto;
  padding-top: 22px;
  text-align: center;
}

.auth-footer p {
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.7;
}

/* -------------------------------------------------------------------------- */
/* Home                                                                       */
/* -------------------------------------------------------------------------- */

.home-page {
  padding-bottom: calc(94px + var(--safe-bottom));
}

.home-hero {
  position: relative;
  overflow: hidden;
  padding: calc(14px + var(--safe-top)) 20px 50px;
  color: #fff;
  background:
    radial-gradient(circle at 86% -15%, rgba(255, 255, 255, 0.15), transparent 36%),
    linear-gradient(145deg, #0f8f62 0%, #0e8a5f 54%, #0b7c55 100%);
  border-radius: 0 0 24px 24px;
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -92px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  box-shadow:
    0 0 0 34px rgba(255, 255, 255, 0.026),
    0 0 0 76px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.hero-glow-a {
  top: 56px;
  left: -26px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.035);
}

.hero-glow-b {
  right: 20%;
  bottom: 28px;
  width: 70px;
  height: 70px;
  background: rgba(217, 119, 6, 0.08);
}

.home-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.home-wordmark .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1);
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.hero-icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  transition: background-color 0.15s ease;
}

.hero-icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.home-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.02em;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1);
}

.home-greeting {
  position: relative;
  z-index: 1;
  margin-top: 28px;
}

.greeting-eyebrow {
  color: rgba(255, 255, 255, 0.78);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.home-greeting h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 780;
  line-height: 1.38;
  letter-spacing: -0.02em;
}

.home-greeting h1 span {
  display: inline;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  margin-top: 10px;
  padding: 3px 10px 3px 8px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
}

.streak-chip .icon {
  color: #f7c777;
  fill: rgba(247, 199, 119, 0.18);
}

.streak-chip strong {
  font-size: 14px;
  font-weight: 780;
}

.home-progress {
  position: relative;
  z-index: 1;
  margin-top: 24px;
}

.home-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
}

.home-progress-meta strong {
  color: #fff;
  font-size: 12px;
  font-weight: 650;
}

.home-body {
  position: relative;
  z-index: 2;
  margin-top: -32px;
  padding: 0 16px;
}

.continue-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.continue-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.continue-number {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 58px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 13px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.continue-number small {
  margin-bottom: 4px;
  color: var(--primary);
  font-family: var(--font);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.12em;
  opacity: 0.7;
}

.continue-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.card-kicker {
  color: var(--ink-3);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.continue-title {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 760;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-sub {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.continue-progress-track {
  flex: 1;
  height: 4px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.continue-progress-track i {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.continue-progress-row em {
  color: var(--ink-3);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.continue-arrow {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink-3);
  border-radius: 50%;
}

.continue-card:hover .continue-arrow {
  color: var(--primary);
  background: var(--primary-soft);
}

.home-modules {
  margin-top: 25px;
}

.ops-banner {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 15px;
  padding: 13px 36px 13px 13px;
  background:
    linear-gradient(135deg, rgba(227, 244, 236, 0.75), transparent 70%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.ops-banner.tone-success {
  background:
    linear-gradient(135deg, rgba(227, 244, 236, 0.95), transparent 72%),
    var(--surface);
}

.ops-banner.tone-promo {
  background:
    linear-gradient(135deg, rgba(255, 245, 230, 0.95), transparent 72%),
    var(--surface);
  border-color: rgba(217, 119, 6, 0.18);
}

.ops-banner-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--primary);
  background: var(--surface);
  border-radius: 9px;
  box-shadow: var(--shadow-xs);
}

.ops-banner.tone-promo .ops-banner-icon {
  color: var(--tone);
}

.ops-copy {
  min-width: 0;
  flex: 1;
}

.ops-kicker {
  display: block;
  color: var(--ink-3);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.ops-copy strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.ops-copy p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 10.5px;
  line-height: 1.55;
}

.ops-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  align-self: center;
  gap: 2px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.ops-banner.tone-promo .ops-link {
  color: var(--tone);
}

.ops-close {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.ops-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

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

.module-card {
  position: relative;
  display: flex;
  min-height: 102px;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
}

.module-card:hover {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  transform: translateY(-1px);
}

.module-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.module-icon.tone-green {
  color: var(--primary);
  background: var(--primary-soft);
}

.module-icon.tone-orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.module-icon.tone-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.module-icon.tone-gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.module-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.module-copy strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.4;
}

.module-copy small {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-arrow {
  position: absolute;
  top: 17px;
  right: 13px;
  color: var(--ink-3);
}

.review-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 13px;
  background:
    linear-gradient(135deg, rgba(255, 245, 230, 0.88), transparent 72%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--tone) 18%, var(--line));
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.review-strip-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--tone);
  background: var(--surface);
  border-radius: 10px;
}

.review-strip-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.review-strip-copy strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.review-strip-copy small {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-strip-arrow {
  display: grid;
  flex: none;
  place-items: center;
  color: var(--tone);
}

.daily-card {
  position: relative;
  margin-top: 22px;
  overflow: hidden;
  padding: 19px 18px 17px;
  background:
    linear-gradient(145deg, rgba(227, 244, 236, 0.7), transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-xs);
}

.daily-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  width: 34px;
  height: 3px;
  background: var(--tone);
  border-radius: 0 0 3px 3px;
}

.daily-mark {
  position: absolute;
  top: 4px;
  right: 17px;
  color: var(--primary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 90px;
  line-height: 1;
  opacity: 0.06;
  pointer-events: none;
}

.daily-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.daily-head .eyebrow {
  display: block;
  color: var(--primary);
  font-size: 9px;
}

.daily-vi {
  margin-top: 9px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 780;
  line-height: 1.42;
  letter-spacing: -0.015em;
}

.daily-zh {
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.daily-zh span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 450;
}

.daily-audio {
  margin-top: 4px;
}

.daily-note {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.7;
}

.daily-example {
  display: flex;
  gap: 10px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mini-line {
  display: block;
  flex: none;
  width: 3px;
  background: var(--primary);
  border-radius: 999px;
}

.daily-example p {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.daily-example small {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11px;
}

.home-footer-line {
  margin: 24px 0 2px;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* Daily tasks                                                                */
/* -------------------------------------------------------------------------- */

.subpage {
  min-height: 100dvh;
  padding-bottom: calc(28px + var(--tabbar-space));
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: calc(14px + var(--safe-top)) 18px 12px;
}

.detail-heading {
  min-width: 0;
  flex: 1;
  padding-top: 3px;
}

.detail-heading .eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-3);
  font-size: 9px;
}

.detail-heading h1 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 780;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.detail-header > .icon-btn {
  margin-top: 1px;
}

.detail-header-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 13px;
}

.tasks-page {
  padding-inline: 16px;
}

.tasks-page .detail-header {
  padding-inline: 2px;
}

.task-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(227, 244, 236, 0.82), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-sm);
}

.task-summary-copy {
  min-width: 0;
}

.task-summary-copy .eyebrow {
  color: var(--primary);
}

.task-summary-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 6px;
}

.task-summary-number strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.task-summary-number span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
}

.task-summary-copy p {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}

.task-summary-card .progress-ring {
  box-shadow: 0 0 0 5px var(--surface);
}

.task-summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 0 4px;
  color: var(--ink-3);
  font-size: 11px;
}

.task-summary-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.task-summary-meta .icon {
  color: var(--primary);
}

.task-summary-meta strong {
  color: var(--ink-2);
  font-weight: 650;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 20px;
}

.task-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.task-card.is-done {
  background: color-mix(in srgb, var(--primary-soft) 35%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 16%, var(--line));
}

.task-card.is-done .progress-ring-inner {
  color: var(--primary);
  background: var(--primary-soft);
}

.task-copy {
  min-width: 0;
  flex: 1;
}

.task-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-title-row h3 {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-reward {
  flex: none;
  color: var(--tone);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.task-copy p {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.task-check {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.task-check::before {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  border: 1.8px solid var(--border);
  border-radius: 50%;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.task-check .icon {
  position: relative;
  z-index: 1;
  transform: scale(0.8);
  transition:
    color 0.16s ease,
    transform 0.16s ease;
}

.task-check:hover::before {
  border-color: var(--primary);
}

.task-check.is-checked::before {
  background: var(--primary);
  border-color: var(--primary);
}

.task-check.is-checked .icon {
  color: #fff;
  transform: scale(1);
}

.weekly-card {
  margin-top: 24px;
  padding: 19px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-xs);
}

.weekly-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.weekly-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 3px;
}

.weekly-number strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.weekly-number span {
  color: var(--ink-2);
  font-size: 12px;
}

.weekly-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 2px 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

.weekly-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 7px;
  height: 128px;
  margin-top: 18px;
  padding-top: 10px;
}

.chart-column {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
}

.chart-value {
  min-height: 14px;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-track {
  position: relative;
  width: min(100%, 24px);
  height: 78px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.chart-track i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background: color-mix(in srgb, var(--primary) 32%, var(--primary-soft));
  border-radius: 999px;
  transition: height 0.4s ease;
}

.chart-column.is-today .chart-track i {
  background: var(--primary);
}

.chart-column.is-today .chart-label {
  color: var(--primary);
  font-weight: 750;
}

.chart-column.is-today .chart-value {
  color: var(--primary);
}

.chart-label {
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.3;
}

.weekly-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 10px;
}

.weekly-footer strong {
  color: var(--ink);
  font-weight: 700;
}

/* -------------------------------------------------------------------------- */
/* Courses                                                                    */
/* -------------------------------------------------------------------------- */

.tab-page {
  min-height: 100dvh;
  padding-bottom: calc(92px + var(--safe-bottom));
}

.tab-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: calc(24px + var(--safe-top)) 20px 16px;
}

.tab-page-head h1 {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: -0.025em;
}

.tab-page-head p {
  max-width: 330px;
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
}

.courses-page .tab-page-head h1 {
  font-size: 20px;
}

.course-count {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 2px;
  padding-bottom: 3px;
  color: var(--ink-2);
}

.course-count strong {
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.course-count span {
  color: var(--ink-3);
  font-size: 10px;
}

.filter-scroller {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 0 20px 2px;
  scrollbar-width: none;
}

.filter-scroller::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 14px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  transition:
    color 0.16s ease,
    background-color 0.16s ease;
}

.filter-pill.is-small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 11px;
}

.filter-pill.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 5px 12px rgba(14, 138, 95, 0.17);
}

.filter-pill span {
  color: currentColor;
  opacity: 0.62;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.course-groups {
  display: flex;
  flex-direction: column;
  gap: 27px;
  padding: 22px 16px 0;
}

.chapter-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
}

.chapter-rule {
  display: block;
  flex: none;
  width: 3px;
  height: 25px;
  background: var(--primary);
  border-radius: 999px;
}

.chapter-copy {
  min-width: 0;
  flex: 1;
}

.chapter-copy h2 {
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.4;
}

.chapter-copy p {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
}

.chapter-progress {
  flex: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chapter-description {
  margin: 7px 0 11px 12px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.6;
}

.course-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.course-card {
  display: block;
  padding: 15px 14px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.course-card:hover {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.course-card-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.course-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 29px;
  height: 29px;
  margin-top: 1px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
}

.course-number.is-complete {
  color: #fff;
  background: var(--primary);
}

.course-copy {
  min-width: 0;
  flex: 1;
}

.course-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.course-title-row h3 {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 710;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-status {
  flex: none;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
}

.course-status.is-current {
  color: var(--primary);
  font-weight: 700;
}

.course-status.is-done {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--primary);
  font-weight: 650;
}

.course-copy p {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-copy p span {
  color: var(--ink-3);
}

.course-chevron {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 28px;
  color: var(--ink-3);
}

.course-progress {
  margin-top: 11px;
}

.filter-empty {
  padding: 12px 16px 20px;
}

.course-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 24px 20px 0;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.course-note .icon {
  color: var(--tone);
}

/* -------------------------------------------------------------------------- */
/* Profile                                                                    */
/* -------------------------------------------------------------------------- */

.profile-page {
  padding-bottom: calc(96px + var(--safe-bottom));
}

.profile-hero {
  position: relative;
  overflow: hidden;
  padding: calc(14px + var(--safe-top)) 20px 24px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 4%, rgba(255, 255, 255, 0.15), transparent 30%),
    linear-gradient(145deg, #108f63, #0b7e57);
  border-radius: 0 0 24px 24px;
}

.profile-hero-shape {
  position: absolute;
  right: -75px;
  top: -68px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(255, 255, 255, 0.025),
    0 0 0 63px rgba(255, 255, 255, 0.018);
}

.profile-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.profile-wordmark .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.profile-topline .hero-icon-button {
  width: 38px;
  height: 38px;
}

.profile-person {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 23px;
}

.profile-avatar {
  color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.93);
  border: 3px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 9px 24px rgba(2, 42, 28, 0.2);
}

.profile-identity {
  min-width: 0;
  flex: 1;
}

.profile-greeting {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.profile-identity h1 {
  overflow: hidden;
  margin-top: 1px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 780;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-level {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
  margin-top: 4px;
  padding: 2px 9px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
}

.profile-level .icon {
  color: #b7e2cf;
}

.profile-edit {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  height: 42px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.profile-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 25px;
  padding-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.profile-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-stats > div:last-child {
  border-right: 0;
}

.profile-stats strong {
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.profile-stats span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 10px;
}

.profile-body {
  padding: 0 16px;
}

.profile-goal-card {
  position: relative;
  z-index: 2;
  margin-top: -17px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}

.profile-goal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-goal-head .eyebrow {
  color: var(--primary);
  font-size: 9px;
}

.profile-goal-head p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 11px;
}

.profile-goal-head p strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 760;
}

.profile-goal-card .linear-progress {
  margin-top: 11px;
}

.profile-goal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 10px;
}

.profile-goal-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.profile-goal-footer a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--primary);
  font-weight: 650;
}

.account-sync-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.account-sync-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 35px;
  height: 35px;
  color: var(--slate);
  background: var(--slate-soft);
  border-radius: 10px;
}

.account-sync-card.is-online .account-sync-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.account-sync-card.is-offline .account-sync-icon {
  color: var(--tone);
  background: var(--tone-soft);
}

.account-sync-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.account-sync-copy .eyebrow {
  font-size: 8px;
  letter-spacing: 0.08em;
}

.account-sync-copy strong {
  margin-top: 1px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.account-sync-copy small {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 3px;
  min-height: 31px;
  padding: 5px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-button:hover {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary));
}

.sync-button:disabled {
  opacity: 0.55;
}

.group-label {
  display: block;
  margin: 21px 3px 8px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.menu-row {
  display: flex;
  width: 100%;
  min-height: 59px;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

.menu-row:not(.is-static):hover {
  background: var(--surface-soft);
}

.menu-row.is-static {
  cursor: default;
}

.menu-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.menu-icon.tone-green {
  color: var(--primary);
  background: var(--primary-soft);
}

.menu-icon.tone-gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.menu-icon.tone-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.menu-icon.tone-orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.menu-icon.tone-slate {
  color: var(--slate);
  background: var(--slate-soft);
}

.menu-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.menu-copy strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 620;
  line-height: 1.4;
}

.menu-copy small {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.4;
}

.menu-arrow {
  display: grid;
  flex: none;
  place-items: center;
  color: var(--ink-3);
}

.preference-card .menu-row {
  min-height: 64px;
}

.preference-card .switch {
  margin-left: auto;
}

.about-row {
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.logout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 46px;
  margin-top: 19px;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 600;
}

.profile-version {
  margin-top: 11px;
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: 0.03em;
  text-align: center;
  opacity: 0.8;
}

/* -------------------------------------------------------------------------- */
/* Settings                                                                   */
/* -------------------------------------------------------------------------- */

.settings-content {
  padding: 6px 16px 24px;
}

.section-lead {
  padding: 8px 4px 18px;
}

.section-lead .eyebrow {
  color: var(--primary);
}

.section-lead h1 {
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 790;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.section-lead p {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.65;
}

.goal-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.goal-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 14px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-align: left;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.goal-card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transform: scaleY(0.4);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.goal-card.is-selected {
  background: color-mix(in srgb, var(--primary-soft) 58%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
}

.goal-card.is-selected::before {
  opacity: 1;
  transform: scaleY(1);
}

.goal-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 39px;
  height: 39px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 11px;
}

.goal-card.is-selected .goal-icon {
  color: #fff;
  background: var(--primary);
}

.goal-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.goal-copy strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.goal-copy small {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}

.goal-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  color: transparent;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 50%;
}

.goal-card.is-selected .goal-check {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.settings-card {
  margin-top: 13px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.slider-card {
  padding: 17px 16px 14px;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-card-head .eyebrow {
  display: block;
  color: var(--ink-3);
}

.slider-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}

.slider-value strong {
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.slider-value span {
  color: var(--ink-2);
  font-size: 12px;
}

.settings-hint {
  color: var(--ink-3);
  font-size: 10px;
}

.range-input {
  width: 100%;
  height: 24px;
  margin-top: 15px;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.range-input::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(
    to right,
    var(--primary) 0,
    var(--primary) var(--range-fill, 27%),
    var(--line) var(--range-fill, 27%),
    var(--line) 100%
  );
  border-radius: 999px;
}

.range-input::-moz-range-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
}

.range-input::-moz-range-progress {
  height: 6px;
  background: var(--primary);
  border-radius: 999px;
}

.range-input::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  appearance: none;
  background: var(--surface);
  border: 4px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(14, 138, 95, 0.24);
}

.range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--surface);
  border: 4px solid var(--primary);
  border-radius: 50%;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 9px;
}

.settings-row {
  display: flex;
  min-height: 63px;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

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

.settings-row-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
}

.settings-row-icon.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.settings-row-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.settings-row-copy strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 620;
  line-height: 1.4;
}

.settings-row-copy small {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
}

.time-input {
  flex: none;
  min-width: 94px;
  padding: 6px;
  color: var(--primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 650;
  text-align: right;
  outline: 0;
}

.time-input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.09);
}

.time-input::-webkit-calendar-picker-indicator {
  opacity: 0.5;
}

.danger-zone {
  margin-top: 17px;
}

.settings-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 17px;
  color: var(--ink-3);
  font-size: 10px;
  text-align: center;
}

.settings-note .icon {
  color: var(--primary);
}

/* -------------------------------------------------------------------------- */
/* Achievements                                                               */
/* -------------------------------------------------------------------------- */

.achievement-content {
  padding: 2px 16px 28px;
}

.achievement-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  padding: 21px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0, rgba(255, 255, 255, 0.16), transparent 35%),
    linear-gradient(145deg, #14593f, #0e8a5f);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-sm);
}

.achievement-hero::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -80px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.achievement-hero > div {
  position: relative;
  z-index: 1;
}

.achievement-hero .eyebrow {
  color: rgba(255, 255, 255, 0.78);
  font-size: 9px;
}

.achievement-hero h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 780;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.achievement-hero p {
  max-width: 290px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  line-height: 1.65;
}

.achievement-hero p strong {
  color: #fff;
  font-weight: 750;
}

.achievement-hero-badge {
  display: grid;
  flex: none;
  place-items: center;
  width: 70px;
  height: 70px;
  color: #f3d28b;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 22px;
  transform: rotate(4deg);
}

.achievement-overall {
  margin-top: -1px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r-card) var(--r-card);
  box-shadow: var(--shadow-xs);
}

.achievement-overall-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 11px;
}

.achievement-overall-meta strong {
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.achievement-section {
  margin-top: 23px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 155px;
  padding: 14px 8px 11px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
}

.badge-card:hover {
  transform: translateY(-2px);
}

.badge-card.is-locked {
  filter: saturate(0.15);
  opacity: 0.74;
}

.badge-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 9px;
  border-radius: 17px;
}

.badge-emblem.tone-green,
.badge-card.tone-green .badge-emblem {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge-emblem.tone-orange,
.badge-card.tone-orange .badge-emblem {
  color: var(--orange);
  background: var(--orange-soft);
}

.badge-emblem.tone-gold,
.badge-card.tone-gold .badge-emblem {
  color: var(--gold);
  background: var(--gold-soft);
}

.badge-emblem.tone-blue,
.badge-card.tone-blue .badge-emblem {
  color: var(--blue);
  background: var(--blue-soft);
}

.badge-card.is-locked .badge-emblem {
  color: #9ea6a2;
  background: #eff1ee;
}

[data-theme="dark"] .badge-card.is-locked .badge-emblem {
  color: #69726d;
  background: #282b29;
}

.badge-spark {
  position: absolute;
  right: -4px;
  top: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #fff;
  background: var(--primary);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.badge-card.is-locked .badge-spark {
  color: #8e9692;
  background: var(--surface-soft);
}

.badge-card strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 710;
  line-height: 1.4;
}

.badge-card small {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.45;
}

.badge-progress {
  width: 72%;
  height: 4px;
  margin-top: auto;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.badge-progress i {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.achievement-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 19px;
  padding: 14px;
  background: var(--tone-soft);
  border-radius: var(--r-card);
}

.tip-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--tone);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 9px;
}

[data-theme="dark"] .tip-icon {
  background: rgba(255, 255, 255, 0.06);
}

.achievement-tip div {
  flex: 1;
}

.achievement-tip strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.achievement-tip p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.55;
}

.achievement-tip a {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 3px;
  align-self: center;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* Notebook                                                                   */
/* -------------------------------------------------------------------------- */

.notebook-content {
  padding: 4px 16px 28px;
}

.notebook-page .top-bar-title {
  font-size: 20px;
}

.notebook-lead {
  padding: 7px 3px 17px;
}

.notebook-lead .eyebrow {
  color: var(--primary);
}

.notebook-lead h1 {
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.notebook-lead p {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 11px;
}

.notebook-lead p strong {
  color: var(--tone);
  font-weight: 700;
}

.notebook-filters {
  padding: 0 0 14px;
}

.notebook-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.notebook-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
}

.notebook-main {
  min-width: 0;
  flex: 1;
}

.notebook-word-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.notebook-word-row h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.35;
}

.word-due {
  padding: 1px 6px;
  color: var(--ink-3);
  background: var(--surface-soft);
  border-radius: 5px;
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.word-due.is-due {
  color: var(--tone);
  background: var(--tone-soft);
}

.notebook-reading {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 12px;
  font-style: italic;
}

.notebook-meaning {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.notebook-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.notebook-side .audio-button {
  width: 36px;
  height: 36px;
}

.mastered-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mastered-control > span {
  color: var(--ink-3);
  font-size: 9px;
  white-space: nowrap;
}

.mastered-control .switch {
  width: 36px;
  height: 22px;
}

.mastered-control .switch::after {
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
}

.mastered-control .switch.is-on::after {
  transform: translateX(14px);
}

.notebook-empty {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.notebook-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 19px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.notebook-tip .icon {
  color: var(--tone);
}

/* Review overlay */

.review-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: calc(12px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  color: #fff;
  background:
    radial-gradient(circle at 80% 5%, rgba(255, 255, 255, 0.13), transparent 30%),
    linear-gradient(155deg, #0b3f2c 0%, #0d6246 54%, #0e8a5f 100%);
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.review-overlay.is-open {
  opacity: 1;
  transform: translateY(0);
}

.review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.review-close {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.13);
}

.review-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.review-counter {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.review-badge {
  color: rgba(255, 255, 255, 0.5);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.14em;
}

.review-progress {
  margin-top: 3px;
}

.review-progress .linear-progress {
  background: rgba(255, 255, 255, 0.15);
}

.review-progress .linear-progress > span {
  background: #fff;
}

.review-stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: min(100%, 500px);
  margin: 0 auto;
  padding: 16px 0 0;
}

.review-flashcard {
  width: 100%;
  min-height: 360px;
  padding: 30px 22px 24px;
  color: var(--ink);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.27);
  text-align: center;
}

.review-word-pos {
  display: inline-flex;
  padding: 2px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.review-flashcard h2 {
  margin-top: 17px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(34px, 10vw, 44px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.review-reading {
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 12px;
  font-style: italic;
}

.review-flashcard .review-audio {
  margin: 14px auto 0;
}

.review-reveal {
  display: block;
  min-height: 43px;
  margin: 17px auto 0;
  padding: 8px 16px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.review-answer {
  margin-top: 17px;
  text-align: left;
}

.mini-rule {
  display: block;
  width: 100%;
  height: 1px;
  margin-bottom: 14px;
  background: var(--line);
}

.review-answer-zh {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.review-answer-note {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.65;
}

.review-example {
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  line-height: 1.55;
}

.review-example small {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 10px;
}

.review-actions {
  display: flex;
  width: 100%;
  gap: 8px;
}

.review-actions .btn {
  flex: 1;
  min-height: 48px;
  padding-inline: 8px;
  font-size: 12px;
}

.review-actions .btn-soft {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.review-actions .review-again {
  color: #ffd0ca;
  background: rgba(214, 59, 47, 0.18);
  border-color: rgba(255, 255, 255, 0.14);
}

.review-actions .btn-primary {
  color: var(--primary-deep);
  background: #fff;
  border-color: #fff;
  box-shadow: none;
}

.review-finished-note {
  color: var(--ink-3) !important;
  font-size: 10px !important;
}

.review-finished {
  width: 100%;
  padding: 34px 24px;
  color: var(--ink);
  background: var(--surface);
  border-radius: 24px;
  text-align: center;
}

.review-finished-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 17px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 9px var(--primary-soft);
}

.review-finished .eyebrow {
  color: var(--primary);
}

.review-finished h2 {
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.4;
}

.review-finished p {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
}

.review-finished p strong {
  color: var(--primary);
  font-size: 18px;
}

.review-finished .btn {
  margin-top: 22px;
}

/* -------------------------------------------------------------------------- */
/* Dictionary                                                                 */
/* -------------------------------------------------------------------------- */

.dictionary-head {
  padding-bottom: 15px;
}

.dictionary-count {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  padding-bottom: 3px;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.dictionary-count small {
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}

.dictionary-page {
  padding-bottom: calc(95px + var(--safe-bottom));
}

.dictionary-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  margin: 0 16px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.dictionary-search:focus-within {
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line));
  box-shadow:
    0 0 0 3px rgba(14, 138, 95, 0.08),
    var(--shadow-sm);
}

.search-leading {
  color: var(--ink-3);
}

.dictionary-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
}

.dictionary-search input::placeholder {
  color: var(--ink-3);
}

.dictionary-search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: -5px;
  padding: 0;
  color: var(--ink-3);
  background: var(--surface-soft);
  border: 0;
  border-radius: 50%;
}

.dictionary-suggestions {
  margin: 10px 16px 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}

.suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 8px;
}

.suggestion-head span {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestion-head small {
  color: var(--ink-3);
  font-size: 9px;
}

.suggestion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 57px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  transition: background-color 0.15s ease;
}

.suggestion-row:hover {
  background: var(--surface-soft);
}

.suggestion-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.suggestion-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-copy small {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-arrow {
  color: var(--ink-3);
}

.dictionary-no-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 18px;
  text-align: center;
  color: var(--ink-3);
}

.dictionary-no-result p {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.dictionary-no-result small {
  font-size: 10px;
  line-height: 1.5;
}

.dictionary-content {
  padding: 14px 16px 0;
}

.featured-word-card {
  padding: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(227, 244, 236, 0.85), transparent 36%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-sm);
}

.featured-word-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.featured-word-top .eyebrow {
  color: var(--primary);
  font-size: 9px;
}

.featured-tag {
  padding: 2px 7px;
  color: var(--ink-3);
  background: var(--surface-soft);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 650;
}

.featured-word-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.featured-word-title h2 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.featured-word-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 11px;
}

.featured-rule {
  display: block;
  height: 1px;
  margin: 13px 0 12px;
  background: var(--line);
}

.featured-meaning {
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
}

.featured-note {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.65;
}

.featured-example {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
}

.featured-example p {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}

.featured-example small {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 10px;
}

.recent-section,
.topic-section {
  margin-top: 22px;
}

.recent-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: none;
}

.recent-chips::-webkit-scrollbar {
  display: none;
}

.recent-chip {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 1px;
  min-width: 94px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-xs);
}

.recent-chip span {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.recent-chip small {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topic-card {
  position: relative;
  display: flex;
  min-height: 82px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-align: left;
}

.topic-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  margin-bottom: 5px;
  border-radius: 9px;
}

.topic-card .tone-green {
  color: var(--primary);
  background: var(--primary-soft);
}

.topic-card .tone-orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.topic-card .tone-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.topic-card .tone-gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.topic-card strong {
  font-size: 12px;
  font-weight: 650;
}

.topic-card small {
  color: var(--ink-3);
  font-size: 9px;
}

.topic-card > .icon {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--ink-3);
}

.dictionary-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

/* Dictionary detail */

.entry-page {
  padding-bottom: 0;
}

.entry-brand-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(62px + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 14px 6px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(18px);
}

.entry-brand-bar h1 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.entry-brand-bar .icon-btn {
  width: 42px;
  height: 42px;
  background: transparent;
  border-color: transparent;
}

.entry-favorite.is-active {
  color: var(--danger);
  background: var(--danger-soft);
}

.entry-favorite.is-active .icon {
  fill: currentColor;
  stroke: currentColor;
}

.entry-content {
  padding: 4px 18px 0;
}

.entry-hero {
  padding: 13px 2px 21px;
  border-bottom: 1px solid var(--line);
}

.entry-hero .eyebrow {
  color: var(--primary);
  font-size: 9px;
}

.entry-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 7px;
}

.entry-word-row h2 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(32px, 9vw, 38px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.entry-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 4px;
}

.entry-reading {
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.entry-hero-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
}

.notebook-save {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}

.notebook-save.is-saved {
  color: var(--ink-2);
  background: var(--surface-soft);
  border-color: var(--line);
}

.notebook-save .icon {
  flex: none;
}

.entry-section {
  padding-top: 22px;
}

.definitions-section .section-heading,
.entry-section .section-heading {
  margin-bottom: 10px;
}

.definition-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.definition-item {
  position: relative;
  padding: 12px 14px 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--r-m) var(--r-m) 0;
}

.definition-number {
  position: absolute;
  top: 12px;
  right: 13px;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.definition-pos {
  color: var(--primary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.definition-item h3 {
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}

.definition-item p {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.65;
}

.example-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.example-card {
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.example-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.example-top p {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
}

.example-card > span {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.related-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.related-list a span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.related-list a small {
  flex: 1;
  color: var(--ink-3);
  font-size: 10px;
}

.related-list a .icon {
  color: var(--ink-3);
}

.entry-bottom-space {
  height: calc(96px + var(--tabbar-space));
}

.entry-actions-bar {
  position: fixed;
  bottom: var(--tabbar-space);
  left: 50%;
  z-index: 70;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 680px);
  padding: 7px 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(28, 49, 38, 0.05);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
}

.entry-actions-bar button {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px 6px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.entry-actions-bar button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.entry-actions-bar button.is-active {
  color: var(--danger);
}

.entry-actions-bar button.is-active span .icon {
  fill: currentColor;
}

.entry-actions-bar small {
  font-size: 9px;
  font-weight: 550;
}

/* -------------------------------------------------------------------------- */
/* Dialogue scenarios                                                         */
/* -------------------------------------------------------------------------- */

.scenarios-content {
  padding: 2px 16px 26px;
}

.scenario-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 19px 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.15), transparent 34%),
    linear-gradient(145deg, #0e8a5f, #0a714e);
  border-radius: var(--r-l);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.scenario-hero::after {
  content: "";
  position: absolute;
  right: -45px;
  bottom: -95px;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.025);
}

.scenario-hero .eyebrow {
  color: rgba(255, 255, 255, 0.76);
  font-size: 9px;
}

.scenario-hero h1 {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 790;
  line-height: 1.42;
  letter-spacing: -0.025em;
}

.scenario-hero > p {
  max-width: 300px;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.65;
}

.scenario-hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.63);
  font-size: 9px;
}

.scenario-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 19px;
}

.scenario-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.scenario-card:hover {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.scenario-art {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 56px;
  height: 64px;
  border-radius: 14px;
}

.scenario-art.tone-green {
  color: var(--primary);
  background: var(--primary-soft);
}

.scenario-art.tone-orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.scenario-art.tone-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.scenario-art.tone-gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.scenario-art i {
  position: absolute;
  bottom: 4px;
  right: 7px;
  color: currentColor;
  font-family: var(--font-display);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  opacity: 0.4;
}

.scenario-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.scenario-kicker {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-copy strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 710;
  line-height: 1.4;
}

.scenario-copy > small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 9px;
}

.scenario-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.scenario-meta .done-tag {
  padding: 1px 6px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-weight: 600;
}

.scenario-arrow {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 30px;
  color: var(--ink-3);
}

.scenario-footer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding: 13px 14px;
  background: var(--surface-soft);
  border-radius: var(--r-m);
  color: var(--ink-3);
}

.scenario-footer .icon {
  flex: none;
  margin-top: 1px;
  color: var(--tone);
}

.scenario-footer p {
  font-size: 10px;
  line-height: 1.65;
}

/* -------------------------------------------------------------------------- */
/* Dialogue room                                                              */
/* -------------------------------------------------------------------------- */

.dialogue-page {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
  padding-bottom: var(--tabbar-space);
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(227, 244, 236, 0.55), transparent 28%),
    var(--bg);
}

.chat-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: calc(58px + var(--safe-top));
  padding: calc(7px + var(--safe-top)) 14px 5px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.chat-header .icon-btn {
  background: transparent;
  border-color: transparent;
}

.chat-title {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.chat-title span {
  display: block;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title h1 {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-finish {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 4px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

.chat-finish.is-done {
  color: var(--ink-3);
  background: var(--surface-soft);
}

.chat-context {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px 8px;
  border-bottom: 1px solid var(--line);
}

.chat-context-level {
  color: var(--ink-3);
  font-size: 9px;
}

.speed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface-soft);
  border-radius: 999px;
}

.speed-toggle > span {
  padding: 0 5px;
  color: var(--ink-3);
  font-size: 9px;
}

.speed-toggle button {
  min-width: 36px;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
}

.speed-toggle button.is-active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(26, 43, 34, 0.1);
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 15px;
  scrollbar-width: none;
}

.chat-scroll::-webkit-scrollbar {
  display: none;
}

.chat-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 8px;
}

.chat-day span {
  padding: 2px 8px;
  color: var(--ink-3);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
}

.chat-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 15px;
  color: var(--ink-3);
  font-size: 9px;
  text-align: center;
}

.chat-lines {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  max-width: 92%;
  animation: chat-in 0.26s ease both;
}

.chat-row.is-them {
  align-self: flex-start;
}

.chat-row.is-me {
  align-self: flex-end;
  justify-content: flex-end;
}

@keyframes chat-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble {
  min-width: 74px;
  max-width: min(100%, 330px);
  padding: 10px 13px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 3px 11px rgba(28, 48, 37, 0.04);
}

.chat-row.is-me .chat-bubble {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 13%, var(--line));
  border-radius: 16px 16px 4px 16px;
}

.chat-bubble p {
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-bubble small {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.chat-audio {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  border-radius: 50%;
  opacity: 0.8;
}

.chat-audio:hover {
  background: var(--primary-soft);
  opacity: 1;
}

.chat-composer {
  flex: none;
  padding: 7px 14px 9px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(28, 49, 38, 0.04);
  backdrop-filter: blur(18px);
}

.reply-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 7px;
  scrollbar-width: none;
}

.reply-chips::-webkit-scrollbar {
  display: none;
}

.reply-chips > span {
  flex: none;
  color: var(--ink-3);
  font-size: 9px;
}

.reply-chips button {
  flex: none;
  min-height: 32px;
  padding: 5px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 48px;
  padding: 4px 5px 4px 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 28px;
}

.chat-input-row input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.chat-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.09);
}

.chat-input-row input::placeholder {
  color: var(--ink-3);
  font-size: 15px;
}

.chat-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 4px 11px rgba(14, 138, 95, 0.22);
}

.chat-send:active {
  transform: scale(0.94);
}

/* -------------------------------------------------------------------------- */
/* Lesson player                                                              */
/* -------------------------------------------------------------------------- */

.lesson-page {
  position: fixed;
  top: var(--vv-top, 0);
  bottom: auto;
  left: 50%;
  z-index: 30;
  display: flex;
  width: min(100%, 680px);
  height: var(--app-height, 100dvh);
  padding-bottom: var(--tabbar-space);
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(227, 244, 236, 0.48), transparent 27%),
    var(--bg);
  transform: translateX(-50%);
}

.lesson-header {
  flex: none;
  padding: calc(8px + var(--safe-top)) 14px 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(18px);
}

.lesson-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.lesson-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.lesson-heading {
  min-width: 0;
  flex: 1;
}

.lesson-heading span {
  display: block;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-heading h1 {
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-step-count {
  flex: none;
  padding: 3px 8px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lesson-top-progress {
  margin: 9px -14px 0;
}

.lesson-top-progress .linear-progress {
  border-radius: 0;
}

.lesson-top-progress .linear-progress > span {
  transition: width 0.35s ease;
}

.lesson-main {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 14px 20px;
  scrollbar-width: none;
}

.lesson-main::-webkit-scrollbar {
  display: none;
}

.lesson-card {
  width: min(100%, 560px);
  margin: auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

.lesson-card-inner {
  padding: 22px 20px 24px;
  animation: card-in 0.25s ease both;
}

@keyframes card-in {
  from {
    opacity: 0.55;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lesson-tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lesson-kind {
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.answer-feedback {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 16px 13px;
  color: #fff;
  background: var(--primary);
  animation: feedback-in 0.24s ease both;
}

.answer-feedback.is-wrong {
  background: var(--danger);
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feedback-symbol {
  display: grid;
  flex: none;
  place-items: center;
  width: 23px;
  height: 23px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.17);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 750;
}

.answer-feedback > div {
  min-width: 0;
  flex: 1;
}

.answer-feedback strong {
  display: block;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.4;
}

.answer-feedback p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 10.5px;
  line-height: 1.55;
}

.answer-feedback .feedback-correct {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 12px;
}

.answer-feedback .feedback-correct b {
  color: #fff;
  font-size: 14px;
}

.answer-feedback .tone {
  color: rgba(255, 233, 191, 0.98);
}

/* Intro lesson */

.knowledge-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 19px;
}

.knowledge-word {
  min-width: 0;
}

.lesson-vi-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(27px, 8vw, 32px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.lesson-vi-title[lang="th"],
.vocab-word[lang="th"],
.entry-word-row h2[lang="th"] {
  padding-top: 0.08em;
  line-height: 1.6;
  letter-spacing: 0;
}

.lesson-reading {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
}

.knowledge-meaning {
  margin-top: 13px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.knowledge-note {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.8;
}

.tone-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 17px;
  padding: 11px 12px;
  background: var(--tone-soft);
  border-radius: var(--r-m);
}

.tone-tip-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--tone);
  background: var(--surface);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

[data-theme="dark"] .tone-tip-mark {
  background: rgba(255, 255, 255, 0.07);
}

.tone-tip strong {
  color: var(--tone);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.tone-tip p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.65;
}

.lesson-example {
  margin-top: 19px;
  padding-left: 13px;
  border-left: 3px solid var(--primary);
}

.example-eyebrow {
  display: block;
  color: var(--ink-3);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.lesson-example-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
  margin-top: 4px;
}

.lesson-example-vi {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
}

.lesson-example-zh {
  margin-top: 1px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.lesson-example-reading {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 9.5px;
  font-style: italic;
  line-height: 1.5;
}

/* Vocab lesson */

.vocab-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 21px;
  text-align: center;
}

.vocab-pos {
  display: inline-flex;
  padding: 2px 8px;
  color: #fff;
  background: var(--primary);
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.vocab-word {
  max-width: 100%;
  margin-top: 14px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(30px, 8.8vw, 34px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.vocab-reading {
  margin-top: 0;
  color: var(--ink-3);
  font-size: 11px;
  font-style: italic;
  line-height: 1.55;
}

.vocab-audio {
  margin-top: 13px;
}

.vocab-meaning {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}

.is-vocab .knowledge-note {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

/* Listening */

.exercise-prompt {
  margin-top: 15px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.listen-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 19px;
}

.large-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding: 0;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 12px 26px rgba(14, 138, 95, 0.25);
}

.large-play-halo {
  position: absolute;
  inset: -7px;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: 50%;
  animation: halo 2.6s ease-out infinite;
}

@keyframes halo {
  0% {
    opacity: 0.8;
    transform: scale(0.92);
  }
  70% {
    opacity: 0;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

.large-play-core {
  display: grid;
  place-items: center;
}

.large-play:active {
  transform: scale(0.95);
}

.listen-caption {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 10px;
}

.listen-word {
  display: none;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1px;
}

[lang="th"] {
  font-family: var(--font-thai);
  line-height: 1.65;
}

.spell-options .option-button {
  min-height: 58px;
  padding-block: 10px;
}

.spell-options .option-button > span:nth-child(2) {
  font-family: var(--font-thai);
  font-size: 20px;
  line-height: 1.6;
  letter-spacing: 0;
}

.option-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.option-button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.option-button.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.option-button.is-correct {
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-color: var(--primary);
}

[data-theme="dark"] .option-button.is-correct {
  color: #b7e9d3;
}

.option-button.is-wrong {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger);
}

.option-button:disabled {
  opacity: 1;
}

.option-letter {
  display: grid;
  flex: none;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
}

.option-button.is-selected .option-letter,
.option-button.is-correct .option-letter {
  color: var(--primary);
  background: var(--surface);
}

.option-button.is-wrong .option-letter {
  color: var(--danger);
  background: var(--surface);
}

.option-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-left: auto;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}

/* Spelling */

.spell-prompt-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 14px;
}

.spell-prompt-row > div {
  min-width: 0;
  flex: 1;
}

.spell-prompt-row .exercise-prompt {
  margin-top: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.spell-prompt-row small {
  display: block;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 9.5px;
  line-height: 1.5;
}

.spell-boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  margin-top: 18px;
}

.letter-box {
  display: grid;
  place-items: center;
  width: 40px;
  height: 48px;
  color: var(--ink);
  background: var(--surface-soft);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 750;
  line-height: 1;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.letter-box.is-filled {
  background: var(--primary-soft);
}

.letter-box.needs-tone {
  box-shadow:
    inset 0 -2px var(--tone),
    0 0 0 1px color-mix(in srgb, var(--tone) 30%, transparent);
}

.spell-tone-hint {
  min-height: 17px;
  margin-top: 7px;
  color: var(--ink-3);
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.spell-tone-hint.is-warning {
  color: var(--tone);
  font-weight: 600;
}

.spell-keyboard {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.spell-key-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 5px;
}

.spell-key {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 2px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 550;
  transition:
    background-color 0.12s ease,
    transform 0.12s ease;
}

.spell-key:active {
  background: var(--primary-soft);
  transform: scale(0.95);
}

.spell-key:disabled {
  opacity: 0.35;
}

.spell-key.is-backspace {
  color: var(--ink-2);
}

.tone-key-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}

.tone-key {
  display: flex;
  min-height: 39px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  line-height: 1;
}

.tone-key span {
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

.tone-key small {
  color: var(--primary);
  font-family: var(--font);
  font-size: 8px;
  font-weight: 550;
  opacity: 0.8;
}

.tone-key.is-active {
  color: #fff;
  background: var(--primary);
}

.tone-key.is-active small {
  color: #fff;
  opacity: 0.9;
}

.tone-key:disabled {
  opacity: 0.55;
}

.order-chip:disabled {
  opacity: 0.8;
}

/* Word order */

.order-translation {
  margin-top: 3px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.order-area {
  margin-top: 15px;
}

.order-dropzone {
  display: flex;
  min-height: 60px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.order-dropzone.has-items {
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}

.order-placeholder {
  width: 100%;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.order-chip {
  min-height: 36px;
  padding: 5px 10px;
  color: var(--primary-deep);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
}

.order-chip:active {
  transform: scale(0.96);
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.word-chip {
  min-height: 43px;
  padding: 8px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  box-shadow: 0 3px 9px rgba(28, 49, 38, 0.06);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.word-chip:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.word-chip:disabled {
  opacity: 0.24;
}

/* Translation */

.translate-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 13px;
  background: var(--surface-soft);
  border-radius: var(--r-m);
}

.translate-source p {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 680;
  line-height: 1.5;
}

.translate-label {
  display: block;
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}

.translate-input {
  display: block;
  width: 100%;
  min-height: 84px;
  margin-top: 6px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  outline: 0;
  font-size: 16px;
  line-height: 1.7;
  resize: vertical;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.translate-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.08);
}

.translate-input::placeholder {
  color: var(--ink-3);
}

.translate-help {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 9px;
  line-height: 1.5;
}

/* Footer */

.lesson-footer {
  flex: none;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(28, 49, 38, 0.05);
  backdrop-filter: blur(18px);
}

.lesson-footer .btn {
  min-height: 52px;
}

.lesson-footer .btn.is-next {
  animation: next-pulse 0.3s ease;
}

@keyframes next-pulse {
  50% {
    transform: scale(0.992);
  }
}

/* -------------------------------------------------------------------------- */
/* Result                                                                     */
/* -------------------------------------------------------------------------- */

.result-page {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  padding-bottom: calc(28px + var(--tabbar-space));
  background:
    radial-gradient(circle at 50% -5%, rgba(227, 244, 236, 0.9), transparent 30%),
    var(--bg);
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(56px + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 14px 4px;
}

.result-top .icon-btn {
  background: transparent;
  border-color: transparent;
}

.result-top-label {
  color: var(--ink-3);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.result-content {
  position: relative;
  z-index: 2;
  width: min(100%, 540px);
  margin: 0 auto;
  padding: 15px 18px 0;
  text-align: center;
  animation: result-in 0.45s 0.08s cubic-bezier(0.22, 0.8, 0.35, 1) both;
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-check-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  margin: 6px auto 16px;
}

.result-check {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  box-shadow:
    0 12px 25px rgba(14, 138, 95, 0.25),
    0 0 0 7px var(--primary-soft);
}

.result-check-ring {
  position: absolute;
  inset: 3px;
  border: 1px dashed color-mix(in srgb, var(--primary) 27%, transparent);
  border-radius: 50%;
  animation: slow-spin 24s linear infinite;
}

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

.result-content > .eyebrow {
  color: var(--primary);
  font-size: 9px;
}

.result-content > h1 {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.result-sub {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

.result-sub strong {
  color: var(--primary);
  font-size: 16px;
  font-weight: 750;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
  padding: 15px 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}

.result-stats > div {
  border-right: 1px solid var(--line);
}

.result-stats > div:last-child {
  border-right: 0;
}

.result-stats strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.result-stats > div:first-child strong {
  color: var(--tone);
}

.result-stats span {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 12px;
}

.result-unlock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  margin-top: 12px;
  padding: 3px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 550;
}

.mistake-section {
  margin-top: 25px;
  text-align: left;
}

.mistake-section .section-heading {
  padding-inline: 2px;
}

.mistake-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mistake-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.mistake-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mistake-copy {
  min-width: 0;
  flex: 1;
}

.mistake-prompt {
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.5;
}

.mistake-answer {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}

.mistake-answer + .mistake-answer {
  margin-top: 1px;
}

.mistake-answer span {
  margin-right: 5px;
  color: var(--ink-3);
  font-size: 9px;
}

.mistake-explanation {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.6;
}

.perfect-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  background: var(--primary-soft);
  border-radius: var(--r-m);
}

.perfect-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 33px;
  height: 33px;
  color: var(--tone);
  background: var(--surface);
  border-radius: 10px;
}

.perfect-card strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.perfect-card p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 25px;
}

.result-actions .btn {
  min-height: 50px;
  font-size: 15px;
}

.result-saved {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 13px;
  color: var(--ink-3);
  font-size: 9px;
}

.result-saved .icon {
  color: var(--primary);
}

.confetti {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -12px;
  left: var(--left);
  width: 6px;
  height: 11px;
  background: var(--color);
  border-radius: 2px;
  opacity: 0;
  transform: rotate(var(--rotate));
  animation: confetti-fall var(--duration) var(--delay) ease-out forwards;
}

.confetti i:nth-child(3n) {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.confetti i:nth-child(4n) {
  width: 4px;
  height: 13px;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-12px) rotate(var(--rotate));
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(72vh) rotate(calc(var(--rotate) + 300deg));
  }
}

.result-empty .result-empty-body {
  padding: 28px 16px;
}

.not-found-body {
  padding: 40px 20px;
}

/* Fatal error & loader */

.fatal-error,
.boot-error {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.fatal-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 20px;
}

.fatal-error h1 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 760;
}

.fatal-error p {
  max-width: 340px;
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.fatal-error .btn {
  margin-top: 20px;
}

.boot-skeleton {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  gap: 18px;
  padding: calc(30px + var(--safe-top)) 18px;
}

.skeleton {
  background: var(--line);
  border-radius: 8px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-block {
  height: 130px;
  border-radius: var(--r-card);
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
}

.skeleton-line.w-40 {
  width: 40%;
}

.skeleton-line.w-60 {
  width: 60%;
}

.skeleton-line.w-80 {
  width: 80%;
}

.skeleton-line.w-35 {
  width: 35%;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.skeleton-row > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

@keyframes skeleton-pulse {
  50% {
    opacity: 0.55;
  }
}

/* -------------------------------------------------------------------------- */
/* Feedback                                                                   */
/* -------------------------------------------------------------------------- */

.feedback-content {
  padding: 5px 16px 28px;
}

.feedback-lead {
  padding: 9px 4px 19px;
}

.feedback-lead .eyebrow {
  color: var(--primary);
}

.feedback-lead h1 {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.42;
  letter-spacing: -0.03em;
}

.feedback-lead p {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.7;
}

.feedback-form-card {
  padding: 18px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-sm);
}

.feedback-form-card.is-success {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0;
}

.feedback-fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.feedback-fieldset legend {
  margin-bottom: 9px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 620;
}

.feedback-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.feedback-type {
  min-height: 34px;
  padding: 5px 12px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
}

.feedback-type.is-active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(14, 138, 95, 0.17);
}

.feedback-form-card .field-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 620;
}

.feedback-form-card .field-label span {
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 500;
}

.feedback-textarea {
  display: block;
  width: 100%;
  min-height: 130px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  outline: 0;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.feedback-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 138, 95, 0.08);
}

.feedback-textarea::placeholder {
  color: var(--ink-3);
}

.feedback-counter {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 9px;
  text-align: right;
}

.feedback-form-card .input-shell {
  height: 47px;
}

.feedback-form-card .input-shell input {
  font-size: 14px;
}

.feedback-note {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 15px 0;
  color: var(--ink-3);
  font-size: 9.5px;
  line-height: 1.6;
}

.feedback-note .icon {
  flex: none;
  margin-top: 1px;
  color: var(--primary);
}

.feedback-form-card .btn {
  margin-top: 2px;
}

.feedback-alt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  padding: 12px 13px;
  background: var(--primary-soft);
  border-radius: var(--r-m);
}

.feedback-alt > span {
  color: var(--primary);
}

.feedback-alt strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.feedback-alt p {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 9.5px;
  line-height: 1.55;
}

.feedback-footer {
  margin-top: 22px;
  color: var(--ink-3);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-align: center;
}

.feedback-success {
  padding: 48px 18px 26px;
  text-align: center;
}

.feedback-success-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 8px var(--primary-soft);
}

.feedback-success .eyebrow {
  color: var(--primary);
}

.feedback-success h2 {
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 790;
  line-height: 1.4;
}

.feedback-success p {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.7;
}

.feedback-success .btn {
  margin-top: 20px;
}

/* Initial boot */

.boot-splash {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.13), transparent 30%),
    var(--primary);
}

.boot-splash img {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  box-shadow: 0 20px 42px rgba(2, 42, 28, 0.22);
}

.boot-splash strong {
  margin-top: 22px;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}

.boot-splash > span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.boot-spinner {
  width: 22px;
  height: 22px;
  margin-top: 27px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 370px) {
  .home-hero {
    padding-inline: 16px;
  }

  .home-body,
  .course-groups,
  .profile-body,
  .tasks-page {
    padding-inline: 13px;
  }

  .home-greeting h1 {
    font-size: 20px;
  }

  .continue-card {
    gap: 10px;
    padding: 14px;
  }

  .continue-number {
    width: 44px;
    height: 54px;
  }

  .continue-title {
    font-size: 16px;
  }

  .module-card {
    padding: 12px;
  }

  .module-icon {
    width: 37px;
    height: 37px;
  }

  .letter-box {
    width: 36px;
    height: 44px;
  }

  .spell-key {
    min-height: 38px;
    font-size: 15px;
  }

  .tone-key {
    min-height: 37px;
  }

  .notebook-card {
    padding: 12px;
  }

  .notebook-side .audio-button {
    width: 33px;
    height: 33px;
  }

  .mastered-control > span {
    display: none;
  }

  .badge-grid {
    gap: 7px;
  }

  .badge-card {
    min-height: 147px;
    padding-inline: 6px;
  }

  .badge-emblem {
    width: 50px;
    height: 50px;
  }

  .result-content {
    padding-inline: 14px;
  }

  .task-summary-card {
    padding: 17px;
  }

  .review-flashcard {
    min-height: 330px;
    padding-inline: 17px;
  }
}

@media (max-height: 720px) {
  .onboarding-slide {
    justify-content: flex-start;
    padding-top: 5px;
  }

  .onboarding-art {
    width: min(232px, 72vw);
  }

  .onboarding-copy {
    margin-top: 17px;
  }

  .onboarding-copy h1 {
    font-size: 22px;
  }

  .onboarding-copy p {
    margin-top: 6px;
    font-size: 13px;
  }

  .splash-center {
    margin-top: -48px;
  }

  .auth-main {
    padding-top: 28px;
  }
}

@media (min-width: 760px) {
  .review-overlay {
    left: 50%;
    right: auto;
    width: min(100%, 680px);
    transform: translate(-50%, 24px);
  }

  .review-overlay.is-open {
    transform: translate(-50%, 0);
  }

  .dialog-layer,
  .sheet-layer {
    padding: 32px;
  }

  .toast-root {
    top: 22%;
  }

  .onboarding-screen {
    padding-inline: 46px;
  }

  .onboarding-track {
    max-width: 680px;
    margin: 0 auto;
  }

  .onboarding-footer {
    width: min(100%, 420px);
    margin: 0 auto;
  }
}

@media (min-width: 900px) {
  .home-hero {
    padding-inline: 30px;
    padding-bottom: 55px;
  }

  .home-body {
    padding-inline: 24px;
  }

  .tab-page-head {
    padding-inline: 28px;
  }

  .filter-scroller {
    padding-inline: 28px;
  }

  .course-groups {
    padding-inline: 24px;
  }

  .profile-hero {
    padding-inline: 28px;
  }

  .profile-body {
    padding-inline: 24px;
  }

  .dictionary-search {
    margin-inline: 24px;
  }

  .dictionary-content,
  .dictionary-suggestions {
    margin-inline: 24px;
  }

  .dictionary-content {
    padding-inline: 0;
  }

  .entry-content {
    padding-inline: 34px;
  }

  .entry-hero {
    padding-top: 22px;
  }

  .result-content {
    padding-top: 28px;
  }

  .lesson-main {
    padding: 22px 28px 28px;
  }

  .lesson-header {
    padding-inline: 28px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .lesson-header {
    padding-top: calc(3px + var(--safe-top));
  }

  .lesson-header-row {
    min-height: 43px;
  }

  .lesson-main {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .lesson-card-inner {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .lesson-footer {
    padding-top: 7px;
    padding-bottom: calc(7px + var(--safe-bottom));
  }

  .lesson-footer .btn {
    min-height: 44px;
  }

  .onboarding-art {
    width: 200px;
  }

  .onboarding-slide {
    flex-direction: row;
    gap: 24px;
    text-align: left;
  }

  .onboarding-copy {
    max-width: 300px;
    margin-top: 0;
    text-align: left;
  }

  .splash-brand {
    margin-top: 17px;
  }

  .splash-bottom {
    bottom: 18px;
  }
}

/* Dark mode detail adjustments */

[data-theme="dark"] .third-party-icon.wechat {
  color: #71d695;
  background: #1a3023;
}

[data-theme="dark"] .onboarding-screen,
[data-theme="dark"] .auth-page,
[data-theme="dark"] .result-page {
  background:
    radial-gradient(circle at 92% -4%, rgba(14, 138, 95, 0.12), transparent 32%),
    var(--bg);
}

[data-theme="dark"] .lesson-page {
  background:
    radial-gradient(circle at 100% 0, rgba(14, 138, 95, 0.09), transparent 27%),
    var(--bg);
}

[data-theme="dark"] .dialogue-page {
  background:
    radial-gradient(circle at 100% 0, rgba(14, 138, 95, 0.08), transparent 28%),
    var(--bg);
}

[data-theme="dark"] .task-summary-card,
[data-theme="dark"] .featured-word-card {
  background: var(--surface);
}

[data-theme="dark"] .review-strip {
  background:
    linear-gradient(135deg, rgba(217, 119, 6, 0.14), transparent 72%),
    var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .review-strip-icon {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .ops-banner {
  background:
    linear-gradient(135deg, rgba(14, 138, 95, 0.16), transparent 70%),
    var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .ops-banner.tone-promo {
  background:
    linear-gradient(135deg, rgba(217, 119, 6, 0.14), transparent 72%),
    var(--surface);
}

[data-theme="dark"] .ops-banner-icon {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .account-sync-card,
[data-theme="dark"] .feedback-form-card {
  box-shadow: none;
}

[data-theme="dark"] .feedback-textarea {
  background: var(--bg);
}

[data-theme="dark"] .feedback-type {
  background: var(--surface-soft);
}

[data-theme="dark"] .feedback-type.is-active {
  background: var(--primary);
}

[data-theme="dark"] .feedback-alt {
  background: var(--primary-soft);
}

[data-theme="dark"] .third-party.is-coming {
  color: var(--ink-3);
}

[data-theme="dark"] .task-summary-card .progress-ring {
  box-shadow: 0 0 0 5px var(--surface);
}

[data-theme="dark"] .result-page {
  background:
    radial-gradient(circle at 50% -5%, rgba(14, 138, 95, 0.16), transparent 30%),
    var(--bg);
}

[data-theme="dark"] .dialog-card,
[data-theme="dark"] .bottom-sheet {
  background: var(--surface);
}

[data-theme="dark"] .onboarding-art {
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .home-hero .greeting-eyebrow,
[data-theme="dark"] .profile-greeting,
[data-theme="dark"] .scenario-hero .eyebrow,
[data-theme="dark"] .achievement-hero .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

[data-theme="dark"] .home-hero,
[data-theme="dark"] .profile-hero,
[data-theme="dark"] .scenario-hero,
[data-theme="dark"] .achievement-hero {
  background-color: var(--primary-deep);
}

[data-theme="dark"] .splash-logo .brand-mark {
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .daily-card {
  background:
    linear-gradient(145deg, rgba(14, 138, 95, 0.11), transparent 55%),
    var(--surface);
}

[data-theme="dark"] .featured-word-title h2,
[data-theme="dark"] .entry-word-row h2,
[data-theme="dark"] .vocab-word,
[data-theme="dark"] .lesson-vi-title,
[data-theme="dark"] .review-flashcard h2,
[data-theme="dark"] .notebook-word-row h3 {
  color: var(--ink);
}

[data-theme="dark"] .option-button.is-correct {
  color: #c9f3df;
}

[data-theme="dark"] .option-button.is-wrong {
  color: #ffb2a9;
}

[data-theme="dark"] .goal-card.is-selected {
  background: color-mix(in srgb, var(--primary-soft) 75%, var(--surface));
}

[data-theme="dark"] .task-card.is-done {
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
}

[data-theme="dark"] .badge-card.is-locked {
  filter: saturate(0.1) brightness(0.9);
}

[data-theme="dark"] .third-party,
[data-theme="dark"] .course-card,
[data-theme="dark"] .task-card,
[data-theme="dark"] .featured-word-card,
[data-theme="dark"] .notebook-card,
[data-theme="dark"] .menu-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .weekly-card,
[data-theme="dark"] .profile-goal-card,
[data-theme="dark"] .result-stats,
[data-theme="dark"] .review-flashcard,
[data-theme="dark"] .review-finished {
  box-shadow: none;
}

[data-theme="dark"] .switch::after {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .tone-tip-mark {
  color: #f0b867;
}

[data-theme="dark"] .answer-feedback.is-wrong {
  background: #ac2e24;
}

[data-theme="dark"] .answer-feedback.is-correct {
  background: var(--primary);
}

[data-theme="dark"] .result-unlock {
  background: var(--primary-soft);
  color: #a9e1ca;
}

[data-theme="dark"] .perfect-card {
  background: var(--primary-soft);
}

[data-theme="dark"] .review-actions .btn-primary {
  color: #0b3f2c;
}

[data-theme="dark"] .boot-splash {
  background-color: var(--primary);
}

/* Motion & accessibility */

@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;
  }

  .confetti {
    display: none;
  }
}

@media (hover: none) {
  .continue-card:hover,
  .course-card:hover,
  .scenario-card:hover,
  .badge-card:hover,
  .module-card:hover {
    transform: none;
  }
}






/* Pronunciation & phonetics */
.pronunciation-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  background: linear-gradient(120deg, var(--surface), var(--primary-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: var(--r-m);
  color: var(--ink);
  text-decoration: none;
}
.pronunciation-entry:hover { border-color: var(--primary); }
.pronunciation-entry-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: var(--surface);
  border-radius: 12px;
}
.pronunciation-entry-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 3px; }
.pronunciation-entry-copy strong { font-size: 14px; }
.pronunciation-entry-copy small { color: var(--ink-2); font-size: 11px; }
.pronunciation-entry-arrow { flex: none; color: var(--ink-3); }

.pronunciation-content {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 4px 18px 30px;
}
.pronunciation-hero {
  padding: 22px 20px 18px;
  background: linear-gradient(145deg, var(--primary-soft), var(--surface) 72%);
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  border-radius: var(--r-l);
}
.pronunciation-hero h1 { margin: 5px 0 3px; font-size: 28px; letter-spacing: -0.03em; }
.pronunciation-subtitle { margin: 0; color: var(--primary-deep); font-family: var(--font-thai); font-size: 17px; font-weight: 700; line-height: 1.55; }
.pronunciation-intro { margin: 12px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.pronunciation-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.pronunciation-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  color: var(--primary-deep);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--border));
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
}
.pronunciation-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 20px;
  padding: 11px 12px;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--gold) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 22%, var(--border));
  border-radius: var(--r-m);
  font-size: 11px;
  line-height: 1.65;
}
.pronunciation-note svg { flex: none; margin-top: 1px; color: var(--gold); }
.pronunciation-section { margin-top: 22px; }
.pronunciation-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.pronunciation-section-head h2 { margin: 2px 0 0; font-size: 20px; }
.pronunciation-total { flex: none; color: var(--ink-3); font-size: 11px; }
.pronunciation-section-desc { margin: 6px 0 10px; color: var(--ink-2); font-size: 12px; line-height: 1.65; }
.phoneme-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.phoneme-card {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
}
.phoneme-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.phoneme-symbol { color: var(--primary-deep); font-family: var(--font-thai); font-size: 30px; font-weight: 800; line-height: 1.25; }
.phoneme-ipa { flex: none; color: var(--ink-3); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.phoneme-card h3 { margin: 2px 0 1px; font-size: 14px; }
.phoneme-zh { margin: 0; color: var(--ink-2); font-size: 11px; line-height: 1.55; }
.phoneme-example {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 10px;
  background: var(--surface-soft);
  border-radius: 10px;
}
.phoneme-example > div { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.phoneme-example strong { font-family: var(--font-thai); font-size: 18px; line-height: 1.5; }
.phoneme-example small { color: var(--ink-2); font-size: 10px; }
.phoneme-tip {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: 9px 0 0;
  padding-top: 8px;
  color: var(--ink-3);
  border-top: 1px solid var(--border);
  font-size: 10px;
  line-height: 1.55;
}
.phoneme-tip svg { flex: none; margin-top: 1px; }
.pronunciation-practice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding: 14px;
  background: var(--primary-soft);
  border-radius: var(--r-m);
}
.pronunciation-practice-icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; color: var(--primary); background: var(--surface); border-radius: 10px; }
.pronunciation-practice strong { display: block; font-size: 13px; }
.pronunciation-practice p { margin: 4px 0 0; color: var(--ink-2); font-size: 11px; line-height: 1.65; }

@media (min-width: 620px) {
  .phoneme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pronunciation-content { padding-inline: 24px; }
}
