/* The dictionary (dictionary.js, translate.js). Mobile style (ui/translate/**: the pill field and
   "Dịch", the word header with the tonal speaker, the outlined "Thêm vào Từ vựng của bạn" pill,
   the source chips, the rounded page), web layout: a side panel on tablets and desktop, a
   bottom sheet on phones, and the "Dịch" screen with a search head, the result in the main
   column and an aside. Tokens are the mobile values the shared :root does not carry yet. */
.dictionary-dialog,
.dict-add-dialog,
.translate-page {
  --dc-on-primary-container: var(--md-on-primary-container);
  --dc-surface-container: var(--md-surface-container);
  --dc-inverse: #1e2b28;
  --dc-error: var(--md-error);
  --dc-link: var(--md-hero);
}

/* ---------- the sheet ---------- */
dialog.dictionary-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: 24px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-family: var(--font-app);
}
dialog.dictionary-dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog.dictionary-dialog::backdrop,
dialog.dict-add-dialog::backdrop {
  background: var(--md-scrim);
}
.dictionary-dialog p,
.dict-add-dialog p {
  margin: 0;
}
.dict-handle {
  display: none;
  flex: none;
  width: 40px;
  height: 5px;
  margin: 10px auto 0;
  border-radius: 99px;
  background: var(--md-outline-variant);
}
.dict-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dictionary-dialog[data-state="result"] .dict-body {
  padding-bottom: 12px;
}

/* LookupInput */
.dict-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 0 20px;
}
.dictionary-dialog h2 {
  margin: 0;
  padding: 0;
}
.dict-input-head h2 {
  font: 700 24px/32px var(--font-app-bold);
}
.dict-search {
  display: grid;
  gap: 8px;
  padding: 12px 20px 20px;
}
.dict-search-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dict-query {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 20px;
  border: 1.5px solid var(--md-primary);
  border-radius: 99px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 400 16px/24px var(--font-app);
}
.dict-query::placeholder {
  color: var(--md-outline);
}
.dict-query[aria-invalid="true"] {
  border-color: var(--dc-error);
}
.dict-search-row.has-icon .dict-query {
  padding-left: 50px;
}
.dict-search-icon {
  position: absolute;
  left: 18px;
  width: 22px;
  height: 22px;
  color: var(--md-on-surface-variant);
  pointer-events: none;
}
.dict-go {
  flex: none;
  min-height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 99px;
  background: var(--md-primary);
  color: #fff;
  font: 600 16px/20px var(--font-app);
  cursor: pointer;
}
.dict-go:hover {
  background: var(--md-hero);
}
.dict-go:disabled {
  opacity: 0.6;
  cursor: progress;
}
.dict-hint {
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.dict-error {
  color: var(--dc-error);
  font: 600 13px/18px var(--font-app);
}
.dict-error:empty {
  display: none;
}

/* WordHeader */
.dict-word-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 0 20px;
}
.dict-word-text {
  flex: 0 1 auto;
  min-width: 0;
}
.dict-eyebrow {
  color: var(--md-on-surface-variant);
  font: 600 12px/16px var(--font-app);
  letter-spacing: 0.02em;
}
.dict-word {
  display: -webkit-box;
  overflow: hidden;
  color: var(--md-on-surface);
  font: 700 26px/32px var(--font-app-bold);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
/* Focused only to start reading here (like #screen-title); the controls show the focus ring. */
.dict-word:focus {
  outline: none;
}
.dict-speak {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
  cursor: pointer;
}
.dict-speak:hover {
  background: #c9e8e1;
}
.dict-speak .mi {
  width: 20px;
  height: 20px;
}
.dict-head-actions {
  display: flex;
  flex: none;
  margin-left: auto;
}
.dict-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
}
.dict-icon:hover {
  background: var(--dc-surface-container);
  color: var(--md-on-surface);
}
.dict-icon .mi {
  width: 24px;
  height: 24px;
}

