.vocabulary-page {
  --word-size-offset: 0px;
  width: min(100%, 820px);
  margin: 40px auto 64px;
  font-family: var(--font-ui);
}
.vocabulary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.vocabulary-heading h1 {
  margin: 0;
  color: var(--ink-1);
  font: 650 clamp(28px, 4vw, 34px)/1.2 var(--font-ui);
  letter-spacing: -.015em;
}
.vocabulary-heading .vocabulary-sibling {
  flex: none;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  color: var(--ink-1);
  font: 550 var(--fs-14)/1 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
.vocabulary-heading .vocabulary-sibling svg { width: 16px; height: 16px; color: var(--accent); }
.vocabulary-heading .vocabulary-sibling:hover { background: var(--surface-2); color: var(--ink-1); }
.vocabulary-heading .vocabulary-sibling:active { transform: scale(.97); }

.vocabulary-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 8px 12px;
  margin-bottom: 22px;
}
.vocabulary-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.vocabulary-article-picker { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px; }
.vocabulary-select-wrap { position: relative; min-width: 0; }
.vocabulary-step { display: flex; gap: 6px; }
.vocabulary-controls :is(.vocabulary-select-trigger, input), .vocabulary-step button {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: var(--r-field);
  background: var(--surface-1);
  color: var(--ink-1);
  font: 500 var(--fs-14)/1.4 var(--font-ui);
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
.vocabulary-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 12px 0 14px;
  text-align: left;
  cursor: pointer;
}
.vocabulary-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vocabulary-select-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-2);
  transition: transform var(--dur-2) var(--ease-out);
}
.vocabulary-select-trigger[aria-expanded="true"] .vocabulary-select-chevron { transform: rotate(180deg); }
.vocabulary-select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 420px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 18px;
  background: var(--surface-0);
  box-shadow: var(--shadow-overlay);
  transform-origin: 50% 0;
  animation: vocabulary-menu-in var(--dur-pop) var(--ease-out) both;
  scrollbar-width: none;
}
.vocabulary-select-menu::-webkit-scrollbar { display: none; }
.vocabulary-select-menu.closing { animation: vocabulary-menu-in 130ms var(--ease-out) reverse both; pointer-events: none; }
.vocabulary-select-menu:focus { outline: none; }
@keyframes vocabulary-menu-in { from { transform: translateY(-4px) scale(.98); } to { transform: none; } }
.vocabulary-select-option {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: var(--r-12);
  color: var(--ink-1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out);
}
.vocabulary-select-act { color: var(--ink-3); font: 500 var(--fs-13)/1.4 var(--font-ui); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vocabulary-select-title { min-width: 0; overflow: hidden; font: 500 var(--fs-14)/1.4 var(--font-ui); text-overflow: ellipsis; white-space: nowrap; }
.vocabulary-select-option[data-value="all"] .vocabulary-select-act { grid-column: 1 / 3; color: inherit; font-size: var(--fs-14); }
.vocabulary-select-check { grid-column: 3; display: grid; place-items: center; color: var(--accent); opacity: 0; }
.vocabulary-select-check svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vocabulary-select-option.is-active { background: var(--surface-1); }
.vocabulary-select-option[aria-selected="true"] { background: var(--accent-a12); }
.vocabulary-select-option[aria-selected="true"].is-active { background: var(--accent-a15); }
.vocabulary-select-option[aria-selected="true"] .vocabulary-select-act { color: var(--accent); }
.vocabulary-select-option[aria-selected="true"] .vocabulary-select-title { font-weight: 600; }
.vocabulary-select-option[aria-selected="true"] .vocabulary-select-check { opacity: 1; }
.vocabulary-filter { position: relative; min-width: 0; }
.vocabulary-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.vocabulary-filter input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 38px;
  font-weight: 450;
}
.vocabulary-filter input::-webkit-search-cancel-button { appearance: none; }
.vocabulary-filter input::placeholder { color: var(--ink-3); opacity: 1; }
.vocabulary-controls :is(.vocabulary-select-trigger, input):hover { background: var(--surface-2); }
.vocabulary-filter input:focus,
.vocabulary-select-trigger:focus-visible,
.vocabulary-select-trigger[aria-expanded="true"] {
  outline: none;
  background: var(--surface-0);
  box-shadow: var(--shadow-float), var(--ring);
}
.vocabulary-search-clear {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
.vocabulary-search-clear svg { width: 12px; height: 12px; stroke-width: 1.9; }
.vocabulary-search-clear[hidden] { display: none; }
.vocabulary-search-clear:hover { color: var(--ink-1); background: color-mix(in srgb, var(--surface-2) 82%, var(--ink-1)); }
.vocabulary-search-clear:active { transform: translateY(-50%) scale(.92); }

.vocabulary-step button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  cursor: pointer;
}
.vocabulary-step button:disabled { color: var(--ink-3); opacity: .42; cursor: default; }
.vocabulary-step button:hover:not(:disabled) { background: var(--surface-2); }
.vocabulary-step button:active:not(:disabled) { transform: scale(.96); }
.vocabulary-step-compact { gap: inherit; }
.vocabulary-step-compact button { display: grid; place-items: center; width: 44px; padding: 0; }
.vocabulary-page svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.vocabulary-step svg { width: 17px; height: 17px; }

