/* ============================================================
   Kaleidoscope-Mirror-91 – Frontend Styles
   ============================================================ */

.km91-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 4px;
}

/* Canvas fills the wrapper */
.km91-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── Source Switcher ── */
.km91-source-switcher {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.km91-source-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, transform 0.15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.km91-source-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.7);
    transform: scale(1.1);
}

.km91-source-btn.active {
    background: rgba(255,255,255,0.3);
    border-color: #fff;
}

/* ── Center Click Hint ── */
.km91-center-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.4);
    font-size: 22px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    z-index: 10;
    pointer-events: all;
}

.km91-center-hint:hover {
    background: rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.85);
}

/* ── Segment Display ── */
.km91-segment-display {
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-family: monospace;
    letter-spacing: 0.04em;
    pointer-events: none;
    z-index: 10;
    transition: color 0.2s;
}

.km91-wrapper:hover .km91-segment-display {
    color: rgba(255,255,255,0.75);
}

/* ── Lightbox ── */
.km91-lightbox {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.km91-lightbox.is-open {
    opacity: 1;
    pointer-events: all;
}

.km91-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.km91-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 60px rgba(0,0,0,0.7);
    transform: scale(0.94);
    transition: transform 0.3s ease;
}

.km91-lightbox.is-open .km91-lightbox-content {
    transform: scale(1);
}

.km91-lightbox-media img,
.km91-lightbox-media video {
    display: block;
    max-width: 80vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.km91-lightbox-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.km91-lightbox-close:hover {
    background: rgba(200,50,50,0.8);
}

/* ── Hidden media pool ── */
.km91-media-pool {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .km91-center-hint {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .km91-source-btn {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
}