/* "Thêm vào Từ vựng của bạn" (SmallPillButton, outlined) */
.dict-add {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 6px 20px 0;
  padding: 0 18px 0 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 99px;
  background: var(--md-surface);
  color: var(--md-primary);
  font: 600 14px/20px var(--font-app);
  cursor: pointer;
}
.dict-add:hover {
  border-color: var(--md-primary);
  background: #00796b0d;
}
.dict-add:disabled {
  opacity: 0.6;
  cursor: progress;
}
.dict-add .mi {
  width: 18px;
  height: 18px;
}

/* SourceTabs: one scrolling row of pills, as on mobile (FilterChip, role Tab); it fades at the edges */
.dict-sources {
  display: flex;
  flex: none;
  gap: 6px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 24px), transparent);
}
.dict-sources::-webkit-scrollbar {
  display: none;
}
.dict-chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 99px;
  background: var(--md-surface);
  color: var(--md-on-surface-variant);
  font: 600 14px/20px var(--font-app);
  white-space: nowrap;
}
.dict-chip:hover {
  border-color: var(--md-primary);
  color: var(--md-primary);
}
.dict-chip[aria-selected="true"] {
  border-color: var(--md-primary);
  background: var(--md-primary);
  color: #fff;
}
.dict-chip:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

/* The selected source: a rounded card like mobile's WebView (radius 18), scrolling inside */
.dict-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 300px;
  margin: 2px 12px 0;
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
}
.dict-card-bar {
  display: flex;
  flex: none;
  align-items: center;
  padding: 4px 10px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--dc-surface-container);
}
select.dict-direction {
  width: auto;
  min-height: 36px;
  margin: 4px 0;
  padding: 4px 30px 4px 12px;
  border-color: var(--md-outline-variant);
  border-radius: 99px;
  font: 600 13px/18px var(--font-app);
}
.dict-panel {
  flex: 1;
  min-height: 0;
  padding: 16px 18px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--md-on-surface);
  font: 400 15px/1.6 var(--font-app);
  overflow-wrap: anywhere;
}
.dict-panel:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: -2px;
}

/* ---------- inside the card: every source's entry, in the app's style (dictionary-sources.js) ---------- */
.dict-panel :is(h1, h2, h3, h4, p, ul, ol, dl, dd, blockquote, figure) {
  margin: 0;
  padding: 0;
}
.dict-panel :is(ul, ol) {
  list-style: none;
}
.dict-panel img {
  height: auto;
  border-radius: 10px;
}
.dsx-credit {
  margin-top: 20px !important;
  padding-top: 10px !important;
  border-top: 1px solid var(--md-outline-variant);
  color: var(--md-outline);
  font-size: 12px;
  line-height: 16px;
}
.dsx-loading {
  display: grid;
  gap: 12px;
  padding: 2px 0;
}
.dsx-loading i {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--dc-surface-container) 0, #f7faf9 50%, var(--dc-surface-container) 100%) 0 0 / 200% 100%;
  animation: dsx-shimmer 1.2s linear infinite;
}
.dsx-loading i:first-of-type {
  width: 45%;
  height: 26px;
}
.dsx-loading i:nth-of-type(3) {
  width: 82%;
}
.dsx-loading i:last-of-type {
  width: 64%;
}
@keyframes dsx-shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dsx-loading i {
    animation: none;
  }
}
.dsx-empty {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 6px 0;
  color: var(--md-on-surface-variant);
}
.dsx-action {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 99px;
  background: var(--md-primary);
  color: #fff;
  font: 600 14px/20px var(--font-app);
}
.dsx-action:hover {
  background: var(--md-hero);
}
.dsx-subtabs {
  display: flex;
  gap: 6px;
  margin: -2px -18px 16px;
  padding: 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.dsx-subtabs::-webkit-scrollbar {
  display: none;
}
.dsx-subtab {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 99px;
  background: var(--dc-surface-container);
  color: var(--md-on-surface-variant);
  font: 600 13px/18px var(--font-app);
}
.dsx-subtab:hover {
  color: var(--md-on-surface);
}
.dsx-subtab[aria-pressed="true"] {
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
}
.dsx-h {
  margin-bottom: 8px !important;
  color: var(--md-on-surface);
  font: 700 16px/22px var(--font-app-bold);
}
.dsx-block {
  margin-top: 22px;
}
.dsx-pos {
  margin: 12px 0 4px !important;
  color: var(--md-primary);
  font: 700 13px/18px var(--font-app);
}
/* A word inside a result: looked up here. */
.dsx-xref {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--md-primary);
  font: inherit;
  text-align: inherit;
  text-decoration: underline;
  text-decoration-color: #00796b59;
  text-underline-offset: 3px;
}
.dsx-xref:hover {
  text-decoration-color: currentColor;
}
.dsx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dsx-chip,
.dsx :is(.x-related, .x-pvrefs) .dsx-xref,
.dsx-laban .x-color-light-blue:has(> .dsx-xref:only-child) .dsx-xref {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 99px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 500 14px/20px var(--font-app);
  font-style: normal;
  text-decoration: none;
}
.dsx-chip:hover,
.dsx :is(.x-related, .x-pvrefs) .dsx-xref:hover,
.dsx-laban .x-color-light-blue:has(> .dsx-xref:only-child) .dsx-xref:hover {
  border-color: var(--md-primary);
  color: var(--md-primary);
}
.dsx-audio,
.dsx-say {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 3px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
  vertical-align: middle;
}
.dsx-audio:hover,
.dsx-say:hover {
  background: #c9e8e1;
}
.dsx-audio .mi,
.dsx-say .mi {
  width: 16px;
  height: 16px;
}
.dsx-say:not(.small) {
  width: 40px;
  height: 40px;
}
.dsx-say:not(.small) .mi {
  width: 20px;
  height: 20px;
}
.dsx details {
  margin: 12px 0;
  padding: 0 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 12px;
}
.dsx details[open] {
  padding-bottom: 12px;
}
.dsx summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--md-primary);
  font-weight: 600;
  cursor: pointer;
}

