html, body {
  margin: 0; padding: 0; height: 100%;
  background: #0b0608;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
canvas#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #1a0d12;
  box-shadow: 0 0 40px #000;
}
#inapp-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; box-sizing: border-box;
  background: #1a0d12; border-bottom: 2px solid #ffd23a;
  font-family: monospace; font-size: 12px; line-height: 1.3; color: #e8d8c8; text-transform: uppercase;
}
#inapp-bar b { color: #ffd23a; }
#inapp-x {
  flex: 0 0 auto; width: 32px; height: 32px; font-size: 20px; line-height: 1;
  background: transparent; border: none; color: #9a8a90;
}
.lb-hidden { display: none !important; }
.lb-note a { color: #5ad8e0; }
/* the save picture, full screen to press and hold, where a browser has no share sheet (js/cloud.js) */
.code-shot { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; box-sizing: border-box; background: rgba(10,5,8,0.94);
  font: bold 13px/1.3 monospace; letter-spacing: .08em; color: #ffd23a; text-align: center; -webkit-touch-callout: default; }
.code-shot img { max-width: 100%; max-height: 74vh; image-rendering: pixelated; -webkit-user-select: auto; user-select: auto; }
.code-shot button { min-height: 44px; padding: 0 26px; font: bold 14px monospace; letter-spacing: .1em; color: #e8d8c8; background: #2a1a22; border: 2px solid #8a5a3a; }
/* the video before a circle (G.VideoScene): whole screen, letterboxed, over everything */
video.cutscene {
  position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
.cutscene-btn {
  position: fixed; z-index: 31; min-height: 44px; padding: 0 16px;
  font-family: monospace; font-size: 14px; font-weight: bold; letter-spacing: 0.08em; text-transform: uppercase;
  color: #5affa0; background: rgba(13,7,10,0.6); border: 2px solid #8a5a3a; border-radius: 0;
}
.cutscene-sound { left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top)); }
#lb-name, #save-load {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,5,8,0.75);
  touch-action: auto; -webkit-user-select: text; user-select: text;
}
#lb-name .lb-panel, #save-load .lb-panel {
  width: min(84vw, 300px); box-sizing: border-box;
  background: #1a0d12; border: 2px solid #0d070a; outline: 2px solid #ffd23a; outline-offset: -4px;
  padding: 16px;
  font-family: monospace; text-transform: uppercase; text-align: center;
}
#lb-name .lb-title, #save-load .lb-title { color: #ffd23a; font-size: 14px; margin-bottom: 12px; letter-spacing: 1px; }
#lb-name .lb-input, #save-load .lb-input {
  width: 100%; box-sizing: border-box; font-family: monospace; font-size: 16px; text-transform: uppercase;
  background: #0d070a; color: #e8d8c8; border: 2px solid #5a3a44; padding: 10px 8px; text-align: center;
  outline: none;
}
#lb-name .lb-input:focus, #save-load .lb-input:focus { border-color: #ffd23a; }
#lb-name .lb-err, #save-load .lb-err { color: #ff7a6a; font-size: 11px; min-height: 14px; margin-top: 8px; }
#lb-name .lb-note, #save-load .lb-note { color: #9a8a90; font-size: 11px; line-height: 1.4; margin-top: 4px; }
#lb-name .lb-row, #save-load .lb-row { display: flex; gap: 10px; margin-top: 12px; }
#lb-name .lb-btn, #save-load .lb-btn {
  flex: 1; min-height: 44px; font-family: monospace; font-size: 13px; text-transform: uppercase;
  border: 2px solid #0d070a; background: #2a1a22; color: #e8d8c8;
}
#lb-name .lb-btn-save, #save-load .lb-btn-save { background: #3a2a10; color: #ffd23a; border-color: #ffd23a; }
#lb-name .lb-btn:active, #save-load .lb-btn:active { filter: brightness(1.2); }

/* a TV break around a cutscene (G.VideoScene opts.tv; Circle 3's sponsor message): the set switches on - a
   dot, a line, the picture - then the card with scanlines, live static, a rolling bar, a colour-split flicker
   and a jitter; static swells and cuts to the video; when the video ends it switches off (.tv-off) */
