/* --- Game Layout --- */
.lobby {
    max-width: 500px;
    margin: 0 auto;
}

.room-code-input {
    text-transform: uppercase;
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    text-align: center;
}

.room-code-display {
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    color: var(--color-primary);
}

.player-list {
    list-style: none;
    padding: 0;
}

.player-list li {
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ready-badge {
    color: var(--color-success);
    font-weight: 600;
}

/* --- Game Screen Layouts --- */
.game-layout {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.game-layout-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-sidebar {
    min-width: 200px;
}

.game-canvas-wrapper {
    position: relative;
    background: var(--color-canvas-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.game-canvas {
    display: block;
}

.opponent-canvas {
    background: var(--color-canvas-bg);
    border-radius: var(--radius);
}

/* --- Score --- */
.score-display {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-primary);
}

.next-marble-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- HUD --- */
.game-hud {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.hud-item {
    text-align: center;
}

.hud-label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.hud-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.controls-hint {
    text-align: center;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* --- Scoreboard --- */
.scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 800px;
}

.scoreboard-item {
    background: var(--color-surface);
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
}

.scoreboard-item.dead {
    opacity: 0.5;
}

.scoreboard-item .name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.scoreboard-item .score {
    font-size: 1.2rem;
}

.scoreboard-item .lives {
    font-size: 0.8rem;
    color: var(--color-danger);
}

/* --- Game Over --- */
.gameover-card {
    max-width: 500px;
    margin: 2rem auto;
    text-align: center;
}

.gameover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.gameover-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.gameover-scores {
    font-size: 2rem;
    margin: 20px 0;
}

/* --- Embedded games ------------------------------------------------------
 * The cabinet is one continuous surface: the marquee bar and the screen share
 * the game's own canvas color, so there is no visible seam where the page
 * stops and the iframe starts. The game leads the page; prose sits below it.
 */

.cabinet {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 2.5rem;
    background: var(--canvas);
    border: 1px solid var(--edge);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lift);
}

.cabinet-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.15rem;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--volt) 7%, var(--canvas)),
        var(--canvas));
    border-bottom: 1px solid var(--edge);
}

.cabinet-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.cabinet-title h1 {
    font-size: clamp(1rem, 2.6vw, 1.3rem);
    letter-spacing: 0.1em;
    margin: 0;
}

.cabinet-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.cabinet-screen {
    position: relative;
    background: var(--canvas);
    line-height: 0;
}

.cabinet-screen iframe {
    display: block;
    width: 100%;
    height: min(76vh, 760px);
    border: 0;
    background: var(--canvas);
}

/* In the fullscreen state the element is the viewport, so the clamp above
 * would leave letterboxing. */
.cabinet-screen:fullscreen iframe {
    height: 100vh;
}

@media (max-width: 900px) {
    .cabinet-screen iframe {
        height: min(70vh, 640px);
    }
}

/* --- Prose below the cabinet --- */
.game-info {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem;
}

@media (max-width: 760px) {
    .game-info {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.game-info p {
    color: var(--text-muted);
}

.controls-text {
    white-space: pre-line;
}