/* Google Dịch */
.dsx-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border-radius: 16px;
  background: var(--md-primary-container);
}
.dsx-hero-text {
  flex: 1;
  min-width: 0;
}
.dsx-translation {
  color: var(--dc-on-primary-container);
  font: 700 22px/30px var(--font-app-bold);
}
.dsx-translation.is-long {
  font: 600 17px/26px var(--font-app);
}
.dsx-translation:not(:only-child) {
  margin-bottom: 2px !important;
}
.dsx-translit {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.dsx-terms li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--md-outline-variant);
}
.dsx-terms li:last-child {
  border-bottom: 0;
}
.dsx-terms strong {
  font-weight: 600;
}
.dsx-rev {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.dsx-defs {
  counter-reset: dsx-def;
}
.dsx-defs li {
  position: relative;
  padding: 3px 0 3px 28px;
  counter-increment: dsx-def;
}
.dsx-defs li::before {
  position: absolute;
  top: 6px;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--dc-surface-container);
  color: var(--md-on-surface-variant);
  font: 700 11px/20px var(--font-app);
  text-align: center;
  content: counter(dsx-def);
}
.dsx-example {
  display: block;
  color: var(--md-on-surface-variant);
  font-style: italic;
}
.dsx-examples li,
.dsx :is(.x-examples > li, .x-EXAMPLE, .x-GramExa, .x-ColloExa) {
  display: block;
  margin: 6px 0;
  padding-left: 12px;
  border-left: 3px solid var(--md-primary-container);
}
/* Longman's pattern groups hold examples of their own: one rule per example, not two. */
.dsx :is(.x-GramExa, .x-ColloExa):has(.x-EXAMPLE) {
  padding-left: 0;
  border-left: 0;
}
.dsx-examples b {
  color: var(--md-primary);
}

