/* HOLOSERPENT — neon/hologram UI.
 *
 * Carries the Cyber Snake palette (neon green primary, cyan secondary, magenta
 * accent on near-black) into a page whose main surface is a WebGL canvas, so
 * everything here is chrome floating over that canvas. Nothing paints an opaque
 * page background: during an AR session the canvas must composite over the real
 * room, and an opaque body would black out passthrough.
 */

:root {
    --neon:    #39ff14;
    --cyan:    #00e5ff;
    --magenta: #ff2fd0;
    --danger:  #ff3b3b;
    --ink:     #020a10;
    --panel:   rgba(2, 10, 16, 0.86);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Courier New', ui-monospace, monospace;
    color: var(--cyan);
    background: radial-gradient(ellipse at 50% 40%, #06202b 0%, #010509 70%);
}

/* The AR session composites the real room through the canvas; kill the page
   backdrop while presenting so nothing occludes passthrough. */
body.xr-presenting { background: transparent; }

#holoCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------------ splash */

.splash {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow-y: auto;
    background: radial-gradient(ellipse at 50% 35%, rgba(6, 32, 43, 0.94) 0%, rgba(1, 5, 9, 0.97) 70%);
    backdrop-filter: blur(3px);
}

.splash-content {
    width: min(560px, 100%);
    text-align: center;
}

.splash-title {
    margin: 0;
    font-size: clamp(2.6rem, 11vw, 4.2rem);
    line-height: 0.92;
    letter-spacing: 0.06em;
    color: var(--neon);
    text-shadow: 0 0 10px var(--neon), 0 0 34px rgba(57, 255, 20, 0.55);
}

.splash-subtitle {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    letter-spacing: 0.42em;
    color: var(--magenta);
    text-shadow: 0 0 12px rgba(255, 47, 208, 0.7);
}

.splash-blurb {
    margin: 1.2rem auto 1.5rem;
    max-width: 42ch;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #9fe8ff;
}

/* ------------------------------------------------------------------- setup */

.setup-section { margin-bottom: 1.1rem; }

.setup-label {
    font-size: 0.72rem;
    letter-spacing: 0.34em;
    color: rgba(0, 229, 255, 0.6);
    margin-bottom: 0.5rem;
}

.setup-row {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
    flex-wrap: wrap;
}

.opt {
    flex: 1 1 0;
    min-width: 92px;
    padding: 0.6rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 6px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.opt:hover { background: rgba(0, 229, 255, 0.12); }

.opt.selected {
    color: var(--neon);
    border-color: var(--neon);
    background: rgba(57, 255, 20, 0.12);
    box-shadow: 0 0 14px rgba(57, 255, 20, 0.35), inset 0 0 12px rgba(57, 255, 20, 0.1);
}

.opt-icon { font-size: 1.3rem; line-height: 1; }
.opt-name { font-size: 0.82rem; font-weight: bold; letter-spacing: 0.08em; }
.opt-desc { font-size: 0.64rem; opacity: 0.7; line-height: 1.25; }

.points-note {
    margin-top: 0.45rem;
    font-size: 0.72rem;
    color: var(--magenta);
    letter-spacing: 0.1em;
}

/* ----------------------------------------------------------------- buttons */

.splash-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.4rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.1rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-align: center;
    text-decoration: none;
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.45);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:hover {
    background: rgba(0, 229, 255, 0.16);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
}

.btn--primary {
    color: var(--neon);
    border-color: var(--neon);
    background: rgba(57, 255, 20, 0.12);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.3);
}

.btn--primary:hover { background: rgba(57, 255, 20, 0.22); }

.btn--link {
    border-color: rgba(0, 229, 255, 0.2);
    background: none;
    font-weight: normal;
    opacity: 0.75;
}

.xr-note {
    margin-top: 0.7rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: rgba(159, 232, 255, 0.75);
}

/* ------------------------------------------------------------------ how-to */

.how-to {
    margin-top: 1.3rem;
    text-align: left;
    border-top: 1px solid rgba(0, 229, 255, 0.2);
    padding-top: 0.8rem;
}

.how-to summary {
    cursor: pointer;
    font-size: 0.74rem;
    letter-spacing: 0.28em;
    color: rgba(0, 229, 255, 0.7);
}

.how-to ul { margin: 0.7rem 0 0; padding-left: 1.1rem; }

.how-to li {
    margin-bottom: 0.45rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #9fe8ff;
}

.how-to strong { color: var(--neon); }