.tv-card { position: fixed; inset: 0; z-index: 32; background: #000; pointer-events: none; }
.tv-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #1d2228 0%, #0b0d11 68%, #000 100%);
  animation: tv-on .55s cubic-bezier(.2,.8,.2,1) both, tv-jitter 2.4s steps(1, end) .55s both; }
.tv-screen::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.38) 0 1px, transparent 1px 3px); }
.tv-screen::after { content: ''; position: absolute; left: 0; right: 0; height: 22%; z-index: 2; pointer-events: none; background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08), rgba(255,255,255,0)); animation: tv-roll 2.3s linear infinite; }
.tv-noise { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: .14; animation: tv-static .4s ease-in 2.55s both; }
.tv-line { position: relative; z-index: 1; padding: 0 16px; text-align: center; color: #f4f4f4;
  font: 800 clamp(20px, 7vw, 34px)/1.1 "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .1em; margin-right: -.1em;
  text-shadow: -2px 0 rgba(255,40,70,.8), 2px 0 rgba(40,220,255,.8), 0 0 18px rgba(255,255,255,.25); animation: tv-flicker 2.4s steps(1, end) .55s both; }
.tv-line.small { font-size: clamp(12px, 3.8vw, 17px); font-weight: 700; letter-spacing: .5em; margin-right: -.5em; color: #c8c8c8; }
video.cutscene.tv-off { animation: tv-off .6s ease-in both; }
@keyframes tv-on { 0% { transform: scale(.02, .004); filter: brightness(8); } 30% { transform: scale(1, .004); filter: brightness(8); } 68% { transform: scale(1, 1.05); filter: brightness(2.2); } 100% { transform: none; filter: none; } }
@keyframes tv-off { 0% { transform: none; filter: none; } 45% { transform: scale(1, .006); filter: brightness(5); } 85% { transform: scale(.02, .006); filter: brightness(8); } 100% { transform: scale(0, 0); filter: brightness(8); opacity: 0; } }
@keyframes tv-static { from { opacity: .14; } to { opacity: 1; } }
@keyframes tv-roll { from { top: -25%; } to { top: 110%; } }
@keyframes tv-flicker { 0% { opacity: 1; } 8% { opacity: .55; } 9% { opacity: 1; } 43% { opacity: .8; } 44% { opacity: 1; } 76% { opacity: .65; } 77%, 100% { opacity: 1; } }
@keyframes tv-jitter { 0%, 100% { translate: 0 0; } 14% { translate: 2px 0; } 15% { translate: 0 0; } 51% { translate: -3px 1px; } 52% { translate: 0 0; } 87% { translate: 1px -1px; } 88% { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { .tv-screen, .tv-line, .tv-screen::after, video.cutscene.tv-off { animation: none; } }

/* the title card (G.TitleCardScene), the way into the lobby after the trailer or the logos: it slams in with
   a white flash and a shake, a fire glow breathes behind it, a light runs over the metal, a loading bar fills
   while the lobby music loads, then it rushes at you and fades as the lobby comes in underneath */
.title-card { position: fixed; inset: 0; z-index: 32; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: #000; pointer-events: none; }
.title-card.tc-leaving { animation: tc-out .5s ease-in both; }
.tc-load { width: min(46vw, 220px); height: 3px; background: rgba(255,255,255,.12); overflow: hidden; opacity: 0; animation: splash-fade .4s ease .7s both; }
.tc-load i { display: block; height: 100%; background: linear-gradient(90deg, #ff7a1a, #ffd23a); transform-origin: 0 50%; animation: tc-bar 2.1s cubic-bezier(.3,.6,.4,1) .7s both; }
@keyframes tc-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.tc-glow { position: absolute; width: min(140vw, 90vh); height: min(140vw, 90vh); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,110,30,.55) 0%, rgba(200,32,42,.28) 38%, rgba(0,0,0,0) 70%); opacity: 0;
  animation: tc-glow 2.6s ease-out .35s both; }
.tc-art { position: relative; height: min(70vh, 122vw); aspect-ratio: 640 / 1100;
  animation: tc-slam .6s cubic-bezier(.18,1.35,.4,1) .05s both, tc-shake .4s linear .55s both; }
.tc-art img, .tc-shine { position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: url(../assets/art/tmtyl-mask.png); mask-image: url(../assets/art/tmtyl-mask.png); -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.tc-shine { opacity: 0; background: linear-gradient(160deg, rgba(255,255,255,0) 40%, rgba(255,244,200,.85) 50%, rgba(255,255,255,0) 60%);
  background-size: 100% 260%; background-position: 0 120%; animation: v-shine 1s ease-in-out 1.15s both; }
.tc-flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff 0%, rgba(255,240,210,.7) 30%, rgba(255,255,255,0) 70%); opacity: 0;
  animation: tc-flash .45s ease-out .5s both; }
@keyframes tc-slam { 0% { opacity: 0; transform: scale(2.4); filter: blur(10px) brightness(2); } 60% { opacity: 1; transform: scale(.96); filter: blur(0) brightness(1.3); } 100% { opacity: 1; transform: scale(1); filter: brightness(1); } }
@keyframes tc-shake { 0%, 100% { translate: 0 0; } 20% { translate: -7px 4px; } 40% { translate: 6px -5px; } 60% { translate: -4px 3px; } 80% { translate: 2px -2px; } }
@keyframes tc-glow { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1.05); } 60% { opacity: .7; transform: scale(.95); } 100% { opacity: .95; transform: scale(1.1); } }
@keyframes tc-flash { 0% { opacity: 0; } 20% { opacity: .9; } 100% { opacity: 0; } }
@keyframes tc-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .tc-art { animation: splash-fade .5s ease both; } .tc-flash, .tc-shine { animation: none; } }

