:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --surface-3: #f8fafc;
  --ink: #17202e;
  --muted: #67717f;
  --faint: #9aa4b2;
  --line: #e3e8ee;
  --line-strong: #d4dbe3;
  --accent: #0e9384;
  --accent-ink: #0b6f63;
  --accent-soft: #e2f5f1;
  --coral: #e4563d;
  --coral-soft: #fdebe6;
  --blue: #3b7cff;
  --blue-soft: #e9f0ff;
  --gold: #d99a25;
  --gold-soft: #fdf2dc;
  --green: #2f9e6e;
  --green-soft: #e6f5ee;
  --danger: #d64545;
  --shadow-sm: 0 1px 2px rgba(23, 32, 46, 0.05);
  --shadow-md: 0 10px 28px rgba(23, 32, 46, 0.08);
  --shadow-lg: 0 20px 50px rgba(23, 32, 46, 0.14);
  --radius: 8px;
  --sidebar-w: 236px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171e27;
  --surface-2: #202936;
  --surface-3: #141b23;
  --ink: #e9eef4;
  --muted: #a3afbd;
  --faint: #728091;
  --line: #26303c;
  --line-strong: #35414f;
  --accent: #25b4a2;
  --accent-ink: #7fd7ca;
  --accent-soft: #123c37;
  --coral: #ef7058;
  --coral-soft: #44211b;
  --blue: #64a0ff;
  --blue-soft: #1b2c49;
  --gold: #e8b04a;
  --gold-soft: #3d2f15;
  --green: #45bd8a;
  --green-soft: #153328;
  --danger: #f07070;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

input {
  color: var(--ink);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.icon {
  flex: none;
  vertical-align: middle;
}

/* ---------- layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 20px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 147, 132, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

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

.brand-text span {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.nav-item:active {
  transform: scale(0.98);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.foot-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--muted);
}

.foot-row strong {
  color: var(--ink);
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #42c3a8);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.ghost-row {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
}

.ghost-row:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px clamp(20px, 4vw, 48px) 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 24px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

.topbar-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xp-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--gold);
  font-size: 14px;
}

.xp-pill strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

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

.view {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
}

.view.active {
  display: block;
  animation: view-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* ---------- shared components ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

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

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 147, 132, 0.26);
}

.btn.primary:hover {
  background: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(14, 147, 132, 0.32);
}

.btn.soft {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.btn.soft:hover {
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--accent) 18%);
}

.btn.ghost {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}

.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

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

.btn.coral:hover {
  filter: brightness(0.95);
}

.btn.lg {
  min-height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

.btn.sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
  gap: 5px;
}

.btn.w-full {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chip.accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.chip.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.chip.gold {
  background: var(--gold-soft);
  color: var(--gold);
}

.chip.coral {
  background: var(--coral-soft);
  color: var(--coral);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-wrap .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search-wrap .input {
  padding-left: 40px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar .search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.filter-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.empty-state .icon {
  color: var(--faint);
  margin-bottom: 12px;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 4px;
}

/* ---------- dashboard ---------- */
.dash-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  margin-bottom: 18px;
  overflow: hidden;
  background: linear-gradient(120deg, #103d3a 0%, #0e6f66 58%, #17968a 100%);
  border: 0;
  color: #fff;
  box-shadow: 0 14px 34px rgba(16, 61, 58, 0.25);
}

.dash-head::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.dash-head .eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.dash-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.dash-head p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
}

.dash-head .btn {
  position: relative;
  z-index: 1;
  flex: none;
  background: #fff;
  color: #0e6f66;
  box-shadow: none;
}

.dash-head .btn:hover {
  background: #f2fffd;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px 18px;
  min-height: 96px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}

