/* Title screen, loading screen and the shared space scene (js/title.js). Portrait first (375×812), fine on desktop. */
:root { --ttl-amber: #F2B33A; --ttl-amber-d: #C27C12; --ttl-cyan: #1BA3D6; --ttl-ink: #0B0D14; }

/* first paint (index.html) */
.ttl-boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(120% 70% at 50% 30%, #17233a 0%, #0d1220 45%, #07080d 100%); }
.ttl-boot-sub { color: var(--text-2); font-size: 13px; letter-spacing: .08em; }

/* ---------- scene ---------- */
.sc-base { position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 30%, #17233a 0%, #0d1220 45%, #07080d 100%); }
.sc { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.sc.on { opacity: 1; }
.sc-layer { position: absolute; inset: -28px; will-change: transform; }
.sc-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; }
.sc-bg.on { opacity: 1; }
.sc-stars { position: absolute; inset: 28px; width: calc(100% - 56px); height: calc(100% - 56px); }
.sc-planet { position: absolute; left: 50%; bottom: calc(-1 * min(118vw, 720px) * .5); width: min(118vw, 720px); aspect-ratio: 1; transform: translateX(-50%); }
.sc-planet-img { image-rendering: pixelated; opacity: 0; transition: opacity 1.4s ease; }
.sc-planet-img.on, .sc-planet .sprite { opacity: 1; }
.sc-atmo { position: absolute; inset: -6%; border-radius: 50%; background: radial-gradient(closest-side, transparent 80%, rgba(90, 190, 255, .28) 88%, transparent 100%); filter: blur(6px); }
.sc-ms-wrap { position: absolute; left: 50%; top: 22%; height: min(48%, 410px); aspect-ratio: 386 / 964; transform: translateX(-50%); perspective: 900px; }
.sc-ms { position: relative; width: 100%; height: 100%; transform: rotateX(34deg) translateZ(0); transform-origin: 50% 70%; animation: sc-bob 7s ease-in-out infinite;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .7)) drop-shadow(0 0 22px rgba(80, 170, 255, .18)); }
.sc-ms-img { width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity 1s ease; display: block; }
.sc-ms-img.on { opacity: 1; }
.sc-eng { position: absolute; width: calc(22% * var(--s)); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, #fff 0%, #9fe8ff 25%, rgba(40, 170, 255, .55) 55%, transparent 100%); animation: sc-eng 1.6s ease-in-out infinite; }
.sc-eng:nth-of-type(odd) { animation-delay: -.5s; }
.sc-eng::after { content: ""; position: absolute; left: 50%; top: 50%; width: 46%; height: 260%; transform: translateX(-50%); border-radius: 50%;
  background: linear-gradient(rgba(140, 220, 255, .8), rgba(40, 140, 255, 0)); filter: blur(3px); }
@keyframes sc-eng { 0%, 100% { opacity: .75; transform: translate(-50%, -50%) scale(.9); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } }
@keyframes sc-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.sc-fly { position: absolute; inset: 0; }
.sc-flyer { position: absolute; left: 0; top: 0; filter: drop-shadow(0 0 4px rgba(120, 200, 255, .5)); opacity: .85; }
.sc-flyer.near { opacity: 1; z-index: 2; }
.sc-flyer::after { content: ""; position: absolute; left: 50%; top: 88%; width: 3px; height: 260%; transform: translateX(-50%);
  background: linear-gradient(rgba(150, 220, 255, .85), rgba(150, 220, 255, 0)); border-radius: 2px; }
.sc-flyer-img { display: block; image-rendering: pixelated; }
.sc-vignette { position: absolute; inset: 0; background: radial-gradient(130% 90% at 50% 45%, transparent 55%, rgba(3, 4, 8, .85) 100%),
  linear-gradient(to bottom, rgba(5, 7, 12, .55), transparent 22%, transparent 62%, rgba(5, 7, 12, .9)); }
.sc-tint { position: absolute; inset: 0; background: var(--tint); mix-blend-mode: soft-light; opacity: .55; }
.still .sc-ms, .still .sc-eng, .still .sc-eng::after { animation: none !important; }

/* ---------- title ---------- */
.ttl, .ld { position: fixed; inset: 0; overflow: hidden; background: #07080d; color: var(--text-1); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ttl-ui, .ld-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding: calc(14px + var(--safe-t)) 16px calc(10px + var(--safe-b)); z-index: 3; }
.ttl-top { margin-top: 6vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ttl-mid, .ld-mid { flex: 1; }
.ttl-tag { font: 500 13px/1.4 var(--font-body); color: #cfd8e6; letter-spacing: .06em; text-shadow: 0 1px 3px #000, 0 0 12px rgba(0, 0, 0, .8);
  animation: ttl-fade 1s .7s both; }

.ttl-logo { position: relative; display: flex; flex-direction: column; align-items: center; animation: ttl-logo-in 1.1s cubic-bezier(.2, .9, .25, 1.1) both; }
.ttl-logo.art { width: min(86vw, 420px); }
.ttl-logo.art.small { width: min(60vw, 260px); }
.ttl-logo-img { width: 100%; height: auto; display: block; opacity: 0; transition: opacity .5s; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .8)); }
.ttl-logo-img.on { opacity: 1; }
.ttl-logo.art::after { content: ""; position: absolute; inset: 0; pointer-events: none; -webkit-mask: var(--logo-mask) center / contain no-repeat; mask: var(--logo-mask) center / contain no-repeat;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .85) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat; animation: ttl-sweep 5s 1.2s ease-in-out infinite; }
.ttl-logo-txt { font: 600 clamp(40px, 13.5vw, 76px)/1 var(--font-head); letter-spacing: .06em; padding: 0 .1em;
  color: transparent; -webkit-text-stroke: 1.5px #1a0f02; paint-order: stroke fill;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .95) 50%, transparent 60%) -150% 0 / 250% 100% no-repeat,
    linear-gradient(#fff9e8 0%, #ffe3a0 38%, #f2b33a 52%, #b8700f 78%, #ffd27a 100%);
  -webkit-background-clip: text; background-clip: text; animation: ttl-sweep-bg 5s 1.2s ease-in-out infinite;
  filter: drop-shadow(0 3px 0 #1a0f02) drop-shadow(0 0 18px rgba(242, 179, 58, .45)); }
.ttl-logo.small .ttl-logo-txt { font-size: clamp(28px, 9vw, 44px); }
.ttl-logo-bar { width: 70%; height: 3px; margin-top: 8px; background: linear-gradient(90deg, transparent, var(--ttl-cyan), #bff0ff, var(--ttl-cyan), transparent);
  box-shadow: 0 0 12px var(--ttl-cyan); animation: ttl-bar 1.2s .5s both; }
@keyframes ttl-logo-in { 0% { opacity: 0; transform: scale(1.35); filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
@keyframes ttl-sweep { 0%, 55% { background-position: -150% 0; } 85%, 100% { background-position: 250% 0; } }
@keyframes ttl-sweep-bg { 0%, 55% { background-position: -150% 0, 0 0; } 85%, 100% { background-position: 250% 0, 0 0; } }
@keyframes ttl-bar { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
@keyframes ttl-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ttl-cta { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 4vh; animation: ttl-fade .8s 1s both; }
.ttl-start { position: relative; min-width: min(78vw, 320px); min-height: 76px; padding: 0 22px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 0; background: linear-gradient(#ffd27a, #f2b33a 45%, #c27c12); color: var(--ttl-ink); cursor: pointer;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
  animation: ttl-pulse 2.2s ease-in-out infinite; transition: transform .08s; }
.ttl-start.b9, .ttl-start.b9-full { clip-path: none; background: none; }
.b9 { border-style: solid; border-width: var(--b9-w, 24px); border-image: var(--b9) var(--b9-slice, 12) fill / var(--b9-w, 24px) stretch; image-rendering: pixelated; }
.b9:active { border-image-source: var(--b9-p, var(--b9)); }
.b9-full { background: var(--b9) center / 100% 100% no-repeat !important; }
.b9-full:active { background-image: var(--b9-p, var(--b9)) !important; }
.ttl-start.b9 { padding: 0 6px; min-height: 80px; }
.ttl-start:active { transform: scale(.97); }
.ttl-start-wrap { position: relative; display: flex; justify-content: center; animation: ttl-pulse 2.2s ease-in-out infinite; }
.ttl-start-wrap .ttl-start { animation: none; }
.ttl-start-glow { position: absolute; inset: -16px; pointer-events: none; opacity: .5; animation: ttl-glow 2.2s ease-in-out infinite; }
.ttl-start-glow:not(.b9) { inset: -40% -20%; mix-blend-mode: screen; }
.ttl-start.gold { min-height: 84px; padding: 0 4px; image-rendering: pixelated; }
.ttl-start-lbl { display: flex; flex-direction: column; align-items: center; line-height: 1.05; text-shadow: 0 1px 0 rgba(255, 240, 200, .6); }
.ttl-start-lbl b { font: 600 25px/1.1 var(--font-head); letter-spacing: .04em; color: #1a0f02; }
.ttl-start-lbl small { font: 600 12px/1.2 var(--font-head); letter-spacing: .32em; color: #4a2c05; margin-top: 3px; }
.ttl-start-emb { display: flex; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
@keyframes ttl-pulse { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.04); filter: brightness(1.12); } }
@keyframes ttl-glow { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.ttl-bottom { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.ttl-row { display: flex; justify-content: center; gap: 10px; }
.ttl-ic { width: 64px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
  border: 1px solid rgba(160, 200, 255, .22); border-radius: 12px; background: linear-gradient(rgba(30, 40, 60, .78), rgba(10, 14, 22, .86)); color: #dfe8f5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 4px 12px rgba(0, 0, 0, .5); }
.ttl-ic span { font-size: 11px; line-height: 1.1; color: #aeb9c9; }
.ttl-ic:active { transform: translateY(1px); }
.ttl-ic[aria-pressed="false"] svg { color: #8790a0; }
.ttl-lang { font: 600 16px/20px var(--font-head); color: var(--ttl-amber); }
.ttl-hint { position: absolute; bottom: calc(100% + 2px); padding: 5px 10px; border-radius: 8px; font-size: 12px; background: rgba(242, 179, 58, .95); color: #1a0f02;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5); animation: ttl-hint 1.6s ease-in-out infinite; }
.ttl-hint::after { content: ""; position: absolute; left: 50%; top: 100%; border: 6px solid transparent; border-top-color: rgba(242, 179, 58, .95); transform: translateX(-50%); }
@keyframes ttl-hint { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.ttl-foot { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: #8d97a7; text-shadow: 0 1px 2px #000; }
.ttl-status { display: flex; align-items: center; gap: 6px; }
.ttl-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #8d97a7; }
.ttl-status.ok .dot { background: #4fdc7c; box-shadow: 0 0 8px #4fdc7c; }
.ttl-status.bad .dot { background: var(--signal-warn); }
.ttl-ver { font-family: var(--font-num); }
.ttl-credits { align-items: center; text-align: center; }

/* warp transition */
.ttl.warp .sc { transition: transform .55s cubic-bezier(.6, 0, .9, .4), filter .55s, opacity .55s; transform: scale(1.5); filter: blur(3px) brightness(1.6); }
.ttl.warp .ttl-ui { transition: opacity .25s, transform .4s; opacity: 0; transform: scale(1.08); }
.ttl.warp-fade { transition: opacity .15s; opacity: 0; }
.ttl-warpfx { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 4; pointer-events: none; }
.fx-sheet { image-rendering: pixelated; background-repeat: no-repeat; }
.ttl-flash { position: absolute; inset: 0; z-index: 5; background: radial-gradient(circle at 50% 50%, #fff 0%, #cff3ff 40%, rgba(150, 220, 255, 0) 75%); opacity: 0; animation: ttl-flash .56s ease-in forwards; pointer-events: none; }
@keyframes ttl-flash { 0% { opacity: 0; } 60% { opacity: .5; } 100% { opacity: 1; background-color: #fff; } }

/* ---------- loading ---------- */
.ld-scene { position: absolute; inset: 0; }
.ld-scene .sc-vignette { background: radial-gradient(130% 90% at 50% 45%, transparent 50%, rgba(3, 4, 8, .85) 100%), linear-gradient(to bottom, rgba(5, 7, 12, .5), transparent 25%, transparent 55%, rgba(5, 7, 12, .95)); }
.ld-top { margin-top: 5vh; }
.ld-bottom { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 2vh; }
.ld-tip { min-height: 64px; padding: 10px 14px; border-radius: 10px; background: rgba(8, 12, 20, .72); border: 1px solid rgba(120, 170, 230, .2); }
.ld-tip b { display: block; font: 600 11px/1.3 var(--font-head); letter-spacing: .14em; color: var(--ttl-amber); text-transform: uppercase; }
.ld-tip-t { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: #dfe6f0; }
.ld-tip-t.in { animation: ttl-fade .45s both; }
.ld-bar { display: flex; flex-direction: column; gap: 6px; }
.ld-track { position: relative; height: 32px; border-radius: 6px; background: #0d1015; box-shadow: 0 0 0 2px #2d333d, 0 0 0 3px #0b0d14, 0 6px 18px rgba(0, 0, 0, .6); overflow: hidden; }
.ld-track.art { background: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .6); border-radius: 0; }
.ld-trk { position: absolute; inset: 0; }
.ld-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(#7fe0ff, var(--ttl-cyan) 55%, #0b6f99); box-shadow: 0 0 14px rgba(27, 163, 214, .8); }
.ld-fill.b9 { min-width: 24px; background: none; box-shadow: 0 0 14px rgba(27, 163, 214, .55); }
.ld-track.art .ld-shine { inset: 4px; }
.ld-shine { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%) -100% 0 / 60% 100% no-repeat; animation: ld-shine 1.8s linear infinite; }
@keyframes ld-shine { to { background-position: 250% 0; } }
.ld-meta { display: flex; justify-content: space-between; font-size: 13px; color: #c8d2e0; text-shadow: 0 1px 2px #000; }
.ld-pct { color: var(--ttl-amber); }
.ld-ver { text-align: center; font: 500 11px var(--font-num); color: #6f7888; }

/* reduced motion: static art, no parallax, no pulses */
.ttl.still *, .ld.still *, html.reduced .ttl *, html.reduced .ld * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .ttl *, .ld * { animation: none !important; } .sc { transition: none; } }
@media (min-width: 900px) { .ttl-top { margin-top: 4vh; } .sc-ms-wrap { top: 18%; } }

/* key art present: its Mother Ship sits mid-screen, keep the vignette lighter in the middle */
.sc.keyart .sc-vignette { background: radial-gradient(140% 95% at 50% 45%, transparent 60%, rgba(3, 4, 8, .8) 100%), linear-gradient(to bottom, rgba(5, 7, 12, .45), transparent 20%, transparent 66%, rgba(5, 7, 12, .85)); }
.sc-bg { image-rendering: auto; }
.ttl-logo-img { image-rendering: pixelated; }
/* landscape / desktop: keep the portrait key art whole in a centred column, a blurred copy fills the sides */
.sc-key-blur { display: none; }
@media (min-aspect-ratio: 3/4) {
  .sc-key-blur { display: block; filter: blur(28px) brightness(.45) saturate(1.2); transform: scale(1.1); }
  .sc-key { width: auto; max-width: none; aspect-ratio: 720 / 1560; left: 50%; transform: translateX(-50%); object-fit: cover; -webkit-mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
}
@media (min-aspect-ratio: 3/4) { .sc-deco { width: auto; max-width: none; aspect-ratio: 720 / 1560; left: 50%; transform: translateX(-50%) scale(1.6); object-fit: cover; } }
