:root {
    --ink: #1b1b2f;
    --pink: #ff4d8d;
    --yellow: #ffd23f;
    --cream: #fffaf0;
    --green: #2ecc71;
    --red: #ff4757;
    --sky: #5ec4ff;
    --font: 'Fredoka', system-ui, sans-serif;
    --head: 'Bangers', 'Fredoka', cursive;
    --hand: 'Caveat', cursive;
    /* Interfaz translúcida (cristal esmerilado) */
    --glass: rgba(255, 250, 240, 0.66);
    --glass-strong: rgba(255, 250, 240, 0.8);
    --glass-white: rgba(255, 255, 255, 0.62);
    --glass-blur: blur(7px) saturate(1.25);
}
/* Modo ligero: sin desenfoque (es caro en GPUs modestas), algo más opaco */
html.lite { --glass: rgba(255, 250, 240, 0.84); --glass-strong: rgba(255, 250, 240, 0.9); --glass-white: rgba(255, 255, 255, 0.82); --glass-blur: none; }

* { box-sizing: border-box; }
html { font-size: clamp(16px, 0.55vw + 9px, 21px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: #5ec4ff; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
[hidden] { display: none !important; }

/* --- Botones ------------------------------------------------------------- */
.btn {
    font: 700 1.15rem var(--font); color: var(--ink); background: var(--yellow);
    border: 3px solid var(--ink); border-radius: 16px; padding: 0.75em 1.4em;
    box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 8px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn-big { font-size: 1.6rem; padding: 0.7em 1.8em; }
.btn-ghost { background: #fff; }
.btn-love { background: var(--pink); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.sfx-toggle {
    position: fixed; top: 14px; right: 14px; z-index: 50; width: 52px; height: 52px; font-size: 1.5rem;
    border-radius: 50%; border: 3px solid var(--ink); background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}

/* --- Capas ---------------------------------------------------------------- */
.overlay {
    position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
    padding: 16px; opacity: 0; transition: opacity .35s;
}
.overlay.on { opacity: 1; }
.overlay.dim { background: rgba(27, 27, 47, 0.45); }

.card {
    background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 4px solid var(--ink); border-radius: 26px; box-shadow: 8px 8px 0 var(--ink);
    padding: 28px 30px; max-width: 560px; width: 100%; max-height: calc(100vh - 32px); overflow: auto;
    transform: scale(.9) rotate(-1deg); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.overlay.on .card { transform: none; }
.card.center { text-align: center; }
.card h2 { font: 400 2.1rem var(--head); letter-spacing: 1.5px; margin: 0 0 12px; color: var(--pink); -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink); }
.card p { font-size: 1.15rem; line-height: 1.45; }
.hand { font-family: var(--hand); font-size: 1.7rem !important; color: #b0306a; }

/* Carga */
#loading { background: linear-gradient(#5ec4ff, #d9f3ff); z-index: 60; }
.loading-box { text-align: center; font-weight: 600; font-size: 1.3rem; }
.loading-car { font-size: 3.4rem; animation: drive 1s ease-in-out infinite alternate; }
@keyframes drive { from { transform: translateX(-18px) rotate(-3deg); } to { transform: translateX(18px) rotate(2deg); } }
.bar { width: min(320px, 80vw); height: 18px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; overflow: hidden; margin: 12px auto; }
#loading-bar { height: 100%; width: 0; background: var(--pink); transition: width .2s; }
#classic-link { color: var(--ink); font-size: 1rem; }

/* Portada */
#title-screen { align-items: flex-end; justify-content: flex-start; padding: 5vh 5vw; }
.title-card { text-align: left; max-width: 620px; animation: pop .7s cubic-bezier(.34, 1.56, .64, 1) both; }
.title-logo {
    width: 84px; height: 84px; display: grid; place-items: center; font: 700 3.2rem var(--font); color: #e8173b;
    background: #fff; border: 6px solid #e8173b; border-radius: 14px; box-shadow: 5px 5px 0 var(--ink); cursor: pointer;
    animation: wobble 2.4s ease-in-out infinite; user-select: none;
}
.title { font: 400 clamp(3.4rem, 9vw, 6.8rem) / .9 var(--head); letter-spacing: 2px; margin: 18px 0 8px; color: #fff; -webkit-text-stroke: 3px var(--ink); text-shadow: 6px 6px 0 var(--ink); }
.title span { color: var(--pink); }
.title-sub { font-size: 1.3rem; font-weight: 600; margin: 0 0 22px; background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); display: inline-block; padding: 6px 14px; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); }
.tesla-box { margin-top: 22px; background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 3px solid var(--ink); border-radius: 18px; padding: 14px 18px; box-shadow: 5px 5px 0 var(--ink); }
.tesla-box p { margin: 0; font-size: 1.1rem; }
.tesla-box .row { justify-content: flex-start; margin-top: 12px; }
@keyframes pop { from { transform: scale(.85) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.05); } }

/* HUD */
.hud {
    position: fixed; top: 14px; left: 14px; z-index: 20; display: flex; gap: 8px; flex-wrap: wrap;
    transform: translateY(-120%); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.hud.on { transform: none; }
.hud span { background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 12px; font-weight: 700; box-shadow: 3px 3px 0 var(--ink); }
#hud-stage { background: rgba(255, 210, 63, 0.82); }
#hud-count.bump { animation: hudBump .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes hudBump { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-2deg); background: #ffe1ee; } 100% { transform: none; } }

/* Cartel de llegada */
.place-banner {
    position: fixed; top: 9vh; left: 50%; z-index: 25; text-align: center; pointer-events: none;
    transform: translate(-50%, -30px) scale(.8); opacity: 0; transition: all .45s cubic-bezier(.34, 1.56, .64, 1);
}
.place-banner.on { transform: translate(-50%, 0) scale(1); opacity: 1; }
#pb-name { font: 400 clamp(2.4rem, 6vw, 4.2rem) var(--head); letter-spacing: 2px; color: #fff; -webkit-text-stroke: 2.5px var(--ink); text-shadow: 5px 5px 0 var(--ink); white-space: nowrap; }
#pb-sub { display: inline-block; margin-top: 6px; font: 700 1.6rem var(--hand); background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 3px solid var(--ink); border-radius: 12px; padding: 2px 14px; box-shadow: 3px 3px 0 var(--ink); }

/* Tarjeta de pregunta: cuadro de diálogo abajo (deja la escena libre arriba) */
.question-card {
    position: fixed; z-index: 22; left: 50%; bottom: 2.2vh; width: min(1120px, 94vw); max-height: 46vh; overflow: auto;
    background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 4px solid var(--ink); border-radius: 26px; box-shadow: 8px 8px 0 var(--ink); padding: 16px 20px 18px;
    transform: translate(-50%, 60px); opacity: 0; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
}
.question-card.on { transform: translate(-50%, 0); opacity: 1; }
.question-card.leaving { transform: translate(-50%, 90px); opacity: 0; }
.question-card.collapsed .qc-options, .question-card.collapsed #qc-thumb { display: none; }
.question-card.collapsed #qc-text { margin: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#qc-toggle { flex: none; font: 700 .95rem var(--font); background: var(--glass-white); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.qc-head-right { display: flex; align-items: center; gap: 10px; }
.drag-hint { position: fixed; top: 74px; left: 14px; z-index: 20; font: 600 .95rem var(--font); background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px; opacity: 0; transition: opacity .5s; pointer-events: none; }
.drag-hint.on { opacity: 1; }
.qc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
#qc-place { font: 700 1.5rem var(--hand); color: #b0306a; }
#qc-thumb { width: 64px; height: 64px; object-fit: cover; border: 3px solid var(--ink); border-radius: 10px; cursor: zoom-in; background: #fff; flex: none; }
#qc-text { font-size: clamp(1.1rem, 1.5vw, 1.4rem); line-height: 1.3; margin: 0 0 12px; }
.qc-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.option-btn {
    display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
    font: 600 1.08rem/1.3 var(--font); color: var(--ink); background: var(--glass-white); border: 3px solid var(--ink); border-radius: 16px;
    padding: 12px 14px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .12s, box-shadow .12s, background .2s;
    animation: optIn .45s cubic-bezier(.34, 1.56, .64, 1) both;
}
.option-btn:hover:not(:disabled) { background: rgba(255, 244, 194, 0.9); transform: translateY(-2px); }
.option-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.option-btn:disabled { cursor: default; }
.opt-letter { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); border: 3px solid var(--ink); font-weight: 700; }
.option-btn.correct { background: rgba(184, 245, 201, 0.92); animation: bounce .5s; }
.option-btn.correct .opt-letter { background: var(--green); color: #fff; }
.option-btn.incorrect { background: rgba(255, 201, 207, 0.92); animation: shake .45s; }
.option-btn.incorrect .opt-letter { background: var(--red); color: #fff; }
.question-card[data-kind="commitment"] { background: rgba(255, 236, 246, 0.68); }
.question-card[data-kind="commitment"] .opt-letter { background: var(--pink); color: #fff; }
@keyframes optIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { 40% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

@media (max-aspect-ratio: 4/5) {
    .question-card { max-height: 56vh; padding: 14px; }
    .qc-options { grid-template-columns: 1fr; gap: 8px; }
    #qc-text { font-size: 1.05rem; margin-bottom: 10px; }
    .option-btn { font-size: .95rem; padding: 9px 11px; }
    .opt-letter { width: 28px; height: 28px; }
    #qc-thumb { width: 48px; height: 48px; }
    #title-screen { align-items: center; padding: 16px; }
    .title-card { text-align: center; }
    .title-logo { margin: 0 auto; }
    .tesla-box .row { justify-content: center; }
}

.toast {
    position: fixed; left: 50%; top: 22vh; z-index: 26; transform: translate(-50%, 10px) scale(.8); opacity: 0;
    font: 400 2.4rem var(--head); letter-spacing: 1.5px; color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 4px 4px 0 var(--ink);
    transition: all .3s cubic-bezier(.34, 1.56, .64, 1); pointer-events: none; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Corazón del resultado */
.heart-meter { width: 160px; height: 160px; margin: 16px auto; filter: drop-shadow(5px 5px 0 var(--ink)); }
.heart-shape { width: 100%; height: 100%; clip-path: url(#heartClip); background: #ffe4ec; position: relative; overflow: hidden; }
#tr-fill { position: absolute; inset: 0; background: linear-gradient(135deg, #ff7eb3, #f43f5e); transform: translateY(100%); }
.big-pct { font: 400 2.6rem var(--head) !important; color: var(--pink); -webkit-text-stroke: 1.5px var(--ink); margin: 0; }

/* Cinemática "Y ahora la última pregunta..." */
.cinematic, .proposal {
    position: fixed; inset: 0; z-index: 35; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
    gap: .2em .45em; padding: 0 6vw; text-align: center; pointer-events: none; opacity: 0; transition: opacity .5s;
    background: radial-gradient(ellipse at center, rgba(11, 16, 48, .25), rgba(11, 16, 48, .65));
}
.cinematic.on, .proposal.on { opacity: 1; }
.proposal { pointer-events: auto; flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: space-between; align-content: normal; padding: 4vh 6vw 3vh; background: radial-gradient(ellipse at center, transparent 30%, rgba(11, 16, 48, .55)); }
.cw, .pw {
    font: 400 clamp(3rem, 9vw, 7.5rem) var(--head); letter-spacing: 3px; color: #fff; opacity: 0;
    -webkit-text-stroke: 3px var(--ink); text-shadow: 6px 6px 0 var(--ink), 0 0 40px rgba(255, 126, 179, .8);
}
.play .cw-1 { animation: reveal 3s ease-out forwards 0s; }
.play .cw-2 { animation: reveal 3s ease-out forwards 2s; }
.play .cw-3 { animation: reveal 3s ease-out forwards 4s; }
.play .cw-4 { animation: reveal 3.5s ease-out forwards 6s; }
.play .cw-5 { animation: reveal 4s ease-out forwards 8.5s; }
.pw-line { display: flex; flex-wrap: wrap; justify-content: center; gap: .1em .4em; }
.pw { color: #ffe1ee; font-size: clamp(3rem, 6.4vw, 7.5rem); }
@media (max-aspect-ratio: 4/5) { .pw { font-size: clamp(3rem, 12vw, 6rem); } }
.play .pw-1 { animation: revealStay 2s ease-out forwards 0.3s; }
.play .pw-2 { animation: revealStay 2s ease-out forwards 2.1s; }
.play .pw-3 { animation: revealStay 2.4s ease-out forwards 3.9s; }
@keyframes reveal { 0% { opacity: 0; transform: translateY(30px) scale(.8); filter: blur(8px); } 30% { opacity: 1; transform: none; filter: none; } 100% { opacity: 1; } }
@keyframes revealStay { 0% { opacity: 0; transform: translateY(40px) scale(.7); filter: blur(10px); } 100% { opacity: 1; transform: none; filter: none; } }
.proposal-options { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; opacity: 0; transform: translateY(30px); transition: all .8s cubic-bezier(.34, 1.56, .64, 1); pointer-events: none; }
.proposal-options.on { opacity: 1; transform: none; pointer-events: auto; }
.proposal-options .btn { animation: heartbeat 1.4s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.07); } 30% { transform: scale(1); } 45% { transform: scale(1.05); } }

/* Celebración y guantera */
#celebration, #glovebox { justify-content: flex-start; padding-left: 4vw; }
@media (max-aspect-ratio: 4/5) { #celebration, #glovebox { justify-content: center; align-items: flex-end; padding-left: 16px; } .glovebox-card, .celebration-card { max-height: 56vh; } .celebration-card .polaroid { max-width: 190px; } }
.celebration-card { max-width: 520px; }
.celebrate-title { font: 400 clamp(2.4rem, 6vw, 3.4rem) var(--head); color: var(--pink); -webkit-text-stroke: 2px var(--ink); text-shadow: 4px 4px 0 var(--ink); margin: 0; letter-spacing: 2px; }
.sub { font-weight: 700; margin: 6px 0 14px; }
.polaroid { background: #fff; padding: 10px 10px 6px; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); transform: rotate(-3deg); display: inline-block; max-width: 280px; }
.polaroid img { width: 100%; display: block; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%; }
.polaroid span { font: 700 1.4rem var(--hand); display: block; padding-top: 4px; }
.glovebox-card { max-width: 520px; text-align: center; }
.monogram-seal { width: 110px; height: 110px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(#d4af37, #a8841f); border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 700 1.6rem 'Playfair Display', serif; color: #fff8dc; }
.spec-sheet { list-style: none; padding: 0; margin: 10px 0; text-align: left; }
.spec-sheet li { display: flex; gap: 14px; align-items: center; background: var(--glass-white); border: 3px solid var(--ink); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; box-shadow: 3px 3px 0 var(--ink); }
.spec-sheet span { font-size: 2rem; }
.spec-sheet small { display: block; color: #555; }

.lightbox { cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 88vh; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--ink); background: #fff; }
.fader { position: fixed; inset: 0; z-index: 40; background: #0b1030; opacity: 0; pointer-events: none; transition: opacity .5s; }
.fader.on { opacity: 1; }
#confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 45; pointer-events: none; }
.fps-meter { position: fixed; bottom: 6px; left: 6px; z-index: 99; font: 12px monospace; background: rgba(0, 0, 0, .6); color: #0f0; padding: 2px 6px; border-radius: 4px; }

/* Ruta entre lugares */
.route {
    position: fixed; left: 50%; bottom: 4vh; z-index: 21; width: min(640px, 88vw); pointer-events: none;
    transform: translate(-50%, 40px); opacity: 0; transition: all .5s cubic-bezier(.34, 1.56, .64, 1);
    background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 3px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink); padding: 10px 16px 12px;
}
.route.on { transform: translate(-50%, 0); opacity: 1; }
.route-label { font: 700 1.35rem var(--hand); color: #b0306a; text-align: center; margin-bottom: 4px; }
.route-line { display: flex; align-items: center; gap: 10px; }
.route-end { font-weight: 700; font-size: .95rem; white-space: nowrap; max-width: 30%; overflow: hidden; text-overflow: ellipsis; }
.route-track { position: relative; flex: 1; height: 10px; border-radius: 6px; background: repeating-linear-gradient(90deg, #d6d6e4 0 10px, transparent 10px 16px); }
#route-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 6px; background: var(--pink); }
#route-car { position: absolute; top: 50%; left: 0; transform: translate(-50%, -58%) scaleX(-1); font-size: 1.6rem; }

/* Aviso con botón (p. ej. arrancar el coche en el Supercharger) */
.prompt {
    position: fixed; left: 50%; bottom: 5vh; z-index: 24; text-align: center; transform: translate(-50%, 40px); opacity: 0;
    transition: all .45s cubic-bezier(.34, 1.56, .64, 1); background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 4px solid var(--ink); border-radius: 22px; box-shadow: 6px 6px 0 var(--ink); padding: 14px 24px 20px; width: min(560px, 92vw);
}
.prompt.on { transform: translate(-50%, 0); opacity: 1; }
#prompt-text { font: 700 1.25rem var(--font); margin: 0 0 12px; }

/* Fin de parte: sello de APTO */
.stage-card { position: relative; padding-top: 34px; }
.stamp {
    display: inline-block; font: 400 3.6rem/1 var(--head); letter-spacing: 6px; color: #1f9d55;
    border: 6px solid #1f9d55; border-radius: 14px; padding: 6px 22px 2px; margin-bottom: 14px;
    background: rgba(255, 255, 255, .55); opacity: 0; transform: scale(2.4) rotate(-14deg);
    mix-blend-mode: multiply;
}
.stamped .stamp { animation: stamp .45s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-14deg); } 70% { opacity: 1; transform: scale(.94) rotate(-9deg); } 100% { opacity: 1; transform: scale(1) rotate(-9deg); } }

/* Cortinilla de capítulo */
.chapter {
    position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; text-align: center; padding: 24px;
    background: radial-gradient(ellipse at 50% 120%, #7a2a6a 0%, #2a1650 45%, #0b1030 100%);
    opacity: 0; transition: opacity 1.1s ease;
}
.chapter.on { opacity: 1; }
.chapter.out { opacity: 0; transition: opacity 1.1s ease; }
.ch-stars {
    position: absolute; inset: 0; pointer-events: none; opacity: .9;
    background-image:
        radial-gradient(2px 2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 28% 62%, #ffe1ee 50%, transparent 51%),
        radial-gradient(2px 2px at 44% 12%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 63% 30%, #fff 50%, transparent 51%),
        radial-gradient(2.5px 2.5px at 78% 14%, #fff6c9 50%, transparent 51%), radial-gradient(1.5px 1.5px at 88% 52%, #fff 50%, transparent 51%),
        radial-gradient(2px 2px at 8% 78%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 52% 84%, #ffe1ee 50%, transparent 51%),
        radial-gradient(2px 2px at 92% 86%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 36% 40%, #fff 50%, transparent 51%);
    animation: twinkle 3.2s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }
.ch-content > * { opacity: 0; }
.chapter.play .ch-kicker { animation: chIn 1s ease-out forwards .5s; }
.chapter.play .ch-title { animation: chIn 1.4s ease-out forwards 1.3s; }
.chapter.play .ch-hearts { animation: chIn 1s ease-out forwards 2.4s; }
.chapter.play .ch-sub { animation: chIn 1.2s ease-out forwards 3s; }
.chapter.play .ch-btn { animation: chIn .8s cubic-bezier(.34, 1.56, .64, 1) forwards 4.4s, heartbeat 1.4s ease-in-out infinite 5.4s; }
@keyframes chIn { from { opacity: 0; transform: translateY(26px) scale(.92); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.ch-kicker { font: 700 1.6rem var(--font); letter-spacing: 8px; text-transform: uppercase; color: #ffd6e7; margin: 0 0 6px; }
.ch-title {
    font: 400 clamp(3.4rem, 10vw, 7.5rem)/1 var(--head); letter-spacing: 3px; margin: 0; color: #fff;
    -webkit-text-stroke: 3px var(--ink); text-shadow: 6px 6px 0 var(--ink), 0 0 50px rgba(255, 126, 179, .85);
}
.ch-hearts { font-size: 2rem; margin: 14px 0 6px; }
.ch-hearts span { display: inline-block; margin: 0 6px; animation: heartbeat 1.6s ease-in-out infinite; }
.ch-hearts span:nth-child(2) { animation-delay: .25s; font-size: 2.6rem; }
.ch-hearts span:nth-child(3) { animation-delay: .5s; }
.ch-sub { font: 700 clamp(1.6rem, 3.6vw, 2.4rem)/1.25 var(--hand); color: #ffe1ee; margin: 6px 0 26px; }

/* --- Examen de circulación (final de la Parte 2) ------------------------------------- */
.exam-hud { position: fixed; inset: 0; z-index: 21; pointer-events: none; opacity: 0; transition: opacity .4s; }
.exam-hud.on { opacity: 1; }
.ex-examiner {
    position: absolute; top: 14px; left: 14px; display: flex; gap: 10px; align-items: flex-start; max-width: min(520px, 70vw);
    background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 3px solid var(--ink); border-radius: 18px; padding: 10px 14px; box-shadow: 4px 4px 0 var(--ink);
}
.ex-examiner.bump { animation: hudBump .5s cubic-bezier(.34, 1.56, .64, 1); }
.ex-avatar { font-size: 2rem; line-height: 1; }
.ex-examiner b { font: 400 1.05rem var(--head); letter-spacing: 1px; color: var(--pink); }
.ex-examiner p { margin: 2px 0 0; font-weight: 600; font-size: 1.1rem; line-height: 1.3; }
.ex-flash {
    position: absolute; left: 50%; top: 18vh; transform: translate(-50%, 10px) scale(.85); opacity: 0;
    font: 700 1.3rem var(--font); padding: 10px 18px; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
    background: #fff; transition: opacity .25s, transform .3s cubic-bezier(.34, 1.56, .64, 1); white-space: nowrap; max-width: 92vw;
}
.ex-flash.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.ex-flash[data-kind="ok"] { background: #c9f7d9; }
.ex-flash[data-kind="leve"] { background: #fff1b8; }
.ex-flash[data-kind="grave"] { background: #ffd0d6; }
.ex-score { position: absolute; top: 14px; right: 80px; display: flex; gap: 8px; }
.ex-chip {
    display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 4px 10px;
    background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 3px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
}
.ex-chip span { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.ex-chip b { font: 400 1.7rem/1 var(--head); }
.ex-chip-grave { background: rgba(255, 208, 214, .85); }
.ex-dash {
    position: absolute; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: rgba(27, 27, 47, .78); color: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 4px 4px 0 var(--ink);
}
.ex-speed { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
.ex-speed b { font: 400 2.8rem/1 var(--head); letter-spacing: 1px; }
.ex-speed small { font-weight: 600; opacity: .8; }
.ex-limit {
    width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--ink);
    border: 6px solid #e8173b; font: 700 1.25rem var(--font);
}
.ex-blink {
    width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.7rem; line-height: 1;
    color: #4a4f66; border-radius: 12px; transition: color .06s, background .06s, transform .06s;
}
.ex-blink.on { color: #1b1b2f; background: #2ee87a; box-shadow: 0 0 18px #2ee87a, 0 0 4px #fff inset; transform: scale(1.12); }

.ex-pad {
    position: absolute; left: 14px; bottom: 16px; max-width: min(640px, 60vw); font-size: .95rem; font-weight: 500;
    background: var(--glass-white); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border: 2px solid var(--ink); border-radius: 12px; padding: 6px 12px;
}
.ex-pad b { background: var(--ink); color: #fff; border-radius: 6px; padding: 0 6px; font-size: .85rem; }
.ex-dim { opacity: .7; }
@media (max-width: 700px) { .ex-pad { display: none; } .ex-score { right: 76px; } }

/* Inspección final: la cena sorpresa */
.dinner { margin: 6px 0 14px; padding: 10px 14px; border: 3px dashed #ff9f1c; border-radius: 14px; background: rgba(255, 159, 28, .12); font-size: 1.1rem !important; }

/* Ficha técnica final: que quepa entera sin scroll (portátil, monitor y móvil) */
.glovebox-card { padding: 22px 26px; }
#gb-step2 .monogram-seal { width: 72px; height: 72px; font-size: 1.15rem; margin-bottom: 8px; border-width: 3px; }
#gb-step2 h2 { font-size: 1.75rem; margin-bottom: 8px; }
#gb-step2 .spec-sheet { margin: 6px 0; }
#gb-step2 .spec-sheet li { padding: 6px 12px; margin-bottom: 7px; gap: 12px; }
#gb-step2 .spec-sheet span { font-size: 1.6rem; }
#gb-step2 .spec-sheet b { font-size: 1.02rem; }
#gb-step2 .spec-sheet small { font-size: .88rem; }
#gb-step2 .hand { font-size: 1.4rem !important; line-height: 1.2; margin: 8px 0 6px; }
#gb-step2 .dinner { margin: 6px 0 12px; padding: 8px 12px; font-size: 1rem !important; line-height: 1.35; color: var(--ink); }
#gb-step2 .btn { margin-top: 2px; }
@media (max-height: 700px) {
    #gb-step2 .monogram-seal { display: none; }
    #gb-step2 h2 { font-size: 1.5rem; }
    #gb-step2 .spec-sheet small { display: none; }
}
@media (max-aspect-ratio: 4/5) {
    .glovebox-card { max-height: 62vh; padding: 16px 18px; }
    #gb-step2 .monogram-seal { display: none; }
    #gb-step2 h2 { font-size: 1.45rem; }
    #gb-step2 .spec-sheet small { display: none; }
    #gb-step2 .spec-sheet li { padding: 4px 10px; margin-bottom: 5px; }
    #gb-step2 .hand { font-size: 1.2rem !important; }
}

/* Tarjeta de APTO con dos botones (Repetir / Continuar): uno al lado del otro y que quepan siempre */
#stage-result .row { flex-wrap: nowrap; }
#stage-result #sr-btn2:not([hidden]) ~ #sr-btn, #stage-result #sr-btn2:not([hidden]) { font-size: 1.15rem; padding: 0.6em 1.1em; }
.stage-card { max-height: calc(100vh - 24px); }
@media (max-height: 520px) { .stage-card { padding: 16px 20px; } .stage-card .stamp { transform: scale(.75); margin: -8px 0; } }

/* Paseo nocturno: el botón "Continuar" pequeño en la esquina, sin tapar el coche */
.prompt.compact { left: auto; right: 18px; bottom: 18px; transform: translate(0, 40px); padding: 10px 14px; width: auto; max-width: 280px; }
.prompt.compact.on { transform: none; }
.prompt.compact #prompt-text { font-size: 1rem; margin: 0 0 8px; }
.prompt.compact .btn-big { font-size: 1.15rem; padding: 0.55em 1.2em; }

/* Portada: START + acceso al modo conducción */
.title-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.title-actions .btn { text-decoration: none; display: inline-block; }
