/* "Góc luyện từ vựng" (vocab.js, vocab-practice.js). Mobile style (ui/vocab/**: AppCard,
   CategoryCard, StepBadge, MascotCard, AnswerOption, AnswerFeedbackPanel, LessonTopBar,
   LetterChunkPicker, the flip card), web layout: page head + underline tabs, a Today card
   beside "Gần đây", a category card grid, parts and words beside a sticky summary panel, the
   word list as a table, a centred lesson card with a progress rail, a statistics dashboard.
   Phones (< 768px) keep the app's single column, teal panels and pinned buttons.
   Tokens are the mobile values (AppTokens.kt / Color.kt) the shared :root does not carry yet. */
.vocab-page,
.vocab-dialog {
  --vc-link: var(--md-hero);
  --vc-success: var(--md-success);
  --vc-success-container: #ddf3e0;
  --vc-error: var(--md-error);
  --vc-error-container: var(--md-error-container);
  --vc-on-error-container: var(--md-on-error-container);
  --vc-surface-container: var(--md-surface-container);
  --vc-on-primary-container: var(--md-on-primary-container);
  --vc-tertiary-container: #bcebf1;
  --vc-on-tertiary-container: #002023;
  --vc-pro: var(--sn-pro);
  --vc-shadow: var(--md-card-shadow);
  --vc-shadow-hover: var(--md-card-shadow-hover);
}
.vocab-page {
  gap: 24px;
}
.vocab-page h2,
.vocab-page h3,
.vocab-page p {
  margin: 0;
}
.vocab-page ol,
.vocab-page ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.vocab-page .mi {
  width: 20px;
  height: 20px;
}
.vocab-chevron {
  color: var(--md-outline);
  flex: none;
}
.vocab-page .vocab-lock {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--vc-pro);
}
.vocab-local,
.vocab-hint,
.vocab-keys {
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.vocab-local.is-warn {
  color: var(--md-warning);
  font-weight: 600;
}
.vocab-empty-line {
  padding: 40px 0;
  text-align: center;
  color: var(--md-on-surface-variant);
  font-size: 16px;
}
.vocab-empty h2 {
  max-width: 440px;
}
.vocab-empty.is-inline {
  padding: 24px 0 8px;
}

/* ---------- shared bits: bars, icon tiles, pills, buttons ---------- */
.vocab-bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--md-streak-track);
}
.vocab-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--md-primary);
}
.vocab-bar.is-thin {
  height: 5px;
}
.vocab-bar.is-thick {
  height: 8px;
}
.vocab-bar.is-streak > span {
  background: var(--md-streak);
}
.vocab-bar.is-success > span {
  background: var(--vc-success);
}
.vocab-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
}
.vocab-icon.is-teal {
  background: var(--md-primary-container);
  color: var(--vc-on-primary-container);
}
.vocab-icon.is-amber {
  background: var(--md-streak-container);
  color: var(--md-on-streak-container);
}
.vocab-icon.is-blue {
  background: var(--vc-tertiary-container);
  color: var(--vc-on-tertiary-container);
}
.vocab-pill {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 999px;
  background: var(--md-surface);
  color: var(--vc-link);
  font: 600 14px/20px var(--font-app);
}
.vocab-pill > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vocab-pill:hover {
  border-color: var(--md-primary);
}
.vocab-pill.is-small {
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: #fff;
}
.vocab-pill.is-small:hover {
  background: var(--md-hero);
}
.vocab-pill.is-small .vocab-lock {
  color: #fff;
}
.vocab-pill.is-on-hero {
  border-color: #ffffff59;
  background: #ffffff1f;
  color: #fff;
}
.vocab-pill.is-on-hero:hover {
  background: #ffffff33;
}
.vocab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--md-on-surface);
  font: 700 16px/22px var(--font-app-bold);
  text-align: center;
  cursor: pointer;
}
.vocab-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.vocab-btn.is-wide {
  width: 100%;
}
.vocab-btn.is-primary {
  background: var(--md-primary);
  color: #fff;
}
.vocab-btn.is-primary:hover:not(:disabled) {
  background: var(--md-hero);
}
.vocab-btn.is-outline {
  border-color: var(--md-outline-variant);
  background: var(--md-surface);
  color: var(--md-on-surface);
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}
.vocab-btn.is-outline:hover {
  border-color: var(--md-primary);
  color: var(--md-primary);
}
.vocab-btn.is-text {
  color: var(--vc-link);
  font-size: 15px;
}
.vocab-btn.is-text:hover {
  background: var(--md-primary-container);
}
.vocab-btn.is-success {
  background: var(--vc-success);
  color: #fff;
}
.vocab-btn.is-error {
  background: var(--vc-error);
  color: #fff;
}
.vocab-btn.is-false {
  border: 2px solid #ba1a1a73;
  background: var(--md-surface);
  color: var(--vc-error);
}
.vocab-btn.is-false:hover {
  background: var(--vc-error-container);
}
.vocab-btn.is-icon {
  width: 52px;
  padding: 0;
  flex: none;
  border-color: var(--md-outline-variant);
  background: var(--md-surface);
  color: var(--md-on-surface-variant);
}
.vocab-btn .mi {
  width: 20px;
  height: 20px;
}

