/* css/story.css — Cutscene director + story presentation.
   Gold-on-dark to match the rest of the game (see css/level-up.css). */

/* ── Full-screen cutscene overlay ── */
.cutscene-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9500;
    overflow: hidden;
    background: #000;
    cursor: default;
    /* Screen shake is applied inline via transform. */
    will-change: transform;
}

/* The WebGL vignette canvas sits underneath the DOM layers. */
.cutscene-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Full-screen colour fade layer. */
.cutscene-fade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    pointer-events: none;
}

/* Container for titles + narration, centred. */
.cutscene-text-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ── Titles ── */
.cutscene-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 90%;
    max-width: 900px;
}

.cutscene-title.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cutscene-title-main {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-weight: bold;
    line-height: 1.05;
}

.cutscene-title-sub {
    margin-top: 18px;
    font-size: 20px;
    letter-spacing: 4px;
    color: #cbb978;
    text-transform: uppercase;
}

/* Epic — huge gold letters with a slow letter-spacing bloom. */
.cutscene-title-epic .cutscene-title-main {
    font-size: 84px;
    letter-spacing: 6px;
    background: linear-gradient(180deg, #FFE68A 0%, #FFD700 45%, #E8A100 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 22px rgba(255, 215, 0, 0.6));
    animation: cutscene-epic-bloom 3.2s ease-in-out infinite alternate;
}

@keyframes cutscene-epic-bloom {
    0% { letter-spacing: 6px; filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.45)); }
    100% { letter-spacing: 14px; filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.85)); }
}

/* Whisper — small, faint, wide-spaced, drifting. */
.cutscene-title-whisper .cutscene-title-main {
    font-size: 34px;
    font-weight: normal;
    letter-spacing: 10px;
    color: rgba(220, 220, 235, 0.75);
    text-shadow: 0 0 18px rgba(150, 170, 255, 0.4);
    font-style: italic;
    animation: cutscene-whisper-drift 5s ease-in-out infinite alternate;
}

@keyframes cutscene-whisper-drift {
    0% { opacity: 0.6; letter-spacing: 8px; }
    100% { opacity: 0.9; letter-spacing: 12px; }
}

/* Glitch — hard white with jittering chromatic ghosts. */
.cutscene-title-glitch .cutscene-title-main {
    font-size: 72px;
    letter-spacing: 4px;
    color: #f5f5f5;
    position: relative;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: cutscene-glitch-flicker 1.4s steps(2, end) infinite;
}

.cutscene-title-glitch .cutscene-title-main::before,
.cutscene-title-glitch .cutscene-title-main::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    overflow: hidden;
}

.cutscene-title-glitch .cutscene-title-main::before {
    color: #ff2e63;
    animation: cutscene-glitch-shift-a 1.1s infinite linear alternate;
}

.cutscene-title-glitch .cutscene-title-main::after {
    color: #08d9d6;
    animation: cutscene-glitch-shift-b 1.3s infinite linear alternate;
}

@keyframes cutscene-glitch-flicker {
    0%, 100% { opacity: 1; }
    47% { opacity: 1; }
    48% { opacity: 0.4; }
    49% { opacity: 1; }
    92% { opacity: 0.7; }
}

@keyframes cutscene-glitch-shift-a {
    0% { transform: translate(-3px, -1px); clip-path: inset(0 0 62% 0); }
    50% { transform: translate(2px, 1px); clip-path: inset(45% 0 20% 0); }
    100% { transform: translate(-2px, 2px); clip-path: inset(70% 0 5% 0); }
}

@keyframes cutscene-glitch-shift-b {
    0% { transform: translate(3px, 1px); clip-path: inset(15% 0 55% 0); }
    50% { transform: translate(-2px, -1px); clip-path: inset(60% 0 10% 0); }
    100% { transform: translate(2px, -2px); clip-path: inset(30% 0 40% 0); }
}

/* ── Narration (typewriter lower-third) ── */
.cutscene-narration {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 820px;
    text-align: center;
}

.cutscene-narration-lower-third {
    bottom: 14%;
}

.cutscene-narration-line {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 26px;
    line-height: 1.5;
    color: #f0ead6;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 18px rgba(0, 0, 0, 0.6);
    margin: 6px 0;
    min-height: 1.5em;
}