.vocabulary-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  margin-top: 2px;
  color: var(--ink-2);
  font: 500 var(--fs-13)/1.4 var(--font-ui);
}
.vocabulary-meta p { margin: 0; font-variant-numeric: tabular-nums; }
.vocabulary-meta-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.vocabulary-word-size {
  display: inline-flex;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--surface-1);
}
.vocabulary-word-size button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font: 500 18px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.vocabulary-word-size button:enabled:hover { background: var(--surface-2); color: var(--ink-1); }
.vocabulary-word-size button:disabled { opacity: .38; cursor: default; }
.vocabulary-meta-actions > :is(button, a),
.vocabulary-article-read {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
:is(#vocabulary-read, .vocabulary-article-read) { padding-inline-end: 14px; }
.vocabulary-meta-actions svg,
.vocabulary-article-read svg { width: 15px; height: 15px; transition: transform var(--dur-1) var(--ease-out); }
#vocabulary-saved-only[aria-pressed="true"] { color: var(--accent); background: var(--accent-a12); }
#vocabulary-saved-only[aria-pressed="true"] svg { fill: currentColor; }
.vocabulary-meta-actions > :is(button, a):hover,
.vocabulary-article-read:hover { color: var(--ink-1); background: var(--surface-1); }
#vocabulary-saved-only[aria-pressed="true"]:hover { color: var(--accent); background: var(--accent-a15); }
:is(#vocabulary-read, .vocabulary-article-read):hover svg { transform: translateX(2px); }
.vocabulary-meta-actions > :is(button, a):active,
.vocabulary-article-read:active { transform: scale(.97); }

#vocabulary-results.is-entering { animation: vocabulary-list-in 200ms var(--ease-out) both; }
@keyframes vocabulary-list-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.vocabulary-article + .vocabulary-article { margin-top: 44px; }
.vocabulary-article-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
  padding-bottom: 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink-1) 14%, transparent);
}
.vocabulary-article-heading h2 {
  margin: 0;
  min-width: 0;
  color: var(--ink-1);
  font: 600 var(--fs-17)/1.35 var(--font-ui);
  overflow-wrap: anywhere;
}
.vocabulary-article-read {
  flex: none;
  font: 500 var(--fs-13)/1.4 var(--font-ui);
}
.vocabulary-group + .vocabulary-group { margin-top: 32px; }
.vocabulary-group :is(h2, h3) {
  margin: 0 0 8px;
  color: var(--ink-2);
  font: 600 var(--fs-13)/1.45 var(--font-ui);
  letter-spacing: .02em;
}
.vocabulary-group ul { margin: 0; padding: 0; list-style: none; }
.vocabulary-sense {
  border-top: 1px solid color-mix(in srgb, var(--ink-1) 7%, transparent);
}
.vocabulary-entry:first-child > .vocabulary-senses > .vocabulary-sense:first-child { border-top: 0; }

