/*
 * Hoops VR — page chrome for the standalone WebXR game.
 * Retro palette matches games/hoops: deep navy arena, gold + green accents,
 * condensed mono for that scoreboard feel.
 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
    background: #0a0e1a;
    color: #f2ead8;
    font-family: 'Courier New', ui-monospace, monospace;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD (flat mode; hidden inside the headset) ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; transition: opacity 0.35s ease, visibility 0.35s; }
#hud.in-vr { display: none; }
/* the title screen is translucent so the arena shows through — keep the HUD
   (score bar, chips, hold button, pause overlay) out of sight until play
   starts, and again when EXIT TO TITLE brings the start screen back */
body:has(#start-screen:not(.hidden)) #hud { opacity: 0; visibility: hidden; }

#hud-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(rgba(10, 14, 26, 0.85), transparent);
    pointer-events: auto;
}
/* menu button: the visible pause/exit affordance (replaces the old ← link) —
   same family as .hud-btn but gold-accented so it reads as the primary chrome */
#menu-btn {
    font-size: 19px;
    line-height: 1;
    border-color: #ffd166;
    color: #ffd166;
}
#menu-btn:hover { border-color: #ffe9a8; color: #ffe9a8; background: rgba(255, 209, 102, 0.14); }
#hud-score {
    font-weight: bold;
    font-size: 15px;
    letter-spacing: 1px;
    color: #ffd166;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hud-right { display: flex; gap: 8px; }
.hud-btn {
    background: rgba(42, 53, 96, 0.7);
    border: 2px solid #2a3560;
    color: #f2ead8;
    font-size: 17px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
}
.hud-btn:hover { border-color: #8fb7ff; }

#view-chips {
    position: absolute;
    top: 58px;
    left: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}

#level-chips {
    position: absolute;
    top: 58px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}
#level-chips .chip { font-size: 12px; padding: 6px 12px; }

#mode-chips {
    position: absolute;
    left: 14px;
    bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    gap: 6px;
    pointer-events: auto;
}