/* ---------- the corner: head, tabs ---------- */
.vocab-head p {
  max-width: 640px;
  color: var(--md-on-surface-variant);
}
.vocab-goal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 999px;
  background: var(--md-surface);
  color: var(--md-on-surface-variant);
  font: 600 14px/20px var(--font-app);
}
.vocab-goal-link .mi {
  color: var(--md-primary);
}
.vocab-goal-link strong {
  color: var(--vc-link);
}
.vocab-goal-link:hover {
  border-color: var(--md-primary);
}
.vocab-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--md-outline-variant);
}
.vocab-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  margin-bottom: -1px;
  padding: 0 2px;
  border-bottom: 3px solid transparent;
  color: var(--md-on-surface-variant);
  font: 600 15px/20px var(--font-app);
}
.vocab-tabs img {
  width: 24px;
  height: 24px;
}
.vocab-tabs a:hover {
  color: var(--md-on-surface);
  border-bottom-color: var(--md-outline-variant);
}
.vocab-tabs a[aria-current="page"] {
  color: var(--vc-link);
  border-bottom-color: var(--md-app-bar);
}
.vocab-tabs a:focus-visible {
  outline-offset: -3px;
}

/* ---------- Học: Today, Gần đây, the categories ---------- */
.vocab-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.vocab-today {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 22px 24px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 22px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
}
.vocab-today-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.vocab-caption {
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.vocab-today-count {
  color: var(--md-on-surface-variant);
  font-size: 15px;
}
.vocab-today-count strong {
  color: var(--md-primary);
  font: 700 36px/40px var(--font-app-bold);
  margin-right: 2px;
}
.vocab-today .vocab-bar {
  max-width: 520px;
  margin: 2px 0 6px;
}
.vocab-today-done {
  color: var(--vc-success);
  font-weight: 600;
}
.vocab-today-hint {
  color: var(--md-on-surface-variant);
}
.vocab-today-mam {
  width: 128px;
  flex: none;
  margin: -34px 0 -12px;
}
.vocab-recent {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}
.vocab-recent .web-section-title {
  font-size: 18px;
  line-height: 24px;
}
.vocab-recent-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
}
.vocab-recent-list li + li {
  border-top: 1px solid var(--md-divider);
}
.vocab-recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  color: var(--md-on-surface);
  font: 600 14px/20px var(--font-app);
}
.vocab-recent-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vocab-recent-item:hover {
  background: var(--vc-surface-container);
  color: var(--vc-link);
}
.vocab-cats-section {
  display: grid;
  gap: 14px;
}
.vocab-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.vocab-section-head span {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.vocab-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.vocab-cat {
  display: grid;
  align-content: start;
  gap: 10px;
  height: 100%;
  min-height: 124px;
  padding: 16px 18px 18px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
  color: var(--md-on-surface);
}
.vocab-cat:hover {
  border-color: #00796b59;
  box-shadow: var(--vc-shadow-hover);
}
.vocab-cat-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.vocab-cat-name {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font: 700 16px/22px var(--font-app-bold);
}
.vocab-cat-count {
  margin-top: auto;
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}

/* ---------- Thống kê: hero, tiles, the week chart ---------- */
.vocab-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.vocab-stats-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  border-radius: 24px;
  background: var(--md-hero);
  color: #fff;
}
.vocab-stats-hero > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}
.vocab-stats-label,
.vocab-stats-week {
  color: var(--md-on-hero-muted);
}
.vocab-stats-total {
  font: 700 52px/60px var(--font-app-bold);
}
.vocab-stats-hero .vocab-pill {
  margin-top: 8px;
}
.vocab-stats-mam {
  width: 140px;
  flex: none;
}
.vocab-stats-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.vocab-tile-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 20px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
}
.vocab-tile-label {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.vocab-tile-value {
  color: var(--md-on-surface-variant);
  font-size: 15px;
}
.vocab-tile-value strong {
  color: var(--md-on-surface);
  font: 700 30px/36px var(--font-app-bold);
}
.vocab-week {
  display: grid;
  gap: 16px;
}
.vocab-week-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.vocab-week-head h2 {
  font-size: 17px;
  line-height: 24px;
}
.vocab-week-head span {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.vocab-chart {
  --plot: 130px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.vocab-chart-col {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
}
/* DailyBarChart: the value sits on its bar; bars grow from a shared baseline (max × 1.1 = full). */
.vocab-chart-plot {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: calc(var(--plot) + 20px);
}
.vocab-chart-value {
  color: var(--md-on-surface-variant);
  font: 600 12px/16px var(--font-app);
}
.vocab-chart-bar {
  width: min(36px, 100%);
  height: max(4px, calc(var(--plot) * var(--f)));
  border-radius: 8px 8px 4px 4px;
  background: #00796b73;
}
.vocab-chart-bar.is-today {
  background: var(--md-primary);
}
.vocab-chart-bar.is-empty {
  background: var(--md-streak-track);
}
.vocab-chart-label {
  color: var(--md-on-surface-variant);
  font: 600 13px/18px var(--font-app);
}
.vocab-chart-col.is-today .vocab-chart-label {
  color: var(--vc-link);
  font-family: var(--font-app-bold);
  font-weight: 700;
}
.vocab-chart-col::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% - 12px);
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 8px;
  background: #1e2b28;
  color: #e8f0ee;
  font: 600 12px/18px var(--font-app);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.vocab-chart-col:hover::after {
  opacity: 1;
}
.vocab-chart-col:hover .vocab-chart-bar:not(.is-empty) {
  filter: brightness(0.92);
}

/* ---------- Cài đặt ---------- */
.vocab-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.vocab-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "icon chevron" "text text" "value value";
  align-content: start;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 176px;
  padding: 20px 20px 22px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 20px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
  color: var(--md-on-surface);
  font: inherit;
  text-align: left;
}
.vocab-setting:hover {
  border-color: #00796b59;
  box-shadow: var(--vc-shadow-hover);
}
.vocab-setting .vocab-icon {
  grid-area: icon;
}
.vocab-setting .vocab-chevron {
  grid-area: chevron;
}
.vocab-setting-text {
  grid-area: text;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.vocab-setting-text strong {
  font: 700 17px/24px var(--font-app-bold);
}
.vocab-setting-text small {
  color: var(--md-on-surface-variant);
  font-size: 14px;
  line-height: 20px;
}
.vocab-setting-value {
  grid-area: value;
  justify-self: start;
  align-self: end;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--md-primary-container);
  color: var(--vc-link);
  font: 700 14px/20px var(--font-app-bold);
  white-space: nowrap;
}

/* ---------- Mục tiêu hàng ngày ---------- */
.vocab-goal-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.vocab-goal-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 22px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
}
.vocab-goal-intro h2 {
  font: 700 19px/26px var(--font-app-bold);
}
.vocab-goal-intro p {
  margin-top: 4px;
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.vocab-goal-mam {
  width: 104px;
  flex: none;
}
.vocab-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.vocab-page .vocab-preset {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-height: 104px;
  margin: 0;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-size: 14px;
  cursor: pointer;
}
.vocab-preset input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.vocab-preset strong {
  font: 700 30px/36px var(--font-app-bold);
}
.vocab-preset span {
  color: var(--md-on-surface-variant);
  font-size: 13px;
  font-weight: 400;
}
.vocab-preset:hover {
  border-color: var(--md-primary);
}
.vocab-preset:has(input:checked) {
  border: 2px solid var(--md-primary);
  background: var(--md-primary-container);
}
.vocab-preset:has(input:checked) strong {
  color: var(--vc-on-primary-container);
}
.vocab-preset:has(input:focus-visible) {
  outline: 3px solid #bb7815;
  outline-offset: 4px;
}
.vocab-custom {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
}
.vocab-custom.is-selected {
  border: 2px solid var(--md-primary);
}
.vocab-custom-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vocab-custom-head h3 {
  flex: 1;
  font: 700 16px/22px var(--font-app-bold);
}
.vocab-custom-current {
  color: var(--vc-link);
  font: 700 15px/20px var(--font-app-bold);
}
.vocab-radio {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid var(--md-outline);
  border-radius: 50%;
}
.vocab-radio.is-on {
  border-color: var(--md-primary);
  box-shadow: inset 0 0 0 4px var(--md-surface), inset 0 0 0 10px var(--md-primary);
}
.vocab-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vocab-page .vocab-custom-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 0 16px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 14px;
  background: var(--md-surface);
  color: var(--md-on-surface-variant);
  font-size: 14px;
  font-weight: 400;
}
.vocab-custom-field:focus-within {
  border-color: var(--md-primary);
}
.vocab-custom-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--md-on-surface);
  font: 16px/22px var(--font-app);
}
.vocab-custom-field:has(input[aria-invalid="true"]) {
  border-color: var(--vc-error);
}
.vocab-custom-field span {
  flex: none;
  white-space: nowrap;
}
.vocab-goal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.vocab-goal-card h2 {
  font-size: 17px;
  line-height: 24px;
}
.vocab-goal-big {
  color: var(--md-on-surface-variant);
}
.vocab-goal-big strong {
  color: var(--md-primary);
  font: 700 40px/44px var(--font-app-bold);
}
.vocab-goal-list {
  display: grid;
  border-top: 1px solid var(--md-divider);
}
.vocab-goal-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--md-divider);
  color: var(--md-on-surface-variant);
}
.vocab-goal-list strong {
  color: var(--md-on-surface);
}