/* Anh Việt (Laban) */
.dsx-laban .x-title-inside {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}
.dsx-laban h2 {
  font: 700 20px/28px var(--font-app-bold);
}
.dsx-laban .x-vocal {
  color: var(--md-on-surface-variant);
}
.dsx-laban .x-bg-grey {
  display: inline-block;
  margin: 16px 0 2px;
  padding: 2px 12px;
  border-radius: 99px;
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
  font: 700 13px/20px var(--font-app);
}
.dsx-laban .x-green {
  margin-top: 10px;
  font-weight: 700;
}
.dsx-laban .x-color-light-blue,
.dsx-laban .x-margin25:not(.x-green) {
  margin-top: 4px;
  padding-left: 12px;
  border-left: 3px solid var(--md-primary-container);
}
.dsx-laban .x-color-light-blue {
  font-style: italic;
}
.dsx-laban .x-margin25:not(.x-green, .x-color-light-blue) {
  margin-top: 0;
  color: var(--md-on-surface-variant);
}
.dsx-laban .x-color-light-blue:has(> .dsx-xref:only-child) {
  display: inline-block;
  margin: 6px 6px 0 0;
  padding: 0;
  border: 0;
}
.dsx-laban .x-inside:has(> .x-related) {
  margin-top: 16px;
}
.dsx-laban .x-inside:has(> .x-related) br {
  display: none;
}
.dsx-laban .x-related {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0; /* the commas between the chips */
}

/* Tra Câu */
.dsx-sentences li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--md-outline-variant);
}
.dsx-sentences li:first-child {
  padding-top: 0;
}
.dsx-pair {
  flex: 1;
  min-width: 0;
}
.dsx-en {
  font-weight: 600;
}
.dsx-vi {
  color: var(--md-on-surface-variant);
}
.dsx-tracau em {
  color: var(--md-primary);
  font-style: normal;
  font-weight: 700;
}
.dsx-tracau .x-dict--title {
  margin: 18px 0 8px;
  color: var(--md-on-surface);
  font: 700 16px/22px var(--font-app-bold);
}
.dsx-tracau article > div:first-child .x-dict--title {
  margin-top: 0;
}
/* Its entries are tables of one cell per row once the bullets are gone: read as blocks. */
.dsx-tracau :is(table, tbody, tr, td) {
  display: block;
}
.dsx-tracau td {
  padding: 1px 0;
}
.dsx-tracau tr[data-id="pa"] td {
  color: var(--md-on-surface-variant);
}
.dsx-tracau tr[data-id="tl"] td {
  padding-top: 14px;
  color: var(--md-primary);
}
.dsx-tracau tr[data-id="mn"] td {
  padding: 6px 0 2px;
  font-weight: 700;
}
.dsx-tracau tr[data-id="mh"] td,
.dsx-tracau tr[data-id="mh_n"] td {
  padding-left: 12px;
  border-left: 3px solid var(--md-primary-container);
}
.dsx-tracau tr[data-id="mh"] td {
  font-style: italic;
}
.dsx-tracau tr[data-id="tn"] td {
  padding-top: 10px;
  color: var(--md-primary);
  font-weight: 700;
}
.dsx-tracau tr[data-id="tn_n"] td {
  color: var(--md-on-surface-variant);
}
.dsx-tracau tr[data-id="mh_n"] td {
  color: var(--md-on-surface-variant);
}
.dsx-tracau blockquote {
  margin: 0 0 0 4px;
}
.dsx-tracau [data-tag="k"] {
  font: 700 18px/26px var(--font-app-bold);
}

/* Hình ảnh */
.dsx-grid {
  columns: 150px;
  column-gap: 8px;
}
.dsx-grid li {
  margin-bottom: 8px;
  break-inside: avoid;
}
.dsx-grid img {
  width: 100%;
  background: var(--dc-surface-container);
}

/* Video ví dụ (YouGlish's widget) */
.dsx-yg {
  min-height: 320px;
}
.dsx-youglish iframe {
  max-width: 100%;
  border: 0;
}