/* ---- partner splash (js/splash.js), like a film's opening, in black and white, on FRONT PAGE's beat:
   on black with film grain and scratches, each card's mark glitches in with sliced bands, holds with a slow
   push-in while a white light (and on the stones, glints) runs over it, and goes out - TLEnt flares out,
   Paradisus switches off like an old TV. Each card runs from --s for --c (set from CONFIG.opening by
   js/splash.js: four bars each, the door on the drop); the glitch and the exits keep their own short
   lengths, only the hold stretches. Then the door: the SAWEDOFF mark over ENTER THE VOID (first launch). ---- */
#splash {
  position: fixed; inset: 0; z-index: 60; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 55%, #1c0708 0%, #070203 55%, #000 100%);
  transition: opacity .45s ease;
  --s1: .1s; --c1: 6.3s; --s2: 6.4s; --c2: 6.2s;
}
#splash.splash-out { opacity: 0; pointer-events: none; }
#splash::before { content: ''; position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .35s ease; }
#splash.splash-film::before { opacity: 1; }
#splash-embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.splash-card { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 20px; }

/* the shared card effect */
.vcard { opacity: 0; }
.vmark { position: relative; }
.vimg { position: relative; }
.vimg img { display: block; width: 100%; height: auto; }
.vslice { position: absolute; inset: 0; opacity: 0; background-position: 0 0; background-size: 100% 100%; background-repeat: no-repeat; }
.vslice.s1 { clip-path: inset(18% 0 70% 0); --j: -14px; }
.vslice.s2 { clip-path: inset(46% 0 44% 0); --j: 11px; }
.vslice.s3 { clip-path: inset(71% 0 17% 0); --j: -8px; }
.vshine {
  position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0) 42%, rgba(255,255,255,.95) 50%, rgba(255,255,255,0) 58%);
  background-size: 100% 280%; background-position: 0 120%;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.splash-cap { opacity: 0; display: flex; align-items: center; gap: 14px; }
.splash-cap span { white-space: nowrap; }
#splash.splash-go .vmark { animation: v-push var(--c) linear var(--s) both; }
#splash.splash-go .vslice { animation: v-slice-in .5s steps(1, end) var(--s) both; }
#splash.splash-go .vslice.s2 { animation-delay: calc(var(--s) + .04s); }
#splash.splash-go .vslice.s3 { animation-delay: calc(var(--s) + .08s); }
#splash.splash-go .vshine { animation: v-shine 1.4s ease-in-out calc(var(--s) + var(--c) * .3) both; }
#splash.splash-go .splash-cap { animation: v-cap-in .4s linear calc(var(--s) + .55s) both, v-cap-out .3s linear calc(var(--s) + var(--c) - .8s) forwards; }

