.qrs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s 0.25s;
}

.qrs-overlay.is-open {
    visibility: visible;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0s 0s;
}

.qrs-overlay.is-open.is-shown {
    opacity: 1;
}

.qrs-panel {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    color: #f1f5f9;
    font-family: 'Exo 2', system-ui, sans-serif;
}

.qrs-panel.is-found {
    overflow: hidden;
    padding: 0;
}

.qrs-panel.is-found>*:not(.qrs-found) {
    display: none;
}

.qrs-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.18s ease, color 0.18s ease;
    z-index: 2;
}

.qrs-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.qrs-title {
    margin: 0 0 14px;
    padding-right: 48px;
    min-height: 32px;
    display: flex;
    align-items: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

.qrs-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.2);
    margin-bottom: 14px;
}

.qrs-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.qrs-video[hidden] {
    display: none;
}

.qrs-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #64748b;
}

.qrs-placeholder[hidden] {
    display: none;
}

.qrs-placeholder svg {
    width: 60px;
    height: 60px;
    opacity: 0.5;
}

.qrs-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qrs-link {
    background: none;
    border: none;
    color: #38bdf8;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.18s ease;
}

.qrs-link:hover {
    color: #bae6fd;
}

.qrs-sep {
    color: #64748b;
    user-select: none;
}

.qrs-status {
    margin: 14px 0 0;
    min-height: 18px;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
}

.qrs-status.is-error {
    color: #f87171;
}

.qrs-status.is-ok {
    color: #4ade80;
}

.qrs-status.is-warn {
    color: #fbbf24;
}

.qrs-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.qrs-divider::before,
.qrs-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.2);
}

.qrs-divider span {
    flex-shrink: 0;
}

.qrs-join {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.qrs-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 14px;
    background: #0f172a;
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.18s ease;
}

.qrs-input::placeholder {
    color: #64748b;
}

.qrs-input:focus {
    border-color: rgba(34, 197, 94, 0.6);
}

.qrs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.qrs-btn--green {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: #04241a;
    flex-shrink: 0;
    padding: 12px 22px;
}

.qrs-btn--green:hover:not(:disabled) {
    filter: brightness(1.08);
}

.qrs-btn--green:disabled {
    opacity: 0.6;
    cursor: wait;
}

.qrs-key-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.qrs-key-input {
    width: 100%;
    color: transparent;
    caret-color: #f1f5f9;
    text-align: center;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.qrs-key-input::placeholder {
    color: #64748b;
    letter-spacing: 0;
    font-weight: 400;
    text-align: center;
}

.qrs-key-mirror {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    pointer-events: none;
    overflow: hidden;
    white-space: nowrap;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #f1f5f9;
    z-index: 1;
}

.qrs-key-mirror span {
    display: inline-block;
    animation: qrsKeyPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes qrsKeyPop {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.qrs-found {
    background: #1e293b;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 26px;
    text-align: center;
    gap: 24px;
    min-height: 320px;
    animation: qrsFoundIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qrs-found[hidden] {
    display: none;
}

.qrs-found__icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(34, 197, 94, 0.35);
    flex-shrink: 0;
}

.qrs-found__icon svg {
    display: block;
    width: 42px;
    height: 42px;
}

.qrs-found__name {
    font-size: 1.85rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.qrs-found__enter {
    min-width: 260px;
    padding: 15px 34px;
    font-size: 17px;
    margin-top: 4px;
    flex-shrink: 0;
    border-radius: 14px;
}

@keyframes qrsFoundIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 520px) {
    .qrs-join {
        flex-direction: column;
    }

    .qrs-btn--green {
        width: 100%;
    }

    .qrs-panel {
        padding: 18px;
        border-radius: 14px;
    }

    .qrs-panel.is-found {
        padding: 0;
    }

    .qrs-title {
        font-size: 1.05rem;
        min-height: 28px;
        padding-right: 42px;
        margin-bottom: 12px;
    }

    .qrs-close {
        top: 14px;
        right: 14px;
        width: 28px;
        height: 28px;
        font-size: 13px;
        border-radius: 8px;
    }

    .qrs-found {
        gap: 20px;
        min-height: 280px;
        padding: 28px 18px;
    }

    .qrs-found__icon {
        width: 72px;
        height: 72px;
    }

    .qrs-found__icon svg {
        width: 36px;
        height: 36px;
    }

    .qrs-found__name {
        font-size: 1.55rem;
    }

    .qrs-found__enter {
        min-width: 0;
        width: 100%;
        font-size: 16px;
        padding: 14px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .qrs-overlay,
    .qrs-btn,
    .qrs-close,
    .qrs-link,
    .qrs-found {
        transition: none;
        animation: none;
    }

    .qrs-key-mirror span {
        animation: none;
    }
}