/* Oxford */
.dsx-oxford .x-webtop {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.dsx-oxford .x-headword {
  font: 700 22px/30px var(--font-app-bold);
}
.dsx-oxford .x-webtop > .x-pos,
.dsx-longman .x-POS {
  color: var(--md-primary);
  font-style: italic;
  font-weight: 600;
}
.dsx-oxford .x-phonetics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 16px;
  width: 100%;
}
.dsx-oxford :is(.x-phons_br, .x-phons_n_am) {
  display: inline-flex;
  align-items: center;
  color: var(--md-on-surface-variant);
}
.dsx-oxford :is(.x-phons_br, .x-phons_n_am)::before {
  margin-right: 2px;
  color: var(--md-outline);
  font: 700 11px/16px var(--font-app);
  content: "UK";
}
.dsx-oxford .x-phons_n_am::before {
  content: "US";
}
.dsx-oxford :is(.x-variants, .x-grammar, .x-labels, .x-use, .x-dis-g) {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.dsx-oxford .x-top-container {
  margin-bottom: 8px;
}
.dsx-oxford :is(.x-senses_multiple, .x-sense_single) {
  margin-top: 10px;
}
.dsx-oxford .x-senses_multiple {
  counter-reset: dsx-sense;
}
.dsx-oxford .x-sense {
  position: relative;
  margin-bottom: 14px;
}
.dsx-oxford .x-senses_multiple > .x-sense,
.dsx-oxford .x-shcut-g > .x-sense,
.dsx-longman :is(.x-Sense, .x-Subsense):has(> .x-sensenum) {
  padding-left: 30px;
}
.dsx-oxford :is(.x-senses_multiple > .x-sense, .x-shcut-g > .x-sense) {
  counter-increment: dsx-sense;
}
.dsx-oxford :is(.x-senses_multiple > .x-sense, .x-shcut-g > .x-sense)::before,
.dsx-longman .x-sensenum {
  position: absolute;
  top: 3px;
  left: 0;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--md-primary);
  color: #fff;
  font: 700 12px/21px var(--font-app);
  font-style: normal;
  text-align: center;
}
.dsx-oxford :is(.x-senses_multiple > .x-sense, .x-shcut-g > .x-sense)::before {
  content: counter(dsx-sense);
}
.dsx-longman .x-Subsense > .x-sensenum {
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
}
.dsx-oxford .x-shcut-g {
  display: block;
  counter-reset: none;
}
.dsx-oxford .x-shcut {
  display: block;
  margin: 18px 0 8px;
  color: var(--md-on-surface-variant);
  font: 700 12px/16px var(--font-app);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dsx-oxford .x-sensetop {
  display: block;
}
/* A sense's picture (its "enlarge image" link is gone): a small tile on its own white card. */
.dsx-oxford [data-id="ox-enlarge"] img {
  width: auto;
  max-width: 160px;
  margin: 6px 0 8px;
  background: #fff;
}
.dsx-oxford .x-def,
.dsx-longman .x-DEF {
  font-weight: 500;
}
.dsx-oxford .x-cf {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}
.dsx-oxford .x-examples {
  margin-top: 4px;
}
.dsx-oxford .x-x,
.dsx-longman :is(.x-EXAMPLE, .x-GramExa, .x-ColloExa) {
  color: var(--md-on-surface-variant);
  font-style: italic;
}
.dsx-oxford .x-gloss {
  font-style: normal;
}
.dsx-oxford .x-xrefs {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}
.dsx-oxford .x-prefix {
  margin-right: 4px;
  color: var(--md-on-surface-variant);
  font-style: italic;
  font-weight: 600;
}
.dsx-oxford :is(.x-idioms, .x-phrasal_verb_links) {
  display: block;
  margin-top: 22px;
}
.dsx-oxford :is(.x-idioms_heading, .x-phrasal_verb_links > .x-unbox) {
  display: block;
  margin-bottom: 8px;
  font: 700 16px/22px var(--font-app-bold);
}
.dsx-oxford .x-idm-g {
  display: block;
  margin: 12px 0;
}
.dsx-oxford .x-idm {
  color: var(--md-primary);
  font-weight: 700;
}
.dsx-oxford .x-pvrefs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dsx-oxford .x-collocs_list {
  padding-left: 18px;
  list-style: disc;
}
.dsx-oxford .x-un {
  display: block;
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.dsx-oxford table {
  border-collapse: collapse;
  font-size: 14px;
}
.dsx-oxford td {
  padding: 3px 10px 3px 0;
  vertical-align: middle;
}
.dsx-more {
  padding-top: 14px;
  border-top: 1px solid var(--md-outline-variant);
}

/* Longman */
.dsx-longman .x-dictentry {
  display: block;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--md-outline-variant);
}
.dsx-longman .x-dictentry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.dsx-longman .x-Head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-bottom: 6px;
}
.dsx-longman .x-HWD {
  font: 700 22px/30px var(--font-app-bold);
}
.dsx-longman .x-HOMNUM {
  margin-left: -8px;
  color: var(--md-outline);
  font-size: 12px;
  vertical-align: super;
}
.dsx-longman :is(.x-PronCodes, .x-GRAM, .x-REGISTERLAB, .x-GEO, .x-FREQ, .x-LEXVAR) {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
/* Longman's speakers say which accent they are (Oxford labels its phonetics instead). */
.dsx-longman .dsx-audio[data-accent] {
  grid-auto-flow: column;
  gap: 3px;
  width: auto;
  padding: 0 10px 0 7px;
  border-radius: 99px;
}
.dsx-longman .dsx-audio[data-accent]::after {
  font: 700 11px/1 var(--font-app);
  text-transform: uppercase;
  content: attr(data-accent);
}
.dsx-longman .x-suppressed {
  display: none;
}
.dsx-longman :is(.x-Sense, .x-Subsense, .x-Tail, .x-Crossref, .x-PhrVbEntry) {
  position: relative;
  display: block;
  margin: 10px 0;
}
.dsx-longman .x-SIGNPOST {
  display: inline-block;
  margin-right: 6px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--md-primary-container);
  color: var(--dc-on-primary-container);
  font: 700 11px/20px var(--font-app);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.dsx-longman :is(.x-PROPFORM, .x-PROPFORMPREP, .x-COLLO, .x-LEXUNIT) {
  color: var(--md-on-surface);
  font-style: normal;
  font-weight: 700;
}
.dsx-longman :is(.x-Section, .x-Collocate) {
  display: block;
  margin: 8px 0;
}
.dsx-longman .x-SECHEADING {
  display: block;
  margin-top: 12px;
  color: var(--md-on-surface-variant);
  font: 700 12px/16px var(--font-app);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dsx-longman .x-COLLOC {
  font-weight: 700;
}
.dsx-longman .x-COLLGLOSS {
  color: var(--md-on-surface-variant);
}
.dsx-longman .x-exaGroup .x-title {
  display: block;
  margin: 8px 0 2px;
  font-weight: 700;
}
.dsx-longman .x-exa {
  display: block;
  margin: 3px 0;
  color: var(--md-on-surface-variant);
}
.dsx-longman .x-NodeW {
  color: var(--md-primary);
  font-weight: 700;
}

/* Toast (inside the modal sheet, so the backdrop never covers it) */
.dict-toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--dc-inverse);
  color: #fff;
  font: 500 14px/20px var(--font-app);
  box-shadow: 0 8px 28px #0e242040;
  transform: translateX(-50%);
  pointer-events: none;
}
.dict-toast:empty {
  display: none;
}