/* ---------- Từ đã thuộc ---------- */
.vocab-days {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.vocab-day {
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
}
.vocab-day-head {
  margin: 0;
  font: inherit;
}
.vocab-day-head button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 8px 12px 8px 18px;
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
}
.vocab-day-head button:hover {
  background: var(--vc-surface-container);
}
.vocab-day-head button:focus-visible {
  outline-offset: -3px;
}
.vocab-day-title {
  display: grid;
  flex: 1;
  min-width: 0;
}
.vocab-day-title strong {
  font: 700 16px/22px var(--font-app-bold);
}
.vocab-day-title small {
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.vocab-count-pill {
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--md-primary-container);
  color: var(--vc-link);
  font: 700 13px/18px var(--font-app-bold);
  white-space: nowrap;
}
.vocab-page .vocab-expand {
  width: 24px;
  height: 24px;
  color: var(--md-on-surface-variant);
}
.vocab-day.is-open .vocab-expand {
  transform: rotate(180deg);
}
.vocab-day-words {
  display: grid;
}
.vocab-day-words li {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 18px;
  border-top: 1px solid var(--md-divider);
}
.vocab-day-words strong {
  font: 700 16px/22px var(--font-app-bold);
  overflow-wrap: anywhere;
}
.vocab-day-words span {
  color: var(--md-on-surface-variant);
  overflow-wrap: anywhere;
}
.vocab-learned-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 14px 10px;
}
.vocab-learned-intro h2 {
  font: 700 17px/24px var(--font-app-bold);
}
.vocab-learned-intro p {
  margin-top: 2px;
  color: var(--md-on-surface-variant);
  font-size: 14px;
  line-height: 20px;
}
.vocab-learned-mam {
  width: 76px;
  flex: none;
}

