:root {
  --bg: #f5f4ef;
  --surface: #fffdf9;
  --surface-soft: #f3f5ef;
  --ink: #232c29;
  --ink-strong: #202824;
  --muted: #5c6863;
  --line: #dadfd8;
  --line-strong: #b9c3b9;
  --green: #2c7a63;
  --green-dark: #245f4c;
  --green-soft: #e8f1eb;
  --red: #b95757;
  --red-soft: #fff2f1;
  --blue: #416c9b;
  --blue-soft: #f0f5fa;
  --yellow: #9b752f;
  --yellow-soft: #fff8e9;
  --shadow: 0 2px 5px rgba(36, 48, 38, .025), 0 10px 28px rgba(36, 48, 38, .045);
  --radius: 14px;
  --side: #faf9f5;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --word-font: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --rail-width: clamp(252px, 22vw, 300px);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei UI", "Noto Sans JP", sans-serif;
}

.site-info-page {
  width: min(760px, calc(100% - 40px));
  margin: 48px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 16px;
  line-height: 1.8;
}

.site-info-page a {
  color: var(--green-dark);
}

.practice-intro {
  padding: .55rem clamp(16px, 2.2vw, 36px);
}
.practice-intro p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.study-guide { overflow-wrap: anywhere; }
.study-guide h1, .study-guide h2 { line-height: 1.25; }
.study-guide h2 { margin: 1.6em 0 .5em; }
.study-guide table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.study-guide th, .study-guide td { padding: .45em; text-align: end; border-bottom: 1px solid var(--line); }
.study-guide th:first-child { text-align: start; }
.study-guide ruby { font-size: 1.6em; }
.study-guide audio { max-width: 100%; }
.study-guide summary { cursor: pointer; }
.language-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding: 0; list-style: none; }