/* ---------- AddVocabQuickSheet ---------- */
dialog.dict-add-dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  padding: 28px 32px;
  border-color: var(--md-outline-variant);
  color: var(--md-on-surface);
  font-family: var(--font-app);
}
.dict-add-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dict-add-head h2 {
  margin: 0 0 4px;
  padding: 0;
  font: 700 22px/28px var(--font-app-bold);
}
.dict-add-head p {
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.dict-add-head .dict-icon {
  margin: -8px -12px 0 0;
}
.dict-field label {
  margin: 16px 0 6px;
  color: var(--md-on-surface-variant);
  font: 600 14px/18px var(--font-app);
}
.dict-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 14px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 400 15px/22px var(--font-app);
}
.dict-field input::placeholder {
  color: var(--md-outline);
}
.dict-field input:focus {
  border-color: var(--md-primary);
}
.dict-field [aria-invalid="true"] {
  border-color: var(--dc-error);
}
.dict-field-error,
.dict-form-error {
  margin-top: 6px !important;
  color: var(--dc-error);
  font: 600 13px/18px var(--font-app);
}
.dict-field-error:empty,
.dict-form-error:empty {
  display: none;
}
.dict-add-dialog .dialog-actions {
  margin-top: 22px;
}

/* ---------- phones: bottom sheets (mobile ModalBottomSheet, radius 26) ---------- */
@media (max-width: 767px) {
  dialog.dictionary-dialog,
  dialog.dict-add-dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
  }
  dialog.dictionary-dialog {
    max-height: 92dvh;
  }
  dialog.dictionary-dialog[data-state="result"] {
    height: 92dvh;
  }
  dialog.dictionary-dialog .dict-body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.dict-add-dialog {
    max-height: 92dvh;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .dict-handle {
    display: block;
  }
  .dict-word {
    font-size: 24px;
  }
  .dict-add-dialog .dialog-actions .button {
    flex: 1;
  }
}
/* ---------- tablets and desktop: the result is a side panel ---------- */
@media (min-width: 768px) {
  dialog.dictionary-dialog[data-state="result"] {
    width: min(600px, calc(100vw - 48px));
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
    margin: 12px 12px 12px auto;
    box-shadow: 0 20px 90px #143d3933;
  }
  .dict-word-head {
    padding: 20px 14px 0 24px;
  }
  .dict-add {
    margin-left: 24px;
  }
  .dictionary-dialog .dict-sources {
    padding: 12px 24px;
  }
  .dict-card {
    margin: 2px 16px 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.dictionary-dialog[open],
  dialog.dict-add-dialog[open] {
    animation: dict-rise 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @media (min-width: 768px) {
    dialog.dictionary-dialog[data-state="result"][open] {
      animation-name: dict-slide;
    }
  }
}
@keyframes dict-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}
@keyframes dict-slide {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ---------- the "Dịch" screen ---------- */
.translate-page {
  gap: 24px;
}
.translate-page h2,
.translate-page p {
  margin: 0;
}
.translate-search {
  padding: 20px 24px 18px;
}
.translate-search .dict-search {
  padding: 0;
}
.translate-search .dict-query {
  min-height: 56px;
  font-size: 17px;
}
.translate-search .dict-go {
  min-height: 56px;
  padding: 0 32px;
}
.translate-split {
  align-items: start;
}
.translate-main {
  min-width: 0;
}
.translate-result {
  display: flex;
  flex-direction: column;
  padding: 0 0 16px;
  overflow: hidden;
}
.translate-result .dict-word-head {
  padding: 22px 16px 0 24px;
}
.translate-result .dict-word {
  font-size: 30px;
  line-height: 38px;
}
.translate-inline {
  display: flex;
  flex-direction: column;
}
.translate-inline .dict-add {
  margin-left: 24px;
}
.translate-result .dict-sources {
  padding: 12px 24px 4px;
}
.translate-result .dict-card {
  flex: none;
  height: min(70vh, 680px);
  margin: 12px 16px 0;
}
.translate-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px 18px;
  align-items: start;
  padding: 28px;
}
.translate-empty-tile {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--md-primary-container);
  color: var(--md-primary);
}
.translate-empty-tile .mi {
  width: 30px;
  height: 30px;
}
.translate-empty-text {
  display: grid;
  gap: 6px;
}
.translate-empty h2 {
  font: 700 22px/30px var(--font-app-bold);
}
.translate-empty p {
  color: var(--md-on-surface-variant);
  font-size: 15px;
  line-height: 22px;
}
.translate-empty-sources {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.translate-empty-sources li {
  padding: 6px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 99px;
  color: var(--md-on-surface-variant);
  font: 600 13px/18px var(--font-app);
}
.translate-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}
.translate-card-title {
  font: 700 18px/24px var(--font-app-bold);
  color: var(--md-on-surface);
}
.translate-card p {
  color: var(--md-on-surface-variant);
  font-size: 14px;
  line-height: 21px;
}
.translate-card p strong {
  color: var(--md-on-surface);
  overflow-wrap: anywhere;
}
.translate-add {
  justify-self: stretch;
  border-radius: 99px;
  font-family: var(--font-app);
}
.translate-add .mi {
  width: 20px;
  height: 20px;
}
.translate-link {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  color: var(--dc-link);
  font: 600 14px/20px var(--font-app);
  text-decoration: none;
}
.translate-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.translate-link .mi {
  width: 18px;
  height: 18px;
}
.translate-source-list {
  display: grid;
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}
.translate-source {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--md-on-surface);
  text-align: left;
}
.translate-source:hover {
  background: var(--dc-surface-container);
}
.translate-source[aria-pressed="true"] {
  background: var(--md-primary-container);
}
.translate-source-text {
  display: grid;
  flex: 1;
  min-width: 0;
}
.translate-source strong {
  font: 600 15px/20px var(--font-app);
}
.translate-source small {
  overflow: hidden;
  color: var(--md-on-surface-variant);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.translate-source[aria-pressed="true"] small {
  color: var(--dc-on-primary-container);
}
.translate-source-open {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--md-outline);
}
.translate-source:hover .translate-source-open {
  color: var(--md-primary);
}