/* ---------- parts and words: the summary panel ---------- */
.vocab-summary {
  display: grid;
  gap: 10px;
  padding: 22px 24px 24px;
  border-radius: 22px;
  background: var(--md-hero);
  color: #fff;
}
.vocab-summary-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vocab-summary h2 {
  font: 700 21px/28px var(--font-app-bold);
  overflow-wrap: anywhere;
}
.vocab-summary-eyebrow,
.vocab-summary-text,
.vocab-summary-row {
  color: var(--md-on-hero-muted);
  font-size: 14px;
  line-height: 20px;
}
.vocab-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.vocab-bar.is-on-panel {
  height: 8px;
  background: #ffffff38;
}
.vocab-bar.is-on-panel > span {
  background: #fff;
}
.vocab-summary .vocab-btn.is-primary {
  background: #fff;
  color: var(--md-hero);
}
.vocab-summary .vocab-btn.is-primary:hover {
  background: var(--md-primary-container);
}
.vocab-part-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.vocab-part {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-height: 76px;
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
  color: var(--md-on-surface);
}
.vocab-part:hover {
  border-color: #00796b59;
  box-shadow: var(--vc-shadow-hover);
}
.vocab-part.is-current {
  border: 2px solid var(--md-primary);
  padding: 11px 15px 11px 13px;
}
.vocab-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  font: 700 16px/1 var(--font-app-bold);
}
.vocab-badge.is-done {
  background: var(--vc-success);
  color: #fff;
}
.vocab-badge.is-current {
  background: var(--md-primary);
  color: #fff;
}
.vocab-badge.is-upcoming {
  background: var(--vc-surface-container);
  color: var(--md-on-surface-variant);
  box-shadow: inset 0 0 0 1.5px var(--md-outline-variant);
}
.vocab-part-body {
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.vocab-part-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.vocab-part-top strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 16px/22px var(--font-app-bold);
}
.vocab-part-top small {
  flex: none;
  color: var(--md-on-surface-variant);
  font-size: 13px;
}

/* ---------- a part's words: filters, the table, modes, voice ---------- */
.vocab-words-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.vocab-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.vocab-filter {
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 999px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 600 14px/20px var(--font-app);
}
.vocab-filter:hover {
  border-color: var(--md-primary);
}
.vocab-filter[aria-pressed="true"] {
  border-color: var(--md-primary);
  background: var(--md-primary);
  color: #fff;
}
.vocab-words-card {
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
}
.vocab-filter-empty {
  padding: 28px 24px;
  color: var(--md-on-surface-variant);
}
.vocab-words {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.vocab-words th {
  padding: 12px 12px;
  border-bottom: 1px solid var(--md-divider);
  background: var(--vc-surface-container);
  color: var(--md-on-surface-variant);
  font: 600 13px/18px var(--font-app);
  text-align: left;
}
.vocab-words th:first-child {
  width: 52px;
}
.vocab-words th:last-child {
  width: 128px;
}
.vocab-words td {
  padding: 4px 12px;
  border-bottom: 1px solid var(--md-divider);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.vocab-words tbody tr:last-child td {
  border-bottom: 0;
}
.vocab-words tbody tr:hover {
  background: #eef3f280;
}
.vocab-words-mark {
  text-align: center;
}
.vocab-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  vertical-align: middle;
}
.vocab-mark.is-learned {
  background: var(--vc-success);
  color: #fff;
}
.vocab-page .vocab-mark .mi {
  width: 15px;
  height: 15px;
}
.vocab-mark.is-started {
  box-shadow: inset 0 0 0 2px var(--md-primary);
}
.vocab-mark.is-new {
  box-shadow: inset 0 0 0 2px var(--md-outline-variant);
}
.vocab-words-en {
  font: 700 16px/22px var(--font-app-bold);
  color: var(--md-on-surface);
}
.vocab-words-vi {
  color: var(--md-on-surface-variant);
  font-size: 15px;
}
.vocab-words-say {
  white-space: nowrap;
  text-align: right;
}
.vocab-say {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--vc-link);
  font: 700 12px/16px var(--font-app-bold);
}
.vocab-say:hover {
  background: var(--md-primary-container);
}
.vocab-page .vocab-say .mi {
  width: 18px;
  height: 18px;
}
.vocab-tools {
  display: grid;
  gap: 16px;
}
.vocab-tools-btn {
  display: none;
}
.vocab-cta-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.vocab-modes,
.vocab-voice {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}
.vocab-modes h2,
.vocab-voice h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 22px;
}
.vocab-modes h2 .mi {
  color: var(--vc-link);
}
.vocab-mode-list {
  display: grid;
  gap: 8px;
}
.vocab-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 14px;
  color: var(--md-on-surface);
  font: 600 15px/20px var(--font-app);
}
.vocab-mode img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.vocab-mode span {
  flex: 1;
}
.vocab-mode:hover:not(.is-locked) {
  border-color: var(--md-primary);
  background: var(--md-primary-container);
}
.vocab-mode.is-locked {
  color: var(--md-outline);
  cursor: not-allowed;
}
.vocab-mode.is-locked img {
  filter: grayscale(1);
  opacity: 0.55;
}
.vocab-page .vocab-mode.is-locked .vocab-lock {
  color: var(--md-outline);
}
.vocab-seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #e7eeec;
}
.vocab-seg-btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--md-on-surface-variant);
  font: 600 14px/18px var(--font-app);
}
.vocab-seg-btn[aria-pressed="true"] {
  background: var(--md-surface);
  color: var(--md-primary);
  box-shadow: 0 1px 3px #0e242026;
}

