.bm-open,
.bm-open body {
    overflow: hidden;
}

#browser-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#browser-modal.is-open {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

.bm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 24, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}

.bm-window {
    position: relative;
    z-index: 1;
    width: min(100%, 920px);
    height: min(88vh, 680px);
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.25s ease;
}

#browser-modal.is-open .bm-window {
    transform: translateY(0) scale(1);
}

.bm-titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 8px 12px 0;
    background: #e8e8e8;
    border-bottom: 1px solid #d4d4d4;
}

.bm-traffic {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.bm-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.15s;
}

.bm-dot--close { background: #ff5f57; cursor: default; }
.bm-dot--min { background: #febc2e; cursor: default; }
.bm-dot--max { background: #28c840; cursor: default; }

.bm-tabs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    padding-left: 4px;
}

.bm-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    height: 32px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    color: #3c4043;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-tab__favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.bm-tab__title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-navbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.bm-nav-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.bm-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #5f6368;
    padding: 0;
}

.bm-nav-btn--static {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
    user-select: none;
}
.bm-nav-btn svg { width: 18px; height: 18px; }

.bm-urlbar {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    background: #f1f3f4;
    border-radius: 18px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #202124;
}

.bm-urlbar__lock {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #1e8e3e;
}

.bm-urlbar__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #5f6368;
    cursor: default;
    padding: 0;
    flex-shrink: 0;
}

.bm-menu-btn svg { width: 18px; height: 18px; }

.bm-content {
    flex: 1;
    min-height: 0;
    background: #fff;
    position: relative;
}

.bm-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.bm-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 2;
}

.bm-loader.is-active {
    opacity: 1;
    visibility: visible;
}

.bm-loader__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8eaed;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: bm-spin 0.8s linear infinite;
}

@keyframes bm-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    #browser-modal { padding: 0; }
    .bm-window {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: none;
    }
    .bm-tab { max-width: 180px; }
}
