.oml-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    pointer-events: none;
}

.oml-overlay[hidden] {
    display: none;
}

.oml-panel {
    position: fixed;
    left: 100px;
    top: 212px;
    width: 380px;
    min-width: 280px;
    height: 350px;
    min-height: 200px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--panel-line);
    border-radius: 14px;
    background: rgba(14, 17, 23, 0.96);
    color: var(--text-primary);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.46);
    pointer-events: auto;
    backdrop-filter: blur(18px);
}

.oml-overlay.is-fullscreen .oml-panel {
    left: 96px !important;
    top: 84px !important;
    right: auto;
    bottom: auto;
    width: min(720px, calc(100vw - 128px));
    height: min(420px, calc(100vh - 116px));
    max-height: calc(100vh - 116px);
}

.oml-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--panel-line);
    flex-shrink: 0;
}

.oml-tabs {
    display: flex;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.oml-tab {
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.oml-tab span {
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 620;
}

.oml-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.oml-icon-btn {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.oml-icon-btn:hover,
.oml-icon-btn:focus-visible {
    background: var(--accent-soft);
    color: var(--text-primary);
    outline: none;
}

.oml-icon-btn svg {
    width: 15px;
    height: 15px;
}

.oml-body {
    flex: 1 1 auto;
    min-height: 180px;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.oml-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 84px);
    justify-content: start;
    align-content: start;
    gap: 6px;
}

.oml-card {
    position: relative;
    width: 84px;
    min-height: 98px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 6px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    background: rgba(20, 24, 31, 0.96);
    color: var(--text-primary);
    text-align: left;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.oml-card:hover,
.oml-card:focus-visible {
    border-color: rgba(255, 168, 79, 0.48);
    background: rgba(26, 30, 39, 0.98);
    transform: translateY(-1px);
    outline: none;
}

.oml-thumb-frame {
    position: relative;
    flex: 0 0 56px;
    width: 100%;
    min-height: 56px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 5px;
    background:
        radial-gradient(circle at 16px 16px, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        rgba(8, 12, 18, 0.98);
    background-size: 12px 12px;
}

.oml-thumb-links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.oml-thumb-link {
    stroke: rgba(255, 168, 79, 0.72);
    stroke-width: 1.8;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.oml-thumb-node {
    position: absolute;
    min-width: 16px;
    min-height: 12px;
    border: 1px solid rgba(255, 168, 79, 0.45);
    border-radius: 5px;
    background: rgba(21, 26, 35, 0.96);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.oml-thumb-node[data-node-type="image"] {
    border-color: rgba(101, 204, 255, 0.55);
    background: rgba(16, 35, 47, 0.96);
}

.oml-thumb-node[data-node-type="video"] {
    border-color: rgba(166, 139, 255, 0.55);
    background: rgba(31, 25, 47, 0.96);
}

.oml-card-name {
    width: 100%;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oml-card-meta {
    color: var(--text-secondary);
    font-size: 9px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oml-empty {
    min-height: 200px;
    display: grid;
    place-content: center;
    color: var(--text-tertiary);
    font-size: 13px;
    text-align: center;
}

.oml-empty strong {
    font-size: 13px;
    font-weight: 500;
}

.oml-empty span {
    display: none;
    max-width: 280px;
    font-size: 12px;
}

.oml-context-menu {
    position: fixed;
    z-index: 10050;
    width: 152px;
    display: grid;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    background: rgba(16, 19, 26, 0.98);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
}

.oml-context-menu[hidden] {
    display: none;
}

.oml-context-menu button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--text-primary);
    text-align: left;
}

.oml-context-menu button:hover {
    background: var(--panel-hover);
}

body[data-theme="light"] .oml-panel,
body[data-theme="light"] .oml-context-menu {
    background: rgba(255, 255, 255, 0.98);
}

body[data-theme="light"] .oml-card {
    background: rgba(255, 255, 255, 0.96);
}

body[data-theme="light"] .oml-thumb-frame {
    background:
        radial-gradient(circle at 16px 16px, rgba(15, 23, 42, 0.1) 1px, transparent 1px),
        rgba(248, 250, 252, 0.98);
    background-size: 12px 12px;
}

@media (max-width: 640px) {
    .oml-overlay {
        pointer-events: none;
    }

    .oml-panel {
        left: 12px !important;
        top: auto !important;
        right: 12px;
        bottom: 12px;
        width: auto;
        height: min(350px, calc(100vh - 96px));
        max-height: calc(100vh - 96px);
    }

    .oml-grid {
        grid-template-columns: repeat(auto-fill, 84px);
    }

    .oml-overlay.is-fullscreen .oml-panel {
        left: 12px !important;
        top: 68px !important;
        right: 12px;
        bottom: 12px;
        width: auto;
        height: min(420px, calc(100vh - 96px));
        max-height: calc(100vh - 96px);
    }
}
