    /* INSTANCE DROPDOWN FIX */
    .dropdown {
        position: relative;
        display: inline-block;
    }

    .dropdown button {
        background: var(--surface-hover);
        padding: 8px 12px;
        border-radius: 8px;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        font-size: 15px;
    }

    .dropdown-menu {
        display: none;
        position: absolute;
        right: 0;
        top: 46px;
        background: var(--surface-muted);
        border: 1px solid var(--surface-border);
        border-radius: 12px;
        min-width: 180px;
        padding: 6px 0;
        box-shadow: var(--shadow-elevated);
        backdrop-filter: blur(10px);
        animation: dropFade 0.18s ease;
    }

    .dropdown-menu .instance-option,
    .dropdown-menu .profileDropItem {
        padding: 10px 14px;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.18s ease, color 0.18s ease;
        color: var(--text-primary);
    }

    .dropdown-menu .instance-option:hover,
    .dropdown-menu .profileDropItem:hover {
        background: var(--surface-hover);
    }

    .dropdown-menu .instance-option.active {
        background: color-mix(in srgb, var(--accent-primary), transparent 65%);
    }


    /* Generic dropdown item (used by ⋯ menu, instances, profile, etc.) */
    .dropdown-item {
        padding: 10px 14px;
        font-size: 14px;
        cursor: pointer;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 10px;
        transition: background 0.18s ease, transform 0.12s ease;
    }

    .dropdown-item:hover {
        background: var(--surface-hover);
    }

    .dropdown-item:active {
        transform: scale(0.97);
    }

    .instance-option {
        padding: 10px 14px;
        font-size: 14px;
        cursor: pointer;
        color: var(--text-primary);
    }

    .instance-option:hover {
        background: var(--surface-hover);
    }

    .profileDropItem {
        padding: 10px 14px;
        cursor: pointer;
        font-size: 14px;
        transition: background 0.2s ease;
        color: var(--text-primary);
    }

    .profileDropItem:hover {
        background: var(--surface-hover);
    }

    /* Inline-style overrides */
    #difficultyMenu,
    #summarizeDropdown {
        background: var(--surface-muted) !important;
        border: 1px solid var(--surface-border) !important;
        box-shadow: var(--shadow-elevated) !important;
        color: var(--text-primary) !important;
    }

@keyframes dropFade {
        from {
            opacity: 0;
            transform: translateY(-6px) scale(0.98);
        }

        to {
            opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Premium select styling across toolbars/forms */
select.modal-input,
#flashModeDropdown,
.plan7-review-select,
#aiStudyMcqModeSelect {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 34px !important;
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
        linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 2px),
        calc(100% - 10px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select.modal-input:hover,
#flashModeDropdown:hover,
.plan7-review-select:hover,
#aiStudyMcqModeSelect:hover {
    background-color: var(--surface-hover);
    border-color: color-mix(in srgb, var(--surface-border), var(--text-primary) 14%);
}

select.modal-input:focus,
#flashModeDropdown:focus,
.plan7-review-select:focus,
#aiStudyMcqModeSelect:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent-primary), var(--surface-border) 40%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 78%);
}

select.modal-input option,
#flashModeDropdown option,
.plan7-review-select option,
#aiStudyMcqModeSelect option {
    background: var(--surface-muted);
    color: var(--text-primary);
}

select.modal-input option:checked,
#flashModeDropdown option:checked,
.plan7-review-select option:checked,
#aiStudyMcqModeSelect option:checked {
    background: color-mix(in srgb, var(--accent-primary), transparent 78%);
    color: var(--text-primary);
}

.mode-info-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-info-btn {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--surface-border), var(--text-primary) 12%);
    background: color-mix(in srgb, var(--accent-primary), transparent 86%);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.mode-info-btn:hover {
    background: color-mix(in srgb, var(--accent-primary), transparent 76%);
    border-color: color-mix(in srgb, var(--accent-primary), var(--surface-border) 40%);
    transform: translateY(-1px);
}

.mode-info-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary), transparent 78%);
}

.mode-info-box {
    margin-top: 8px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    background: linear-gradient(
        165deg,
        color-mix(in srgb, var(--surface-base), var(--accent-primary) 6%),
        var(--surface-elevated)
    );
    box-shadow: var(--shadow-soft);
}

.mode-info-row {
    padding: 8px 2px;
    border-top: 1px solid color-mix(in srgb, var(--surface-border), transparent 35%);
}

.mode-info-row:first-child {
    border-top: none;
    padding-top: 2px;
}

.mode-info-row-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.mode-info-row-text {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.ai-mode-info-modal {
    width: min(560px, 92vw);
    max-height: min(78vh, 680px);
    overflow: hidden;
    position: relative;
}

.ai-mode-info-title {
    margin: 0;
    color: var(--text-primary);
}

.ai-mode-info-subtitle {
    margin: 8px 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.mode-info-modal-list {
    max-height: min(54vh, 460px);
    overflow: auto;
}

.ai-mode-info-close {
    position: absolute;
    right: 12px;
    top: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.ai-mode-info-close:hover {
    color: var(--text-primary);
    border-color: color-mix(in srgb, var(--surface-border), var(--text-primary) 20%);
    background: transparent;
}