/* --------------------------------------------------------------- flat HUD */

.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    pointer-events: none;
}

.hud-score {
    font-size: 0.95rem;
    letter-spacing: 0.2em;
    color: var(--neon);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.6);
}

.hud-btn {
    pointer-events: auto;
    width: 34px;
    height: 34px;
    font-family: inherit;
    color: var(--cyan);
    background: rgba(2, 10, 16, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
}

/* ------------------------------------------------------------------- dpad */

.dpad {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, 52px);
    grid-template-rows: repeat(2, 52px);
    gap: 0.35rem;
}

.dpad-btn {
    font-family: inherit;
    font-size: 1rem;
    color: var(--cyan);
    background: rgba(2, 10, 16, 0.62);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
    color: var(--neon);
    border-color: var(--neon);
    box-shadow: 0 0 14px rgba(57, 255, 20, 0.45);
}

.dpad-up    { grid-area: 1 / 2; }
.dpad-left  { grid-area: 2 / 1; }
.dpad-down  { grid-area: 2 / 2; }
.dpad-right { grid-area: 2 / 3; }
.dpad-in    { grid-area: 1 / 4; font-size: 0.7rem; }
.dpad-out   { grid-area: 2 / 4; font-size: 0.7rem; }

/* ------------------------------------------------------------- XR overlay */

.xr-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12vh;
    pointer-events: none;
}

.xr-hint {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    letter-spacing: 0.06em;
    color: var(--neon);
    background: rgba(2, 10, 16, 0.7);
    border: 1px solid var(--neon);
    border-radius: 8px;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
}

.xr-hint:empty { display: none; }

.xr-hud {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.5rem 1.2rem;
    background: rgba(2, 10, 16, 0.55);
    border: 1px solid rgba(57, 255, 20, 0.5);
    border-radius: 8px;
}

.xr-hud-label {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: rgba(0, 229, 255, 0.7);
}

.xr-hud-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--neon);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.6);
}

/* Always-available way out of the session, independent of the world-locked
   panel — someone who wants to leave shouldn't have to aim at anything. */
.xr-exit {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    pointer-events: auto;
    padding: 0.7rem 1.1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    color: var(--danger);
    background: rgba(2, 10, 16, 0.8);
    border: 2px solid var(--danger);
    border-radius: 8px;
    cursor: pointer;
}

/* ---------------------------------------------------------------- game over */

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    width: min(420px, calc(100% - 2rem));
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.4rem;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 10px;
    box-shadow: 0 0 34px rgba(57, 255, 20, 0.28);
}

.game-over h2 {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    letter-spacing: 0.16em;
    color: var(--danger);
    text-shadow: 0 0 14px rgba(255, 59, 59, 0.6);
}

.game-over-cause { margin: 0 0 0.8rem; font-size: 0.82rem; color: #9fe8ff; }

.game-over-score {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    color: var(--neon);
    letter-spacing: 0.1em;
}

#sales-pitch .cta-text {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(159, 232, 255, 0.8);
}

#leaderboard-panel { margin-bottom: 1rem; text-align: left; }

#leaderboard-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    letter-spacing: 0.2em;
    text-align: center;
    color: var(--cyan);
}

#leaderboard-list { margin: 0; padding: 0; list-style: none; }

.lb-entry {
    display: grid;
    grid-template-columns: 1.6rem 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.28rem 0.4rem;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(0, 229, 255, 0.12);
}

.lb-rank  { color: var(--magenta); }
.lb-name  { color: #9fe8ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: var(--neon); font-weight: bold; }
.lb-mode  { font-size: 0.72rem; opacity: 0.8; }

.lb-loading, .lb-empty {
    padding: 0.4rem;
    font-size: 0.76rem;
    text-align: center;
    opacity: 0.7;
}

.lb-status { margin: 0.4rem 0 0; font-size: 0.7rem; text-align: center; opacity: 0.7; }

.signin-prompt { margin-bottom: 0.8rem; }

.game-over-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.game-over-buttons .btn { flex: 1 1 46%; }

/* ----------------------------------------------------------------- version */

.version {
    position: fixed;
    right: 0.6rem;
    bottom: 0.4rem;
    z-index: 5;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: rgba(0, 229, 255, 0.35);
    pointer-events: none;
}

@media (max-width: 480px) {
    .dpad { grid-template-columns: repeat(4, 46px); grid-template-rows: repeat(2, 46px); }
    .splash { align-items: flex-start; }
}