.stat-icon.teal {
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-icon.coral {
  background: var(--coral-soft);
  color: var(--coral);
}

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

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

.stat-info {
  min-width: 0;
}

.stat-info strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-info span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.dash-grid.lower {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0;
}

.panel {
  padding: 20px;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.panel-head .muted {
  font-size: 13px;
  color: var(--muted);
}

.week-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 170px;
  padding-top: 18px;
}

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

.week-val {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.week-bar {
  width: min(26px, 60%);
  min-height: 6px;
  border-radius: 6px 6px 3px 3px;
  background: var(--surface-2);
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.week-bar.hot {
  background: linear-gradient(180deg, #42c3a8, var(--accent));
  box-shadow: 0 4px 10px rgba(14, 147, 132, 0.22);
}

.week-bar.today {
  background: linear-gradient(180deg, #ffb85c, var(--gold));
  box-shadow: 0 4px 10px rgba(217, 154, 37, 0.3);
}

.week-label {
  font-size: 12px;
  color: var(--muted);
}

.week-label.today {
  color: var(--gold);
  font-weight: 700;
}

.wod-word {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 2px;
}

.wod-word h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.wod-phonetic {
  color: var(--muted);
  font-size: 14px;
  margin: 2px 0 12px;
}

.wod-meaning {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

.wod-example {
  padding: 12px 14px;
  margin: 0 0 6px;
  border-left: 3px solid var(--accent);
  background: var(--surface-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
}

.wod-cn {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.wod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-list,
.mini-word-list {
  display: flex;
  flex-direction: column;
}

.review-row,
.mini-word-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.review-row:last-child,
.mini-word-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.review-main,
.mini-main {
  flex: 1;
  min-width: 0;
}

.review-main strong,
.mini-main strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.review-main span,
.mini-main span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

/* ---------- words ---------- */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.word-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 17px 18px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.word-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

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

.word-top h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.word-top .pos {
  display: block;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}

.word-phonetic {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.word-meaning {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.word-example {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.word-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.word-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.diff-dots {
  display: inline-flex;
  gap: 3px;
}

.diff-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

.diff-dots i.on {
  background: var(--gold);
}

.word-card .icon-btn {
  width: 32px;
  height: 32px;
}

.known-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.count-line {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 20, 27, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: min(430px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 28px;
}

.drawer-word-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.drawer-word-head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.drawer-word-head .pos {
  color: var(--faint);
  font-size: 14px;
  font-weight: 600;
}

.drawer-phonetic {
  color: var(--muted);
  margin: 4px 0 18px;
}

.drawer-section {
  margin-bottom: 18px;
}

.drawer-section h4 {
  margin: 0 0 7px;
  font-size: 13px;
  color: var(--faint);
  font-weight: 600;
}

.drawer-meaning {
  font-size: 17px;
  font-weight: 600;
}

.drawer-example {
  padding: 13px 15px;
  border-left: 3px solid var(--accent);
  background: var(--surface-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0;
}

.drawer-example-cn {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 4px;
}

/* ---------- flashcards ---------- */
.flash-config {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px;
}

.flash-config h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.flash-config > p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.field {
  margin-bottom: 18px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flash-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
}

.flash-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.flash-progress {
  flex: 1;
  min-width: 80px;
}

.flash-card {
  width: min(100%, 560px);
  min-height: 320px;
  perspective: 1300px;
  cursor: pointer;
  animation: pop 0.24s ease;
}

.flash-inner {
  position: relative;
  width: 100%;
  min-height: 320px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.flash-card.flipped .flash-inner {
  transform: rotateY(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}

.flash-face.back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  text-align: left;
}

.flash-word {
  margin: 6px 0 0;
  font-size: 38px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.flash-phonetic {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.flash-meaning {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.flash-example {
  margin: 14px 0 0;
  padding: 12px 15px;
  border-left: 3px solid var(--accent);
  background: var(--surface-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  line-height: 1.6;
}

.flash-example-cn {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.flash-face-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flash-face-bottom {
  position: absolute;
  bottom: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 12px;
}

.flash-actions {
  display: flex;
  gap: 10px;
  width: min(100%, 560px);
}

.flash-actions .btn {
  flex: 1;
}

.flash-exit-row {
  width: min(100%, 560px);
  display: flex;
  justify-content: flex-end;
}

.flash-summary {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 34px 30px;
}

.summary-ring {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 16px;
}

.summary-ring circle {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
}

.summary-ring .bg {
  stroke: var(--surface-2);
}

.summary-ring .fg {
  stroke: var(--accent);
  transform: rotate(-90deg);
  transform-origin: 46px 46px;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.summary-ring .ring-num {
  font-size: 24px;
  font-weight: 700;
  fill: var(--ink);
}

.flash-summary h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.flash-summary > p {
  margin: 0 0 20px;
  color: var(--muted);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.summary-stat {
  padding: 13px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.summary-stat strong {
  display: block;
  font-size: 20px;
}

.summary-stat span {
  font-size: 12px;
  color: var(--muted);
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- practice ---------- */
.practice-layout {
  max-width: 760px;
  margin: 0 auto;
}

.practice-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.practice-head .chip {
  flex: none;
}

.practice-progress {
  flex: 1;
}

.practice-score {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.practice-score strong {
  color: var(--ink);
}

.practice-card {
  padding: 26px 28px;
}

.sentence-display {
  font-size: 21px;
  line-height: 1.75;
  font-weight: 600;
  margin-bottom: 18px;
  min-height: 74px;
}

.blank-input {
  display: inline-block;
  width: min(190px, 46%);
  min-width: 110px;
  height: 40px;
  padding: 0 10px;
  margin: 0 4px;
  border: 2px solid var(--blue);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  vertical-align: baseline;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.blank-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.blank-input.wrong {
  border-color: var(--danger);
  background: var(--coral-soft);
  animation: shake 0.4s ease;
}

.blank-input.correct {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  animation: pop 0.35s ease;
}

mark.blank-answer {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.practice-cn {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 14px;
  min-height: 22px;
}

.feedback {
  min-height: 24px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}

.feedback.correct {
  color: var(--green);
  animation: pop 0.3s ease;
}

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

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hint-text {
  display: inline-block;
  margin-top: 10px;
  padding: 9px 13px;
  border-radius: var(--radius);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  animation: pop 0.3s ease;
}

.practice-end {
  text-align: center;
  padding: 40px 30px;
}

/* ---------- quiz ---------- */
.quiz-layout {
  max-width: 720px;
  margin: 0 auto;
}

.quiz-config {
  padding: 30px;
  text-align: center;
}

.quiz-config h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.quiz-config > p {
  margin: 0 0 22px;
  color: var(--muted);
}

.quiz-config .field {
  text-align: left;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.quiz-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 18px;
}

.quiz-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #42c3a8);
  transition: width 0.28s ease;
}

.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.timer.urgent {
  color: var(--danger);
}

.timer-track {
  width: 130px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s linear;
}

.quiz-question {
  margin: 0 0 20px;
  font-size: 22px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.quiz-question .q-word {
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 0 7px;
  border-radius: 5px;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.quiz-option {
  position: relative;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.correct {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--coral-soft);
  color: var(--danger);
  animation: shake 0.35s ease;
}

.quiz-option .opt-letter {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  vertical-align: 2px;
}

.quiz-option.correct .opt-letter {
  background: var(--green);
  color: #fff;
}

.quiz-option.wrong .opt-letter {
  background: var(--danger);
  color: #fff;
}

.quiz-explain {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 13px;
  animation: pop 0.3s ease;
}

.quiz-explain strong {
  color: var(--ink);
}

.quiz-result {
  padding: 36px 30px;
  text-align: center;
}

.quiz-result h3 {
  margin: 14px 0 6px;
  font-size: 24px;
}

.quiz-result > p {
  margin: 0 0 22px;
  color: var(--muted);
}

.result-list {
  margin: 0 0 22px;
  text-align: left;
}

.result-list h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.result-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface-3);
  font-size: 14px;
}

.result-item .icon {
  flex: none;
  align-self: center;
}

.result-item .ok {
  color: var(--green);
}

.result-item .no {
  color: var(--danger);
}

.result-item strong {
  overflow-wrap: anywhere;
}

.result-item span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------- listening ---------- */
.listen-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

.phrase-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 560px;
  overflow-y: auto;
  padding: 12px;
}

.phrase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.phrase-item:hover {
  background: var(--surface-2);
}

.phrase-item.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.phrase-num {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.phrase-item.active .phrase-num {
  background: var(--accent);
  color: #fff;
}

.phrase-item.done .phrase-num {
  background: var(--green-soft);
  color: var(--green);
}

.phrase-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.phrase-item.active .phrase-preview {
  color: var(--accent-ink);
  font-weight: 600;
}

.listen-player {
  padding: 26px 28px;
}

.listen-progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.listen-progress-line .bar {
  flex: 1;
}

.big-play {
  width: 76px;
  height: 76px;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px rgba(14, 147, 132, 0.34);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.big-play:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 32px rgba(14, 147, 132, 0.4);
}

.big-play:active {
  transform: scale(0.96);
}

.listen-sentence {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.6;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}

.listen-cn {
  margin: 0 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  min-height: 22px;
}

.listen-speed {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.speed-btn {
  min-width: 64px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.speed-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.dictation {
  margin-top: 8px;
}

.dictation-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dictation-row .input {
  flex: 1;
}

.listen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.transcript {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px dashed var(--line-strong);
  font-size: 14px;
  animation: pop 0.3s ease;
}

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.gold {
  border-left: 3px solid var(--gold);
}

.toast .icon {
  color: var(--accent);
}

.toast.success .icon {
  color: var(--green);
}

.toast.error .icon {
  color: var(--danger);
}

.toast.gold .icon {
  color: var(--gold);
}

.toast.out {
  animation: toast-out 0.24s ease both;
}

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

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.92);
    opacity: 0.6;
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

/* ---------- bottom nav ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: 62px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: color 0.16s ease, background 0.16s ease;
}

.bottom-nav-item.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .dash-grid,
  .dash-grid.lower {
    grid-template-columns: 1fr;
  }

  .listen-layout {
    grid-template-columns: 1fr;
  }

  .phrase-list {
    max-height: 210px;
  }
}

@media (max-width: 820px) {
  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 16px calc(88px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    display: flex;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar-title h1 {
    font-size: 21px;
  }

  .dash-head {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }

  .dash-head .btn {
    width: 100%;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .practice-card {
    padding: 20px 18px;
  }

  .sentence-display {
    font-size: 18px;
  }

  .flash-word {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-info strong {
    font-size: 19px;
  }

  .stat-info span {
    font-size: 12px;
  }

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

  .flash-actions {
    flex-wrap: wrap;
  }

  .flash-actions .btn {
    flex: 1 1 40%;
  }

  .dictation-row {
    flex-direction: column;
    align-items: stretch;
  }

  .xp-pill {
    height: 34px;
    padding: 0 10px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
