/* Breakout - mobile-first, 320px base */

:root {
    --color-bg:      #1a1a2e;
    --color-paddle:  #2ECC71;
    --color-ball:    #FFFFFF;
    --color-text:    #EAEAEA;
    --color-accent:  #E94560;
    --color-panel:   rgba(15, 15, 30, 0.82);
    --color-letterbox: #0b0b14;
    --court-w: 320;
    --court-h: 600;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Darker than the court, so the play area reads as bounded on wide screens. */
    background: var(--color-letterbox);
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Locked to the court's aspect ratio so the HUD and the overlays line up with
   the canvas edges instead of the window edges. */
#game-container {
    position: relative;
    width: min(100vw, calc(100dvh * var(--court-w) / var(--court-h)));
    height: min(100dvh, calc(100vw * var(--court-h) / var(--court-w)));
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--color-bg);
}

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

/* Text/UI layers over the canvas. Transparent to pointers except buttons. */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    pointer-events: none;
    z-index: 8;
}

.hidden {
    display: none !important;
}

.btn {
    pointer-events: auto;
    min-height: 48px;
    min-width: 220px;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    background: var(--color-paddle);
    color: #08351c;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-text);
}

.title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 6px;
}

.gameover-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--color-accent);
}

.subtitle {
    font-size: 16px;
    opacity: 0.85;
}

.big-score {
    font-size: 46px;
    font-weight: 800;
}

.record {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-paddle);
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 700;
    pointer-events: none;
    z-index: 6;
}

#hud .lives {
    color: var(--color-accent);
}

#toast {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--color-panel);
    font-weight: 700;
    pointer-events: none;
    z-index: 10;
}

#pause-screen p {
    font-size: 24px;
    font-weight: 800;
    padding: 10px 22px;
    border-radius: 8px;
    background: var(--color-panel);
}

#fallback {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    text-align: center;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 18px;
    z-index: 20;
}

@media (min-width: 768px) {
    .title { font-size: 42px; }
    .big-score { font-size: 56px; }
}
