/* Title screen overlay. Sits above the HUD and below the loading overlay. */
#title-screen { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
#title-screen[hidden] { display: none; }
html.title-screen-active #game-hud,
html.title-screen-active #controls-help,
html.title-screen-active #pointer-capture-hint { visibility: hidden; }
html.title-screen-active canvas { cursor: default; }

.title-vignette {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 85% 75% at 50% 46%, transparent 52%, rgba(14, 8, 28, .5) 100%),
        linear-gradient(to bottom, rgba(10, 6, 30, .18), transparent 22%, transparent 70%, rgba(12, 6, 20, .42));
}

.title-prompt {
    position: absolute; left: 0; right: 0; bottom: 11vh;
    text-align: center; white-space: nowrap;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
    font-size: clamp(1.05rem, 2.3vw, 1.75rem);
    letter-spacing: .2em; text-transform: uppercase;
    opacity: 0; transition: opacity 2.2s ease 2.4s;
}
#title-screen.is-revealed .title-prompt { opacity: 1; }
.title-prompt span {
    display: inline-block;
    background: linear-gradient(to bottom, #fff6c8 0%, #ffd25a 48%, #d19422 56%, #ffdf7a 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 1px 0 #2a1604) drop-shadow(0 0 2px rgba(0, 0, 0, .9)) drop-shadow(0 2px 6px rgba(20, 8, 0, .7));
    animation: title-letter-pulse 2.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * 75ms);
}
@keyframes title-letter-pulse {
    0%, 100% { opacity: .42; transform: translateY(0); }
    50% {
        opacity: 1; transform: translateY(-2px);
        filter: drop-shadow(0 1px 0 #2a1604) drop-shadow(0 0 2px rgba(0, 0, 0, .9)) drop-shadow(0 0 12px rgba(255, 196, 92, .75));
    }
}
/* Continue / New Game: the chosen line pulses, the other waits dimmed. */
.title-menu { display: flex; flex-direction: column; align-items: center; gap: .6em; }
.title-option { all: unset; cursor: pointer; pointer-events: auto; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.title-option:not(.is-selected) span { animation: none; opacity: .34; }
.title-option:focus-visible { outline: 1px solid rgba(255, 210, 90, .6); outline-offset: .3em; }
/* New Game over a save asks first (D-032 step 3). */
.title-question {
    margin: 0 auto .5em; max-width: min(48em, 88vw); white-space: normal; line-height: 1.5;
    font-size: .6em; letter-spacing: .14em; color: #f3e7c6;
    text-shadow: 0 1px 0 #2a1604, 0 0 3px rgba(0, 0, 0, .95), 0 2px 10px rgba(10, 4, 0, .8);
}
.title-prompt.is-starting { transition: opacity .7s ease, transform .7s ease, filter .7s ease; opacity: 0 !important; transform: scale(1.08); filter: brightness(1.8); }
.title-prompt.is-starting span { animation: none; opacity: 1; }

.title-iris {
    position: absolute; display: none; border-radius: 50%;
    box-shadow: 0 0 0 300vmax #000, inset 0 0 18px 6px rgba(0, 0, 0, .85);
}

.title-veil { position: absolute; inset: 0; background: #000; opacity: 1; transition: opacity 2.6s ease .15s; }
#title-screen.is-revealed .title-veil { opacity: 0; }
#title-screen.is-leaving .title-vignette,
#title-screen.is-leaving .title-prompt { display: none; }

@media (prefers-reduced-motion: reduce) {
    .title-prompt span { animation: none; opacity: 1; }
}