/* TLEnt: A GAME BY TLE, silver between two hairlines; flares out */
.vcard-tle { --s: var(--s1); --c: var(--c1); }
#splash.splash-go .vcard-tle { animation: v-in .55s linear var(--s) both, v-out-flare .8s ease-in calc(var(--s) + var(--c) - .8s) forwards; }
.vcard-tle .vimg { width: min(56vw, 40vh, 320px); transform: translateX(7%); } /* the artwork's weight sits left (big TL, small nt): nudged so it reads centred */
.vcard-tle .vslice { background-image: url(../assets/art/tle.png); }
.vcard-tle .vshine { -webkit-mask-image: url(../assets/art/tle.png); mask-image: url(../assets/art/tle.png); }
.vcard-tle .splash-cap::before, .vcard-tle .splash-cap::after { content: ''; width: 34px; height: 1px; }
.vcard-tle .splash-cap::before { background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.7)); }
.vcard-tle .splash-cap::after { background: linear-gradient(90deg, rgba(255,255,255,.7), rgba(255,255,255,0)); }
.vcard-tle .splash-cap span {
  font: 700 15px/1 "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .42em; margin-right: -.42em; /* cancels the space after the last letter: truly centred */
  background: linear-gradient(180deg, #ffffff 0%, #d6d6d6 55%, #9a9a9a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Paradisus: glints on the stones; switches off like an old TV */
.vcard-prod { --s: var(--s2); --c: var(--c2); }
#splash.splash-go .vcard-prod { animation: v-in .55s linear var(--s) both, v-out-tv .6s linear calc(var(--s) + var(--c) - .6s) forwards; }
#splash.splash-go .vcard-prod .vslice { animation: v-slice-in .5s steps(1, end) var(--s) both, v-slice-out .3s steps(1, end) calc(var(--s) + var(--c) - .62s) forwards; }
.vcard-prod .vimg { width: min(74vw, 44vh, 380px); }
.vcard-prod .vslice { background-image: url(../assets/art/paradisus.png); }
.vcard-prod .vshine { -webkit-mask-image: url(../assets/art/paradisus.png); mask-image: url(../assets/art/paradisus.png); }
.vcard-prod .splash-cap span { font: 600 12px/1 Georgia, "Times New Roman", serif; letter-spacing: .32em; margin-right: -.32em; color: #d4d4d4; }
.glint { position: absolute; left: var(--x); top: var(--y); width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, #fff 0 2px, rgba(255,255,255,.55) 3px, rgba(255,255,255,0) 9px),
    linear-gradient(90deg, rgba(255,255,255,0), #fff 50%, rgba(255,255,255,0)) center / 100% 2px no-repeat,
    linear-gradient(0deg, rgba(255,255,255,0), #fff 50%, rgba(255,255,255,0)) center / 2px 100% no-repeat; }
/* positions live here, not in style="" attributes: the site's content security policy blocks those */
.glint.g1 { --x: 22%; --y: 30%; --f: .32; } .glint.g2 { --x: 78%; --y: 24%; --f: .42; } .glint.g3 { --x: 50%; --y: 46%; --f: .52; }
.glint.g4 { --x: 12%; --y: 62%; --f: .62; } .glint.g5 { --x: 88%; --y: 70%; --f: .7; }
#splash.splash-go .glint { animation: v-glint .55s ease-out calc(var(--s) + var(--c) * var(--f)) both; }

@keyframes v-in {
  0% { opacity: 0; transform: none; filter: blur(1px) brightness(1); }
  20% { opacity: .8; transform: translateX(-8px); }
  27% { opacity: .1; }
  47% { opacity: .9; transform: translateX(5px); }
  53% { opacity: .2; }
  73% { opacity: 1; transform: translateX(-2px); filter: blur(0) brightness(1.8); }
  100% { opacity: 1; transform: none; filter: blur(0) brightness(1); }
}
@keyframes v-out-tv {
  0% { opacity: 1; transform: none; filter: brightness(1); }
  20% { transform: translateX(6px); filter: brightness(1.6); }
  33% { transform: scale(1.04, 1); filter: brightness(2.2); }
  60% { opacity: 1; transform: scale(1.15, .015); filter: brightness(4); }
  88% { opacity: 1; transform: scale(0, .015); filter: brightness(4); }
  92%, 100% { opacity: 0; transform: scale(0, 0); }
}
@keyframes v-out-flare {
  0% { opacity: 1; transform: scale(1); filter: blur(0) brightness(1); }
  40% { opacity: 1; transform: scale(1.03); filter: blur(1px) brightness(2.6) drop-shadow(0 0 18px rgba(255,255,255,.9)); }
  75% { opacity: .5; transform: scale(1.1); filter: blur(7px) brightness(4) drop-shadow(0 0 30px rgba(255,255,255,1)); }
  100% { opacity: 0; transform: scale(1.16); filter: blur(12px) brightness(5); }
}
@keyframes v-push { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes v-slice-in {
  0% { opacity: 0; transform: none; }
  20% { opacity: 1; transform: translateX(var(--j)); }
  40% { opacity: 1; transform: translateX(calc(var(--j) * -.6)); }
  60% { opacity: 1; transform: translateX(calc(var(--j) * .4)); }
  80%, 100% { opacity: 0; transform: none; }
}
@keyframes v-slice-out { 0% { opacity: 1; transform: translateX(calc(var(--j) * -1)); } 50% { opacity: 1; transform: translateX(var(--j)); } 100% { opacity: 0; transform: none; } }
@keyframes v-shine { 0% { opacity: 1; background-position: 0 120%; } 85% { opacity: 1; } 100% { opacity: 0; background-position: 0 -20%; } }
@keyframes v-cap-in { 0% { opacity: 0; } 30% { opacity: .9; } 40% { opacity: .2; } 60%, 100% { opacity: .9; } }
@keyframes v-cap-out { from { opacity: .9; } to { opacity: 0; } }
@keyframes v-glint { 0% { opacity: 0; transform: scale(.2) rotate(0deg); } 40% { opacity: 1; transform: scale(1) rotate(25deg); } 100% { opacity: 0; transform: scale(.4) rotate(45deg); } }

/* the first screen: one tap so a phone will play sound, then FRONT PAGE and the logos */
.splash-gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
#splash.splash-gating .splash-gate { opacity: 1; }
.splash-start { font: bold 15px/1 monospace; letter-spacing: .24em; margin-right: -.24em; color: #e8e8e8; animation: splash-enter 1.4s ease-in-out infinite; }
.splash-hint { font: 600 11px/1 "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: .32em; margin-right: -.32em; color: #8a8a8a; }

/* the door: SAWEDOFF over ENTER THE VOID, once the logos are done (first launch) */
.splash-door { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; pointer-events: none; }
.splash-artist { width: min(80vw, 46vh, 420px); height: auto; opacity: 0; }
.splash-enter { font: bold 15px/1 monospace; letter-spacing: 0.24em; margin-right: -0.24em; color: #ffd23a; text-shadow: 0 0 12px rgba(255,122,26,.8); opacity: 0; }
#splash.splash-wait .splash-artist { animation: door-artist 1.1s cubic-bezier(.2,.7,.2,1) both, door-breathe 3.2s ease-in-out 1.1s infinite; }
#splash.splash-wait .splash-enter { animation: splash-enter 1.4s ease-in-out .9s infinite both; }

@keyframes door-artist { 0% { opacity: 0; transform: scale(.9); filter: blur(4px) brightness(2.5); } 60% { opacity: 1; filter: blur(0) brightness(1.3); } 100% { opacity: 1; transform: scale(1); filter: brightness(1); } }
@keyframes door-breathe { 0%, 100% { filter: brightness(1) drop-shadow(0 0 0 rgba(255,255,255,0)); } 50% { filter: brightness(1.15) drop-shadow(0 0 10px rgba(255,255,255,.35)); } }
@keyframes splash-enter { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes splash-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes v-calm { 0% { opacity: 0; } 30%, 70% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #splash.splash-go .vcard, #splash.splash-go .vcard-tle, #splash.splash-go .vcard-prod { animation: v-calm var(--c) ease var(--s) both; }
  #splash.splash-go .splash-cap { animation: none; opacity: .9; }
  #splash.splash-go .vmark, #splash.splash-go .vslice, #splash.splash-go .vshine, #splash.splash-go .glint { animation: none; }
  #splash.splash-wait .splash-artist { animation: splash-fade .6s ease both; }
  #splash-embers { display: none; }
}