/* QuickTranslateHelpSheet, for the web */
.translate-help {
  gap: 16px;
}
.translate-help-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.translate-help-mam {
  flex: none;
  width: 76px;
}
.translate-help-head p {
  margin-top: 2px;
  font-size: 13px;
  line-height: 18px;
}
.translate-steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.translate-steps li {
  display: flex;
  gap: 12px;
}
.translate-steps li > div {
  display: grid;
  flex: 1;
  gap: 8px;
  min-width: 0;
}
.translate-steps strong {
  font: 700 15px/22px var(--font-app-bold);
  color: var(--md-on-surface);
}
.translate-step-n {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--md-primary);
  color: #fff;
  font: 700 14px/1 var(--font-app-bold);
}
.translate-help p.translate-example {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--dc-surface-container);
  color: var(--md-on-surface);
  font-size: 14px;
  line-height: 21px;
}
.translate-example mark {
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--md-primary-container);
  color: inherit;
  font-weight: 700;
}
.translate-menu {
  display: flex;
  flex-wrap: wrap;
  justify-self: start;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: var(--md-app-bar);
}
.translate-menu-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  font: 600 11px/14px var(--font-app);
}
.translate-menu-item img {
  filter: brightness(0) invert(1);
}
.translate-menu-item.is-on {
  background: #fff;
  color: var(--md-primary);
}
.translate-menu-item.is-on img {
  filter: none;
}
.translate-help-note {
  padding-top: 12px;
  border-top: 1px solid var(--md-outline-variant);
}
.translate-try {
  justify-self: start;
  margin-top: 0;
}

