.queue-game-offer {
    position: relative;
    width: min(680px, calc(100% - 2rem));
    margin: 1.25rem auto 0;
    padding: 1rem 3.25rem 1rem 1rem;
    border: 1px solid rgba(0, 242, 254, 0.28);
    border-radius: 18px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.09), rgba(99, 102, 241, 0.12));
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
}

.queue-game-offer__icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--cyan-gradient);
    color: #06101e;
    font-size: 1.15rem;
}

.queue-game-offer strong { display: block; color: var(--text-color); }
.queue-game-offer p { margin: 0.2rem 0 0; color: var(--secondary-text); font-size: 0.82rem; }
.queue-game-offer > button:not(.queue-game-offer__dismiss),
.queue-match-banner button,
.queue-game-over button {
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 12px;
    background: var(--cyan-gradient);
    color: #07111c;
    cursor: pointer;
    font: inherit;
    font-weight: 850;
}

.queue-game-offer__dismiss {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--secondary-text);
    cursor: pointer;
}

.queue-game-panel {
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer, 200);
    padding: clamp(0.65rem, 2vw, 1.25rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    row-gap: 0.6rem;
    background:
        radial-gradient(circle at 50% 18%, rgba(99, 102, 241, 0.28), transparent 32rem),
        linear-gradient(180deg, #070a16, #0d1022 72%, #090b17);
    color: #f8fafc;
}

.queue-game-header {
    width: min(920px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem;
}

.queue-game-header span { color: #67e8f9; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.queue-game-header h2 { margin: 0.1rem 0 0; font-size: clamp(1.45rem, 3vw, 2.15rem); }
.queue-game-header > button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    cursor: pointer;
}

.queue-game-stats { display: flex; gap: 0.55rem; }
.queue-game-stats span { min-width: 84px; padding: 0.55rem 0.75rem; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; display: grid; background: rgba(255,255,255,.05); color: #98a2b8; font-size: 0.64rem; }
.queue-game-stats b { color: #fff; font-size: 1rem; }

.queue-game-canvas-wrap {
    position: relative;
    min-height: 0;
    height: min(100%, 640px);
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    aspect-ratio: 5 / 8;
    overflow: hidden;
    border: 1px solid rgba(103, 232, 249, 0.24);
    border-radius: 22px;
    background: #050713;
    box-shadow: 0 24px 65px rgba(0, 0, 0, 0.5), 0 0 45px rgba(32, 217, 232, 0.08);
}

#queue-game-canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.queue-game-controls { display: none; }
.queue-game-keyboard-hint { position: relative; z-index: 1; min-height: 1rem; margin: 0 auto; color: #7f899e; font-size: 0.78rem; text-align: center; }
.queue-game-keyboard-hint i { margin-right: 0.35rem; color: #67e8f9; }

.queue-game-over {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    padding: 1.5rem;
    background: rgba(5, 7, 19, 0.86);
    text-align: center;
    backdrop-filter: blur(8px);
    z-index: 4;
}
.queue-game-over > i { color: #f472b6; font-size: 2.5rem; }
.queue-game-over h3 { margin: 0.8rem 0 0; font-size: 1.65rem; }
.queue-game-over p { margin: 0.4rem 0 1rem; color: #aab2c5; }

.queue-game-record { position: absolute; top: 1rem; left: 50%; z-index: 2; min-width: 190px; padding: 0.75rem 1rem; border: 1px solid rgba(251,191,36,.35); border-radius: 14px; display: grid; grid-template-columns: auto 1fr; gap: 0 0.55rem; background: rgba(32,25,12,.94); box-shadow: 0 14px 35px rgba(0,0,0,.38); transform: translateX(-50%); }
.queue-game-record span { grid-row: 1 / 3; align-self: center; font-size: 1.35rem; }
.queue-game-record strong { color: #fde68a; }
.queue-game-record small { color: #c8b77d; }

.queue-match-banner {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    z-index: var(--z-lightbox, 400);
    width: min(760px, calc(100% - 2rem));
    padding: 0.9rem 1rem;
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-radius: 17px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    background: rgba(9, 20, 22, 0.97);
    box-shadow: 0 18px 55px rgba(0,0,0,.48), 0 0 38px rgba(52,211,153,.13);
    color: #f8fafc;
    transform: translateX(-50%);
    backdrop-filter: blur(16px);
    pointer-events: none;
}
.queue-match-banner__icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: rgba(52,211,153,.13); color: #34d399; font-size: 1.15rem; }
.queue-match-banner__copy { display: grid; }
.queue-match-banner__copy strong { color: #fff; font-size: 0.96rem; }
.queue-match-banner__copy span { color: #aab2c5; font-size: 0.8rem; }
.queue-match-banner button:disabled { opacity: 0.68; cursor: wait; }
.queue-match-banner button { pointer-events: auto; }

@media (max-width: 620px) {
    .queue-game-offer { grid-template-columns: auto 1fr; padding: 0.85rem 2.8rem 0.85rem 0.85rem; }
    .queue-game-offer > button:not(.queue-game-offer__dismiss) { grid-column: 1 / -1; width: 100%; }
    .queue-game-panel {
        inset: 0;
        z-index: var(--z-modal, 250);
        padding: 0;
        grid-template: minmax(0, 1fr) / minmax(0, 1fr);
        row-gap: 0;
        place-items: center;
        overflow: hidden;
    }
    .queue-game-header {
        position: absolute;
        top: max(0.35rem, env(safe-area-inset-top));
        left: 50%;
        z-index: 5;
        width: min(400px, calc(100% - 0.75rem));
        min-height: 44px;
        margin: 0;
        padding: 0.3rem;
        grid-template-columns: minmax(0, 1fr) auto 38px;
        gap: 0.35rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px;
        background: rgba(5, 7, 19, 0.82);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
        transform: translateX(-50%);
        backdrop-filter: blur(10px);
    }
    .queue-game-header > div:first-child > span { display: none; }
    .queue-game-header h2 { margin: 0; font-size: 1.05rem; white-space: nowrap; }
    .queue-game-header > button { width: 38px; height: 38px; }
    .queue-game-stats { gap: 0.25rem; }
    .queue-game-stats span { min-width: 54px; padding: 0.25rem 0.4rem; border-radius: 9px; }
    .queue-game-stats b { font-size: 0.82rem; }
    .queue-game-canvas-wrap {
        height: auto;
        width: min(100vw, 62.5dvh);
        max-width: none;
        max-height: 100dvh;
        margin: 0;
        border-radius: clamp(0px, 3vw, 18px);
    }
    .queue-game-controls {
        position: absolute;
        right: 0.7rem;
        bottom: max(0.7rem, env(safe-area-inset-bottom));
        left: 0.7rem;
        z-index: 3;
        display: flex;
        justify-content: space-between;
        pointer-events: none;
    }
    .queue-game-controls button {
        width: 58px;
        height: 58px;
        border: 1px solid rgba(103, 232, 249, 0.48);
        border-radius: 18px;
        background: rgba(7, 19, 33, 0.74);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
        color: #67e8f9;
        cursor: pointer;
        font-size: 1.15rem;
        pointer-events: auto;
        backdrop-filter: blur(9px);
        touch-action: manipulation;
    }
    .queue-game-keyboard-hint { display: none; }
    .queue-match-banner {
        top: calc(env(safe-area-inset-top) + 58px);
        width: min(760px, calc(100% - 0.75rem));
        grid-template-columns: auto 1fr;
    }
    .queue-match-banner button { grid-column: 1 / -1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .queue-game-panel *, .queue-match-banner * { scroll-behavior: auto !important; transition: none !important; }
}
