.lv-dictionary {
    --lvd-ink: #29231f;
    --lvd-muted: #64584f;
    --lvd-accent: #761e32;
    --lvd-accent-dark: #581126;
    --lvd-paper: #faf4ed;
    --lvd-border: #ded0c4;
    --lvd-white: #fff;
    width: min(1120px, calc(100% - 32px));
    margin: clamp(24px, 5vw, 58px) auto 60px;
    color: var(--lvd-ink);
    font-size: 1rem;
    line-height: 1.55;
}
.lv-dictionary, .lv-dictionary * { transition-property: color, background-color, border-color; }
.lv-dictionary [hidden] { display: none !important; }
.lv-dictionary :focus-visible { outline: 3px solid #aa3954; outline-offset: 3px; }
.lv-dictionary a { color: var(--lvd-accent); text-underline-offset: .2em; }
.lv-dictionary a:not(.lvd-button):not(.lvd-call) { text-decoration: underline; }
.lvd-hero {
    background: linear-gradient(115deg, #f8eee3, #fffaf5 74%);
    border: 1px solid var(--lvd-border);
    border-top: 4px solid var(--lvd-accent);
    padding: clamp(22px, 5vw, 52px);
    border-radius: 12px;
}
.lvd-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-bottom: 15px; color: var(--lvd-muted); font-size: .9rem; }
.lvd-hero h1 {
    margin: 0 0 .45rem;
    font-size: clamp(2.15rem, 5.4vw, 4.1rem);
    line-height: 1.05;
    color: var(--lvd-accent-dark);
    letter-spacing: -.033em;
    overflow-wrap: anywhere;
}
.lvd-hero p { margin: 0; max-width: 62ch; font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--lvd-muted); }
.lvd-total { display: inline-block; margin-top: 17px; color: var(--lvd-accent); font-weight: 600; }
.lvd-emergency {
    margin: 18px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 10px 16px;
    border: 1px solid var(--lvd-border);
    border-left: 3px solid var(--lvd-accent);
    border-radius: 8px;
    background: #fffaf7;
}
.lvd-emergency p { margin: 0 auto 0 0; }
.lv-dictionary .lvd-call { padding: .38rem .8rem; border-radius: 6px; background: var(--lvd-accent); color: white; text-decoration: none; }
.lvd-emergency a { overflow-wrap: anywhere; }
.lvd-controls {
    padding: clamp(14px, 2.5vw, 24px);
    border: 1px solid var(--lvd-border);
    border-radius: 10px;
    background: var(--lvd-white);
}
.lvd-mode-row, .lvd-result-row, .lvd-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.lvd-mode-row { justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.lvd-modes { display: flex; flex-wrap: wrap; gap: 5px; background: var(--lvd-paper); border-radius: 8px; padding: 4px; }
.lvd-modes button, .lv-dictionary .lvd-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: .43rem .75rem;
    border: 1px solid var(--lvd-border);
    border-radius: 7px;
    background: var(--lvd-white);
    color: var(--lvd-accent);
    font: inherit;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.lvd-modes button { border-color: transparent; background: transparent; }
.lvd-modes button[aria-pressed="true"], .lv-dictionary .lvd-primary,
.lv-dictionary .lvd-button[data-active="true"] { background: var(--lvd-accent); border-color: var(--lvd-accent); color: white; }
.lv-dictionary .lvd-button:not(:disabled):hover,
.lvd-modes button[aria-pressed="false"]:hover { border-color: var(--lvd-accent); }
.lv-dictionary .lvd-button[aria-pressed="true"]:not([data-active="true"]) { background: var(--lvd-paper); border-color: #b98e8d; }
.lv-dictionary button:disabled { opacity: .63; cursor: default; }
.lv-dictionary .lvd-primary:hover, .lv-dictionary .lvd-call:hover { background: var(--lvd-accent-dark); }
.lvd-progress, .lvd-result-row p, .lvd-foot p { margin: 0; color: var(--lvd-muted); font-size: .93rem; }
.lvd-fields, .lvd-quiz-settings { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; }
.lvd-quiz-settings { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.lvd-fields label, .lvd-quiz-settings label { display: grid; gap: .3rem; min-width: 0; font-weight: 600; font-size: .94rem; }
.lvd-fields input, .lvd-fields select, .lvd-quiz-settings select {
    min-height: 44px;
    min-width: 0;
    width: 100%;
    border: 1px solid #bcae9f;
    border-radius: 6px;
    background: var(--lvd-white);
    color: var(--lvd-ink);
    padding: 7px 10px;
    font: inherit;
    font-weight: 400;
}
.lvd-panel { margin: 20px 0 0; }
.lvd-result-row { justify-content: space-between; margin-bottom: 11px; }
.lvd-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--lvd-accent);
    text-decoration: underline;
    text-underline-offset: .18em;
    cursor: pointer;
}
.lvd-entries { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.lvd-entry {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 15px;
    min-width: 0;
    padding: 16px;
    background: var(--lvd-white);
    border: 1px solid var(--lvd-border);
    border-radius: 9px;
    scroll-margin-top: 112px;
}
.lvd-entry-topic { color: var(--lvd-muted); font-size: .84rem; }
.lvd-entry .lvd-phrase { margin: .25rem 0 .3rem; font-size: clamp(1.16rem, 2.3vw, 1.35rem); color: var(--lvd-accent-dark); line-height: 1.28; overflow-wrap: anywhere; }
.lvd-entry p { margin: 0; overflow-wrap: anywhere; }
.lvd-entry .lvd-button { font-size: .86rem; min-height: 36px; padding-inline: .5rem; }
.lvd-entry .lvd-link { font-size: .86rem; }
.lv-dictionary .lvd-more { margin: 18px auto 0; display: flex; }
.lvd-learning {
    max-width: 760px;
    padding: clamp(16px, 4vw, 32px);
    border-radius: 10px;
    border: 1px solid var(--lvd-border);
    background: var(--lvd-white);
}
.lvd-learning h2 { font-size: clamp(1.35rem, 3.5vw, 2rem); line-height: 1.25; color: var(--lvd-accent-dark); margin: 0 0 .65rem; }
.lvd-learning p { margin: .65rem 0; }
.lvd-learning .lvd-actions { margin-top: 12px; }
.lvd-learning select:disabled { color: var(--lvd-muted); background: var(--lvd-paper); }
.lvd-study-card {
    margin-block: 10px;
    padding: clamp(16px, 4vw, 25px);
    min-height: 140px;
    border-radius: 9px;
    background: var(--lvd-paper);
    border: 1px solid var(--lvd-border);
}
.lvd-learning .lvd-meaning { font-size: 1.2rem; }
.lvd-quiz-settings { margin-bottom: 16px; }
.lvd-choices { display: grid; gap: 8px; margin-block: .8rem; }
.lv-dictionary .lvd-choice { justify-content: start; text-align: start; min-height: 44px; }
.lv-dictionary .lvd-choice[data-correct="true"] { color: #155934; border-color: #3d835a; background: #edf8ef; opacity: 1; }
.lv-dictionary .lvd-choice[data-wrong="true"] { color: #7c1831; border-color: #a63e56; background: #fff0f3; opacity: 1; }
.lvd-score { font-size: 1.25rem; font-weight: 600; }
.lvd-review { margin-block: 8px; padding-inline-start: 1.3rem; list-style: disc; }
.lvd-error { margin: 12px 0; color: var(--lvd-accent-dark); }
.lvd-notes {
    margin-top: 24px;
    padding: 12px 16px;
    border: 1px solid var(--lvd-border);
    border-radius: 8px;
    background: var(--lvd-paper);
}
.lvd-notes summary { cursor: pointer; font-weight: 600; }
.lvd-notes dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 14px; row-gap: 6px; margin: 10px 0 0; }
.lvd-notes dt { color: var(--lvd-accent); font-weight: 600; }
.lvd-notes dd { margin: 0; }
.lvd-foot { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .9rem; }
.lvd-foot p { flex: 1 1 100%; }
#lvd-display {
    position: fixed;
    inset: 0;
    margin: auto;
    max-width: min(680px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    padding: 0;
    background: var(--lvd-paper);
    color: var(--lvd-ink);
    border: 1px solid var(--lvd-border);
    border-radius: 12px;
}
#lvd-display::backdrop { background: #291a1abe; }
.lvd-dialog-inner { padding: clamp(20px, 6vw, 48px); text-align: center; }
#lvd-display-phrase { margin: 0 0 .6rem; color: var(--lvd-accent-dark); font-size: clamp(1.8rem, 7vw, 3.6rem); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
#lvd-display-meaning { margin: 0 0 1rem; }
.lvd-dialog-inner .lvd-actions { justify-content: center; }
@media (max-width: 880px) {
    .lvd-entries { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
    .lv-dictionary { width: calc(100% - 24px); }
    .lvd-entries { grid-template-columns: minmax(0,1fr); }
    .lvd-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
    #lvd-search-wrap { grid-column: 1/-1; }
    .lvd-mode-row { align-items: flex-start; }
    .lvd-emergency { gap: 8px 13px; }
    .lvd-emergency p { flex-basis: 100%; }
    .lvd-entry .lvd-button, .lvd-entry .lvd-link { min-height: 44px; }
}