.vocabulary-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px auto;
  gap: 0 12px;
  align-items: center;
  min-height: 54px;
  margin-inline: -10px;
  padding: 6px 10px;
  border-radius: var(--r-12);
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-1) var(--ease-out);
}
.vocabulary-line:has(.vocabulary-summary) { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .vocabulary-line:hover { background: color-mix(in srgb, var(--surface-1) 72%, transparent); }
  .vocabulary-line:has(.vocabulary-summary):hover:not(:has(:is(.vocabulary-listen, .vocabulary-bookmark):hover)) :is(.vocabulary-word, .vocabulary-disclosure) { color: var(--accent); }
}

.vocabulary-summary {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: var(--r-12);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.vocabulary-line:has(.vocabulary-summary:is(:focus-visible, [aria-expanded="true"])) :is(.vocabulary-word, .vocabulary-disclosure) { color: var(--accent); }

.vocabulary-term {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 9px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.vocabulary-word {
  min-width: 0;
  font: 600 calc(var(--fs-17) + var(--reading-adjustment) + var(--word-size-offset))/1.35 var(--font-serif-en);
  color: var(--ink-1);
  transition: color var(--dur-1) var(--ease-out);
}
.vocabulary-phonetics {
  min-width: 0;
  color: var(--ink-3);
  font: 400 var(--fs-13)/1.4 var(--font-ui);
}
.vocabulary-pronunciation {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.vocabulary-disclosure {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  transition: transform 200ms var(--ease-sheet), color var(--dur-1) var(--ease-out);
}
.vocabulary-disclosure svg { width: 15px; height: 15px; }
.vocabulary-summary[aria-expanded="true"] .vocabulary-disclosure { transform: rotate(180deg); }

.vocabulary-listen, .vocabulary-bookmark {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 42px;
  padding: 4px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
.vocabulary-listen { flex: none; min-width: 36px; min-height: 36px; }
.vocabulary-bookmark { grid-column: 3; grid-row: 1; }
:is(.vocabulary-listen, .vocabulary-bookmark) svg { width: 17px; height: 17px; }
:is(.vocabulary-listen, .vocabulary-bookmark):hover { background: var(--surface-2); color: var(--ink-1); }
:is(.vocabulary-listen, .vocabulary-bookmark):active { transform: scale(.92); }
.vocabulary-listen[aria-pressed="true"] { color: var(--accent); background: var(--accent-a12); }
.vocabulary-bookmark[aria-pressed="true"] { color: var(--accent); }
.vocabulary-bookmark[aria-pressed="true"] svg { fill: currentColor; }
.vocabulary-bookmark.is-popping svg { animation: fav-icon-pop 200ms var(--ease-out); }

.vocabulary-context {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 190ms var(--ease-sheet), opacity 160ms var(--ease-out), visibility 190ms step-end;
}
.vocabulary-context.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows 190ms var(--ease-sheet), opacity 160ms var(--ease-out), visibility 0s;
}
.vocabulary-context-inner { overflow: hidden; min-height: 0; }
.vocabulary-context-card {
  margin: 2px 0 12px;
  padding: 14px 16px;
  border-radius: var(--r-12);
  background: var(--surface-1);
}
.vocabulary-definition {
  margin: 0;
  color: var(--ink-1);
  font: 500 var(--fs-15)/1.55 var(--font-ui);
  overflow-wrap: anywhere;
}
.vocabulary-context-quote {
  margin: 0;
  color: var(--ink-1);
  font: 450 calc(var(--fs-17) + var(--reading-adjustment))/1.6 var(--font-serif-en);
  overflow-wrap: anywhere;
}
.vocabulary-definition + .vocabulary-context-quote {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--ink-1) 8%, transparent);
}
.vocabulary-context-quote mark {
  padding: 0 .18em;
  border-radius: 4px;
  background: var(--accent-a20);
  color: var(--ink-1);
}
.vocabulary-context-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.vocabulary-context-label {
  margin: 0;
  color: var(--ink-3);
  font: 500 var(--fs-12)/1.4 var(--font-ui);
}
.vocabulary-context-jump {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-1);
  font: 550 var(--fs-12)/1 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), transform 100ms var(--ease-out);
}
.vocabulary-context-jump::before { content: ""; position: absolute; inset: -6px -4px; border-radius: inherit; }
.vocabulary-context-jump svg {
  width: 13px;
  height: 13px;
  transition: transform var(--dur-1) var(--ease-out);
}
.vocabulary-context-jump:hover { background: color-mix(in srgb, var(--surface-2) 84%, var(--ink-1) 16%); }
.vocabulary-context-jump:hover svg { transform: translateX(2px); }
.vocabulary-context-jump:active { transform: scale(.97); }

