/* Component-only styles. Fonts and surrounding editor belong to the host app. */
.dv {
  --dv-paper: #fffdf9;
  --dv-ink: #26241f;
  --dv-muted: #6b6258;
  --dv-green: #506957;
  --dv-soft: #eaf0e8;
  --dv-line: #e5dfd6;
  --dv-hover: #f2ece4;
  font:
    400 16px/1.55 Inter,
    system-ui,
    sans-serif;
  color: var(--dv-ink);
}
.dv,
.dv * {
  box-sizing: border-box;
}
.dv [hidden] {
  display: none !important;
}
.dv button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  touch-action: manipulation;
}
.dv button:focus-visible,
.dv a:focus-visible,
.dv [role="tabpanel"]:focus-visible {
  outline: none;
  background: #dce7d9;
  color: #293e2e;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.dv svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.dv strong {
  font-weight: 600;
}
.dv h2,
.dv h3,
.dv h4,
.dv p,
.dv dl,
.dv dd {
  margin: 0;
}
.dv h2:focus {
  outline: none;
}
.dv #dv-live-word {
  color: var(--dv-ink) !important;
}
.dv-card {
  width: 430px;
  max-width: calc(100vw - 24px);
  padding: 24px;
  background: var(--dv-paper);
  border: 1px solid var(--dv-line);
  border-radius: 20px;
  box-shadow:
    0 12px 36px #46392c12,
    0 2px 5px #46392c06;
  text-align: left;
}
.dv-dialog {
  position: fixed;
  z-index: 12005;
  overflow: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.dv-entry {
  position: relative;
  margin: 0;
}
.dv-entry-top {
  position: sticky;
  top: 0;
  background: var(--dv-paper);
  z-index: 2;
  margin-bottom: 18px;
}
.dv-entry-top::before {
  content: "";
  position: absolute;
  inset: -24px -24px -8px;
  z-index: -1;
  background: var(--dv-paper);
  pointer-events: none;
}
.dv-wordline {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 44px;
  gap: 0;
}
.dv .dv-wordline h2 {
  font:
    700 30px/1.2 Inter,
    system-ui,
    sans-serif;
  letter-spacing: -0.6px;
  min-width: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.dv .dv-pos {
  font-size: 14px;
  line-height: 1.5;
  color: var(--dv-muted);
}
.dv .dv-read {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 13px;
  color: var(--dv-green);
  flex-shrink: 0;
  position: relative;
  align-self: flex-start;
}
.dv .dv-read:hover {
  color: #293e2e;
}
.dv .dv-read:active {
  opacity: 0.65;
}
.dv .dv-read:focus-visible {
  background: transparent;
}
.dv .dv-read:focus-visible::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.dv-close-anchor {
  position: sticky;
  top: 0;
  height: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 5;
  pointer-events: none;
}
.dv .dv-close {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin-right: -12px;
  border-radius: 8px;
  color: var(--dv-muted);
  background: var(--dv-paper);
}
.dv .dv-close:hover {
  background: var(--dv-hover);
}

/* One concise category row; no duplicate word headings or filled selector container. */
.dv-entry-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  column-gap: 22px;
  row-gap: 2px;
  padding: 0;
  margin: 0;
}
.dv .dv-entry-tabs button {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 5px 0 7px;
  font:
    500 14px/1.5 Inter,
    system-ui,
    sans-serif;
  color: var(--dv-muted);
  text-align: left;
  overflow-wrap: anywhere;
  position: relative;
}
.dv .dv-entry-tabs button:hover {
  color: var(--dv-green);
}
.dv .dv-entry-tabs button[aria-selected="true"] {
  color: var(--dv-green);
  font-weight: 600;
}
.dv .dv-entry-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: #718875;
}
.dv [role="tabpanel"]:focus-visible {
  background: #f7f5ef;
  border-radius: 8px;
  text-decoration: none;
}
.dv .dv-definition {
  font-size: 18px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.dv-example {
  border-left: 2px solid #bccab5;
  padding-left: 14px;
  margin-top: 16px;
}
.dv-label {
  display: block;
  font-size: 14px;
  color: var(--dv-muted);
  margin-bottom: 3px;
}
.dv-example p {
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.dv-visible-section {
  padding: 16px;
  border-radius: 12px;
  margin-top: 16px;
}
.dv-visible-section h3 {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--dv-green);
  margin-bottom: 8px;
}
.dv-visible-section p {
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.dv-visible-section p + p {
  margin-top: 4px;
}
.dv-visible-forms {
  background: #f4efe8;
}
.dv-inflections > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--dv-line);
}
.dv-inflections > div:first-child {
  padding-top: 0;
}
.dv-inflections > div:last-child {
  padding-bottom: 0;
  border: 0;
}
.dv-inflections dt {
  font-size: 14px;
  line-height: 1.5;
  color: var(--dv-muted);
}
.dv-inflections dd {
  font-size: 16px;
  line-height: 1.5;
}
.dv-visible-synonyms {
  background: var(--dv-soft);
  margin-top: 12px;
}
.dv-syn-item + .dv-syn-item {
  border-top: 1px solid #d7e0d3;
  padding-top: 10px;
  margin-top: 10px;
}
.dv-syn-item .dv-example {
  margin: 0;
  padding: 0;
  border: 0;
}
.dv-lexeme + .dv-lexeme {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--dv-line);
}
.dv-entry-meaning-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--dv-green);
  margin-bottom: 8px !important;
  overflow-wrap: anywhere;
}
/* Shared card template: section titles and their speech button stay together. */
.dv .dv-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dv .dv-section-heading h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
.dv .dv-section-heading .dv-read {
  flex-shrink: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 9px;
  margin: 0;
}
.dv-other-meanings {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--dv-line);
}
.dv-labelled-meanings {
  margin-top: 16px;
  padding-top: 0;
  border: 0;
}
.dv-other-heading {
  font-size: 14px;
  line-height: 1.5;
  color: var(--dv-green);
  font-weight: 600;
  margin-bottom: 16px !important;
}
.dv-other-meanings .dv-section-heading .dv-other-heading {
  margin-bottom: 0 !important;
}
.dv-other-meaning + .dv-other-meaning {
  margin-top: 12px;
}
.dv-meaning-cue {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
  margin-bottom: 4px !important;
}
.dv-other-meaning p {
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.dv .dv-usage {
  font-size: 14px;
  line-height: 1.5;
  color: var(--dv-muted);
  margin-bottom: 8px;
}
.dv .dv-sense-label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--dv-muted);
  margin-bottom: 8px;
}
.dv-entry-link {
  font: inherit;
  color: var(--dv-green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 2px;
}
.dv-entry-link:hover {
  color: #293e2e;
  text-decoration-thickness: 2px;
}
.dv-hint,
.dv-audio-status {
  font-size: 13px;
  line-height: 1.6;
  color: var(--dv-muted);
  margin-top: 14px !important;
}
.dv-toolbar {
  display: flex;
  position: fixed;
  z-index: 12005;
  padding: 5px;
  border: 1px solid var(--dv-line);
  background: var(--dv-paper);
  box-shadow: 0 4px 14px #46392c1a;
  border-radius: 12px;
}
.dv .dv-lookup {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--dv-soft);
  color: var(--dv-green);
  min-height: 40px;
}
.dv-suggestions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.dv .dv-suggestions button {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--dv-soft);
  color: var(--dv-green);
}
.dv-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
::highlight(dictionary-word) {
  background: var(--sk-selection-bg, #cbdccd);
  color: var(--sk-selection-text, #243d30);
}
@media (max-width: 700px) {
  .dv .dv-dialog {
    left: 8px !important;
    right: 8px !important;
    bottom: var(--dv-keyboard-bottom, 8px) !important;
    top: auto !important;
    width: auto;
    max-width: none;
    padding: 16px 20px 20px;
  }
  .dv-entry-top::before {
    inset: -16px -20px -8px;
  }
  .dv .dv-wordline h2 {
    font-size: 27px;
  }
  .dv-inflections > div {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
  }
}
@media (max-width: 420px) {
  .dv-inflections > div {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 12px;
  }
  .dv-noun-forms .dv-inflections > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

/* Quiet disclosure; both choices inherit the same dictionary theme. */
.dv-navigation { display: flex; align-items: center; gap: 16px; }
.dv-navigation > :first-child { flex: 1; min-width: 0; }
.dv-language-control { position: relative; flex: none; color: var(--dv-muted); }
.dv .dv-language {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: var(--dv-muted) !important;
  font: 400 13px/1.5 Inter, system-ui, sans-serif;
}
.dv .dv-language svg { width: 14px; height: 14px; transition: transform 140ms ease-out; }
.dv .dv-language[aria-expanded="true"] svg { transform: rotate(180deg); }
.dv .dv-language:hover { color: var(--dv-ink) !important; }
.dv .dv-language:focus-visible,
.dv .dv-language-options button:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  color: var(--dv-ink) !important;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.dv-language-options {
  position: absolute;
  z-index: 3;
  right: 0;
  top: calc(100% - 2px);
  width: 144px;
  padding: 6px;
  border: 1px solid var(--dv-line);
  border-radius: 12px;
  background: var(--dv-paper) !important;
  box-shadow: 0 6px 18px #0002;
  animation: dv-language-open 140ms ease-out;
}
.dv .dv-language-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  font: 400 14px/1.5 Inter, system-ui, sans-serif;
  color: var(--dv-ink) !important;
  background: transparent !important;
}
.dv .dv-language-options button[aria-pressed="true"] {
  background: var(--dv-soft) !important;
  color: var(--dv-green) !important;
}
.dv .dv-language-options button:hover,
.dv .dv-language-options button:focus-visible { background: var(--dv-hover) !important; }
.dv .dv-language-options svg { width: 16px; height: 16px; visibility: hidden; }
.dv .dv-language-options [aria-pressed="true"] svg { visibility: visible; }
@keyframes dv-language-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .dv-language-options { animation: none !important; }
  .dv .dv-language svg { transition: none !important; }
}

/* Long-list disclosure for other meanings. */
.dv-more-meanings {
  margin-top: 12px;
  border: 0;
}
.dv-more-meanings > summary {
  cursor: pointer;
  font: 400 14px/1.5 Inter, system-ui, sans-serif;
  color: var(--dv-muted);
  background: transparent;
  padding: 8px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  list-style: none;
}
.dv-more-meanings > summary::-webkit-details-marker { display: none; }
.dv-more-meanings > summary svg {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  transition: transform 140ms ease-out;
}
.dv-more-meanings[open] > summary svg { transform: rotate(180deg); }
.dv-more-meanings > summary:focus-visible {
  outline: none;
  background: transparent;
  color: var(--dv-ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  border-radius: 4px;
}
.dv-more-meanings > summary:hover { color: var(--dv-ink); background: transparent; }
@media (prefers-reduced-motion: reduce) {
  .dv-more-meanings > summary svg { transition: none; }
}

/* Keep the trigger quiet even under the host dark-mode button hover rule. */
.dv #dv-live-dialog .dv-language { background: transparent !important; }

/* Shared meaning template: usage notes follow the example in every category. */
.dv .dv-example + .dv-usage { margin-top: 12px; }


/* Shared card anatomy: hosts position the card; the component owns its contents.
   Keep these semantic spacing tokens common to every language and category. */
.dv {
  --dv-card-padding: 24px;
  --dv-content-gap: 16px;
  --dv-note-gap: 12px;
  --dv-cue-gap: 8px;
  --dv-section-gap: 24px;
  --dv-section-inset: 20px;
  --dv-panel-padding: 16px;
  --dv-section-speaker-size: 36px;
}
.dv .dv-card { padding: var(--dv-card-padding); }
.dv .dv-card :is(.dv-entry, .dv-lexeme, .dv-sense, .dv-other-meaning, [role="tabpanel"]) {
  padding: 0;
}
.dv .dv-card :is(.dv-sense, .dv-other-meaning) { display: flow-root; }
.dv .dv-card :is(.dv-sense, .dv-other-meaning) > :is(p, h3, h4, .dv-example, .dv-visible-section) {
  margin: 0;
}
.dv .dv-card :is(.dv-sense, .dv-other-meaning) > * + :is(p, h3, h4, .dv-example, .dv-visible-section) {
  margin-top: var(--dv-content-gap);
}
.dv .dv-card :is(.dv-sense, .dv-other-meaning) > .dv-meaning-cue {
  margin-bottom: 0 !important;
}
.dv .dv-card :is(.dv-sense, .dv-other-meaning) > .dv-meaning-cue + * {
  margin-top: var(--dv-cue-gap);
}
.dv .dv-card :is(.dv-sense, .dv-other-meaning) > .dv-usage {
  margin-top: var(--dv-note-gap);
  margin-bottom: 0;
}
.dv .dv-card .dv-example {
  padding: 0 0 0 14px;
  border-left: 2px solid #bccab5;
}
.dv .dv-card .dv-example .dv-label { margin: 0 0 3px; }
.dv .dv-card .dv-example p { margin: 0; padding: 0; font-size: 16px; line-height: 1.65; }
.dv .dv-card .dv-visible-section { padding: var(--dv-panel-padding); }
.dv .dv-card :is(.dv-other-meanings, .dv-lexeme + .dv-lexeme) {
  margin-top: var(--dv-section-gap);
  padding-top: var(--dv-section-inset);
  border-top: 1px solid var(--dv-line);
}
.dv .dv-card .dv-other-meaning + .dv-other-meaning { margin-top: var(--dv-content-gap); }
.dv .dv-card .dv-section-heading {
  display: flex;
  align-items: center;
  gap: var(--dv-cue-gap);
  margin: 0 0 var(--dv-cue-gap);
  padding: 0;
}
.dv .dv-card .dv-section-heading h3 { margin: 0 !important; padding: 0; min-width: 0; }
.dv .dv-card .dv-section-heading .dv-read {
  width: var(--dv-section-speaker-size);
  min-width: var(--dv-section-speaker-size);
  height: var(--dv-section-speaker-size);
  padding: 0;
  margin: 0;
  align-self: center;
}
.dv .dv-card .dv-read svg { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.dv .dv-card .dv-meaning-cue { font: 600 15px/1.5 Inter, system-ui, sans-serif; }
@media (max-width: 700px) {
  .dv { --dv-card-padding: 16px 20px 20px; }
}
@media (pointer: coarse), (max-width: 767px) {
  .dv { --dv-section-speaker-size: 44px; }
  .dv .dv-card [role="tab"] { min-width: 44px; }
}


/* A meaning keeps its definition, example and note together. Separate meanings,
   including the first revealed row, without adding lines within their content. */
.dv .dv-card :is(.dv-other-meaning + .dv-other-meaning, .dv-more-meanings > .dv-other-meaning) {
  margin-top: var(--dv-content-gap);
  padding-top: var(--dv-content-gap);
  border-top: 1px solid var(--dv-line);
}