.pricing-page {
  width: min(61rem, calc(100% - clamp(2rem, 7vw, 6rem)));
  margin: 0 auto;
  padding: 1.5rem 0 clamp(2rem, 6vw, 4.5rem);
  overflow-wrap: anywhere;
}
.pricing-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
}
.pricing-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
}
.pricing-brand img { flex: none; border-radius: 9px; }
.pricing-languages { position: relative; margin-inline-start: auto; font-size: .9rem; }
.pricing-languages summary {
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}
.pricing-languages[open] summary { background: var(--surface); }
.pricing-languages .language-links {
  position: absolute;
  z-index: 2;
  inset-inline-end: 0;
  display: grid;
  width: max-content;
  max-width: calc(100vw - 3rem);
  margin: .45rem 0 0;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.pricing-languages a { display: block; padding: .2rem .3rem; }
.pricing-intro { margin: clamp(2.2rem, 6vw, 4.8rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.pricing-intro h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(2rem, 5.4vw, 3.75rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.pricing-intro p {
  max-width: 52ch;
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.6;
}
.pricing-plans { display: grid; gap: clamp(.9rem, 2.2vw, 1.35rem); }
.pricing-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: .85rem;
  padding: clamp(1.2rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .32s var(--ease), box-shadow .32s var(--ease);
}
.pricing-card h2, .pricing-card p { margin: 0; }
.pricing-card h2 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); line-height: 1.3; }
.pricing-card p { color: var(--muted); line-height: 1.55; }
.pricing-card .pricing-amount {
  display: block;
  color: var(--ink-strong);
  font-size: clamp(1.85rem, 4.5vw, 2.85rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.pricing-paid { background: linear-gradient(145deg, var(--surface), var(--green-soft)); }
.pricing-rate span { display: block; margin-bottom: .3rem; font-size: .9rem; }
.pricing-card .pricing-addon { color: var(--green-dark); font-weight: 700; }
.pricing-estimate:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  width: 100%;
  padding: .95rem 0;
  border-top: 1px solid var(--line);
}
.pricing-estimate p { margin-bottom: .35rem; font-size: .875rem; }
.pricing-stepper { display: flex; align-items: center; gap: .5rem; }
.pricing-stepper button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.pricing-stepper button:disabled { opacity: .45; cursor: default; }
.pricing-count { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.pricing-total output { color: var(--green-dark); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pricing-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  margin-top: auto;
  padding: .6rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.pricing-primary { border-color: var(--green-dark); background: var(--green-dark); color: var(--surface); }
.pricing-guide { margin: 1.25rem 0 0; font-size: .9rem; }
.pricing-guide a, .pricing-languages a { color: var(--green-dark); text-underline-offset: .15em; }
.pricing-page :is(a, button, summary):focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
.pricing-action:active, .pricing-stepper button:not(:disabled):active { transform: scale(.97); }
@media (min-width: 760px) {
  .pricing-plans { grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr); }
}
@media (hover: hover) {
  .pricing-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(36, 48, 38, .08); }
  .pricing-action:hover, .pricing-stepper button:not(:disabled):hover { background: var(--green-soft); }
  .pricing-primary:hover { background: var(--green); }
}
@media (prefers-reduced-motion: reduce) {
  .pricing-card, .pricing-action, .pricing-stepper button { transition: none; }
  .pricing-card:hover, .pricing-action:active, .pricing-stepper button:not(:disabled):active { transform: none; }
}

/* Enhanced listening, offline, and sync controls */
.listen-settings-toggle {
  display: none;
}

.listen-controls-body {
  display: contents;
}

.compact-options,
.voice-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.compact-options label,
.voice-options label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}

.compact-options select,
.voice-options select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.voice-options {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.voice-options button {
  min-height: 38px;
}

.listen-mini-player {
  position: fixed;
  right: 14px;
  bottom: 76px;
  left: 14px;
  z-index: 40;
  display: none;
  grid-template-columns: 40px minmax(0, 1fr) 46px 40px;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid rgba(24, 116, 95, .3);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 35px rgba(24, 37, 34, .2);
  backdrop-filter: blur(14px);
}

.listen-player {
  align-self: start;
}

.listen-mini-player.is-visible {
  display: grid;
}

.listen-mini-player > div {
  display: grid;
  min-width: 0;
}

.listen-mini-player strong,
.listen-mini-player small {
  overflow-wrap: anywhere;
}

.listen-mini-player small {
  color: var(--muted);
}

.listen-mini-player button {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

#miniPlay {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.offline-panel {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.offline-panel-head,
.offline-panel-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.offline-panel h2,
.offline-panel p {
  margin: 0;
}

.offline-panel p {
  color: var(--muted);
}

.offline-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.offline-level {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.offline-level > div {
  display: grid;
}

.offline-level > div small,
.offline-level > span {
  color: var(--muted);
  font-size: 14px;
}

.offline-level > span {
  grid-column: 1 / -1;
}

.offline-level button {
  min-height: 34px;
}

.offline-level button[data-offline-action="delete"] {
  grid-column: 2;
  grid-row: 1;
}

.panel-status {
  width: 100%;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.sync-panel {
  flex-wrap: wrap;
}

@media (min-width: 761px) {
  .listen-controls-body {
    display: contents !important;
  }
}

@media (max-width: 760px) {
  .listen-layout {
    display: flex;
    flex-direction: column;
  }

  .listen-player {
    order: 1;
  }

  .listen-controls {
    order: 2;
    padding: 0;
  }

  .listen-settings-toggle {
    display: flex;
    width: 100%;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    text-align: left;
  }

  .listen-settings-toggle > span:first-child {
    display: grid;
    gap: 3px;
  }

  .listen-settings-toggle small {
    color: var(--muted);
  }

  .listen-settings-toggle > span:last-child {
    font-size: 20px;
    transition: transform .2s var(--ease);
  }

  .listen-settings-toggle.is-open > span:last-child {
    transform: rotate(180deg);
  }

  .listen-controls-body {
    display: none;
    padding: 0 16px 18px;
  }

  .listen-controls-body.is-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .listen-controls-body .audio-source-note {
    grid-column: 1 / -1;
  }

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

@media (max-width: 520px) {
  .listen-page .page-heading {
    padding-bottom: 4px;
  }

  .listen-player {
    min-height: 480px;
  }

  .listen-controls-body.is-open {
    display: block;
  }

  .offline-panel {
    padding: 16px 14px;
  }

  .offline-panel-head,
  .offline-panel-head > div {
    align-items: flex-start;
  }

  .offline-panel-head {
    flex-direction: column;
  }

  .offline-levels {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-size: 100%;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

small {
  font-size: 14px;
}

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

button,
select,
.file-button {
  min-height: 40px;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), transform 140ms var(--ease);
}

button:hover {
  border-color: #a6b5aa;
  background: var(--surface-soft);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.file-button:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

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

.topbar {
  position: sticky;
  z-index: 45;
  top: 0;
  display: grid;
  grid-template-columns: minmax(140px, min(20%, var(--rail-width))) minmax(0, 1fr) auto;
  align-items: center;
  column-gap: clamp(8px, 1.5vw, 24px);
  min-height: 72px;
  padding: 0 clamp(16px, 2.2vw, 36px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-family: var(--word-font);
  font-size: 23px;
}

.brand > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand strong {
  font-size: 1.16rem;
  letter-spacing: -.025em;
  font-weight: 680;
  line-height: 1.25;
  white-space: nowrap;
}

.brand small {
  max-width: 280px;
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.main-nav {
  display: flex;
  align-self: stretch;
  min-width: 0;
  gap: clamp(1px, .55vw, 10px);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px clamp(5px, .65vw, 13px);
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: .91rem;
  font-weight: 500;
  line-height: 1.25;
  hyphens: auto;
}

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

.nav-item.is-active {
  color: var(--green-dark);
  font-weight: 600;
}

.nav-item.is-active::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2.5px;
  border-radius: 3px 3px 0 0;
  background: var(--green);
  content: "";
}

.nav-icon {
  flex: 0 0 auto;
}

.header-today {
  display: flex;
  align-items: baseline;
  justify-self: end;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.header-today strong {
  color: var(--ink);
  font-size: 19px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: clamp(8px, 1.25vw, 20px);
  min-width: 0;
}

.header-shortcuts {
  display: flex;
  align-items: center;
  gap: clamp(4px, .6vw, 10px);
  min-width: 0;
}

.header-shortcuts:empty { display: none; }

.header-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  max-width: 14rem;
  padding: .35rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--surface);
  font-size: .875rem;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.header-shortcut:hover { background: var(--green-soft); border-color: var(--line-strong); }
.header-shortcut:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

@media (min-width: 1400px) and (max-width: 1699px) {
  .topbar.has-resource-links { grid-template-columns: max-content minmax(0, 1fr) auto; }
}

@media (min-width: 1081px) and (max-width: 1399px) {
  .app-shell:has(.topbar.has-resource-links) { --topbar-size: 101px; }
  .topbar.has-resource-links { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 58px 42px; }
  .topbar.has-resource-links .header-actions { grid-area: 1 / 2; }
  .topbar.has-resource-links .main-nav { grid-area: 2 / 1 / auto / -1; }
}

.ui-icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-more, .nav-label-short, .practice-settings-toggle {
  display: none;
}
.nav-secondary {
  display: contents;
}
.language-chevron {
  position: absolute;
  right: 4px;
  width: 14px;
  pointer-events: none;
}
#languageSelect:hover {
  background: var(--surface-soft);
}
.language-control {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.language-icon {
  position: absolute;
  left: 7px;
  z-index: 1;
  pointer-events: none;
  color: var(--green-dark);
  line-height: 1;
}

#languageSelect {
  width: 9.1rem;
  min-height: 44px;
  padding: 7px 23px 7px 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background-color: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  appearance: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer-brand { display: grid; gap: .15rem; }
.footer-brand small { max-width: 70ch; }

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.site-footer button {
  min-height: 32px;
  padding: 3px 0;
  border: 0;
  color: var(--green-dark);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-info-dialog {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.site-info-dialog::backdrop {
  background: rgba(24, 37, 34, 0.4);
}

.site-info-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.site-info-heading h2 {
  margin: 4px 0 16px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.site-info-heading button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.site-info-body {
  overflow-wrap: anywhere;
  line-height: 1.75;
}

.site-info-body p {
  margin: 0 0 12px;
}

main {
  width: 100%;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.practice-layout {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-size, 72px));
}

.practice-sidebar {
  position: sticky;
  top: var(--topbar-size, 72px);
  align-self: start;
  height: calc(100vh - var(--topbar-size, 72px));
  overflow: auto;
  padding: 26px clamp(16px, 1.6vw, 26px) 36px;
  border-right: 1px solid var(--line);
  background: var(--side);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.sidebar-head,
.control-label,
.card-topline,
.page-heading,
.progress-head,
.bulk-bar,
.sync-panel,
.sync-panel > div,
.word-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head {
  align-items: flex-start;
  margin-bottom: 28px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-head h2,
.page-heading h1,
.sync-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar-head h2 {
  font-size: 1.4rem;
  letter-spacing: -.025em;
  font-weight: 660;
}

.pool-badge {
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 14px;
  white-space: nowrap;
}

.pool-badge b {
  font-size: 14px;
}

.control-section {
  margin-top: 22px;
}

.control-label {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
}

.text-button {
  min-height: auto;
  padding: 3px 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 14px;
}

.mode-list {
  display: grid;
  gap: 3px;
}

.mode-option {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 7px 18px 7px 10px;
  border-color: transparent;
  text-align: left;
  position: relative;
  background: transparent;
}

.mode-option:hover {
  border-color: var(--line);
}

.mode-option.is-active {
  border-color: #b8d8cc;
  color: var(--green-dark);
  background: var(--green-soft);
}

.mode-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.mode-option strong {
  font-size: 14px;
  font-weight: 600;
}

.mode-option small {
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.mode-glyph {
  display: grid;
  width: 23px;
  height: 24px;
  place-items: center;
  color: var(--muted);
  font: 600 1.12rem var(--word-font);
}

.mode-option.is-active .mode-glyph {
  color: var(--green-dark);
}

.mode-option.is-active::after {
  position: absolute;
  inset-inline-end: 8px;
  top: calc(50% - 2.5px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}
.practice-sidebar .sidebar-head {
  align-items: center;
  gap: 8px;
}
.practice-sidebar .pool-badge {
  padding: 0;
  color: var(--muted);
  background: transparent;
  white-space: normal;
  text-align: end;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.level-chip {
  display: grid;
  min-width: 0;
  min-height: 48px;
  place-content: center;
  gap: 1px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 14px;
}

.level-chip strong {
  color: var(--ink);
  font-size: 14px;
}

.level-chip.is-active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
}

.level-chip.is-active strong {
  color: var(--green-dark);
}

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

.scope-grid button {
  min-height: 36px;
  padding-inline: 4px;
  color: var(--muted);
  font-size: 14px;
  hyphens: auto;
  line-height: 1.3;
}

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

.sidebar-options {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

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

.switch-row b {
  font-size: 14px;
}

.switch-row small {
  color: var(--muted);
  font-size: .875rem;
}

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

.switch-row i {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  background: #c7cfc8;
  transition: background 150ms var(--ease);
}

.switch-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 150ms var(--ease);
}

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

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

.practice-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 26px clamp(24px, 3.2vw, 64px) 52px;
}

.session-strip,
.study-card,
.quick-stats {
  width: min(100%, 960px);
}

.session-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr);
  align-items: center;
  gap: clamp(12px, 1.8vw, 32px);
  margin-bottom: 22px;
}

.session-stat {
  display: grid;
  gap: 3px;
  min-width: 0;
  align-self: stretch;
  align-content: end;
}

.session-stat span,
.session-progress > span {
  color: var(--muted);
  font-size: 14px;
}

.session-stat + .session-stat {
  border-inline-start: 1px solid var(--line);
  padding-inline-start: clamp(12px, 1.5vw, 24px);
}
.session-stat strong {
  font-size: clamp(1.3rem, 1.75vw, 1.65rem);
  line-height: 1.18;
  font-weight: 610;
  color: var(--ink-strong);
}

.session-progress {
  display: grid;
  gap: 7px;
}

.session-progress > span {
  text-align: right;
}

.session-progress > div,
.progress-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 6px;
  background: #dce2da;
}

.session-progress i,
.progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 250ms var(--ease);
}

.study-card {
  position: relative;
  min-height: 0;
  padding: 24px clamp(22px, 2.5vw, 38px) 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.study-card.is-correct {
  border-color: #86bca9;
}

.study-card.is-wrong {
  border-color: #e2aaa7;
}

.card-topline {
  min-height: 40px;
  padding-bottom: 16px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.card-meta,
.card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.level-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.level-pill {
  border-color: transparent;
  color: var(--green-dark);
  background: var(--green-soft);
}

.badge.mastered {
  border-color: #badbcf;
  color: var(--green-dark);
  background: var(--green-soft);
}

.badge.selected {
  border-color: #c1d5ed;
  color: var(--blue);
  background: var(--blue-soft);
}

.badge.wrong {
  border-color: #f0c1be;
  color: var(--red);
  background: var(--red-soft);
}

.prompt-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(215px, 29vh, 292px);
  padding: 25px 4%;
  text-align: center;
}

.prompt-kicker {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.prompt {
  max-width: 100%;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(1.65rem, 2.55vw, 2.55rem);
  font-weight: 630;
  line-height: 1.4;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.prompt.is-meaning,
.prompt.is-sentence {
  hyphens: auto;
}

.prompt[lang="ja"] {
  font-family: var(--word-font);
  font-size: clamp(3.25rem, 5.7vw, 5.3rem);
  font-weight: 600;
  line-height: 1.24;
}
.prompt.is-sentence, .prompt.is-long {
  width: min(100%, 38rem);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.6;
  letter-spacing: 0;
  text-align: start;
}
.sub-prompt:empty { display: none; }
.sub-prompt {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  max-width: 42rem;
}

.audio-orb {
  display: none;
  grid-template-columns: 38px auto;
  align-items: center;
  gap: 8px;
  min-width: 112px;
  min-height: 52px;
  margin-top: 26px;
  padding: 6px 16px 6px 7px;
  border-color: #b6d8cb;
  border-radius: 26px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.audio-orb.is-visible {
  display: grid;
}

.audio-orb > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 14px;
}

.audio-orb small {
  font-size: 14px;
  font-weight: 700;
}

.answer-block {
  width: min(100%, 720px);
  margin: 0 auto;
}

.answer-block > label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 580;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 3.6fr) minmax(7rem, 1fr);
  gap: 10px;
}

.answer-row textarea {
  width: 100%;
  min-height: 52px;
  max-height: 132px;
  resize: none;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-family: "Yu Gothic UI", "Noto Sans JP", sans-serif;
  font-size: 18px;
  line-height: 1.4;
  min-width: 0;
}

.answer-row textarea::placeholder {
  color: #6c7871;
}

.answer-row textarea:focus-visible,
.learn-answer-row input:focus-visible {
  border-color: var(--green);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(44, 122, 99, .19);
}

@media (forced-colors: active) {
  .answer-row textarea:focus-visible,
  .learn-answer-row input:focus-visible { outline-color: Highlight; }
}

.handwriting .answer-row textarea {
  min-height: 90px;
  font-size: 23px;
}

.primary {
  border-color: var(--green);
  color: white;
  background: var(--green);
  font-weight: 700;
}

#submitAnswer {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  line-height: 1.25;
}
.enter-icon { width: 16px; }
.primary:disabled {
  opacity: .6;
  cursor: default;
}
.switch-row input:focus-visible + i, .listen-switch input:focus-visible + i {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.primary:hover {
  border-color: var(--green-dark);
  color: white;
  background: var(--green-dark);
}

.input-hint {
  margin: 9px 1px 0;
  color: var(--muted);
  font-size: .875rem;
}

.feedback {
  display: none;
  width: min(100%, 660px);
  min-height: 40px;
  margin: 16px auto 0;
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.feedback.correct,
.feedback.wrong,
.feedback.notice {
  display: flex;
  align-items: center;
}

.feedback.correct {
  color: var(--green-dark);
  background: var(--green-soft);
}

.feedback.wrong {
  color: var(--red);
  background: var(--red-soft);
}

.feedback.notice {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.answer-detail {
  display: none;
  width: min(100%, 660px);
  margin: 10px auto 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.answer-detail.is-visible {
  display: block;
}

.answer-detail .answer-word {
  margin-bottom: 5px;
  font-family: var(--word-font);
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.answer-detail .word-reading {
  margin-left: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.answer-detail .answer-meaning {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.6;
}

.answer-detail .meta,
.example-furigana {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.example {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.example p,
.example span {
  margin: 0;
  line-height: 1.6;
}

.example p {
  font-size: 14px;
}

.example span {
  color: var(--muted);
  font-size: 14px;
}

.card-actions {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1.4vw, 22px);
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.card-actions button {
  min-height: 44px;
  padding: 5px 10px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.card-actions button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.card-actions button span {
  min-width: 0;
  hyphens: auto;
}

.quick-stats {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.quick-stats > div {
  display: grid;
  gap: 3px;
  padding: 12px;
  text-align: center;
}

.quick-stats > div + div {
  border-left: 1px solid var(--line);
}

.quick-stats span {
  color: var(--muted);
  font-size: 14px;
}

.quick-stats strong {
  font-size: 16px;
}

.page-view {
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
  padding: 48px 0 70px;
}

.page-heading {
  align-items: flex-end;
  margin-bottom: 30px;
  gap: 16px;
}

.page-heading h1 {
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink-strong);
  letter-spacing: -.035em;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.learn-page {
  width: 100%;
  min-height: calc(100vh - var(--topbar-size, 72px));
  margin: 0;
  padding: 0;
}

.learn-page.is-active {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.learn-heading {
  grid-row: 1;
  grid-column: 2;
  width: min(calc(100% - 44px), 860px);
  justify-self: center;
  margin: 28px 0 20px;
}

.learn-layout {
  display: contents;
}

.learn-sidebar {
  position: sticky;
  top: var(--topbar-size, 72px);
  grid-row: 1 / span 2;
  grid-column: 1;
  align-self: start;
  height: calc(100vh - var(--topbar-size, 72px));
  overflow: auto;
  padding: 28px 24px 36px;
  border-right: 1px solid var(--line);
  background: var(--side);
  scrollbar-width: thin;
}

.learn-target-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.learn-target-grid button {
  min-width: 0;
  min-height: 42px;
  padding: 4px 2px;
  color: var(--muted);
  font-weight: 650;
}

.learn-target-grid button.is-active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.control-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.control-note.is-warning {
  color: var(--yellow);
}

.learn-rule-note {
  margin-top: 30px;
  padding-left: 12px;
  border-left: 3px solid #c8dcd5;
}

.learn-rule-note strong {
  color: var(--ink-strong);
}

.learn-rule-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.learn-main {
  display: flex;
  grid-row: 2;
  grid-column: 2;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0 clamp(22px, 5vw, 72px) 46px;
}

.learn-progress-strip {
  display: grid;
  width: min(100%, 860px);
  grid-template-columns: repeat(3, minmax(76px, auto)) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 4px 14px;
}

.learn-progress-strip > div:not(.learn-progress-track) {
  display: grid;
  gap: 1px;
}

.learn-progress-strip span {
  color: var(--muted);
  font-size: 14px;
}

.learn-progress-strip strong {
  color: var(--ink-strong);
  font-size: 20px;
}

.learn-progress-track {
  display: grid;
  gap: 7px;
}

.learn-progress-track > div {
  height: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: #dce2da;
}

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

.learn-card {
  width: min(100%, 820px);
  min-height: 590px;
  margin: 10px auto 0;
  padding: 22px 28px 24px;
  border: 1px solid #e3e7e9;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: 78px;
  border-color: var(--line);
}

.learn-card-head,
.learn-word-line,
.learn-reading-row,
.learn-example > div,
.learn-decision-bar {
  display: flex;
  align-items: center;
}

.learn-card-head {
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.learn-card-body {
  min-height: 335px;
  padding: 30px 8px 18px;
}

.learn-word-line {
  justify-content: center;
  gap: 12px;
}

.learn-word-line h2 {
  margin: 0;
  color: var(--ink-strong);
  font-family: var(--word-font);
  font-size: clamp(2.65rem, 5vw, 4.5rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
}

.learn-audio-button {
  flex: 0 0 38px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 18px;
  font-weight: 700;
}

.learn-audio-button.is-word {
  flex-basis: 42px;
  width: 42px;
  min-height: 42px;
}

.learn-reading-row {
  justify-content: center;
  gap: 9px;
  min-height: 32px;
  margin-top: 7px;
}

.learn-reading,
.learn-reading-placeholder {
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
}

.learn-reading.is-revealed {
  color: var(--ink);
}

.learn-reading.is-revealed.is-correct {
  color: var(--green);
}

.learn-reading.is-revealed.is-wrong {
  color: var(--red);
}

.learn-reading-row > span:last-child {
  color: var(--muted);
  font-size: 14px;
}

.learn-meaning {
  margin: 15px 0 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.65;
  text-align: center;
}

.learn-details-placeholder {
  min-height: 205px;
}

.learn-pos {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.learn-examples {
  margin-top: 24px;
}

.learn-example {
  padding: 10px 0;
}

.learn-example + .learn-example {
  margin-top: 4px;
}

.learn-example > div {
  gap: 9px;
}

.learn-example span {
  flex: 0 0 auto;
  color: var(--green);
  font-weight: 700;
}

.learn-example p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.learn-example > div > p {
  flex: 1;
  color: var(--ink-strong);
  font-family: var(--word-font);
  font-size: 17px;
  line-height: 1.65;
}

.learn-example .learn-audio-button {
  flex-basis: 34px;
  width: 34px;
  min-height: 34px;
  font-size: 16px;
}

.learn-example-meaning {
  margin-top: 5px !important;
  padding-left: 30px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.learn-example-meaning span {
  margin-right: 9px;
  color: var(--blue);
}

.learn-no-example {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
}

.learn-empty {
  display: grid;
  min-height: 330px;
  place-content: center;
  gap: 8px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.learn-empty strong {
  color: var(--ink-strong);
  font-size: 21px;
}

.learn-empty span {
  max-width: 430px;
  line-height: 1.7;
}

.learn-empty.is-complete strong {
  color: var(--green-dark);
}

.learn-answer-area {
  padding: 18px 8px 0;
}

.learn-answer-area > label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 650;
}

.learn-answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 8px;
}

.learn-answer-row input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-strong);
  background: var(--surface);
  font-size: 17px;
}

.learn-answer-row input.is-correct,
.learn-answer-row input.is-correct:disabled {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  opacity: 1;
  -webkit-text-fill-color: var(--green-dark);
}

.learn-answer-row input.is-wrong,
.learn-answer-row input.is-wrong:disabled {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
  opacity: 1;
  -webkit-text-fill-color: var(--red);
}

.learn-answer-row .primary {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
  font-weight: 650;
}

.learn-answer-row .primary:disabled,
.learn-answer-row .primary:disabled:hover {
  cursor: default;
  border-color: var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
  opacity: 1;
}

.learn-feedback {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.learn-feedback.is-correct {
  color: var(--green-dark);
}

.learn-feedback.is-wrong {
  color: var(--red);
}

.learn-feedback.is-warning {
  color: var(--yellow);
}

.learn-decision-bar {
  justify-content: center;
  gap: 10px;
  padding: 14px 8px 0;
}

.show-button,
.forget-button {
  display: grid;
  flex: 1 1 0;
  width: min(100%, 280px);
  max-width: 280px;
  min-height: 58px;
  place-content: center;
  gap: 0;
}

.show-button {
  border-color: #8eabc7;
  color: var(--blue);
  background: var(--blue-soft);
}

.show-button:hover {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.show-button:disabled {
  cursor: default;
  border-color: var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
  opacity: 1;
}

.forget-button {
  border-color: #d67b59;
  color: #fff;
  background: #d9603d;
}

.forget-button:hover {
  border-color: #bd4f31;
  color: #fff;
  background: #c95535;
}

.show-button strong,
.show-button small,
.forget-button strong,
.forget-button small {
  color: inherit;
}

.show-button small,
.forget-button small {
  opacity: 0.86;
}

.page-count,
.today-summary {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.page-count strong,
.today-summary strong {
  color: var(--ink-strong);
  font-size: 29px;
  font-weight: 600;
}

.page-count span,
.today-summary span,
.today-summary small {
  color: var(--muted);
  font-size: 14px;
}

.library-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto 156px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-box {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
}

.search-box span {
  color: var(--muted);
  font-size: 19px;
}

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

.level-tabs {
  display: flex;
  gap: 4px;
}

.level-tab {
  min-width: 46px;
  min-height: 42px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 14px;
}

.level-tab.is-active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 700;
}

.library-controls select {
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
}

.bulk-bar {
  min-height: 48px;
  padding: 8px 2px 8px 12px;
  color: var(--muted);
  font-size: 14px;
}

.bulk-bar > div {
  display: flex;
  gap: 6px;
}

.bulk-bar button {
  min-height: 32px;
  padding: 4px 9px;
  font-size: 14px;
}

.word-list {
  display: grid;
  gap: 22px;
}

.level-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.level-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.level-title span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.word-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

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

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

.word-row.is-mastered {
  background: #f4f8f2;
}

.word-row.is-excluded {
  opacity: 0.56;
}

.word-row > input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

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

.word-title-line {
  justify-content: flex-start;
  gap: 9px;
  min-width: 0;
}

.word-title-line > strong {
  font-family: var(--word-font);
  font-size: 1.32rem;
}

.word-reading {
  color: var(--muted);
  font-size: 14px;
}

.word-meaning {
  margin-top: 5px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.word-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.word-actions button {
  min-width: 58px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 14px;
}

.empty-state {
  padding: 70px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.load-row {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.load-row button {
  min-width: 150px;
}

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

.memory-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.memory-overview > div {
  display: grid;
  min-width: 0;
  min-height: 108px;
  align-content: center;
  gap: 5px;
  padding: 18px 20px;
}

.memory-overview > div + div {
  border-left: 1px solid var(--line);
}

.memory-overview span,
.memory-overview small {
  color: var(--muted);
  font-size: 14px;
}

.memory-overview strong {
  color: var(--ink-strong);
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.memory-analytics {
  margin-bottom: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.memory-analytics-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.memory-tabs {
  display: flex;
  min-width: 0;
  gap: 2px;
}

.memory-tabs button {
  position: relative;
  min-height: 40px;
  padding: 7px 14px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.memory-tabs button::after {
  position: absolute;
  right: 14px;
  bottom: 1px;
  left: 14px;
  height: 2px;
  background: transparent;
  content: "";
}

.memory-tabs button.is-active {
  color: var(--green-dark);
  font-weight: 700;
}

.memory-tabs button.is-active::after {
  background: var(--green);
}

.memory-panel {
  min-height: 420px;
  padding: 24px;
}

.memory-chart-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.memory-chart-copy h2 {
  margin: 3px 0 6px;
  font-size: 20px;
}

.memory-chart-copy p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.memory-inline-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.memory-inline-stats span {
  display: grid;
  min-width: 90px;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 14px;
}

.memory-inline-stats b {
  color: var(--ink-strong);
}

.chart-scroll {
  width: 100%;
  margin-top: 22px;
  overflow-x: auto;
}

.memory-chart {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}

.memory-chart text {
  fill: var(--muted);
  font-family: inherit;
  font-size: 14px;
}

.chart-grid line {
  stroke: #e7eaed;
  stroke-width: 1;
}

.chart-correct {
  fill: #4ea88b;
}

.chart-wrong {
  fill: #d86743;
}

.curve-personal,
.curve-baseline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.curve-personal {
  stroke: #d26742;
}

.curve-baseline {
  stroke: #2d9a82;
  stroke-dasharray: 8 7;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 5px 0 0 44px;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 20px;
  height: 4px;
  border-radius: 4px;
  background: var(--green);
}

.chart-legend .is-wrong,
.chart-legend .is-personal {
  background: #d26742;
}

.chart-legend .is-baseline {
  background: #2d9a82;
}

.chart-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--green);
  color: var(--muted);
  background: var(--green-soft);
  line-height: 1.6;
}

.retention-score {
  display: grid;
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 28px;
  text-align: right;
}

.retention-score small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.due-forecast {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.due-forecast h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.due-forecast > div {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.due-forecast span {
  display: grid;
  min-height: 62px;
  place-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  text-align: center;
}

.due-forecast span.is-today {
  border-color: #9fcabc;
  color: var(--green-dark);
  background: var(--green-soft);
}

.due-forecast small {
  color: var(--muted);
  font-size: 14px;
}

.durability-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(230px, 0.7fr);
  gap: 32px;
  margin-top: 32px;
}

.durability-bars {
  display: grid;
  gap: 15px;
}

.durability-row {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 13px;
}

.durability-row > span {
  display: grid;
}

.durability-row small {
  color: var(--muted);
  font-size: 14px;
}

.durability-row > div {
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: #edf0f2;
}

.durability-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ea88b, #d6a237);
}

.durability-row > strong {
  text-align: right;
}

.memory-band-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.memory-band-summary > div {
  display: grid;
  min-height: 92px;
  align-content: center;
  gap: 4px;
  padding: 14px;
}

.memory-band-summary > div:nth-child(even) {
  border-left: 1px solid var(--line);
}

.memory-band-summary > div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.memory-band-summary span {
  color: var(--muted);
}

.memory-band-summary strong {
  font-size: 23px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 28px 0 12px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.badge.review-due {
  border-color: #e2c482;
  color: #805f20;
  background: var(--yellow-soft);
}

.badge.memory-stage {
  border-color: #bfd1e5;
  color: var(--blue);
  background: var(--blue-soft);
}

.progress-card {
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.progress-card.is-total {
  grid-column: span 3;
  min-height: 180px;
  background: var(--green-soft);
}

.progress-head strong {
  font-size: 16px;
}

.progress-head b {
  color: var(--green-dark);
  font-size: 24px;
}

.progress-bar {
  height: 7px;
  margin: 25px 0 14px;
}

.progress-card > span {
  color: var(--muted);
  font-size: 14px;
}

.progress-card dl {
  display: flex;
  gap: 28px;
  margin: 22px 0 0;
}

.progress-card dl div {
  display: grid;
  gap: 3px;
}

.progress-card dt {
  color: var(--muted);
  font-size: 14px;
}

.progress-card dd {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.sync-panel {
  gap: 24px;
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sync-panel > div:first-child {
  justify-content: flex-start;
  gap: 14px;
}

.sync-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 20px;
}

.sync-panel h2 {
  font-size: 14px;
}

.sync-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.progress-actions {
  display: flex;
  gap: 7px;
}

.progress-actions button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  font-size: 14px;
}

.file-button {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.file-button input {
  display: none;
}

.danger {
  border-color: #e6bbb8;
  color: var(--red);
  background: var(--red-soft);
}

.listen-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.listen-controls,
.listen-player,
.up-next {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.listen-controls {
  padding: 20px;
}

.listen-setting + .listen-setting {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.listen-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.listen-level-button {
  display: grid;
  min-width: 0;
  min-height: 52px;
  place-content: center;
  gap: 2px;
  padding: 5px 2px;
  color: var(--muted);
}

.listen-level-button strong {
  color: var(--ink);
  font-size: 14px;
}

.listen-level-button small {
  font-size: 14px;
}

.listen-level-button.is-active {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
}

.listen-level-button.is-active strong {
  color: var(--green-dark);
}

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

.listen-segmented button {
  min-height: 38px;
  color: var(--muted);
  font-size: 14px;
}

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

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

.listen-switches {
  display: grid;
  gap: 7px;
}

.listen-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  cursor: pointer;
}

.listen-switch > span {
  display: grid;
  gap: 2px;
}

.listen-switch b {
  font-size: 14px;
}

.listen-switch small {
  color: var(--muted);
  font-size: 14px;
}

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

.listen-switch i {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  background: #c7cfc8;
  transition: background 150ms var(--ease);
}

.listen-switch i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 150ms var(--ease);
}

.listen-switch input:checked + i {
  background: var(--green);
}

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

.audio-source-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
}

.audio-source-note > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #bdd1e8;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.audio-source-note p {
  margin: 0;
  color: #3f5873;
  font-size: 14px;
  line-height: 1.5;
}

.audio-source-note strong {
  color: var(--blue);
  font-size: 14px;
}

.audio-source-note small {
  color: #68809a;
  font-size: 14px;
}

.listen-player {
  display: flex;
  min-height: 580px;
  flex-direction: column;
  padding: 24px 30px 26px;
  box-shadow: var(--shadow);
}

.listen-player-head,
.listen-player-head > div,
.up-next-head,
.up-next-row,
.up-next-main {
  display: flex;
  align-items: center;
}

.listen-player-head,
.up-next-head,
.up-next-row {
  justify-content: space-between;
}

.listen-player-head {
  color: var(--muted);
  font-size: 14px;
}

.listen-player-head > div {
  gap: 7px;
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aeb4b9;
}

.stage-dot.is-playing {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.listen-word-stage {
  display: flex;
  min-height: 255px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 4%;
  text-align: center;
}

.listen-word-stage h2 {
  max-width: 100%;
  margin: 17px 0 5px;
  font-family: var(--word-font);
  font-size: 46px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.listen-reading {
  min-height: 26px;
  color: var(--green-dark);
  font-family: "Yu Gothic UI", "Noto Sans JP", sans-serif;
  font-size: 17px;
}

.listen-meaning {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.listen-example {
  min-height: 110px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.listen-example > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.listen-example p {
  margin: 0;
  font-family: "Yu Gothic UI", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.listen-example small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.listen-progress {
  padding: 24px 0 12px;
}

.listen-progress > div {
  height: 5px;
  overflow: hidden;
  border-radius: 5px;
  background: #e4e8e6;
}

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

.transport-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
}

.transport-controls > button:not(.listen-play-button) {
  width: 46px;
  min-height: 46px;
  padding: 0;
  color: #555c63;
  font-size: 14px;
}

.listen-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 150px;
  min-height: 50px;
  padding: 7px 18px;
  border-color: var(--green);
  border-radius: 25px;
  color: white;
  background: var(--green);
}

.listen-play-button:hover {
  border-color: var(--green-dark);
  color: white;
  background: var(--green-dark);
}

.listen-play-button span {
  font-size: 14px;
}

.listen-play-button b {
  font-size: 14px;
}

.listen-status {
  min-height: 18px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.up-next {
  margin-top: 18px;
  padding: 18px 22px 6px;
}

.up-next-head {
  min-height: 30px;
  margin-bottom: 6px;
}

.up-next-head h2 {
  margin: 0;
  font-size: 14px;
}

.up-next-list {
  display: grid;
}

.up-next-row {
  min-height: 58px;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.up-next-main {
  min-width: 0;
  gap: 12px;
}

.up-next-index {
  width: 24px;
  color: var(--muted);
  font-size: 14px;
}

.up-next-word {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.up-next-word strong {
  font-family: var(--word-font);
  font-size: 14px;
}

.up-next-word small,
.up-next-meaning {
  color: var(--muted);
  font-size: 14px;
}

.up-next-meaning {
  max-width: 44%;
  overflow-wrap: anywhere;
}

/* Grammar and reading exercises */
.quiz-heading {
  margin-bottom: 20px;
}

.quiz-kind-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 560px);
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0f2f3;
}

.quiz-kind-tabs button {
  display: grid;
  min-height: 52px;
  gap: 2px;
  padding: 7px 16px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.quiz-kind-tabs button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(29, 38, 48, 0.08);
}

.quiz-kind-tabs b {
  font-size: 14px;
  font-weight: 600;
}

.quiz-kind-tabs span {
  font-size: 14px;
  line-height: 1.45;
}

.quiz-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-sidebar {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.quiz-filter-section + .quiz-filter-section {
  margin-top: 20px;
}

.quiz-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.quiz-sections button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 46px;
  gap: 8px;
  padding: 7px 10px;
  text-align: left;
}

.quiz-sections button strong {
  font-size: 14px;
  font-weight: 600;
}

.quiz-sections button small {
  flex: 0 1 auto;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.quiz-sections button.is-active,
.quiz-filter-buttons button.is-active {
  border-color: rgba(31, 128, 100, 0.42);
  color: var(--green-dark);
  background: var(--green-soft);
}

.quiz-filter-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.quiz-filter-buttons button {
  min-width: 0;
  min-height: 36px;
  padding: 5px;
  font-size: 14px;
}

.quiz-select-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.quiz-filter-section select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
}

.quiz-sidebar-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.quiz-sidebar-stats > div {
  display: grid;
  gap: 3px;
  text-align: center;
}

.quiz-sidebar-stats span {
  color: var(--muted);
  font-size: 14px;
}

.quiz-sidebar-stats strong {
  font-size: 14px;
  font-weight: 600;
}

.quiz-source-note {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quiz-source-note > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 700;
}

.quiz-source-note p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.quiz-workspace {
  min-width: 0;
  padding: 26px;
}

.quiz-panel {
  display: none;
}

.quiz-panel.is-active {
  display: block;
}

.quiz-question-card,
.reading-article,
.reading-question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-question-card {
  min-height: 596px;
  padding: 22px;
}

.quiz-card-head,
.reading-article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.quiz-card-head > div,
.reading-article > header > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.quiz-card-head .level-pill,
.reading-article .level-pill {
  display: inline-grid;
  min-width: 38px;
  min-height: 26px;
  place-items: center;
  padding: 3px 7px;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.quiz-grammar-meta {
  display: grid;
  gap: 5px;
  margin-top: 20px;
}

.quiz-grammar-meta > span {
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

.quiz-grammar-meta > strong {
  color: var(--ink-strong);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.grammar-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.grammar-labels > span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 600;
}

.quiz-question-body {
  display: grid;
  min-height: 150px;
  align-content: center;
  margin-top: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quiz-question-body > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.quiz-context {
  white-space: pre-line;
  color: var(--ink-strong);
  font-family: var(--word-font);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.75;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.quiz-options button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 58px;
  gap: 10px;
  padding: 8px 12px;
  text-align: left;
}

.quiz-options button > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 14px;
}

.quiz-options button > b {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
}

.quiz-options button:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-options button.is-correct {
  border-color: rgba(31, 128, 100, 0.5);
  color: var(--green-dark);
  background: var(--green-soft);
}

.quiz-options button.is-correct > span {
  color: #fff;
  background: var(--green);
}

.quiz-options button.is-wrong {
  border-color: rgba(201, 80, 80, 0.5);
  color: #9f3939;
  background: var(--red-soft);
}

.quiz-options button.is-wrong > span {
  color: #fff;
  background: var(--red);
}

.quiz-feedback {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  font-size: 14px;
}

.quiz-feedback strong {
  font-size: 14px;
  font-weight: 600;
}

.quiz-feedback .is-correct {
  color: var(--green);
}

.quiz-feedback .is-wrong {
  color: var(--red);
}

.quiz-feedback span {
  color: var(--muted);
}

.quiz-explanation {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  padding: 14px;
  border-left: 3px solid var(--yellow);
  background: var(--yellow-soft);
  font-size: 14px;
  line-height: 1.7;
}

.quiz-explanation:empty {
  display: none;
}

.quiz-explanation p {
  margin: 0;
  overflow-wrap: anywhere;
}

.quiz-explanation p b {
  margin-right: 8px;
}

.quiz-explanation mark {
  padding: 1px 4px;
  color: inherit;
  background: #ffe8a9;
}

.quiz-vocab-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.quiz-vocab-source > b {
  margin-right: 2px;
}

.quiz-vocab-chip {
  display: inline-grid;
  max-width: min(100%, 220px);
  min-height: 36px;
  padding: 4px 7px;
  border: 1px solid rgba(168, 117, 32, 0.25);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.7);
}

.quiz-vocab-chip b,
.quiz-vocab-chip small {
  overflow-wrap: anywhere;
}

.quiz-vocab-chip small {
  color: var(--muted);
  font-size: 14px;
}

.quiz-answer-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 7px;
  border-top: 1px solid rgba(168, 117, 32, 0.18);
  color: var(--muted);
  font-size: 14px;
}

.quiz-answer-source a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.quiz-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
}

.quiz-card-actions button {
  min-height: 42px;
  padding: 7px 14px;
}

.quiz-card-actions button.is-mastered {
  border-color: rgba(31, 128, 100, 0.45);
  color: var(--green-dark);
  background: var(--green-soft);
}

.reading-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.reading-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}

.reading-toolbar select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.wrapped-select {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  padding: 7px 27px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.wrapped-select::after {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  content: "";
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.wrapped-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.wrapped-select:focus-within {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  align-items: start;
  gap: 12px;
}

.reading-article,
.reading-question-card {
  min-width: 0;
  min-height: 540px;
  padding: 20px;
}

.reading-article h2 {
  margin: 20px 0 10px;
  font-size: 21px;
}

.reading-text {
  margin-top: 20px;
  font-family: var(--word-font);
  font-size: 16px;
  line-height: 2.05;
}

.reading-text p {
  margin: 0 0 12px;
}

.reading-translation {
  margin-top: 18px;
  padding: 13px;
  border-left: 3px solid var(--blue);
  color: var(--ink);
  background: var(--blue-soft);
  font-size: 14px;
  line-height: 1.75;
}

.reading-vocab {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.reading-vocab .quiz-vocab-chip {
  max-width: 175px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.reading-question-prompt {
  min-height: 86px;
  margin: 24px 0 0;
  font-family: var(--word-font);
  font-size: 18px;
  line-height: 1.65;
}

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

.reading-question-card .quiz-card-actions {
  margin-top: 14px;
}

.quiz-progress-summary {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.quiz-progress-summary > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.quiz-progress-summary h2 {
  margin: 0;
  font-size: 20px;
}

.quiz-progress-summary > header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.quiz-progress-summary > header p strong {
  color: var(--ink);
  font-size: 16px;
}

.quiz-progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-progress-grid article {
  min-width: 0;
  padding: 14px;
}

.quiz-progress-grid article + article {
  border-left: 1px solid var(--line);
}

.quiz-progress-grid article > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
}

.quiz-progress-grid article > div span {
  color: var(--muted);
  font-size: 14px;
}

.quiz-progress-grid dl {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
}

.quiz-progress-grid dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.quiz-progress-grid dt {
  color: var(--muted);
}

.quiz-progress-grid dd {
  margin: 0;
  font-weight: 600;
}

@media (max-width: 1080px) {
  .site-footer {
    margin-bottom: var(--bottom-nav-size, 72px);
  }
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 0 22px;
    background: var(--surface);
    backdrop-filter: none;
  }

  .main-nav {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: auto;
    min-height: 64px;
    padding: 2px max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    gap: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .nav-item {
    display: grid;
    min-width: 0;
    place-content: center;
    gap: 1px;
    padding: 5px;
    font-size: 14px;
    text-align: center;
  }

  .nav-item > span:last-child {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    hyphens: auto;
    line-height: 1.15;
  }

  .nav-item.is-active::after {
    top: 0;
    bottom: auto;
  }

  .nav-icon {
    margin: 0 auto;
  }

  .header-actions {
    grid-column: 2;
  }

}

@media (max-width: 1360px) {
  .learn-page.is-active {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .learn-sidebar {
    padding: 22px 16px 28px;
  }

  .learn-main {
    padding: 22px 20px 32px;
  }

  .learn-progress-strip {
    gap: 12px;
  }

  .page-view {
    padding-bottom: 96px;
  }

  .library-controls {
    grid-template-columns: 1fr 156px;
  }

  .level-tabs {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .listen-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .listen-controls {
    padding: 16px;
  }

  .quiz-layout {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .quiz-workspace {
    padding: 20px;
  }

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

  .reading-article,
  .reading-question-card {
    min-height: auto;
  }

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

  .quiz-progress-grid article:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .quiz-progress-grid article:nth-child(4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding: 0 16px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .brand small {
    max-width: 165px;
  }

  .learn-page {
    width: 100%;
    padding-top: 26px;
  }

  .learn-page.is-active {
    display: block;
  }

  .learn-page > .page-heading {
    width: calc(100% - 32px);
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 20px;
    margin-left: auto;
  }

  .learn-layout {
    display: block;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .learn-sidebar {
    position: static;
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 18px 16px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .learn-rule-note {
    margin-top: 18px;
    padding-top: 15px;
  }

  .learn-main {
    padding: 18px 16px 28px;
  }

  .learn-progress-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .learn-progress-track {
    grid-column: 1 / -1;
  }

  .learn-card {
    min-height: 540px;
    margin-top: 18px;
    padding: 18px 18px 20px;
  }

  .learn-card-body {
    min-height: 310px;
    padding-right: 0;
    padding-left: 0;
  }

  .sidebar-head {
    margin-bottom: 14px;
  }

  .control-section {
    margin-top: 16px;
  }

  .quick-stats {
    display: grid;
  }

  .page-view {
    width: min(100% - 32px, 1180px);
    padding-top: 28px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .library-controls {
    grid-template-columns: 1fr;
  }

  .level-tabs {
    grid-row: auto;
    grid-column: auto;
    overflow-x: auto;
  }

  .library-controls select {
    min-height: 42px;
  }

  .word-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .word-actions {
    grid-column: 2;
  }

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

  .progress-card.is-total {
    grid-column: span 2;
  }

  .sync-panel {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .listen-setting + .listen-setting {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .audio-source-note {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .listen-player {
    min-height: 540px;
  }

  .quiz-kind-tabs {
    width: 100%;
  }

  .quiz-layout {
    display: block;
  }

  .quiz-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quiz-filter-section + .quiz-filter-section {
    margin-top: 0;
  }

  .quiz-sidebar-stats,
  .quiz-source-note {
    margin-top: 0;
    padding-top: 12px;
  }

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

  .quiz-sections button {
    min-height: 48px;
  }

  .quiz-source-note {
    align-self: end;
  }

  .quiz-workspace {
    padding: 16px;
  }

  .quiz-context {
    font-size: 22px;
  }

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

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

  .quiz-progress-grid article:nth-child(3),
  .quiz-progress-grid article:nth-child(5) {
    border-left: 0;
  }

  .quiz-progress-grid article:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .quiz-progress-grid article:nth-child(4) {
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .listen-mini-player {
    bottom: calc(var(--bottom-nav-size, 72px) + 10px);
  }

  .site-footer {
    padding: 18px 16px;
    margin-bottom: var(--bottom-nav-size, 72px);
  }
  .header-actions {
    gap: 8px;
  }

  .header-today {
    display: none;
  }

  #languageSelect {
    width: min(148px, 46vw);
    min-height: 40px;
    padding-left: 30px;
  }

  .language-icon {
    left: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand strong {
    font-size: 14px;
    line-height: 1.2;
  }

  .header-today span {
    display: none;
  }

  .brand small { font-size: .75rem; }

  .nav-item {
    font-size: 14px;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
    font-size: 15px;
  }

  .learn-heading {
    display: grid;
    align-items: start;
    gap: 12px;
  }

  .learn-heading .today-summary {
    justify-self: start;
    justify-items: start;
  }

  .learn-word-line h2 {
    font-size: 38px;
  }

  .learn-meaning {
    font-size: 16px;
  }

  .learn-answer-row {
    grid-template-columns: 1fr;
  }

  .learn-answer-row .primary {
    min-height: 46px;
  }

  .learn-example > div > p {
    font-size: 16px;
  }

  .learn-example-meaning {
    padding-left: 0;
  }

  .sidebar-head {
    display: none;
  }

  .control-section {
    margin-top: 12px;
  }

  .switch-row {
    gap: 7px;
  }

  .switch-row small {
    display: none;
  }

  .bulk-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .bulk-bar > div {
    flex-wrap: wrap;
  }

  .word-row {
    padding: 12px;
  }

  .word-title-line {
    flex-wrap: wrap;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .progress-card.is-total {
    grid-column: auto;
  }

  .sync-panel,
  .sync-panel > div:first-child {
    align-items: flex-start;
  }

  .progress-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .listen-controls {
    display: block;
  }

  .listen-setting + .listen-setting {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .audio-source-note {
    margin-top: 18px;
  }

  .listen-player {
    min-height: 510px;
    padding: 18px 14px 20px;
  }

  .listen-word-stage {
    min-height: 220px;
    padding: 20px 2%;
  }

  .listen-word-stage h2 {
    font-size: 35px;
  }

  .listen-example {
    min-height: 105px;
    padding: 15px 13px;
  }

  .listen-example p {
    font-size: 14px;
  }

  .up-next {
    padding: 15px 14px 5px;
  }

  .up-next-meaning {
    display: none;
  }

  .quiz-page {
    width: min(100% - 24px, 1180px);
  }

  .quiz-page .page-heading {
    display: grid;
    gap: 10px;
  }

  .quiz-page .page-count {
    justify-items: start;
  }

  .quiz-kind-tabs span {
    display: none;
  }

  .quiz-kind-tabs button {
    min-height: 42px;
    place-items: center;
    padding: 5px;
    text-align: center;
  }

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

  .quiz-filter-section + .quiz-filter-section {
    margin-top: 14px;
  }

  .quiz-sections {
    gap: 4px;
  }

  .quiz-sections button {
    min-height: 45px;
  }

  .quiz-sections button small {
    display: none;
  }

  .quiz-filter-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #quizStructure.quiz-filter-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quiz-sidebar-stats {
    margin-top: 15px;
  }

  .quiz-source-note {
    display: none;
  }

  .quiz-workspace {
    padding: 10px;
  }

  .quiz-question-card,
  .reading-article,
  .reading-question-card {
    padding: 14px;
  }

  .quiz-question-card {
    min-height: 530px;
  }

  .quiz-question-body {
    min-height: 135px;
    padding: 15px 4px;
  }

  .quiz-context {
    font-size: 20px;
    line-height: 1.7;
  }

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

  .quiz-options button {
    min-height: 52px;
  }

  .quiz-card-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

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

  .reading-toolbar label {
    grid-column: 1 / -1;
  }

  .reading-text {
    font-size: 15px;
  }

  .reading-question-prompt {
    min-height: auto;
  }

  .quiz-progress-summary > header {
    display: grid;
  }

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

  .quiz-progress-grid article + article,
  .quiz-progress-grid article:nth-child(4) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .memory-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-overview > div:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .memory-overview > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

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

@media (max-width: 620px) {
  #progressView .page-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  #progressView .today-summary {
    grid-template-columns: auto auto;
    align-items: baseline;
    justify-content: start;
    justify-items: start;
    column-gap: 9px;
  }

  #progressView .today-summary small {
    grid-column: 1 / -1;
  }

  .memory-analytics-head,
  .memory-chart-copy {
    align-items: stretch;
    flex-direction: column;
  }

  .memory-analytics-head > .primary {
    width: 100%;
  }

  .memory-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .memory-tabs button {
    padding-right: 5px;
    padding-left: 5px;
  }

  .memory-panel {
    min-height: 360px;
    padding: 18px 14px;
  }

  .memory-inline-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .memory-inline-stats span {
    min-width: 0;
  }

  .retention-score {
    text-align: left;
  }

  .due-forecast > div {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chart-legend {
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  .memory-overview {
    grid-template-columns: 1fr;
  }

  .memory-overview > div + div,
  .memory-overview > div:nth-child(4) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .durability-row {
    grid-template-columns: 82px minmax(0, 1fr) 42px;
    gap: 8px;
  }
}

@media (max-width: 760px) {
  .listen-layout {
    display: flex;
    flex-direction: column;
  }

  .listen-layout > .listen-player {
    order: 1;
    align-self: stretch;
    min-width: 0;
  }

  .listen-layout > .listen-controls {
    order: 2;
    display: block;
    padding: 0;
  }

  .listen-controls > .listen-settings-toggle {
    display: flex;
  }

  .listen-controls > .listen-controls-body {
    display: none;
  }

  .listen-controls > .listen-controls-body.is-open {
    display: grid;
  }
}

@media (max-width: 520px) {
  .listen-controls > .listen-controls-body.is-open {
    display: block;
  }
}

@media (max-width: 1080px) {
  html { scroll-padding-bottom: calc(var(--bottom-nav-size, 72px) + 12px); }
  .nav-more { display: grid; }
  html:not(:lang(zh)) .nav-label-full { display: none; }
  html:not(:lang(zh)) .nav-label-short { display: block; }
  .nav-secondary { display: none; }
  .nav-more[aria-expanded="true"] + .nav-secondary {
    position: absolute;
    inset-inline-end: max(12px, env(safe-area-inset-right));
    bottom: calc(100% + 6px);
    display: grid;
    gap: 2px;
    width: min(18rem, calc(100% - 24px));
    max-height: 55dvh;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 4px 28px rgba(35, 44, 41, .14);
  }
  .nav-secondary .nav-item {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 12px;
    min-height: 46px;
    padding: 9px 12px;
    border-radius: 7px;
    text-align: start;
  }
  .nav-secondary .nav-icon { margin: 0; }
  .nav-secondary .is-active { background: var(--green-soft); }
  .nav-secondary .is-active::after { display: none; }
  .main-nav > .nav-item {
    align-content: start;
    grid-template-rows: 20px auto;
    justify-items: center;
    gap: 4px;
    padding: 8px 5px 6px;
  }
  .main-nav > .is-active::after {
    width: 28px;
    height: 2px;
    margin-inline: auto;
  }
  .listen-mini-player { bottom: calc(var(--bottom-nav-size, 72px) + 10px); }
}

@media (max-width: 900px) {
  .practice-layout { display: block; }
  .practice-settings-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content) auto;
    align-items: center;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 860px;
    min-height: 50px;
    margin: 16px auto 0;
    padding: 8px 13px;
    border-color: var(--line);
    background: var(--surface);
    text-align: start;
    line-height: 1.35;
  }
  #practiceSettingsSummary {
    color: var(--ink);
    font-size: .91rem;
    font-weight: 560;
    hyphens: auto;
  }
  .settings-label { color: var(--green-dark); font-size: .875rem; }
  .settings-chevron {
    width: 14px;
    transition: transform 140ms var(--ease);
  }
  .practice-settings-toggle[aria-expanded="true"] .settings-chevron { transform: rotate(180deg); }
  .practice-sidebar {
    position: static;
    display: none;
    width: calc(100% - 32px);
    max-width: 860px;
    height: auto;
    margin: 8px auto 0;
    padding: 0 15px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .practice-settings-toggle[aria-expanded="true"] + .practice-sidebar { display: block; }
  .practice-sidebar .sidebar-head { display: none; }
  .practice-sidebar .control-section { margin-top: 14px; }
  .mode-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.2rem), 1fr)); }
  .scope-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .scope-grid button, .level-chip { min-height: 44px; }
  .sidebar-options {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: 8px 18px;
    margin-top: 14px;
    padding-top: 8px;
  }
  .switch-row { min-height: 44px; }
  .practice-main { max-width: 892px; margin-inline: auto; padding: 18px 16px 32px; }
  .study-card { padding: 18px clamp(16px, 4vw, 32px); }
  .session-strip { gap: 10px; margin-bottom: 16px; }
  .study-card.single-level .card-topline:not(:has(.card-badges > *)) { display: none; }
  .prompt-area { min-height: 200px; padding: 22px 2%; }
  .practice-main .quick-stats { background: transparent; border: 0; }
}

@media (max-width: 620px) {
  .session-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .session-progress { grid-column: 1 / -1; }
  .session-stat { display: flex; flex-direction: column; }
  .session-stat > span { flex: 1; line-height: 1.3; hyphens: auto; }
  .session-stat + .session-stat { padding-inline-start: 10px; }
  .session-progress .session-idle {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .prompt-area { min-height: 182px; }
  .prompt[lang="ja"] { font-size: clamp(2.9rem, 13.5vw, 3.95rem); }
  .prompt.is-long { font-size: 1.28rem; }
  .prompt.is-sentence { font-size: 1.25rem; }
  .answer-row { grid-template-columns: minmax(0, 1fr); }
  #submitAnswer { min-height: 46px; }
  .enter-icon { display: none; }
  .card-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 2px;
    margin-top: 18px;
    padding-top: 9px;
  }
  .card-actions button {
    flex-direction: column;
    justify-content: start;
    min-width: 0;
    gap: 5px;
    padding: 6px 2px;
    font-size: .875rem;
  }
  .card-actions #playAudio:disabled { display: none; }
  .brand strong { font-size: 1rem; }
  #languageSelect { width: min(9rem, 41vw); min-height: 44px; }
}

@media (max-width: 360px) {
  .practice-settings-toggle { grid-template-columns: auto minmax(0, 1fr) auto; }
  .settings-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .prompt-area { min-height: 150px; padding: 15px 0; }
  .prompt-kicker { margin-bottom: 8px; }
  .sub-prompt { margin-top: 6px; }
  .transport-controls {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
  }
  .transport-controls .listen-play-button { min-width: 0; padding-inline: 7px; }
}

@media (max-width: 360px), (max-width: 620px) and (max-height: 700px) {
  .practice-main > .study-card { order: -1; }
  .practice-main > .session-strip { margin: 17px 0 0; }
}

@media (max-width: 840px) {
  .topbar.has-resource-links { row-gap: 5px; padding-block: 8px; }
  .topbar.has-resource-links .header-actions { display: contents; }
  .topbar.has-resource-links .brand { grid-area: 1 / 1; }
  .topbar.has-resource-links .language-control { grid-area: 1 / 2; }
  .topbar.has-resource-links .header-shortcuts { grid-area: 2 / 1 / auto / -1; justify-content: flex-end; }
  .topbar.has-resource-links .header-today { display: none; }
  .topbar.has-resource-links .header-shortcut { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .header-shortcut { transition: none; }
}
