/* Live game rejoin banner — pair with shared/js/active-game-banner.js.

   Pinned to the top of the viewport rather than inline in the page: a
   student who lost their phone mid-round should not have to scroll to
   find out the game is still running. */

.active-game-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 98000;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.25);
    font-family: inherit;
    animation: agb-slide-down 260ms ease-out;
}

@keyframes agb-slide-down {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* Nudge the page down so the banner never covers a site header. */
body.has-active-game-banner {
    padding-top: 4.25rem;
}

.agb-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}

.agb-text {
    flex: 1;
    min-width: 0;
}

.agb-headline {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.agb-detail {
    font-size: 0.85rem;
    opacity: 0.92;
    line-height: 1.35;
    /* A long course name must not push the Rejoin button off screen. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agb-rejoin {
    flex-shrink: 0;
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    background: #fff;
    color: #4f46e5;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
}

.agb-rejoin:hover,
.agb-rejoin:focus-visible {
    background: #ede9fe;
    color: #3730a3;
}

.agb-dismiss {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.agb-dismiss:hover,
.agb-dismiss:focus-visible {
    background: rgba(255, 255, 255, 0.32);
}

@media (max-width: 600px) {
    .active-game-banner {
        flex-wrap: wrap;
        gap: 0.5rem 0.75rem;
    }

    .agb-text {
        flex-basis: calc(100% - 5rem);
    }

    .agb-detail {
        white-space: normal;
    }

    .agb-rejoin {
        flex: 1;
        text-align: center;
    }

    body.has-active-game-banner {
        padding-top: 7.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .active-game-banner {
        animation: none;
    }
}

@media print {
    .active-game-banner {
        display: none;
    }

    body.has-active-game-banner {
        padding-top: 0;
    }
}
