:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #14201c;
  --ink-soft: #33443e;
  --muted: #68756f;
  --line: #dce3dd;
  --line-strong: #c8d2ca;
  --green: #176a55;
  --green-dark: #0f4d3f;
  --green-soft: #e7f2ed;
  --coral: #df654a;
  --coral-soft: #fff0eb;
  --gold: #d3a02e;
  --stage: #142a24;
  --stage-muted: #a9beb7;
  --white: #ffffff;
  --shadow: 0 18px 44px rgba(28, 47, 40, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 106, 85, 0.24);
  outline-offset: 2px;
}

svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.9;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 28px;
  padding: 13px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  min-width: 205px;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 7px;
  color: var(--white);
  background: var(--green);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 21px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

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

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

.search-box {
  display: flex;
  min-width: 260px;
  max-width: 600px;
  height: 44px;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: var(--green);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(23, 106, 85, 0.08);
}

.search-box svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #89958f;
}

.search-box kbd {
  display: grid;
  min-width: 25px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
}

.voice-status {
  display: flex;
  min-width: 132px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(211, 160, 46, 0.12);
}

.voice-status.is-ready .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(23, 106, 85, 0.12);
}

.voice-status.is-error .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(223, 101, 74, 0.12);
}

.workspace {
  display: grid;
  width: min(100%, 1540px);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  height: calc(100vh - 76px);
  padding: 25px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.progress-heading,
.settings-title-row,
.library-heading,
.stage-topline,
.stage-actions,
.list-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-heading h2,
.settings-title-row h2,
.library-heading h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.progress-heading > strong {
  color: var(--green);
  font-size: 22px;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  margin-top: 17px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8ece8;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 280ms ease;
}

.stat-grid {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.stat-grid div {
  display: grid;
  gap: 1px;
}

.stat-grid strong {
  font-size: 16px;
}

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

.level-switch {
  margin-top: 23px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.level-switch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.level-switch-heading span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.level-switch-heading small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.level-switch-buttons {
  display: grid;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.level-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.level-button span {
  font-size: 11px;
  white-space: nowrap;
}

.level-button:hover {
  color: var(--green);
  background: var(--surface);
}

.level-button.is-active {
  border-color: #cfe0d7;
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(28, 47, 40, 0.07);
}

.level-button em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.level-button.is-active em {
  color: var(--green);
}

.filter-nav {
  display: grid;
  gap: 6px;
  margin-top: 25px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.filter-button {
  display: grid;
  min-height: 45px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  grid-template-columns: 24px 1fr auto;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.filter-button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.filter-button.is-active {
  border-color: #cfe0d7;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 700;
}

.filter-button span {
  padding-left: 6px;
}

.filter-button em {
  min-width: 26px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.filter-button.is-active em {
  color: var(--green);
}

.settings-panel {
  margin-top: 24px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.settings-title-row svg {
  color: var(--green);
}

.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 13px;
}

.range-row output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.rate-slider {
  width: 100%;
  margin: 10px 0 21px;
  accent-color: var(--green);
}

.switch-row {
  display: grid;
  align-items: start;
  gap: 12px;
  grid-template-columns: 1fr auto;
  cursor: pointer;
}

.switch-row > span:first-child {
  display: grid;
  gap: 2px;
}

.switch-row strong {
  font-size: 13px;
}

.switch-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: #c8d2ca;
  transition: background 160ms ease;
}

.switch-ui::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(20, 32, 28, 0.25);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked + .switch-ui {
  background: var(--green);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(16px);
}

.switch-row input:focus-visible + .switch-ui {
  outline: 3px solid rgba(23, 106, 85, 0.24);
  outline-offset: 3px;
}

.source-panel {
  display: flex;
  gap: 11px;
  margin-top: 25px;
  padding: 15px 0 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.source-panel svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--coral);
}

.source-panel div {
  display: grid;
}

.source-panel span,
.source-panel small {
  font-size: 10px;
}

.source-panel strong {
  margin: 2px 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

.study-stage {
  position: relative;
  min-height: 385px;
  padding: 28px 30px 25px;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--stage);
  box-shadow: var(--shadow);
}

.study-stage::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 190px;
  height: 6px;
  background: var(--coral);
  content: "";
}

.stage-topline {
  position: relative;
  z-index: 1;
  color: var(--stage-muted);
  font-size: 12px;
}

.stage-label,
.stage-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-index {
  color: #cbe1d8;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.page-badge {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  color: #d3e2dc;
  background: rgba(255, 255, 255, 0.06);
}

.word-display {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  min-height: 242px;
  padding: 23px 0 17px;
}

.word-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.word-speak {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  border: 0;
  color: var(--white);
  background: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 66px;
  line-height: 1.08;
  text-align: left;
}

.word-speak:hover svg {
  color: #dfeee8;
  transform: scale(1.08);
}

.word-speak svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: #81aa9c;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.word-speak.is-speaking svg {
  color: #f6b29f;
  animation: voicePulse 800ms ease-in-out infinite;
}

@keyframes voicePulse {
  50% {
    opacity: 0.45;
    transform: scale(0.92);
  }
}

.bookmark-button {
  margin-top: 8px;
}

.word-meaning {
  max-width: 800px;
  margin: 14px 0 0;
  color: #eff6f2;
  font-size: 18px;
  font-weight: 600;
}

.meaning-reveal {
  display: flex;
  min-height: 42px;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px dashed rgba(206, 231, 220, 0.28);
  border-radius: 5px;
  color: #eff6f2;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.meaning-reveal:hover,
.meaning-reveal:focus-visible {
  border-color: rgba(206, 231, 220, 0.58);
  background: rgba(255, 255, 255, 0.09);
}

.meaning-reveal:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.meaning-hidden-state,
.meaning-hide-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.meaning-hidden-state {
  color: var(--stage-muted);
  font-size: 13px;
  font-weight: 650;
}

.meaning-hidden-state svg,
.meaning-hide-hint svg {
  width: 16px;
  height: 16px;
}

.meaning-reveal .word-meaning {
  margin: 0;
}

.meaning-hide-hint {
  margin-left: auto;
  color: #a9bbb3;
  font-size: 11px;
  font-weight: 650;
}

.meaning-reveal[aria-expanded="false"] .word-meaning,
.meaning-reveal[aria-expanded="false"] .meaning-hide-hint {
  display: none;
}

.meaning-reveal[aria-expanded="true"] .meaning-hidden-state {
  display: none;
}

.word-note {
  max-width: 840px;
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--stage-muted);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.note-inline-translation {
  color: #b7d9ca;
  font-weight: 650;
}

.note-part-of-speech {
  color: #86c5a8;
  font-weight: 800;
}

.note-label {
  color: var(--green);
  font-weight: 750;
}

.mobile-rate-control {
  display: none;
}

.rate-step-button {
  display: inline-flex;
  width: 40px;
  min-width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(225, 238, 233, 0.2);
  border-radius: 5px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
}

.rate-step-button:hover,
.rate-step-button:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.rate-step-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.rate-step-button svg {
  width: 17px;
  height: 17px;
}

.stage-actions {
  position: relative;
  z-index: 1;
  gap: 18px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.playback-group,
.secondary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.text-button,
.primary-speak {
  display: inline-flex;
  min-width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #dce9e4;
  background: rgba(255, 255, 255, 0.06);
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.icon-button:hover,
.text-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.icon-button.is-active,
.text-button.is-active {
  border-color: rgba(246, 178, 159, 0.55);
  color: #ffd8cc;
  background: rgba(223, 101, 74, 0.14);
}

.text-button {
  padding: 0 13px;
  font-size: 13px;
}

.primary-speak {
  min-width: 102px;
  padding: 0 17px;
  border-color: var(--white);
  color: var(--stage);
  background: var(--white);
  font-weight: 750;
}

.primary-speak:hover {
  border-color: #e9f2ee;
  background: #e9f2ee;
}

.library {
  margin-top: 24px;
  padding: 24px 0 16px;
}

.library-heading {
  gap: 20px;
  padding: 0 2px 18px;
}

.library-heading h1 {
  font-size: 24px;
}

.library-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-select {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.page-select svg {
  color: var(--muted);
}

.page-select select {
  border: 0;
  outline: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
}

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

.library .icon-button:hover {
  border-color: var(--line-strong);
  color: var(--green);
  background: var(--green-soft);
}

.list-result-bar {
  min-height: 45px;
  padding: 0 3px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.list-result-bar p {
  margin: 0;
}

.list-result-bar span {
  color: var(--green);
  font-weight: 700;
}

.word-list-head,
.word-row {
  display: grid;
  grid-template-columns: 190px minmax(260px, 1fr) 78px 104px;
  gap: 16px;
}

.word-list-head {
  padding: 13px 10px;
  color: var(--muted);
  font-size: 11px;
}

.word-list {
  min-height: 200px;
}

.word-row {
  position: relative;
  min-height: 78px;
  align-items: center;
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.word-row:last-child {
  border-bottom: 1px solid var(--line);
}

.word-row:hover {
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 9px 24px rgba(25, 45, 38, 0.06);
}

.word-row.is-selected {
  background: var(--green-soft);
  box-shadow: inset 3px 0 0 var(--green);
}

.word-row.is-speaking .row-word {
  color: var(--green);
}

.row-word-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.row-word-button:hover {
  color: var(--green);
}

.row-word {
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.2;
}

.word-row.is-speaking .row-word-button svg {
  color: var(--coral);
}

.row-word-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #a3aea8;
}

.row-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.row-meaning-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.row-meaning-toggle:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.row-meaning-hidden {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 5px;
  color: #75847d;
  font-size: 12px;
  font-weight: 650;
}

.row-meaning-hidden svg {
  width: 14px;
  height: 14px;
}

.row-meaning-toggle[aria-expanded="false"] .row-meaning,
.row-meaning-toggle[aria-expanded="false"] .row-note {
  display: none;
}

.row-meaning-toggle[aria-expanded="true"] .row-meaning-hidden {
  display: none;
}

.row-meaning {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.row-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.row-page {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.row-actions .icon-button,
.bookmark-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-color: var(--line);
  color: #748078;
  background: var(--surface);
}

.row-actions .icon-button:hover,
.bookmark-button:hover {
  border-color: #b8cbbf;
  color: var(--green);
  background: var(--green-soft);
}

.row-actions .icon-button.is-active,
.bookmark-button.is-active {
  border-color: #c7dacf;
  color: var(--green);
  background: var(--green-soft);
}

.row-actions .mastery-button.is-active {
  border-color: #f0c7bc;
  color: var(--coral);
  background: var(--coral-soft);
}

.study-stage .bookmark-button {
  border-color: rgba(255, 255, 255, 0.14);
  color: #c9dad4;
  background: rgba(255, 255, 255, 0.06);
}

.study-stage .bookmark-button:hover,
.study-stage .bookmark-button.is-active {
  border-color: rgba(246, 178, 159, 0.55);
  color: #ffd8cc;
  background: rgba(223, 101, 74, 0.14);
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 65px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  color: var(--coral);
}

.empty-state strong {
  color: var(--ink-soft);
  font-size: 15px;
}

.empty-state span {
  margin: 3px 0 14px;
  font-size: 13px;
}

.empty-state button,
.load-more {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface);
  font-weight: 650;
}

.empty-state button:hover,
.load-more:hover {
  border-color: var(--green);
  color: var(--green);
}

.load-more {
  display: block;
  width: min(100%, 320px);
  margin: 22px auto 3px;
}

.load-more[hidden] {
  display: none;
}

.toast {
  position: fixed;
  z-index: 60;
  bottom: 22px;
  left: 50%;
  padding: 10px 15px;
  border-radius: 7px;
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(20, 32, 28, 0.22);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .word-list-head,
  .word-row {
    grid-template-columns: 170px minmax(220px, 1fr) 64px 92px;
  }

  .word-speak {
    font-size: 58px;
  }

  .text-button {
    padding: 0 10px;
  }
}

@media (max-width: 940px) {
  .topbar {
    gap: 18px;
    padding-inline: 18px;
  }

  .brand {
    min-width: 176px;
  }

  .voice-status {
    min-width: auto;
  }

  .voice-status span:last-child {
    display: none;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    position: static;
    display: grid;
    height: auto;
    padding: 16px 18px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-columns: minmax(200px, 0.85fr) minmax(330px, 1.15fr);
    gap: 18px 26px;
  }

  .filter-nav {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .level-switch {
    margin: 0;
    padding: 0;
    border: 0;
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .level-switch-heading {
    max-width: 330px;
  }

  .level-switch-buttons {
    max-width: 330px;
  }

  .settings-panel {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .source-panel {
    display: none;
  }

  .main-content {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .topbar {
    display: grid;
    gap: 10px 14px;
    padding: 11px 14px 13px;
    grid-template-columns: 1fr auto;
  }

  .brand {
    min-width: 0;
  }

  .search-box {
    width: 100%;
    max-width: none;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .voice-status {
    grid-column: 2;
    grid-row: 1;
  }

  .sidebar {
    display: block;
    padding: 14px;
  }

  .progress-panel,
  .settings-panel {
    display: none;
  }

  .level-switch {
    margin-bottom: 12px;
  }

  .level-switch-heading {
    max-width: none;
  }

  .level-switch-buttons {
    max-width: none;
  }

  .filter-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .filter-button {
    min-width: max-content;
    flex: 0 0 auto;
    padding: 8px 11px;
    grid-template-columns: 19px auto auto;
    gap: 1px 4px;
  }

  .filter-button svg {
    width: 16px;
    height: 16px;
  }

  .filter-button span {
    padding-left: 2px;
  }

  .main-content {
    padding: 12px;
  }

  .study-stage {
    min-height: 360px;
    padding: 21px 20px 20px;
  }

  .stage-meta {
    gap: 7px;
  }

  .word-display {
    min-height: 219px;
    padding: 20px 0 15px;
  }

  .word-speak {
    gap: 10px;
    font-size: 43px;
  }

  .word-speak svg {
    width: 23px;
    height: 23px;
  }

  .word-meaning {
    margin-top: 12px;
    font-size: 16px;
  }

  .word-note {
    font-size: 12px;
  }

  .stage-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .mobile-rate-control {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 9px;
    padding-bottom: 4px;
  }

  .mobile-rate-control > span {
    color: var(--stage-muted);
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-rate-control output {
    min-width: 49px;
    color: var(--white);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
    text-align: center;
  }

  .playback-group,
  .secondary-actions {
    width: 100%;
  }

  .secondary-actions .text-button {
    flex: 1;
  }

  .library {
    margin-top: 13px;
    padding-top: 15px;
  }

  .library-heading h1 {
    font-size: 21px;
  }

  .word-list-head {
    display: none;
  }

  .word-row {
    min-height: 0;
    align-items: start;
    padding: 15px 7px 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .row-word-button {
    grid-column: 1;
    grid-row: 1;
  }

  .row-word {
    font-size: 24px;
  }

  .row-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    flex-direction: column;
  }

  .row-copy {
    grid-column: 1;
    grid-row: 2;
    padding-right: 8px;
  }

  .row-page {
    display: none;
  }

  .row-note {
    -webkit-line-clamp: 5;
  }

  .row-actions .icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
}

@media (max-width: 460px) {
  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 19px;
  }

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

  .study-stage::after {
    width: 120px;
  }

  .stage-label > span:last-child,
  .page-badge {
    display: none;
  }

  .word-speak {
    font-size: 38px;
  }

  .word-note {
    max-height: none;
    overflow: visible;
  }

  .secondary-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .secondary-actions .text-button {
    padding: 0 7px;
  }

  .library-heading {
    align-items: flex-end;
  }

  .page-select svg {
    display: none;
  }
}

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

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