/* Titan Reliquary · cinematic splash v3 ("Vault Door")
   Shown once per session on a plain load. Everything is namespaced #tr-splash / .ts-*.
   Layers: still (CSS fallback frame) → WebGL canvas (alpha: the final iris wipe is transparent pixels, so the app shows through) → copy → controls.
   Palette is deliberately neutral: blackened steel, polished silver, one warm tungsten light. No navy, no gold, no neon. */

html:not(.ts-on) #tr-splash { display: none; }
html.ts-on { overflow: hidden; }
html.ts-on #app { visibility: hidden; }
html.ts-on.ts-reveal #app { visibility: visible; }

#tr-splash {
  position: fixed; inset: 0; z-index: 100300; overflow: hidden;   /* above the wing dock (100100) and the Vault door (100200): nothing behind the intro is tappable */
  background: #020202; color: #e9e6e0;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none; cursor: pointer;
  opacity: 1;
}
#tr-splash.ts-handoff { background: transparent; }       /* the canvas now carries the wipe */
#tr-splash.ts-out { opacity: 0; pointer-events: none; transition: opacity var(--ts-out, .5s) cubic-bezier(.4, 0, .2, 1); }
#tr-splash * { box-sizing: border-box; }

.ts-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .35s ease; }
#tr-splash.ts-glon .ts-gl { opacity: 1; }