/* ---------- the lesson card (LessonTopBar + ExerciseShell) ---------- */
.vocab-practice-page {
  justify-items: center;
}
.vocab-lesson {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 720px;
  padding: 24px 32px 28px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 26px;
  background: var(--md-surface);
  box-shadow: var(--vc-shadow);
}
.is-match .vocab-lesson {
  max-width: 860px;
}
.vocab-lesson > div {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.vocab-keys {
  text-align: center;
}
.vocab-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.vocab-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  margin-left: -10px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--md-on-surface-variant);
}
.vocab-close:hover {
  background: var(--vc-surface-container);
}
.vocab-page .vocab-close .mi {
  width: 24px;
  height: 24px;
}
.vocab-rail-bar {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--md-streak-track);
}
.vocab-rail-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--md-primary);
}
.vocab-rail-count {
  min-width: 44px;
  color: var(--md-on-surface-variant);
  font: 600 14px/20px var(--font-app);
  text-align: right;
}
.vocab-rail-title {
  flex: 1;
  margin-right: 34px;
  text-align: center;
  font: 700 17px/24px var(--font-app-bold);
}
.vocab-stage {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.vocab-tag {
  width: max-content;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--md-primary-container);
  color: var(--vc-link);
  font: 700 14px/18px var(--font-app-bold);
}
.vocab-tag.is-new {
  background: var(--md-streak-container);
  color: var(--md-warning);
}
.vocab-tag.is-mode {
  color: var(--vc-on-primary-container);
}
.vocab-prompt {
  font: 700 22px/30px var(--font-app-bold);
  color: var(--md-on-surface);
}
.vocab-prompt:focus,
#vocab-prompt:focus {
  outline: none;
}
.vocab-word-card,
.vocab-tf-card,
.vocab-prompt-card {
  min-width: 0;
  border: 1px solid var(--md-outline-variant);
  border-radius: 28px;
  background: var(--md-surface);
  box-shadow: 0 2px 6px #0e242010;
}
.vocab-word-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 30px 20px;
  text-align: center;
}
.vocab-word-en {
  font: 700 36px/44px var(--font-app-bold);
  color: var(--md-on-surface);
  overflow-wrap: anywhere;
}
.vocab-word-vi {
  font: 600 22px/30px var(--font-app);
  overflow-wrap: anywhere;
}
.vocab-divider {
  width: 48px;
  height: 2px;
  border-radius: 2px;
  background: var(--md-divider);
}
.vocab-speak {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--vc-on-primary-container);
}
.vocab-speak:hover {
  background: #c9e7e1;
}
.vocab-speak.is-large {
  width: 56px;
  height: 56px;
}
.vocab-page .vocab-speak .mi {
  width: 24px;
  height: 24px;
}
.vocab-page .vocab-speak.is-large .mi {
  width: 28px;
  height: 28px;
}
.vocab-tf-card {
  overflow: hidden;
  text-align: center;
}
.vocab-tf-card.is-right {
  border: 2px solid var(--vc-success);
}
.vocab-tf-card.is-wrong {
  border: 2px solid var(--vc-error);
}
.vocab-tf-top {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px 20px 22px;
  border-bottom: 1px solid var(--md-divider);
}
.vocab-tf-meaning {
  padding: 20px;
  font: 600 22px/30px var(--font-app);
  overflow-wrap: anywhere;
}
.vocab-prompt-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px 20px;
  border-radius: 24px;
  text-align: center;
}
.vocab-prompt-word {
  min-width: 0;
  font: 700 28px/36px var(--font-app-bold);
  overflow-wrap: anywhere;
}
.vocab-prompt-word.is-en {
  font-size: 34px;
  line-height: 42px;
}
.vocab-options {
  display: grid;
  gap: 10px;
}
.vocab-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  text-align: left;
  font: 600 16px/22px var(--font-app);
}
.vocab-option.is-idle:hover {
  border-color: var(--md-primary);
  background: #ddf0ec66;
}
.vocab-option-key {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--vc-surface-container);
  color: var(--md-on-surface-variant);
  font: 700 14px/1 var(--font-app-bold);
}
.vocab-option-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.vocab-option[aria-disabled="true"] {
  cursor: default;
}
.vocab-option.is-correct {
  border-color: var(--vc-success);
  background: var(--vc-success-container);
  color: var(--vc-success);
  font-family: var(--font-app-bold);
  font-weight: 700;
}
.vocab-option.is-correct .vocab-option-key {
  background: var(--vc-success);
  color: #fff;
}
.vocab-option.is-wrong {
  border-color: var(--vc-error);
  background: var(--vc-error-container);
  color: var(--vc-on-error-container);
  font-family: var(--font-app-bold);
  font-weight: 700;
}
.vocab-option.is-wrong .vocab-option-key {
  background: var(--vc-error);
  color: #fff;
}
.vocab-option.is-inactive {
  color: #0e242080;
}
.vocab-option.is-inactive .vocab-option-key {
  color: #4b5f5b80;
}
.vocab-built {
  display: grid;
  place-items: center;
  min-height: 60px;
  padding: 10px 14px;
  border: 2px solid var(--md-primary);
  border-radius: 18px;
  background: var(--md-surface);
  font: 700 24px/32px var(--font-app-bold);
  text-align: center;
  overflow-wrap: anywhere;
}
.vocab-built.is-right {
  border-color: var(--vc-success);
}
.vocab-built.is-wrong {
  border-color: var(--vc-error);
}
.vocab-built-empty {
  color: var(--md-outline-variant);
}
.vocab-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.vocab-tile {
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 14px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 600 18px/24px var(--font-app);
}
.vocab-tiles.is-letters .vocab-tile {
  width: 48px;
  padding: 0;
}
.vocab-tile:hover:not(:disabled):not(.is-used) {
  border-color: var(--md-primary);
}
.vocab-tile.is-used {
  background: var(--vc-surface-container);
  color: #4b5f5b66;
  transform: scale(0.9);
}
.vocab-tile:disabled {
  cursor: default;
  opacity: 1;
}
.vocab-controls {
  display: grid;
  gap: 10px;
}
.vocab-check-row {
  display: flex;
  gap: 10px;
}
.vocab-tf-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.vocab-tf-buttons .vocab-btn {
  min-height: 60px;
}
.vocab-feedback {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
  border-radius: 22px;
}
.vocab-feedback.is-right {
  background: var(--vc-success-container);
  color: var(--vc-success);
}
.vocab-feedback.is-wrong {
  background: var(--vc-error-container);
  color: var(--vc-on-error-container);
}
.vocab-feedback-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vocab-feedback-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
}
.is-right .vocab-feedback-icon {
  background: var(--vc-success);
}
.is-wrong .vocab-feedback-icon {
  background: var(--vc-error);
}
.vocab-feedback-title {
  font: 700 22px/28px var(--font-app-bold);
}
.vocab-feedback-text {
  font-size: 16px;
  line-height: 24px;
}
.vocab-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.vocab-feedback-actions [data-vocab="continue"] {
  flex: 1 1 220px;
}

