/* Lightcoil UI: minimal, punchy, crisp — zero blurred text shadows, zero clutter over the arena. */

#stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

/* Title Screen */
#title-screen,
#end-screen {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    pointer-events: none;
    padding: 24px;
}

#title-screen[hidden],
#end-screen[hidden],
#hud[hidden] {
    display: none;
}

/* The logo's slam, glint, spin and launch happen in the 3D scene (title.ts), where the serpent winds round it. The
   page's image stays as an invisible placeholder that decides its size and place, and stands in until the 3D one
   is ready. */
.logo-slam {
    display: flex;
    justify-content: center;
}

.logo-beat {
    position: relative;
    will-change: transform;
}

body.gl-logo #title-logo {
    visibility: hidden;
}

/* Play: a thick yellow slab that sways in 3D and throbs on the beat (the beat is set on #play-wrap from main.js).
   The slab's sides are layers stacked behind the button, darkening as they go back. */
#play-wrap {
    perspective: 700px;
    pointer-events: none;
    will-change: transform;
}

#play-wrap .slab {
    position: relative;
    transform-style: preserve-3d;
    animation: slab-sway 5s ease-in-out infinite;
}

@keyframes slab-sway {
    0%, 100% { transform: rotateX(20deg) rotateY(-28deg); }
    50% { transform: rotateX(10deg) rotateY(28deg); }
}

#play-wrap .slab i {
    position: absolute;
    inset: 0;
    background: #000;
    clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 11px), calc(100% - 11px) 100%, 11px 100%, 0 calc(100% - 11px), 0 11px);
}

#play-wrap .slab i:nth-child(1) { transform: translateZ(-3px); background: #e0dc00; }
#play-wrap .slab i:nth-child(2) { transform: translateZ(-6px); background: #c8c400; }
#play-wrap .slab i:nth-child(3) { transform: translateZ(-9px); background: #b0ad00; }
#play-wrap .slab i:nth-child(4) { transform: translateZ(-12px); background: #989500; }
#play-wrap .slab i:nth-child(5) { transform: translateZ(-15px); background: #807e00; }
#play-wrap .slab i:nth-child(6) { transform: translateZ(-18px); background: #686600; }
#play-wrap .slab i:nth-child(7) { transform: translateZ(-21px); background: #504f00; }
#play-wrap .slab i:nth-child(8) { transform: translateZ(-24px); background: #383700; }
#play-wrap .slab i:nth-child(9) { transform: translateZ(-27px); background: #202000; }
#play-wrap .slab i:nth-child(10) { transform: translateZ(-30px); background: #000; }

#title-screen.launch #play-wrap .slab {
    animation: play-drop 0.45s ease-in forwards;
}

@keyframes play-drop {
    30% { transform: scale(1.25); }
    100% { transform: translateY(55vh) scale(0.6); opacity: 0; }
}

#title-screen.launch #title-best {
    opacity: 0;
    transition: opacity 0.2s;
}

#hud.arrive {
    animation: hud-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes hud-in {
    from { transform: translate(-50%, -160%); opacity: 0; }
}

#title-logo {
    display: block;
    width: min(740px, 88vw);
    max-height: 36vh;
    object-fit: contain;
    margin: 0;
    will-change: transform;
    user-select: none;
    pointer-events: none;
}

#title-best {
    font: 700 18px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.16em;
    color: var(--punch);
    background: rgba(12, 16, 28, 0.72);
    padding: 7px 14px;
    --c: 6px;
    --t: 1px;
    --edge: rgba(255, 252, 0, 0.6);
}

#title-best[hidden] { display: none; }

.cta {
    --c: 11px;
    --t: 3px;
    --edge: #000;
    pointer-events: auto;
    font: 700 26px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: #000;
    background: var(--punch);
    padding: 20px 60px;
    transition: transform 0.12s ease, background 0.12s ease;
    cursor: pointer;
}

.cta:hover {
    transform: scale(1.06);
    background: #fff;
}

.cta:active {
    transform: scale(0.96);
    background: #00e5ff;
}

/* The teaching glove: no words, just a white glove drawing a lasso round something worth looping */
#glove {
    position: fixed;
    left: 0;
    top: 0;
    width: 76px;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}

#glove[hidden] { display: none; }

/* Minimal Active Gameplay HUD — tucked at the very top, clear of the SFP badge & arena */
#hud {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.hud-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: rgba(10, 14, 24, 0.68);
    --c: 8px;
    --t: 1px;
    --edge: rgba(0, 229, 255, 0.45);
}

#hud-shields {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
}

#hud-shields .pip {
    display: block;
    width: 10px;
    height: 14px;
    background: #00e5ff;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    transition: opacity 0.2s, transform 0.2s;
}

#hud-shields .pip.off {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(0.75);
}

#hud-score {
    font: 700 clamp(22px, 4vw, 32px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

#hud-mult {
    font: 700 clamp(16px, 3vw, 22px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    color: #00e5ff;
    font-variant-numeric: tabular-nums;
}

#hud-mult.hot {
    color: var(--punch);
}

.hud-bars {
    display: flex;
    gap: 6px;
    width: min(230px, 54vw);
}

.bar-track {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.bar-fill {
    width: 100%;
    height: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    will-change: transform;
}

/* How much of the grid you've claimed, towards the stage's target: violet, like the claimed floor */
.hud-claim {
    flex: none;
    width: min(230px, 54vw);
    height: 4px;
}

#hud-claim-fill {
    background: #a040ff;
}

#hud-combo-fill {
    background: #00e5ff;
}

#hud-combo-fill.active {
    background: var(--punch);
}

#hud-weapon-wrap {
    opacity: 0.22;
    transition: opacity 0.15s;
}

#hud-weapon-wrap.armed {
    opacity: 1;
}

#hud-weapon-fill {
    background: #18ff66;
}

/* End Screen Card */
.end-card {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 28px 42px;
    background: rgba(10, 14, 24, 0.82);
    --c: 12px;
    --t: 2px;
    --edge: var(--punch);
}

#end-score {
    font: 700 clamp(40px, 9vw, 68px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

#end-best {
    font: 700 16px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.2em;
    color: #7af0ff;
}

#end-best.new-best {
    color: var(--punch);
}

/* Bottom bar gap before mute (SOUL.md: "The game's tools stay in the bar, with a gap before mute.") */
#bar .gap {
    width: 10px;
}

/* Volume slider menu above mute button */
#vol-menu {
    width: 170px;
    padding: 8px 14px;
    align-items: center;
}

/* ?demo, for recording a trailer: no shell */
body.demo #badge,
body.demo #bar {
    display: none;
}