.vocabulary-notice {
  margin: 28px 0;
  color: var(--ink-2);
  font: 450 var(--fs-15)/1.6 var(--font-ui);
}
.vocabulary-end:not([hidden]) { justify-content: space-between; margin-top: 24px; }
.vocabulary-step[hidden] { display: none; }

.vocabulary-audio-status {
  position: fixed;
  z-index: 30;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--surface-0);
  color: var(--ink-1);
  font: 500 var(--fs-13)/1.4 var(--font-ui);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.vocabulary-audio-status.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .vocabulary-page { margin: 24px auto 48px; }
  .vocabulary-heading { margin-bottom: 18px; }
  .vocabulary-controls { grid-template-columns: minmax(0, 1fr); }
  .vocabulary-article-picker { gap: 6px; }
  .vocabulary-meta-actions { gap: 4px; }
  .vocabulary-word-size button { width: 34px; }
  #vocabulary-saved-only { padding-inline: 6px; }
  #vocabulary-read { padding-inline-start: 6px; }
  .vocabulary-line {
    gap: 0 4px;
    margin-inline: -6px;
    padding: 6px;
  }
  .vocabulary-definition { font-size: var(--fs-14); }
  .vocabulary-listen { min-width: 42px; min-height: 42px; }
  .vocabulary-phonetics { font-size: var(--fs-12); }
  .vocabulary-context-card { padding: 12px 14px; }
}

@media (max-width: 400px) {
  .vocabulary-meta { column-gap: 4px; }
  #vocabulary-saved-only { padding-inline: 4px; }
  #vocabulary-saved-only svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .vocabulary-heading .vocabulary-sibling,
  .vocabulary-controls :is(.vocabulary-select-trigger, input),
  .vocabulary-select-chevron,
  .vocabulary-select-option,
  .vocabulary-step button,
  .vocabulary-search-clear,
  .vocabulary-word-size button,
  .vocabulary-meta-actions :is(button, a),
  .vocabulary-meta-actions svg,
  .vocabulary-article-read,
  .vocabulary-article-read svg,
  .vocabulary-line,
  .vocabulary-word,
  .vocabulary-disclosure,
  .vocabulary-listen,
  .vocabulary-bookmark,
  .vocabulary-context,
  .vocabulary-context-jump,
  .vocabulary-context-jump svg,
  .vocabulary-audio-status {
    transition: none !important;
  }
  .vocabulary-select-menu,
  .vocabulary-select-menu.closing,
  #vocabulary-results.is-entering,
  .vocabulary-bookmark.is-popping svg {
    animation: none !important;
  }
}