/* ---------- the result (ResultView) ---------- */
.vocab-result {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 8px 0 0;
  text-align: center;
}
.vocab-result-mam {
  width: 168px;
}
.vocab-result-lead {
  color: var(--md-on-surface-variant);
  font-size: 17px;
}
.vocab-result-score {
  color: var(--md-primary);
  font: 700 60px/68px var(--font-app-bold);
}
.vocab-result-score.is-low {
  color: var(--md-warning);
}
.vocab-result-text {
  max-width: 340px;
  font-size: 16px;
  line-height: 24px;
}
.vocab-result-tiles {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.vocab-stat {
  display: grid;
  gap: 2px;
  flex: 1;
  max-width: 260px;
  padding: 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 16px;
}
.vocab-stat strong {
  font: 700 22px/28px var(--font-app-bold);
}
.vocab-stat span {
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.vocab-result-actions {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

/* ---------- Flashcard ---------- */
.vocab-flip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.vocab-flip-pos {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.vocab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.vocab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 999px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 600 14px/18px var(--font-app);
}
.vocab-page .vocab-chip .mi {
  width: 16px;
  height: 16px;
}
.vocab-chip.is-on {
  border-color: var(--md-primary);
  background: var(--md-primary);
  color: #fff;
}
.vocab-flip-deck {
  position: relative;
  height: 320px;
}
.vocab-page .vocab-flip-card {
  height: 100%;
  border-radius: 28px;
  perspective: 1200px;
}
.vocab-flip-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.vocab-flip-card.is-flipped .vocab-flip-inner {
  transform: rotateY(180deg);
}
.vocab-flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  border-radius: 28px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.vocab-flip-face.is-front {
  border: 1px solid var(--md-outline-variant);
  background: var(--md-surface);
  box-shadow: 0 2px 8px #0e242012;
  color: var(--md-on-surface);
}
.vocab-flip-face.is-back {
  transform: rotateY(180deg);
  background: var(--md-hero);
  color: #fff;
}
.vocab-flip-face strong {
  max-width: 100%;
  font: 700 36px/44px var(--font-app-bold);
  overflow-wrap: anywhere;
}
.vocab-flip-face.is-back strong {
  font-size: 30px;
  line-height: 40px;
}
.vocab-flip-face small {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.vocab-flip-face.is-back small {
  color: var(--md-on-hero-muted);
}
.vocab-flip-prompt {
  color: var(--vc-link);
  text-align: center;
  font: 700 17px/24px var(--font-app-bold);
}
.vocab-flip-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.vocab-flip-actions .vocab-btn.is-outline {
  min-height: 52px;
  font-size: 16px;
}

/* ---------- Nối nghĩa ---------- */
.vocab-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.vocab-match-col {
  display: grid;
  gap: 10px;
  align-content: start;
}
.vocab-match-card {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 8px 10px;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 16px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 400 16px/22px var(--font-app);
  text-align: center;
  overflow-wrap: anywhere;
}
.vocab-match-card.is-left {
  font-family: var(--font-app-bold);
  font-weight: 700;
}
.vocab-match-card:hover:not(.is-matched) {
  border-color: var(--md-primary);
}
.vocab-match-card.is-selected {
  border: 2px solid var(--md-primary);
  background: var(--md-primary-container);
  color: var(--vc-on-primary-container);
}
.vocab-match-card.is-matched {
  border-color: transparent;
  background: var(--vc-success-container);
  color: var(--vc-success);
  opacity: 0.75;
  transform: scale(0.96);
  cursor: default;
}
.vocab-match-card.is-wrong {
  border: 2px solid var(--vc-error);
  background: var(--vc-error-container);
  color: var(--vc-on-error-container);
}
.vocab-match-wrong {
  justify-self: center;
  min-height: 40px;
}
.vocab-match-wrong:not(:empty) {
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--vc-error-container);
  color: var(--vc-on-error-container);
  font: 700 14px/20px var(--font-app-bold);
}

/* ---------- Ôn tập done ---------- */
.vocab-review-done {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 40px 0 24px;
  text-align: center;
}
.vocab-review-done p {
  color: var(--md-primary);
  font: 700 20px/28px var(--font-app-bold);
}

/* ---------- dialogs: exit, alert, dictionary ---------- */
.vocab-dialog h2 {
  margin: 0 0 8px;
}
.vocab-dialog .icon-tile {
  margin-bottom: 12px;
}
.vocab-dialog .icon-tile .mi {
  width: 24px;
  height: 24px;
}

/* ---------- tablet and up ---------- */
@media (min-width: 768px) {
  .vocab-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vocab-days .vocab-day-words {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vocab-days .vocab-day-words li:nth-child(odd) {
    border-right: 1px solid var(--md-divider);
  }
}
@media (min-width: 1280px) {
  .vocab-top {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  }
  .vocab-today.is-wide {
    grid-column: 1 / -1;
  }
}
@media (min-width: 768px) and (max-width: 1279px) {
  .vocab-recent-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vocab-recent-list li + li {
    border-top: 0;
  }
  .vocab-recent-list li {
    border-bottom: 1px solid var(--md-divider);
  }
  .vocab-recent-list li:nth-child(odd) {
    border-right: 1px solid var(--md-divider);
  }
}
@media (min-width: 1024px) {
  .vocab-today {
    padding: 26px 32px;
  }
  .vocab-today-mam {
    width: 150px;
  }
  .vocab-stats {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }
  .vocab-stats-tiles {
    grid-template-columns: minmax(0, 1fr);
  }
  .vocab-week {
    grid-column: 1 / -1;
  }
  .vocab-chart {
    --plot: 180px;
  }
  .vocab-stats-hero {
    padding: 28px 36px;
  }
  .vocab-stats-mam {
    width: 168px;
  }
  .vocab-flip-deck {
    height: 340px;
  }
}
@media (min-width: 1280px) {
  .vocab-cats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Below the two-column layout the summary panel comes first, as mobile's app-bar panel. */
@media (max-width: 1023px) {
  .vocab-parts > .web-aside,
  .vocab-wordlist > .web-aside,
  .vocab-learned > .web-aside {
    order: -1;
  }
  .vocab-wordlist > .web-aside {
    grid-template-columns: minmax(0, 1fr);
  }
  .vocab-goal > .web-aside {
    order: 2;
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .vocab-wordlist .vocab-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

/* ---------- phones: the app's single column, teal panels, pinned buttons ---------- */
@media (max-width: 767px) {
  /* A lesson or study mode takes the whole screen, as on mobile (no tab bar under it). */
  .app-shell:has(.vocab-practice-page) .sidebar {
    display: none;
  }
  .app-shell:has(.vocab-practice-page) .workspace {
    padding-bottom: 0;
  }
  .vocab-practice-page .audio-status:not(:empty) {
    bottom: 24px;
  }
  .vocab-page {
    gap: 16px;
  }
  .vocab-head {
    display: none;
  }
  .vocab-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: calc(-1 * var(--main-pad-top)) calc(-1 * var(--main-pad-x)) 0;
    padding: 0 var(--main-pad-x);
    background: var(--md-surface);
  }
  .vocab-tabs a {
    justify-content: center;
    gap: 6px;
    font-size: 14px;
  }
  .vocab-today {
    margin-top: 14px;
    padding: 16px 16px 16px 18px;
    border-radius: 20px;
  }
  .vocab-today-mam {
    width: 104px;
    margin: -30px -4px -8px 0;
  }
  .vocab-today-count strong {
    font-size: 30px;
    line-height: 34px;
  }
  .vocab-recent-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: none;
    scrollbar-width: none;
  }
  .vocab-recent-list li + li {
    border: 0;
  }
  .vocab-recent-item {
    max-width: 200px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    background: var(--md-surface);
  }
  .vocab-cats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .vocab-cat {
    min-height: 96px;
    padding: 12px;
    gap: 8px;
    border-radius: 16px;
  }
  .vocab-cat-top {
    gap: 8px;
    align-items: flex-start;
  }
  .vocab-cat .vocab-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .vocab-cat .vocab-icon .mi {
    width: 18px;
    height: 18px;
  }
  .vocab-cat-name {
    font-size: 14px;
    line-height: 20px;
  }
  .vocab-stats-tiles {
    order: 2;
  }
  .vocab-stats-hero {
    padding: 20px;
    border-radius: 20px;
  }
  .vocab-stats-total {
    font-size: 44px;
    line-height: 52px;
  }
  .vocab-stats-mam {
    width: 104px;
  }
  .vocab-tile-card {
    padding: 14px;
  }
  .vocab-tile-value strong {
    font-size: 24px;
    line-height: 30px;
  }
  .vocab-chart {
    --plot: 110px;
    gap: 4px;
  }
  .vocab-settings {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-top: 4px;
    overflow: hidden;
    border: 1px solid var(--md-outline-variant);
    border-radius: 18px;
    background: var(--md-surface);
  }
  .vocab-settings li + li {
    border-top: 1px solid var(--md-divider);
  }
  .vocab-setting {
    grid-template-columns: 32px minmax(0, 1fr) auto auto;
    grid-template-areas: "icon text value chevron";
    align-items: center;
    min-height: 60px;
    padding: 8px 12px 8px 16px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .vocab-setting:hover {
    box-shadow: none;
    background: var(--vc-surface-container);
  }
  .vocab-setting .vocab-icon {
    width: 32px;
    background: none;
    color: var(--md-primary);
  }
  .vocab-setting-text strong {
    font: 400 16px/22px var(--font-app);
  }
  .vocab-setting-text small {
    display: none;
  }
  .vocab-setting-value {
    align-self: center;
    padding: 0;
    background: none;
  }
  .vocab-presets {
    gap: 10px;
  }
  .vocab-goal-intro {
    padding: 14px 16px;
  }
  .vocab-goal-mam {
    width: 84px;
  }
  .vocab-custom-row {
    flex-wrap: wrap;
  }
  .vocab-page .vocab-custom-field {
    flex-basis: 100%;
  }
  .vocab-custom-row .vocab-btn {
    width: 100%;
  }
  /* The summary is mobile's teal panel under the app bar; its button is pinned above the nav. */
  .vocab-parts .vocab-summary,
  .vocab-wordlist .vocab-summary {
    margin: calc(-1 * var(--main-pad-top)) calc(-1 * var(--main-pad-x)) 0;
    padding: 4px var(--main-pad-x) 18px;
    border-radius: 0;
    background: var(--md-app-bar);
  }
  .vocab-parts .vocab-summary-top,
  .vocab-wordlist .vocab-summary h2,
  .vocab-wordlist .vocab-summary-eyebrow {
    display: none;
  }
  .vocab-parts-page,
  .vocab-words-page {
    padding-bottom: 76px;
  }
  .vocab-cta-row {
    position: fixed;
    left: var(--gutter);
    right: var(--gutter);
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 5;
    margin: 0;
  }
  .vocab-summary .vocab-btn.vocab-sticky-cta,
  .vocab-summary .vocab-btn.vocab-sticky-cta:hover {
    width: auto;
    flex: 1;
    min-width: 0;
    background: var(--md-primary);
    color: #fff;
    box-shadow: 0 6px 20px #0e242033;
  }
  .vocab-summary .vocab-tools-btn {
    display: grid;
    place-items: center;
    width: 54px;
    min-height: 54px;
    border: 1.5px solid var(--md-outline-variant);
    background: var(--md-surface);
    color: var(--vc-link);
    box-shadow: 0 6px 20px #0e242026;
  }
  .vocab-summary .vocab-tools-btn.is-dim {
    color: var(--md-outline);
  }
  .vocab-wordlist .vocab-tools {
    display: none;
    position: fixed;
    left: var(--gutter);
    right: var(--gutter);
    bottom: calc(142px + env(safe-area-inset-bottom));
    z-index: 6;
    max-width: 360px;
    padding: 6px;
    gap: 6px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 22px;
    background: var(--md-surface);
    box-shadow: 0 16px 48px #0e242033;
  }
  .vocab-wordlist .vocab-tools.is-open {
    display: grid;
  }
  .vocab-wordlist .vocab-tools .web-card {
    border: 0;
    box-shadow: none;
    padding: 12px 14px;
  }
  .vocab-parts-page .audio-status:not(:empty),
  .vocab-words-page .audio-status:not(:empty) {
    bottom: 150px;
  }
  .vocab-part-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .vocab-modes,
  .vocab-voice {
    padding: 14px 16px;
  }
  .vocab-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(-1 * var(--main-pad-x));
    padding: 0 var(--main-pad-x);
    scrollbar-width: none;
  }
  .vocab-filter {
    flex: none;
    padding: 0 14px;
  }
  .vocab-words thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .vocab-words,
  .vocab-words tbody {
    display: block;
  }
  .vocab-words tr {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "mark en say" "mark vi say";
    align-items: center;
    column-gap: 8px;
    padding: 8px 4px 8px 14px;
    border-bottom: 1px solid var(--md-divider);
  }
  .vocab-words tbody tr:last-child {
    border-bottom: 0;
  }
  .vocab-words td {
    padding: 0;
    border: 0;
  }
  .vocab-words-mark {
    grid-area: mark;
    text-align: left;
  }
  .vocab-words-en {
    grid-area: en;
  }
  .vocab-words-vi {
    grid-area: vi;
    font-size: 13px;
    line-height: 18px;
  }
  .vocab-words-say {
    grid-area: say;
  }
  .vocab-say {
    min-width: 44px;
    padding: 0 4px;
    flex-direction: column;
    gap: 0;
    font-size: 10px;
    line-height: 12px;
  }
  /* The lesson fills the screen like mobile's: no outer card. */
  .vocab-practice-page {
    padding-bottom: 8px;
  }
  .vocab-lesson {
    gap: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .vocab-keys {
    display: none;
  }
  .vocab-prompt {
    font-size: 20px;
    line-height: 28px;
  }
  .vocab-word-en,
  .vocab-prompt-word.is-en,
  .vocab-flip-face strong {
    font-size: 30px;
    line-height: 38px;
  }
  .vocab-prompt-word {
    font-size: 24px;
    line-height: 32px;
  }
  .vocab-feedback {
    margin: 0 calc(-1 * var(--main-pad-x));
    padding: 18px var(--main-pad-x) 20px;
    border-radius: 26px 26px 0 0;
  }
  .vocab-flip-deck {
    height: 280px;
  }
  .vocab-result-mam {
    width: 150px;
  }
  .vocab-result-score {
    font-size: 52px;
    line-height: 60px;
  }
  .vocab-learned-mam {
    width: 64px;
  }
  .vocab-learned-intro {
    padding: 10px 14px 10px 8px;
  }
}
@media (hover: none) {
  .vocab-keys {
    display: none;
  }
}

/* ---------- motion (none with reduced motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .vocab-cat,
  .vocab-part,
  .vocab-setting,
  .vocab-option,
  .vocab-tile,
  .vocab-match-card,
  .vocab-filter,
  .vocab-chip {
    transition: border-color 0.18s, background-color 0.18s, box-shadow 0.18s, transform 0.18s, opacity 0.18s;
  }
  .vocab-cat:hover,
  .vocab-part:hover,
  .vocab-setting:hover {
    transform: translateY(-2px);
  }
  .vocab-flip-inner {
    transition: transform 0.3s ease;
  }
  .vocab-expand {
    transition: transform 0.2s;
  }
  .vocab-stage.is-entering {
    animation: vocab-enter 240ms ease-out;
  }
  .vocab-word-card {
    animation: vocab-spring 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .vocab-feedback {
    animation: vocab-rise 260ms ease-out;
  }
  .vocab-option.is-correct {
    animation: vocab-pop 280ms ease-in-out;
  }
  .vocab-result-score {
    animation: vocab-spring 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .vocab-match-card.is-wrong {
    animation: vocab-shake 350ms linear;
  }
  .vocab-rail-bar > span {
    transition: width 0.3s ease;
  }
  .vocab-chart-bar {
    animation: vocab-grow 700ms cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom;
  }
}
@keyframes vocab-enter {
  from { opacity: 0; transform: translateX(8%); }
  to { opacity: 1; transform: none; }
}
@keyframes vocab-spring {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}
@keyframes vocab-rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes vocab-pop {
  50% { transform: scale(1.04); }
}
@keyframes vocab-shake {
  0%, 100% { translate: 0; }
  14%, 43%, 71% { translate: 12px; }
  29%, 57%, 86% { translate: -12px; }
}
@keyframes vocab-grow {
  from { transform: scaleY(0); }
}

/* ConfirmSheet / AlertDialog: centred, the two buttons side by side. */
.vocab-exit,
.vocab-alert {
  text-align: center;
}
.vocab-exit .dialog-actions,
.vocab-alert .dialog-actions {
  justify-content: center;
}
.vocab-exit .dialog-actions .button {
  flex: 1;
}
.vocab-alert .icon-tile {
  margin-inline: auto;
}