.translate-main {
  display: grid;
  gap: 24px;
}

/* Wide: the aside carries "Thêm vào Từ vựng của bạn" and the sources, so the result card drops its copies. */
@media (min-width: 1024px) {
  .translate-inline {
    display: none;
  }
  .translate-split {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}
@media (min-width: 1280px) {
  .translate-split {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  /* Under the result: the intro and the note on the left, the three steps on the right. */
  .translate-help.is-wide {
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 32px;
    align-items: start;
  }
  .translate-help.is-wide .translate-help-head {
    flex-direction: column;
    align-items: flex-start;
    grid-row: 1;
  }
  .translate-help.is-wide .translate-steps {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  .translate-help.is-wide .translate-help-note {
    grid-row: 2;
    padding-top: 0;
    border-top: 0;
  }
  .translate-help.is-wide .translate-try {
    grid-row: 3;
  }
}
@media (max-width: 1023px) {
  .translate-aside.is-tools {
    display: none;
  }
}
@media (max-width: 767px) {
  .translate-page {
    gap: 16px;
  }
  .translate-search {
    padding: 16px;
  }
  .translate-search .dict-query,
  .translate-search .dict-go {
    min-height: 52px;
  }
  .translate-search .dict-go {
    padding: 0 20px;
  }
  .translate-search .dict-search-row.has-icon .dict-query {
    padding: 0 14px 0 42px;
    font-size: 16px;
  }
  .translate-search .dict-search-icon {
    left: 14px;
    width: 20px;
    height: 20px;
  }
  .translate-result .dict-word-head {
    padding: 16px 8px 0 16px;
  }
  .translate-result .dict-word {
    font-size: 26px;
    line-height: 32px;
  }
  .translate-inline .dict-add {
    margin-left: 16px;
  }
  .translate-result .dict-sources {
    padding: 10px 16px 2px;
  }
  .translate-result .dict-card {
    height: 64vh;
    margin: 10px 10px 0;
  }
  .translate-empty {
    padding: 20px;
  }
  .translate-empty h2 {
    font-size: 19px;
    line-height: 26px;
  }
}
