.vocab-select {
    position: relative;
    min-width: 0;
}
.vocab-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    padding: 0 !important;
    clip-path: inset(50%);
}
.vocab-select-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid #cedce5;
    border-radius: 12px;
    background: white;
    font: inherit;
    color: #283943;
    text-align: left;
}
.vocab-select-trigger > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vocab-select-symbol {
    color: #66849a;
    font-size: 19px;
    line-height: 1;
}
.vocab-select-trigger[aria-expanded='true'] {
    background: #f2f8fe;
    border-color: #88bde1;
}
.vocab-select-trigger:focus-visible {
    outline: 2px solid #399de4;
    outline-offset: 3px;
}
.vocab-select-trigger:disabled {
    opacity: 0.75;
    cursor: default;
}
.vocab-select-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 6px;
    background: white;
    border: 1px solid #d6e3eb;
    border-radius: 14px;
    box-shadow: 0 12px 35px #24445924;
    overflow-y: auto;
    z-index: 12000;
    color: #283943;
}
.vocab-select-menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 9px;
    padding: 10px 12px;
    background: white;
    text-align: left;
    font: inherit;
    color: inherit;
}
.vocab-select-menu button[aria-selected='true'] {
    background: #edf7ff;
    font-weight: 600;
}
.vocab-select-menu button[aria-selected='true']:after {
    content: '✓';
    color: #27678e;
}
.vocab-select-menu button:hover,
.vocab-select-menu button:focus-visible {
    background: #edf7ff;
    outline: 2px solid #97c9eb;
    outline-offset: -2px;
}
.vocab-dialog {
    --vocab-ink: #24292e;
    position: fixed;
    inset: 0;
    padding: 0;
    margin: auto;
    width: 540px;
    max-width: calc(100vw - 32px);
    max-height: calc(var(--vocab-height, 100dvh) - 32px);
    border: 1px solid #dde7ed;
    border-radius: 24px;
    background: white;
    color: var(--vocab-ink);
    box-shadow: 0 18px 80px #233c5533;
    overflow: hidden;
}
.vocab-dialog::backdrop {
    background: #172c3f55;
    backdrop-filter: blur(3px);
}
.vocab-dialog[open] {
    display: flex;
    flex-direction: column;
}
.vocab-dialog * {
    box-sizing: border-box;
}
.vocab-dialog [hidden] {
    display: none !important;
}
.vocab-dialog-header {
    padding: 20px 24px 14px;
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: space-between;
    flex-shrink: 0;
}
.vocab-dialog-header h2 {
    font:
        700 21px/1.3 Roboto,
        sans-serif;
    margin: 0;
}
.vocab-close {
    border: 0;
    border-radius: 50%;
    background: #f4f6f7;
    min-width: 44px;
    height: 44px;
    font-size: 25px;
    color: #334550;
}
.vocab-dialog-body {
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 24px 24px;
    min-height: 0;
}
.vocab-dialog-foot {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px 24px 22px;
    border-top: 1px solid #dde7ed;
    flex-shrink: 0;
}
.vocab-dialog .vocab-primary {
    flex: 1;
}
.vocab-btn {
    min-height: 46px;
    padding: 10px 17px;
    border-radius: 12px;
    border: 1px solid #dce7ee;
    background: white;
    color: #283943;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}
.vocab-btn.vocab-primary {
    background: #a0d7ff;
    border-color: #75bce9;
    box-shadow: 2px 3px 0 #399de4;
}
.vocab-btn.vocab-secondary {
    background: #f2f8fe;
}
.vocab-btn.vocab-danger {
    color: #a33d28;
    background: #fff4f1;
    border-color: #e9c2b8;
}
.vocab-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}
.vocab-btn:focus-visible,
.vocab-close:focus-visible {
    outline: 2px solid #287cb7;
    outline-offset: 3px;
}
.vocab-dialog input,
.vocab-dialog textarea,
.vocab-dialog select {
    font:
        16px/1.5 Roboto,
        sans-serif;
    border: 1px solid #bdcdd8;
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 46px;
    max-width: 100%;
    width: 100%;
    background: white;
    color: #283943;
}
.vocab-dialog input[readonly] {
    background: #f8fafb;
}
.vocab-dialog input:focus-visible,
.vocab-dialog textarea:focus-visible {
    outline: 2px solid #399de4;
    outline-offset: 2px;
}
.vocab-dialog textarea {
    min-height: 120px;
    resize: vertical;
}
.vocab-dialog label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}
.vocab-field {
    margin-top: 18px;
}
.vocab-field-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 15px;
}
.vocab-muted {
    font-size: 13px;
    color: #5c6e79;
    line-height: 1.6;
    margin: 0;
}
.vocab-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5c7281;
}
.vocab-term {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.25;
    margin: 15px 0;
    overflow-wrap: anywhere;
}
.vocab-meaning {
    font-size: 22px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.5;
    margin: 12px 0 22px;
}
.vocab-saved {
    color: #48652b;
    font-size: 13px;
    margin: 0 0 18px;
}
.vocab-context {
    padding: 18px;
    background: #f2f8fe;
    border-radius: 14px;
    margin-top: 20px;
}
.vocab-context blockquote {
    font-size: 17px;
    line-height: 1.65;
    margin: 10px 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.vocab-context p {
    margin: 0;
    font-size: 13px;
    color: #596f7d;
}
.vocab-notice {
    background: #fff7e9;
    border: 1px solid #ecd6b5;
    border-radius: 12px;
    padding: 13px;
    font-size: 13px;
    margin-top: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.vocab-notice:empty {
    display: none;
}
.vocab-notice.error {
    color: #913721;
    background: #fff4f0;
}
.vocab-notice .vocab-btn {
    margin-top: 10px;
}
.vocab-discard .vocab-btn {
    margin: 10px 5px 0 0;
}
.vocab-toast {
    position: fixed;
    z-index: 12000;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #263e4c;
    color: white;
    border-radius: 13px;
    padding: 14px 20px;
    max-width: calc(100vw - 24px);
    box-shadow: 0 7px 30px #2343;
    font-size: 14px;
}
.vocab-device-tabs {
    display: flex;
    background: #f2f5f7;
    border-radius: 11px;
    padding: 4px;
    gap: 4px;
    margin: 15px 0;
}
.vocab-device-tabs button {
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    background: transparent;
    color: #263e4c;
}
.vocab-device-tabs button[aria-pressed='true'] {
    background: white;
    box-shadow: 0 1px 4px #20304020;
}
.vocab-dialog details {
    padding: 14px;
    border: 1px solid #dde7ed;
    border-radius: 12px;
    margin-top: 18px;
}
.vocab-dialog summary {
    font-size: 14px;
    min-height: 30px;
    cursor: pointer;
}
.vocab-dialog ol {
    font-size: 14px;
    line-height: 1.6;
    padding-left: 24px;
    margin: 12px 0;
}
.vocab-dialog li {
    margin-bottom: 10px;
}
.vocab-anki-summary {
    padding: 18px;
    background: #f2f8fe;
    border-radius: 14px;
    margin: 15px 0;
}
.vocab-anki-summary strong {
    display: block;
    font-size: 22px;
    margin-bottom: 5px;
}
@media (max-width: 600px) {
    .vocab-dialog {
        inset: auto 0 auto;
        top: calc(var(--vocab-top, 0px) + var(--vocab-height, 100dvh));
        transform: translateY(-100%);
        margin: 0;
        width: 100%;
        max-width: 100%;
        max-height: calc(var(--vocab-height, 100dvh) - 12px);
        border-radius: 24px 24px 0 0;
    }
    .vocab-dialog.vocab-editor {
        top: var(--vocab-top, 0px);
        transform: none;
        height: var(--vocab-height, 100dvh);
        max-height: var(--vocab-height, 100dvh);
        border-radius: 0;
        border: 0;
    }
    .vocab-dialog.vocab-editor .vocab-dialog-body {
        flex: 1;
    }
    .vocab-dialog-header {
        padding: 17px 20px 14px;
    }
    .vocab-dialog-body {
        padding: 0 20px 22px;
    }
    .vocab-dialog-foot {
        padding: 14px 20px max(18px, env(safe-area-inset-bottom));
    }
    .vocab-dialog-foot .vocab-btn {
        min-height: 48px;
    }
    .vocab-field-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .vocab-term {
        font-size: 32px;
    }
    .vocab-select-menu {
        font-size: 15px;
    }
}