/* ── Skip button ── */
.cutscene-skip-btn {
    position: absolute;
    right: 28px;
    bottom: 26px;
    padding: 10px 22px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 24px;
    color: #FFD700;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease, background 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}

.cutscene-skip-btn.visible {
    opacity: 0.85;
    transform: translateY(0);
}

.cutscene-skip-btn:hover {
    background: rgba(255, 215, 0, 0.18);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
    opacity: 1;
}

/* ── Act-advance banner (transient toast when an act begins) ── */
.story-act-banner {
    position: fixed;
    left: 50%;
    top: 22%;
    transform: translateX(-50%) translateY(-16px);
    z-index: 9400;
    padding: 16px 40px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.55);
    border-radius: 10px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.25);
}

.story-act-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.story-act-banner-eyebrow {
    font-size: 13px;
    letter-spacing: 6px;
    color: #cbb978;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.story-act-banner-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 30px;
    font-weight: bold;
    background: linear-gradient(180deg, #FFE68A 0%, #FFD700 60%, #E8A100 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .cutscene-title-epic .cutscene-title-main { font-size: 46px; letter-spacing: 3px; }
    .cutscene-title-whisper .cutscene-title-main { font-size: 24px; letter-spacing: 6px; }
    .cutscene-title-glitch .cutscene-title-main { font-size: 40px; }
    .cutscene-title-sub { font-size: 15px; letter-spacing: 2px; }

    @keyframes cutscene-epic-bloom {
        0% { letter-spacing: 3px; filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.45)); }
        100% { letter-spacing: 8px; filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.85)); }
    }

    .cutscene-narration-line { font-size: 19px; }
    .cutscene-narration-lower-third { bottom: 16%; }

    .cutscene-skip-btn { right: 14px; bottom: 16px; padding: 8px 16px; font-size: 12px; }

    .story-act-banner { padding: 12px 24px; width: 80%; }
    .story-act-banner-title { font-size: 22px; }
    .story-act-banner-eyebrow { font-size: 11px; letter-spacing: 4px; }
}

/* ── Verdict Finale (§2.6 / §6.7) — the composer overlay ── */
.verdict-finale {
    position: fixed;
    inset: 0;
    z-index: 9700; /* above the cutscene overlay (9500) */
    background: radial-gradient(ellipse at center, rgba(20, 16, 8, 0.97) 0%, rgba(0, 0, 0, 0.99) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    animation: verdict-fade-in 0.6s ease;
}

@keyframes verdict-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.verdict-finale-inner {
    max-width: 860px;
    width: 100%;
    text-align: center;
}

.verdict-eyebrow {
    font-size: 13px;
    letter-spacing: 6px;
    color: #cbb978;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.verdict-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 44px;
    font-weight: bold;
    background: linear-gradient(180deg, #FFE68A 0%, #FFD700 55%, #E8A100 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.5));
    margin-bottom: 14px;
}

.verdict-lede {
    font-size: 17px;
    line-height: 1.5;
    color: #d8d2c4;
    max-width: 620px;
    margin: 0 auto 28px;
}

.verdict-lede em { color: #FFD700; font-style: italic; }

.verdict-slices {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.verdict-slice {
    flex: 1 1 220px;
    max-width: 260px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    padding: 20px 16px;
    text-align: center;
}

.verdict-slice-label {
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 2px;
    filter: drop-shadow(0 0 10px currentColor);
}

.verdict-slice-sub {
    font-size: 12px;
    letter-spacing: 3px;
    color: #aaa;
    text-transform: uppercase;
    margin: 4px 0 12px;
}

.verdict-slice-blurb {
    font-size: 13px;
    line-height: 1.45;
    color: #c8c2b6;
    min-height: 76px;
}

.verdict-weight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

.verdict-weight-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.08);
    color: #FFD700;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.verdict-weight-btn:hover { background: rgba(255, 215, 0, 0.22); }
.verdict-weight-btn:active { transform: scale(0.9); }

.verdict-weight-val {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    min-width: 28px;
}

.verdict-spin-btn {
    padding: 16px 48px;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: verdict-spin-pulse 2s ease-in-out infinite;
}

.verdict-spin-btn:hover { transform: scale(1.04); }

.verdict-spin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #555;
    color: #999;
    animation: none;
}

@keyframes verdict-spin-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.35); }
    50% { box-shadow: 0 0 28px rgba(255, 215, 0, 0.7); }
}

@media (max-width: 768px) {
    .verdict-title { font-size: 30px; }
    .verdict-lede { font-size: 15px; }
    .verdict-slices { flex-direction: column; align-items: center; }
    .verdict-slice { max-width: 340px; width: 100%; }
    .verdict-slice-blurb { min-height: 0; }
    .verdict-spin-btn { padding: 14px 32px; font-size: 16px; width: 100%; max-width: 340px; }
}