/* Fallback / reduced-motion still frame: lit steel, one silver coin, nothing else */
.ts-still { display: none; position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease;
  background:
    radial-gradient(ellipse 60% 46% at 50% 40%, rgba(255, 236, 205, .20) 0%, rgba(120, 112, 100, .10) 40%, rgba(0, 0, 0, 0) 74%),
    radial-gradient(ellipse 130% 100% at 50% 40%, #121211 0%, #060606 60%, #010101 100%); }
.ts-still-coin { position: absolute; left: 50%; top: 40%; width: min(52vmin, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background:
    conic-gradient(from 200deg, #6c6d70, #e9eaec 14%, #8b8c90 28%, #f6f6f7 40%, #77787c 56%, #d9dadd 70%, #8d8e92 84%, #6c6d70),
    #888;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), inset 0 0 0 9px rgba(60, 60, 64, .55), inset 0 0 0 11px rgba(255, 255, 255, .22), 0 22px 60px -10px rgba(0, 0, 0, .9), 0 0 120px rgba(255, 224, 180, .10); }
.ts-still-coin::after { content: ""; position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%), repeating-radial-gradient(circle, rgba(0, 0, 0, .06) 0 1px, transparent 1px 4px); mix-blend-mode: soft-light; }
#tr-splash.ts-nogl .ts-still, #tr-splash.ts-reduced .ts-still { display: block; }
#tr-splash.ts-nogl .ts-gl, #tr-splash.ts-reduced .ts-gl { display: none; }
#tr-splash.ts-stillon .ts-still { opacity: 1; }

/* Copy: small, quiet, only at the end */
.ts-copy { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 20px calc(max(24px, env(safe-area-inset-bottom)) + 1.5vh);
  display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none; }
.ts-feature { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; opacity: 0; will-change: opacity, transform; }
.ts-f-country { font-size: clamp(11px, 1.2vmin + 7px, 15px); font-weight: 500; letter-spacing: .46em; padding-left: .46em; text-transform: uppercase; color: #ece8e1; text-shadow: 0 1px 14px rgba(0, 0, 0, .8); }
.ts-f-meta { font-size: clamp(11px, 1.1vmin + 6px, 14px); font-weight: 400; font-style: italic; letter-spacing: .14em; color: #b5b1a9; text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.ts-f-meta::before { content: ""; display: block; width: 42px; height: 1px; margin: 0 auto 12px; background: linear-gradient(90deg, transparent, rgba(236, 232, 225, .6), transparent); }
.ts-mark { margin-top: 22px; font-size: 10px; letter-spacing: .62em; padding-left: .62em; text-transform: uppercase; color: #8d8982; opacity: 0; }

/* Grok's review GRK-3-08: Skip is readable over any frame (white text on a dark pill, 16 px, 48 px tall) and appears almost at once */
.ts-skip, .ts-sound { position: absolute; top: max(16px, env(safe-area-inset-top)); z-index: 3; appearance: none; background: rgba(0, 0, 0, .72); color: #fff; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .5); opacity: 0; transition: color .2s, border-color .2s, background .2s; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ts-skip { right: 18px; font: inherit; font-size: 16px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; min-height: 48px; min-width: 88px; padding: 12px 18px 12px 20px; border-radius: 999px; }
.ts-sound { left: 18px; width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.ts-sound svg { width: 20px; height: 20px; }
.ts-sound .ts-snd-waves { display: none; }
.ts-sound.ts-snd-on .ts-snd-waves { display: inline; }
.ts-sound.ts-snd-on .ts-snd-x { display: none; }
.ts-sound.ts-snd-on { color: #f1efe9; border-color: rgba(240, 236, 228, .6); }
.ts-run .ts-skip, .ts-run .ts-sound { animation: tsFade .4s ease .25s forwards; }
.ts-skip:hover, .ts-skip:focus-visible, .ts-sound:hover, .ts-sound:focus-visible { color: #fff; border-color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .1); outline: 0; }
.ts-skip:focus-visible, .ts-sound:focus-visible { box-shadow: 0 0 0 2px #fff; }
#tr-splash.ts-handoff .ts-skip, #tr-splash.ts-handoff .ts-sound { opacity: 0; animation: none; transition: opacity .25s ease; }

@keyframes tsFade { to { opacity: 1; } }
@media (max-height: 520px) { .ts-copy { padding-bottom: 18px; } .ts-mark { display: none; } }
@media (prefers-reduced-motion: reduce) { .ts-skip, .ts-sound { animation-duration: .3s !important; animation-delay: .2s !important; } }

/* End-of-sequence type: opacity, lift and tracking are driven per frame by splash.js from the timeline (deterministic, frame-drop safe) */
.ts-feature { transform: translateY(10px); }
.ts-f-country { letter-spacing: .62em; padding-left: .62em; }
.ts-f-kicker { font-size: 10px; letter-spacing: .5em; padding-left: .5em; text-transform: uppercase; font-style: normal; color: #9a968e; margin-bottom: 2px; text-shadow: 0 1px 10px rgba(0, 0, 0, .8); }
.ts-f-country { margin-top: 2px; }

/* Film exit (tr72): zoom-through hand-off from the opening film to the app (see filmExit in splash.js) */
#tr-splash.ts-film-exit { background: transparent; pointer-events: none; }
#tr-splash.ts-film-exit > :not(.ts-film) { opacity: 0 !important; transition: opacity .35s ease !important; }
#tr-splash.ts-film-exit .ts-film {
  transform: scale(2.6); filter: blur(22px) brightness(1.9) saturate(1.5); opacity: 0 !important;
  transition: transform var(--ts-exit, 1.6s) cubic-bezier(.55, 0, .9, .45),
              filter var(--ts-exit, 1.6s) cubic-bezier(.5, 0, .8, .5),
              opacity calc(var(--ts-exit, 1.6s) * .62) cubic-bezier(.4, 0, .6, 1) calc(var(--ts-exit, 1.6s) * .38) !important;
  will-change: transform, filter, opacity;
}
html.ts-film-reveal #app { animation: tsAppRise var(--ts-exit, 1.6s) cubic-bezier(.16, .84, .3, 1) both; transform-origin: 50% 42%; }
@keyframes tsAppRise {
  0%   { opacity: 0; transform: scale(.86); filter: blur(14px) brightness(1.5); }
  35%  { opacity: 0; }
  100% { opacity: 1; transform: none; filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  #tr-splash.ts-film-exit .ts-film { transform: none; filter: none; }
  html.ts-film-reveal #app { animation-name: none; }
}

/* ---------- Motion splash (2026-10-10, js/motion-splash.js): the theme's own 2.5-3.5 s canvas opening ----------
   One 2D canvas under the controls; the root takes the theme's background (--ts-bg) so there is never a black flash on a light theme.
   The caller dissolves it (.ts-out, opacity) into the app, or the canvas clears itself to transparent (.ts-handoff). */
.ts-mo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }
#tr-splash.ts-motion { background: var(--ts-bg, #020202); }
#tr-splash.ts-motion .ts-gl, #tr-splash.ts-motion .ts-still, #tr-splash.ts-motion .ts-copy { display: none; }
#tr-splash.ts-motion.ts-handoff { background: transparent; }
/* Skip stays a 48 px, readable pill over any theme (light themes too): solid dark fill, white 16 px text */
#tr-splash.ts-motion .ts-skip, #tr-splash.ts-motion .ts-sound { background: rgba(8, 8, 10, .82); border-color: rgba(255, 255, 255, .6); color: #fff; z-index: 5; }
@media (prefers-reduced-motion: reduce) { .ts-mo { transition: none; } }

/* ---------- Theme switch (tr113, js/motion-splash.js switchTo): the new theme's motion splash over the app, then a dissolve ---------- */
.ts-switch { position: fixed; inset: 0; z-index: 100400; background: var(--ts-bg, #050505); opacity: 1; touch-action: none; }
.ts-switch.ts-handoff { background: transparent; }
.ts-switch .ts-switch-skip { position: absolute; z-index: 5; top: max(14px, env(safe-area-inset-top)); right: 14px; min-height: 48px; min-width: 48px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .6); background: rgba(8, 8, 10, .82); color: #fff; font: 600 16px/1 system-ui, sans-serif; letter-spacing: .06em; cursor: pointer; }
.ts-switch .ts-switch-skip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ss-op-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 8px; font-size: 16px; cursor: pointer; }
.ss-op-switch input { width: 22px; height: 22px; accent-color: var(--gold, #c9a227); }
