:root {
    --bg-dark: #12070e;
    --bg-card: rgba(38, 14, 28, 0.75);
    --bg-card-border: rgba(232, 180, 184, 0.2);
    --text-main: #fff5f6;
    --text-muted: #d4a5b0;
    --text-faint: #8a6570;
    --rose-gold: #f5c4cd;
    --rose-accent: #e56b81;
    --gold-accent: #f0c987;
    --rose-glow: rgba(229, 107, 129, 0.35);
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background-color: #080306;
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-container {
    width: 100%;
    max-width: 440px;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(circle at 50% 15%, #2d0f21 0%, var(--bg-dark) 85%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.95);
}

.candle-glow {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, var(--rose-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(10px);
}

.demo-badge {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(229, 107, 129, 0.18);
    border: 1px solid var(--rose-gold);
    color: var(--rose-gold);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(8px);
}
.demo-badge.hidden { display: none; }

.screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    padding: 24px 20px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.content-centered {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 14px;
    z-index: 1;
}

.envelope-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wax-seal {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    background: rgba(229, 107, 129, 0.12);
    border: 1px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.wax-seal svg {
    width: 26px;
    height: 26px;
    color: var(--rose-gold);
}

.romantic-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold-accent);
}

.title-romantic {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 700;
    color: var(--rose-gold);
    line-height: 1.15;
}

.subtitle-romantic {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 320px;
    font-weight: 300;
}

/* Recuadro: Adivina el personaje */
.passcode-card {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--bg-card-border);
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    margin-top: 6px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.passcode-card.shake {
    animation: shakeAnim 0.4s ease;
    border-color: var(--rose-accent) !important;
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.passcode-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gold-accent);
    text-transform: none;
}

.passcode-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 16px;
    color: #fff;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.passcode-input:focus {
    border-color: var(--rose-gold);
    box-shadow: 0 0 15px var(--rose-glow);
}

.passcode-hint {
    font-size: 12px;
    color: var(--text-faint);
    transition: color 0.2s ease;
}

.passcode-hint.success {
    color: var(--gold-accent) !important;
    font-weight: 600;
}

.passcode-hint.error {
    color: var(--rose-accent) !important;
    font-weight: 600;
}

.action-dock {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint-audio {
    font-size: 12px;
    color: var(--text-faint);
}

button {
    border: none;
    outline: none;
    border-radius: 16px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.25s ease, background 0.25s ease;
    user-select: none;
}

button:active {
    transform: scale(0.97);
}

.btn-romantic {
    background: linear-gradient(135deg, #e56b81 0%, #a82442 100%);
    color: #fff;
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 30px var(--rose-glow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-romantic.btn-locked {
    opacity: 0.45;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    border-color: transparent;
    cursor: pointer;
}

/* Barra de progreso */
.story-progress-bar {
    display: flex;
    gap: 5px;
    width: 100%;
    margin-bottom: 16px;
}

.story-segment {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.story-segment-fill {
    height: 100%;
    width: 0%;
    background: var(--gold-accent);
    border-radius: 3px;
    transition: width 0.35s ease;
}

.story-segment.completed .story-segment-fill,
.story-segment.active .story-segment-fill {
    width: 100%;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pill-counter {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--rose-gold);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--bg-card-border);
}

.btn-audio-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    border-radius: 30px;
    padding: 6px 14px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.audio-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold-accent);
}

.btn-audio-pill.muted .audio-dot {
    background: var(--text-faint);
}

.btn-audio-pill.muted {
    opacity: 0.5;
}

.slide-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    overflow: hidden;
}

.letter-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 24px;
    padding: 32px 24px;
    width: 100%;
    min-height: 300px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
}

.slide-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 10px 0;
}

.slide-content p {
    font-family: var(--font-serif);
    font-size: 20px;
    line-height: 1.7;
    color: #fff0f3;
    font-weight: 400;
    text-align: center;
}

.animate-slide {
    animation: fadeSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reader-footer {
    display: flex;
    gap: 12px;
    padding-top: 16px;
}

.btn-nav-primary {
    flex: 2;
    background: linear-gradient(135deg, #e56b81 0%, #a82442 100%);
    color: #fff;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px var(--rose-glow);
}

.btn-nav-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    padding: 16px;
    font-size: 15px;
}

.btn-nav-secondary:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Pantalla Intermedia Cuestionario */
.intro-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 22px;
    padding: 26px 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    margin: 4px 0;
}

.intro-card-text {
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.65;
    color: #fff0f3;
    font-weight: 400;
    text-align: center;
}

.btn-link-secondary {
    background: transparent;
    border: none;
    color: var(--text-faint);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s ease;
}

.btn-link-secondary:active {
    color: var(--rose-gold);
}

/* Cuestionario Sí / No */
.quiz-wrapper {
    gap: 24px;
}

.quiz-badge {
    background: rgba(229, 107, 129, 0.15);
    border: 1px solid var(--rose-accent);
    color: var(--rose-gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 30px;
}

.quiz-card-single {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 24px;
    padding: 36px 24px;
    width: 100%;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
}

.question-text {
    font-family: var(--font-serif);
    font-size: 23px;
    font-weight: 600;
    color: #fff0f3;
    line-height: 1.45;
    text-align: center;
}

.quiz-binary-buttons {
    width: 100%;
    display: flex;
    gap: 14px;
}

.btn-choice {
    flex: 1;
    padding: 18px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

.btn-choice.yes {
    background: linear-gradient(135deg, #e56b81 0%, #b82b49 100%);
    color: #fff;
    box-shadow: 0 8px 25px var(--rose-glow);
}

.btn-choice.no {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
}

/* Pantalla final 404 */
.faded-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(229, 107, 129, 0.08);
    border: 1px solid rgba(229, 107, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rose-accent);
}

.faded-icon svg {
    width: 34px;
    height: 34px;
}

.title-faded {
    font-family: var(--font-serif);
    font-size: 52px;
    font-weight: 700;
    color: var(--rose-gold);
    letter-spacing: -1px;
}

.faded-badge {
    margin-top: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--gold-accent);
    border: 1px solid rgba(240, 201, 135, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
}