.chip {
    background: rgba(20, 26, 46, 0.85);
    border: 2px solid #2a3560;
    color: #aeb6c6;
    font-family: inherit;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 1px;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    text-transform: uppercase;
}
.chip:hover { border-color: #8fb7ff; color: #f2ead8; }
.chip.active { border-color: #ffd166; color: #ffd166; }

#hold-btn {
    position: absolute;
    /* bottom-right, thumb-reach corner; sits above the cookie banner when
       it's showing */
    bottom: max(64px, env(safe-area-inset-bottom));
    right: max(28px, env(safe-area-inset-right));
    width: 128px;
    height: 128px;
    border-radius: 50%;
    border: 4px solid #ff8c1a;
    background: radial-gradient(circle at 35% 30%, #ffab4d, #e8742c 65%, #c65a1d);
    color: #2b1608;
    font-family: inherit;
    font-weight: bold;
    font-size: 17px;
    line-height: 1.25;
    letter-spacing: 1px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 6px 22px rgba(232, 116, 44, 0.45);
    touch-action: none;
}
#hold-btn:active { transform: scale(0.94); }
/* while the consent banner is up, keep the bottom controls clear of it */
body:has(.rm-cookie-banner) #hold-btn { bottom: 190px; }
body:has(.rm-cookie-banner) #mode-chips { bottom: 190px; }

/* ---------- Pause / menu overlay ---------- */
/* full-screen; child of #hud so .in-vr + the start-screen :has() rule hide it.
   pointer-events flips on only while shown so it never blocks the live HUD. */
#pause-menu {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
    pointer-events: auto;
}
#pause-menu.hidden { display: none; }
.pm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 9, 18, 0.72);
    backdrop-filter: blur(3px);
}
.pm-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    max-height: 100%;
    overflow-y: auto;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(20, 26, 46, 0.96), rgba(10, 14, 26, 0.96));
    border: 2px solid #2a3560;
    border-radius: 18px;
    padding: 26px 22px 24px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(143, 183, 255, 0.06);
}
.pm-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-indent: 0.14em;
    margin-bottom: 20px;
    background: linear-gradient(180deg, #ffe9a8 10%, #ffd166 50%, #ff8c1a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
.pm-actions { display: flex; flex-direction: column; gap: 10px; }
.pm-btn {
    display: block;
    width: 100%;
    font-family: inherit;
    font-weight: bold;
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    padding: 14px 18px;
    border: 2px solid #2a3560;
    border-radius: 12px;
    background: rgba(20, 26, 46, 0.85);
    color: #aeb6c6;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.pm-btn:hover { border-color: #8fb7ff; color: #f2ead8; }
.pm-btn-primary {
    background: linear-gradient(180deg, #ffe9a8, #ffd166 45%, #ff8c1a);
    border-color: #ffe9a8;
    color: #2b1608;
    font-size: 17px;
    box-shadow: 0 4px 0 #c65a1d, 0 0 22px rgba(255, 140, 26, 0.35);
}
.pm-btn-primary:hover { filter: brightness(1.06); color: #2b1608; }
.pm-btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #c65a1d; }

/* HOW TO PLAY: a menu button that expands the shared views/controls grid */
.pm-howto { text-align: left; }
.pm-howto summary { list-style: none; position: relative; }
.pm-howto summary::-webkit-details-marker { display: none; }
.pm-howto summary::after {
    content: "\25BE";
    position: absolute;
    right: 16px;
    color: #6b7590;
}
.pm-howto[open] summary::after { content: "\25B4"; }
.pm-howto .howto-grid { margin-top: 10px; }

/* ---------- Start screen (arcade title) ---------- */
#start-screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    /* translucent vignette: the live arena (crowd, lights) shows through */
    background:
        linear-gradient(rgba(10, 14, 26, 0.68), rgba(10, 14, 26, 0.38) 30%, rgba(10, 14, 26, 0.7) 78%),
        radial-gradient(ellipse at 50% 34%, rgba(20, 26, 46, 0.25), rgba(10, 14, 26, 0.62) 80%);
    overflow-y: auto;
    transition: opacity 0.35s ease;
}
/* faint CRT scanlines for the arcade-cabinet feel */
#start-screen::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.14) 0px, rgba(0, 0, 0, 0.14) 1px,
        transparent 1px, transparent 3px);
    opacity: 0.5;
}
#start-screen.hidden { opacity: 0; pointer-events: none; }

.ss-inner {
    position: relative;
    text-align: center;
    width: 100%;
    max-width: 520px;
    padding: clamp(18px, 4vh, 40px) 18px 20px;
    margin: auto;  /* centers, but never clips the top when it overflows */
}

/* --- Hero logo --- */
.ss-hero { margin-bottom: clamp(10px, 2.5vh, 22px); }
.ss-ball {
    display: block;
    font-size: clamp(34px, 8vw, 46px);
    line-height: 1;
    margin-bottom: 2px;
    animation: ball-bounce 1.6s cubic-bezier(0.28, 0, 0.58, 1) infinite;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
}
@keyframes ball-bounce {
    0%, 100% { transform: translateY(0) scaleY(1); }
    12%      { transform: translateY(2px) scaleY(0.92); }
    50%      { transform: translateY(-14px) scaleY(1.04); }
    88%      { transform: translateY(2px) scaleY(0.92); }
}
.ss-title {
    display: inline-block;
    font-size: clamp(58px, 15vw, 92px);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0.06em;
    background: linear-gradient(180deg, #ffe9a8 8%, #ffd166 42%, #ff8c1a 68%, #e8742c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.65))
            drop-shadow(0 0 26px rgba(255, 140, 26, 0.35));
}
.ss-vr {
    display: inline-block;
    vertical-align: super;
    font-size: 0.34em;
    letter-spacing: 0.1em;
    margin-left: 0.18em;
    padding: 0.14em 0.42em 0.1em;
    border-radius: 0.28em;
    background: linear-gradient(180deg, #ff8c1a, #e8742c);
    color: #1c0e04;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: #1c0e04;
    transform: rotate(-4deg) translateY(-0.15em);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 140, 26, 0.5);
}
.tagline {
    margin-top: 10px;
    font-size: clamp(11px, 3vw, 13px);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.42em;
    text-indent: 0.42em; /* re-center: letter-spacing pads the right edge */
    color: #8fb7ff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

/* --- One-line hook --- */
.ss-hook {
    font-size: clamp(13px, 3.6vw, 15px);
    letter-spacing: 1px;
    color: #f2ead8;
    margin-bottom: clamp(14px, 2.5vh, 22px);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
.ss-hook .nw { white-space: nowrap; }
.ss-hook strong { color: #ffd166; }
.ss-hook em { color: #3ddc7a; font-style: normal; font-weight: bold; }

/* --- CTA buttons --- */
.ss-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: clamp(14px, 2.5vh, 22px);
}
#vr-btn, #play-btn {
    font-family: inherit;
    font-weight: bold;
    letter-spacing: 2px;
    border-radius: 14px;
    cursor: pointer;
    text-transform: uppercase;
}
#vr-btn {
    width: min(100%, 320px);
    font-size: 19px;
    padding: 16px 24px;
    background: linear-gradient(180deg, #55e98d, #3ddc7a 45%, #1f9e50);
    border: 3px solid #7df2a9;
    color: #06220f;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 0 #14713a, 0 0 22px rgba(61, 220, 122, 0.45);
    animation: vr-pulse 1.8s ease-in-out infinite;
}
#vr-btn:not(:disabled):hover { filter: brightness(1.08); }
#vr-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 #14713a; }
@keyframes vr-pulse {
    0%, 100% { box-shadow: 0 4px 0 #14713a, 0 0 14px rgba(61, 220, 122, 0.35); }
    50%      { box-shadow: 0 4px 0 #14713a, 0 0 34px rgba(61, 220, 122, 0.75); }
}
#vr-btn:disabled {
    background: rgba(20, 26, 46, 0.8);
    border-color: #2a3560;
    color: #6b7590;
    cursor: default;
    text-shadow: none;
    box-shadow: none;
    animation: none;
}
#play-btn {
    width: min(100%, 320px);
    font-size: 14px;
    padding: 12px 24px;
    background: rgba(20, 26, 46, 0.75);
    border: 2px solid #8fb7ff;
    color: #8fb7ff;
}
#play-btn:hover { color: #f2ead8; border-color: #f2ead8; }

/* --- Mode / Level selector rows --- */
.ss-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: clamp(14px, 2.5vh, 20px);
}
.ss-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ss-label {
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #6b7590;
    width: 52px;
    text-align: right;
    flex: none;
}
.chip-row { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.ss-row .chip { font-size: 11px; padding: 6px 11px; }

/* --- Multiplayer card --- */
.ss-mp {
    background: rgba(10, 14, 26, 0.62);
    border: 2px solid #2a3560;
    border-radius: 14px;
    padding: 12px 16px 10px;
    margin-bottom: 12px;
    backdrop-filter: blur(2px);
}
.ss-mp-title {
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffd166;
}
.ss-mp-copy { font-size: 12px; color: #aeb6c6; margin-top: 3px; }
.mp-row { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mp-row .chip { font-size: 12px; }
#mp-code {
    width: 86px;
    background: #0a0e1a;
    border: 2px solid #2a3560;
    border-radius: 999px;
    color: #ffd166;
    font-family: inherit;
    font-weight: bold;
    font-size: 15px;
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
}
#mp-code:focus { outline: none; border-color: #8fb7ff; }
#mp-code::placeholder { color: #4a5578; }
#mp-name {
    width: 210px;
    background: #0a0e1a;
    border: 2px solid #2a3560;
    border-radius: 999px;
    color: #f2ead8;
    font-family: inherit;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    padding: 5px 12px;
}
#mp-name:focus { outline: none; border-color: #8fb7ff; }
#mp-name::placeholder { color: #4a5578; }
/* brief shake when create/join is pressed without a name */
#mp-name.mp-name-missing {
    border-color: #ff6b6b;
    animation: mp-name-shake 0.3s;
}
@keyframes mp-name-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.mp-status { margin-top: 6px; font-size: 12px; color: #aeb6c6; min-height: 16px; }

/* --- HOW TO PLAY (collapsed by default) --- */
.ss-howto { margin-bottom: 14px; }
.ss-howto summary {
    display: inline-block;
    list-style: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #aeb6c6;
    border: 2px solid #2a3560;
    border-radius: 999px;
    padding: 7px 18px;
    background: rgba(20, 26, 46, 0.75);
    -webkit-user-select: none;
    user-select: none;
}
.ss-howto summary::-webkit-details-marker { display: none; }
.ss-howto summary::after { content: " \25BE"; color: #6b7590; }
.ss-howto[open] summary::after { content: " \25B4"; }
.ss-howto summary:hover { border-color: #8fb7ff; color: #f2ead8; }
.howto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
    text-align: left;
    background: rgba(10, 14, 26, 0.62);
    border: 2px solid #2a3560;
    border-radius: 14px;
    padding: 14px 16px;
}
.howto-col h3 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #6b7590;
    margin-bottom: 8px;
}
.howto-col p { font-size: 12px; line-height: 1.5; color: #aeb6c6; margin-bottom: 7px; }
.howto-col p:last-child { margin-bottom: 0; }
.howto-col strong { color: #f2ead8; }
@media (max-width: 460px) {
    .howto-grid { grid-template-columns: 1fr; }
}

kbd {
    background: #2a3560;
    border-radius: 4px;
    padding: 1px 6px;
    color: #f2ead8;
    font-family: inherit;
    font-size: 11px;
    white-space: nowrap;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

/* --- Footer --- */
.ss-footer {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #6b7590;
}
