@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --bg-deep: #07111a;
    --red: #c0001a;
    --red-dim: #8a0012;
    --glass: rgba(245, 240, 232, .04);
    --glass-b: rgba(255, 255, 255, .08);
    --text-main: #d8cfc0;
    --text-dim: #7a7060;
    --text-muted: rgba(255, 255, 255, .3);
    --voice-col: #4ea8b8;

    /* Fonts */
    --font-mono: 'Share Tech Mono', monospace;
    --font-heading: 'ITC Avant Garde Gothic', 'Avant Garde', 'Century Gothic', Futura, sans-serif;

    /* Red palette */
    --red-006: rgba(192, 0, 26, .06);
    --red-012: rgba(192, 0, 26, .12);
    --red-035: rgba(192, 0, 26, .35);
    --red-040: rgba(192, 0, 26, .4);

    /* White palette */
    --white-007: rgba(255, 255, 255, .07);
    --white-010: rgba(255, 255, 255, .1);
    --white-035: rgba(255, 255, 255, .35);

    /* Violet palette (flashbacks) */
    --violet-012: rgba(160, 20, 140, .12);
    --violet-055: rgba(160, 20, 140, .55);
    --violet-090: rgba(160, 20, 140, .9);

    /* Blue palette (fins) */
    --blue-012: rgba(30, 90, 200, .12);
    --blue-055: rgba(30, 90, 200, .55);
    --blue-090: rgba(30, 90, 200, .9);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 20px;
    line-height: 1.8;
    background: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── BACKGROUND ── */

@keyframes noiseDrift {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(200px, 200px);
    }
}

.bg {
    position: fixed;
    inset: -4%;
    z-index: 0;
    background:
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(0, 40, 80, .35) 0%, transparent 55%),
        linear-gradient(160deg, #0b1822 0%, #07111a 100%);
}

/* ── FOND DYNAMIQUE
   Teal + rouge interpolés jour par jour via JS (updateBgPhase).
   BG_FROM (j1) : teal haut-gauche large, rouge infime bas-droit.
   BG_TO (jMax) : teal réduit coin haut-droit, rouge dominant centre-bas.
────────────────────────────────────────────────── */
#bg-dynamic {
    position: fixed;
    inset: -4%;
    z-index: 0;
    pointer-events: none;
}

.bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px;
    opacity: .5;
    pointer-events: none;
    animation: noiseDrift 120s linear infinite;
    will-change: transform;
}


/* ── TAP HINT ── */
.tap-hint::after {
    content: '▼';
    display: block;
    text-align: right;
    color: rgba(255, 255, 255, .18);
    font-size: 10px;
    letter-spacing: .2em;
    margin-top: 4px;
    animation: tapBlink 1.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes tapBlink {

    0%,
    100% {
        opacity: .18;
    }

    50% {
        opacity: .55;
    }
}

/* ── SHARED ── */
.page {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: none;
    flex-direction: column;
    align-items: center;
}

.page.active {
    display: flex;
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-b);
    backdrop-filter: blur(10px);
    border-radius: 2px;
    padding: 1.5rem 1.75rem;
}

/* ══════════════════════════════════════
   CONFIG PAGE
══════════════════════════════════════ */
#page-config {
    justify-content: center;
    gap: 2rem;
    padding: 2rem 1.5rem;
}

.cfg-header,
.credits-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.h-series {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .28);
}

.h-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(48px, 8vw, 88px);
    letter-spacing: .06em;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 80px var(--red-040);
}

.h-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .28);
}

.cfg-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    width: min(360px, 90vw);
}

.cfg-action-btn {
    width: 100%;
    border: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all .25s;
    border-radius: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

/* ── SAVE SLOTS ── */
.save-slots {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
}

.save-slot {
    border: 1px solid var(--glass-b);
    border-radius: 2px;
    padding: .8rem 1rem;
    background: rgba(255, 255, 255, .02);
    transition: border-color .2s;
}

.save-slot:hover {
    border-color: rgba(255, 255, 255, .14);
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .3rem;
}

.slot-num {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--white-035);
}

.slot-date {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, .22);
}

.slot-info {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, .5);
    margin-bottom: .6rem;
    min-height: 1.3em;
}

.slot-btns {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.slot-btns .cfg-action-btn {
    padding: .6rem 1rem;
    font-size: 15px;
    width: 100%;
}

/* ── Icône dans les boutons ── */
.btn-icon {
    font-size: 20px !important;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
    user-select: none;
    flex-shrink: 0;
}

.cfg-action-primary {
    background: linear-gradient(135deg, var(--red-dim), var(--red));
    color: #fff;
    box-shadow: 0 4px 30px var(--red-035);
}

.cfg-action-primary:hover {
    box-shadow: 0 6px 50px rgba(192, 0, 26, .55);
    transform: translateY(-1px);
}

.cfg-action-secondary {
    background: transparent;
    color: rgba(255, 255, 255, .45);
    border: 1px solid rgba(255, 255, 255, .12);
}

.cfg-action-secondary:hover {
    border-color: var(--red-dim);
    color: rgba(255, 255, 255, .75);
    background: var(--red-006);
}

.cfg-footer {
    margin-top: 28px;
    text-align: center;
    width: min(360px, 90vw);
}

.cfg-credits-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 1rem 2rem;
    border: 1px solid var(--glass-b);
    border-radius: 1px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    transition: all .25s;
    box-sizing: border-box;
}

.cfg-credits-link:hover {
    border-color: var(--red-dim);
    color: rgba(255, 255, 255, .55);
    background: rgba(192, 0, 26, .04);
}

.cfg-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    margin-top: .5rem;
    padding: .6rem 2rem;
    background: transparent;
    border: 1px solid rgba(192, 0, 26, .15);
    border-radius: 1px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--red-035);
    cursor: pointer;
    transition: all .25s;
    box-sizing: border-box;
}

.cfg-reset-btn:hover {
    border-color: rgba(192, 0, 26, .5);
    color: rgba(192, 0, 26, .7);
    background: rgba(192, 0, 26, .04);
}


/* ══════════════════════════════════════
   PAUSE MODAL
══════════════════════════════════════ */
.pause-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(7, 17, 26, .85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.pause-overlay.open {
    display: flex;
}

.pause-modal {
    background: rgba(11, 24, 34, .98);
    border: 1px solid var(--glass-b);
    border-top: 2px solid var(--red);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pause-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--red);
}

.pause-info {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    color: var(--white-035);
    line-height: 1.7;
}

.pause-menu {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pause-btn {
    background: transparent;
    border: 1px solid var(--white-010);
    color: rgba(255, 255, 255, .45);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    padding: 1rem 1.5rem;
    border-radius: 1px;
    width: 100%;
    cursor: pointer;
    transition: all .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.pause-btn:hover:not(:disabled) {
    border-color: var(--red-dim);
    color: #fff;
    background: var(--red-006);
}

.pause-btn-disabled {
    opacity: .3;
    cursor: not-allowed;
}

.pause-btn-danger {
    border-color: rgba(192, 0, 26, .25);
    color: rgba(192, 0, 26, .6);
}

.pause-btn-danger:hover:not(:disabled) {
    border-color: var(--red);
    color: var(--red);
    background: rgba(192, 0, 26, .08);
}

/* ══════════════════════════════════════
   CUSTOM MODAL (alert / confirm)
══════════════════════════════════════ */
.vn-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(7, 17, 26, .85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.vn-modal-overlay.open {
    display: flex;
}

.vn-modal {
    background: rgba(11, 24, 34, .98);
    border: 1px solid var(--glass-b);
    border-top: 2px solid var(--red);
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.vn-modal-message {
    font-family: 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-line;
}

.vn-modal-btns {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
}

.vn-modal-btns .pause-btn {
    width: auto;
    padding: .6rem 1.25rem;
}


.pause-speed {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pause-speed-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pause-speed-btns {
    display: flex;
    gap: .4rem;
}

.speed-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--white-010);
    color: var(--white-035);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .15em;
    text-transform: uppercase;
    padding: .55rem .5rem;
    border-radius: 1px;
    cursor: pointer;
    transition: all .2s;
}

.speed-btn:hover {
    border-color: var(--red-dim);
    color: #fff;
    background: var(--red-006);
}

.speed-btn-active {
    border-color: var(--red-dim);
    color: #fff;
    background: var(--red-012);
}

.pause-mode {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pause-mode-rows {
    display: flex;
    flex-direction: column;
}

.mode-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.mode-row:last-child {
    border-bottom: none;
}

.mode-row-icon {
    font-size: 16px;
    color: var(--white-035);
    flex-shrink: 0;
}

.mode-row-label {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--white-035);
}

/* Toggle switch style iOS */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 26px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 13px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background .25s, border-color .25s;
    outline: none;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, .4);
    border-radius: 50%;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.22, .61, .36, 1), background .25s;
}

.toggle-switch[aria-checked="true"] {
    background: var(--red);
    border-color: var(--red);
}

.toggle-switch[aria-checked="true"] .toggle-thumb {
    transform: translateX(18px);
    background: #fff;
}

.pause-close {
    background: linear-gradient(135deg, var(--red-dim), var(--red));
    border: none;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    padding: 1rem 2rem;
    border-radius: 1px;
    width: 100%;
    cursor: pointer;
    transition: all .25s;
    box-shadow: 0 4px 30px var(--red-035);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.pause-close:hover {
    box-shadow: 0 6px 50px rgba(192, 0, 26, .55);
    transform: translateY(-1px);
}

.pause-shortcuts {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .06em;
    color: rgba(255, 255, 255, .2);
    text-align: center;
    padding: .5rem 0 .25rem;
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.pause-shortcuts kbd {
    display: inline-block;
    background: var(--white-007);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 3px;
    padding: 0 .3rem;
    font-family: inherit;
    font-size: 9px;
    line-height: 1.5;
}

/* Focus visible pour l'accessibilité clavier */
:focus-visible {
    outline: 2px solid rgba(192, 0, 26, .7);
    outline-offset: 2px;
}

/* ══════════════════════════════════════
   GAME PAGE
══════════════════════════════════════ */
#page-game {
    padding: 0 1.5rem 5rem;
}

/* Mobile topbar — visible seulement quand scene-recap est caché */
.game-topbar-mobile {
    display: none;
    width: 100%;
    align-items: center;
    gap: .75rem;
}

/* Recap header — titre + bouton pause en haut du panneau gauche */
.recap-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-bottom: 1rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--white-007);
}

/* Bouton fermeture du récap — visible uniquement en mobile.
   Sélecteur double-classe (.topbar-btn.recap-close-btn) pour
   surpasser la spécificité de .topbar-btn { display:flex }. */
.topbar-btn.recap-close-btn {
    display: none;
}

.topbar-txt {
    flex: 1;
}

.topbar-series {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .22);
}

.topbar-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .65);
}

/* ── Big scene heading ── */
.scene-heading {
    padding: .1rem 0 1rem;
    border-bottom: 1px solid var(--glass-b);
    margin-bottom: 1.25rem;
    opacity: 0;
    transition: opacity .6s;
}

.scene-heading.visible {
    opacity: 1;
}

.scene-heading-sup {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--red-dim);
    margin-bottom: .3rem;
}

.scene-heading-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .88);
    line-height: 1.2;
}

.topbar-btn {
    background: none;
    border: 1px solid var(--white-010);
    color: var(--text-muted);
    font-size: 15px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-btn:hover {
    border-color: var(--red-dim);
    color: rgba(255, 255, 255, .7);
}

/* Game body: three-column — recap | portrait | text */
.game-layout {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 290px 185px 1fr;
    gap: 1.8rem;
    align-items: start;
    min-height: calc(100vh - 5rem);
    /* stabilise le sticky dès le lancement */
}

/* ── LEFT: scene recap nav ── */
.scene-recap {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    position: sticky;
    top: 1.5rem;
    padding-top: .5rem;
}


/* ── RIGHT: text panel ── */
.text-panel {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* Scene card — extends .card */
.scene-card {
    padding: 2rem 2rem 5rem;
    min-height: 200px;
    position: relative;
}

.scene-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--red), rgba(192, 0, 26, 0));
}

#log {
    display: flex;
    flex-direction: column;
}

#choices,
.past-choices {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
}

#ending {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

#ending.visible {
    display: flex;
}

/* Lines */
.line {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .4s, transform .4s;
    padding: .1rem 0;
}

.line.shown {
    opacity: 1;
    transform: none;
}

.line-narration {
    font-style: italic;
    color: var(--text-main);
    font-size: 20px;
    line-height: 1.8;
    padding: .3rem 0;
}

/* ── Style B: Dialogue with integrated portrait ── */

@keyframes slideFromLeft {
    from {
        opacity: 0;
        transform: translateX(-70px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideFromLeftVoice {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dialogue block — portrait + text fused */
.line-dialogue-block {
    display: flex;
    gap: 0;
    align-items: stretch;
    margin: .8rem 0;
    transition: none;
}

.line-dialogue-block.shown {
    animation: slideFromLeft .5s cubic-bezier(.22, .61, .36, 1) forwards;
}

/* Voice block slide (slightly shorter travel) */
.line-voice-block.shown {
    animation: slideFromLeftVoice .45s cubic-bezier(.22, .61, .36, 1) forwards;
}

/* Portrait area */
.portrait {
    flex-shrink: 0;
    position: relative;
    width: 120px;
    align-self: flex-start;
    background: var(--char-col);
    overflow: hidden;
}

.portrait img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    object-position: center top;
    display: block;
    filter: brightness(.85) contrast(1.1);
}

.portrait-fallback {
    width: 120px;
    height: 120px;
    background: var(--char-col, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
    color: rgba(255, 255, 255, .7);
}

/* ── PORTRAIT PANEL (portrait du personnage qui parle) ── */
#portrait-panel {
    position: sticky;
    top: 6rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    pointer-events: none;
}

@keyframes portraitEntrance {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.portrait-card {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.portrait-card.present {
    display: none;
}

.portrait-card.active {
    display: flex;
    animation: portraitEntrance .35s cubic-bezier(.22, .61, .36, 1) forwards;
}

/* ── Cadre style viseur ── */
.pc-frame {
    position: relative;
    padding: 10px;
}

/* Coin supérieur gauche & inférieur droit via pseudo-éléments */
.pc-frame::before,
.pc-frame::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--pcolor, #888);
    border-style: solid;
    opacity: .9;
    transition: opacity .3s;
}

.pc-frame::before {
    top: 0;
    left: 0;
    border-width: 2px 0 0 2px;
}

.pc-frame::after {
    bottom: 0;
    right: 0;
    border-width: 0 2px 2px 0;
}

/* Coin supérieur droit & inférieur gauche via spans .pc-corner */
.pc-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--pcolor, #888);
    border-style: solid;
    opacity: .9;
}

.pc-corner-tr {
    top: 0;
    right: 0;
    border-width: 2px 2px 0 0;
}

.pc-corner-bl {
    bottom: 0;
    left: 0;
    border-width: 0 0 2px 2px;
}

.pc-img {
    width: 165px;
    height: 165px;
    background-size: cover;
    background-position: top center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 32px;
    color: rgba(255, 255, 255, .7);
    background-color: var(--pcolor, #333);
    box-shadow: 0 0 24px var(--pglow, rgba(136, 136, 136, .35));
}

.pc-info {
    display: block;
    text-align: center;
}

.pc-id {
    display: none;
}

.pc-name {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--pcolor, rgba(255, 255, 255, .5));
    opacity: .75;
}

.pc-speaking {
    display: none;
}

/* Dialogue body */
.dlg-body {
    flex: 1;
    padding: .7rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    background: rgba(245, 240, 232, .05);
    border-left: 2px solid var(--char-col, rgba(255, 255, 255, .2));
    border-radius: 0 3px 3px 0;
    min-height: 120px;
}

/* Speaker tag */
.speaker-tag {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--char-col, rgba(255, 255, 255, .5));
    margin-bottom: 2px;
}

/* Mood tag */
.dlg-mood {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--char-col, var(--text-muted));
    opacity: .6;
    margin-bottom: 2px;
}

/* Dialogue text */
.dlg-text {
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-main);
}

/* Voice block */
.line-voice-block {
    margin: .8rem 0;
    padding: .6rem 1rem .6rem 1.1rem;
    border-radius: 0 4px 4px 0;
    background: rgba(200, 0, 26, .06);
    border-left: 2px solid var(--voice-accent, var(--red));
    transition: none;
}

.voice-tag {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--voice-accent, var(--red));
    opacity: .55;
    margin-bottom: 3px;
}

.voice-text {
    font-style: italic;
    font-size: 20px;
    line-height: 1.5;
    color: #e85a5a;
}

.line-quote {
    border: 1px solid rgba(192, 0, 26, .18);
    background: rgba(192, 0, 26, .04);
    padding: .85rem 1.35rem;
    margin: .75rem 0;
    position: relative;
}

.line-quote::before {
    content: '❝';
    position: absolute;
    top: -.55rem;
    left: .8rem;
    background: #0e1a22;
    padding: 0 .2rem;
    color: var(--red-040);
    font-size: 15px;
}

.quote-text {
    font-style: italic;
    color: rgba(200, 190, 170, .75);
    font-size: 20px;
}

.line-sep {
    text-align: center;
    color: rgba(192, 0, 26, .3);
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: .35em;
    padding: .85rem 0;
}

/* Scene divider between scenes */
.scene-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2.2rem 0;
    margin: .5rem 0;
}

.scene-divider::before,
.scene-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(192, 0, 26, .25), transparent);
}

.scene-divider-symbol {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: .3em;
    color: var(--red-035);
    flex-shrink: 0;
}

/* ── Day grid (compact chips) ── */
.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: .4rem;
    padding: .3rem 0 .5rem;
}

.day-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 0 .4rem;
    background: rgba(192, 0, 26, .04);
    border: 1px solid rgba(192, 0, 26, .2);
    border-radius: 2px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.day-chip:hover {
    background: var(--red-012);
    border-color: rgba(192, 0, 26, .55);
}

.day-chip.active {
    background: rgba(192, 0, 26, .18);
    border-color: rgba(192, 0, 26, .85);
}

.day-chip-num {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .06em;
    color: rgba(192, 0, 26, .65);
    user-select: none;
    transition: color .2s;
}

.day-chip:hover .day-chip-num {
    color: rgba(192, 0, 26, .9);
}

.day-chip.active .day-chip-num {
    color: rgba(192, 0, 26, 1);
}

/* Past choices (already selected) */
.choice-btn.past {
    opacity: .25;
    pointer-events: none;
    transition: all .5s;
}

.choice-btn.past.chosen {
    opacity: 1;
    pointer-events: none;
    border-color: var(--red-040);
    background: var(--red-006);
    box-shadow: 0 0 25px rgba(192, 0, 26, .1), inset 0 0 30px rgba(192, 0, 26, .03);
}

.choice-btn.past.chosen .choice-num {
    color: var(--red);
    background: rgba(192, 0, 26, .08);
    text-shadow: 0 0 12px rgba(192, 0, 26, .6);
}

.choice-btn.past.chosen .choice-text {
    color: rgba(255, 255, 255, .95);
}


/* ── Day chip states ── */
.day-chip.unplayed {
    border-color: var(--white-007);
    background: rgba(255, 255, 255, .01);
}

.day-chip.unplayed .day-chip-num {
    color: rgba(255, 255, 255, .2);
}

.day-chip.selected {
    background: rgba(192, 0, 26, .22);
    border-color: rgba(192, 0, 26, .9);
}

.day-chip.selected .day-chip-num {
    color: #fff;
}

/* ── Chip type: neutral (intro, épilogue) — blanc ── */
.day-chip.chip-type-neutral:not(.unplayed) {
    border-color: rgba(255, 255, 255, .25);
}
.day-chip.chip-type-neutral:not(.unplayed) .day-chip-num {
    color: rgba(255, 255, 255, .55);
}
.day-chip.chip-type-neutral:hover {
    background: rgba(255, 255, 255, .07);
    border-color: rgba(255, 255, 255, .45);
}
.day-chip.chip-type-neutral:hover .day-chip-num {
    color: rgba(255, 255, 255, .85);
}
.day-chip.chip-type-neutral.selected {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .75);
}
.day-chip.chip-type-neutral.selected .day-chip-num {
    color: #fff;
}

/* ── Chip type: flashback — rouge-violet ── */
.day-chip.chip-type-flashback:not(.unplayed) {
    border-color: rgba(160, 20, 140, .4);
}
.day-chip.chip-type-flashback:not(.unplayed) .day-chip-num {
    color: rgba(200, 70, 180, .8);
}
.day-chip.chip-type-flashback:hover {
    background: var(--violet-012);
    border-color: var(--violet-055);
}
.day-chip.chip-type-flashback:hover .day-chip-num {
    color: rgba(200, 70, 180, .9);
}
.day-chip.chip-type-flashback.selected {
    background: rgba(160, 20, 140, .22);
    border-color: var(--violet-090);
}
.day-chip.chip-type-flashback.selected .day-chip-num {
    color: rgba(220, 110, 200, 1);
}

/* ── Chip type: ending — bleu ── */
.day-chip.chip-type-ending:not(.unplayed) {
    border-color: rgba(30, 90, 200, .4);
}
.day-chip.chip-type-ending:not(.unplayed) .day-chip-num {
    color: rgba(80, 140, 230, .8);
}
.day-chip.chip-type-ending:hover {
    background: var(--blue-012);
    border-color: var(--blue-055);
}
.day-chip.chip-type-ending:hover .day-chip-num {
    color: rgba(80, 140, 230, .9);
}
.day-chip.chip-type-ending.selected {
    background: rgba(30, 90, 200, .22);
    border-color: var(--blue-090);
}
.day-chip.chip-type-ending.selected .day-chip-num {
    color: rgba(120, 170, 255, 1);
}

/* ── Day detail panel ── */
.day-detail {
    margin-top: .5rem;
    border-top: 1px solid rgba(192, 0, 26, .2);
    padding-top: .5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.day-detail-header {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(192, 0, 26, .85);
    margin-bottom: .25rem;
}

.day-detail-scene {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .4);
    text-transform: uppercase;
    text-decoration: none;
    padding: .2rem 0 .2rem .5rem;
    border-left: 2px solid rgba(192, 0, 26, .15);
    transition: color .2s, border-color .2s;
    line-height: 1.4;
}

.day-detail-scene:hover {
    color: rgba(255, 255, 255, .8);
    border-left-color: rgba(192, 0, 26, .6);
}

.day-detail-choice {
    display: flex;
    align-items: flex-start;
    gap: .3rem;
    padding-left: .4rem;
}

.day-detail-arrow {
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(192, 0, 26, .5);
    flex-shrink: 0;
    line-height: 1.5;
}

.day-detail-choice-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-style: italic;
    line-height: 1.5;
}

.day-detail-choice-block {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding-left: .4rem;
    margin-bottom: .35rem;
}

.day-detail-choice-chosen {
    display: flex;
    align-items: flex-start;
    gap: .3rem;
}

.day-detail-choice-chosen .day-detail-choice-text {
    color: rgba(255, 255, 255, .55);
    font-style: normal;
}

.day-detail-choice-alt {
    display: flex;
    align-items: flex-start;
    gap: .3rem;
    padding-left: .8rem;
}

.day-detail-arrow-alt {
    color: rgba(255, 255, 255, .15);
}

.day-detail-choices-title {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--red-040);
    padding: .4rem .4rem .2rem;
    margin-top: .2rem;
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.day-detail-empty {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .15);
    padding: .2rem .5rem;
}

.cursor {
    display: inline-block;
    width: 1.5px;
    height: .85em;
    background: var(--red);
    margin-left: 1px;
    vertical-align: middle;
    animation: blink .9s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0
    }
}

/* Choices */
.choices-label {
    font-family: var(--font-mono);
    font-size: 20px;
    letter-spacing: .35em;
    text-transform: uppercase;
    color: var(--text-main);
    text-align: center;
    padding-top: 1.5rem;
    margin-bottom: 1.2rem;
    position: relative;
}

.choices-label::before,
.choices-label::after {
    content: '';
    position: absolute;
    top: 0;
    height: 1px;
    width: 35%;
    background: linear-gradient(90deg, transparent, var(--red-035), transparent);
}

.choices-label::before {
    left: 0;
}

.choices-label::after {
    right: 0;
}

.choice-btn {
    position: relative;
    overflow: hidden;
    background: rgba(192, 0, 26, .03);
    border: 1px solid var(--red-012);
    border-radius: 2px;
    display: flex;
    align-items: stretch;
    width: 100%;
    text-align: left;
    cursor: pointer;
    padding: 0;
    transition: all .35s cubic-bezier(.22, .61, .36, 1);
    opacity: 0;
    transform: translateX(-12px);
}

.choice-btn.shown {
    opacity: 1;
    transform: none;
}

/* Fond animé au hover */
.choice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--red-012) 0%, rgba(192, 0, 26, .03) 40%, transparent 100%);
    opacity: 0;
    transition: opacity .35s;
}

.choice-btn:hover::before {
    opacity: 1;
}

/* Ligne lumineuse en haut */
.choice-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--red) 50%, transparent 100%);
    opacity: 0;
    transition: opacity .4s;
}

.choice-btn:hover::after {
    opacity: .7;
}

.choice-num {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    line-height: 1;
    color: rgba(192, 0, 26, .5);
    min-width: 3.2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(192, 0, 26, .1);
    padding: .9rem .4rem;
    transition: all .35s;
    position: relative;
    z-index: 1;
    letter-spacing: .12em;
}

.choice-text {
    font-family: 'Times New Roman', Times, serif;
    font-size: 20px;
    color: rgba(255, 255, 255, .55);
    padding: .85rem 1.15rem;
    flex: 1;
    transition: all .35s;
    line-height: 1.55;
    position: relative;
    z-index: 1;
}

.choice-btn:hover {
    border-color: var(--red-040);
    background: var(--red-006);
    box-shadow: 0 0 25px rgba(192, 0, 26, .1), inset 0 0 30px rgba(192, 0, 26, .03);
    transform: translateX(4px);
}

.choice-btn:hover .choice-num {
    color: var(--red);
    background: rgba(192, 0, 26, .08);
    text-shadow: 0 0 12px rgba(192, 0, 26, .6);
}

.choice-btn:hover .choice-text {
    color: rgba(255, 255, 255, .95);
}

/* Active / click */
.choice-btn:active {
    transform: scale(.985) translateX(4px);
    border-color: var(--red);
    box-shadow: 0 0 35px rgba(192, 0, 26, .25), inset 0 0 40px var(--red-006);
}

/* Ending */
.ending-narrative p {
    font-style: italic;
    color: var(--text-dim);
    font-size: 20px;
    text-align: center;
    line-height: 2.1;
    border-top: 1px solid var(--white-007);
    padding-top: 1.5rem;
}

.ending-narrative p+p {
    border-top: none;
    padding-top: 0;
}

.community-stat {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .15em;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 1.5rem;
}

/* ── SUCCÈS ── */
.ach-block {
    border: 1px solid var(--white-007);
    border-left: 2px solid var(--red-dim);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* .ach-title conservé pour compatibilité fin.php */
.ach-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.ach-trophy-icon {
    font-size: 14px;
    vertical-align: middle;
    color: rgba(192, 0, 26, .7);
}

.ach-count {
    color: rgba(192, 0, 26, .7);
}

.ach-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.ach-item {
    border: 1px solid var(--white-010);
    border-radius: 1px;
    padding: .4rem .75rem;
    background: rgba(255, 255, 255, .03);
    cursor: default;
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    transition: border-color .2s, background .2s;
}

.ach-item:hover {
    border-color: var(--red-035);
    background: rgba(192, 0, 26, .04);
}

.ach-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .65);
}

.ach-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--red-dim);
    border: 1px solid var(--red-040);
    padding: .1rem .3rem;
    border-radius: 1px;
}

.ach-new {
    border-color: var(--red-040);
    background: var(--red-006);
}

.ach-locked {
    opacity: .22;
}

/* Dans fin.php : description visible au survol via tooltip natif (title)
   + affichage inline sous le label */
.ach-desc {
    display: none;
}

/* ── TITRE RÉSUMÉ ── */
.ending-summary-title {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: .5rem;
}

/* ── BLOC BILAN ── */
.ending-recap {
    border: 1px solid var(--white-007);
    border-left: 2px solid var(--red-dim);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Titre de section partagé (Bilan + Succès) */
.recap-section-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--red);
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: -.25rem;
}

.recap-section-icon {
    font-size: 22px;
    color: var(--red);
}

.recap-section-count {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
    letter-spacing: .1em;
}

/* Lignes Fin / Scènes */
.recap-main-rows {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.recap-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.recap-row-key {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 4.5rem;
    flex-shrink: 0;
}

.recap-row-val {
    font-family: var(--font-mono);
    font-size: 15px;
    color: rgba(255, 255, 255, .8);
}

/* Sous-titres Amitié / Enquête */
.recap-sub-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-top: 1px solid var(--white-007);
    padding-top: 1rem;
    margin-bottom: -.25rem;
}

/* ── CARTES PERSONNAGES (Amitié) ── */
.recap-chars-grid {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.recap-char-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .85rem;
}

.recap-char-sq {
    width: 52px;
    height: 52px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    transition: filter .3s;
}

.recap-char-sq img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.recap-char-sq.recap-char-grey {
    filter: grayscale(1) brightness(.4);
}

.recap-char-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--char-col, #555);
    color: rgba(255, 255, 255, .9);
}

.recap-char-name {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
}

.recap-char-card-grey .recap-char-name {
    color: rgba(255, 255, 255, .25);
}

.recap-char-pct {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: rgba(255, 255, 255, .85);
}

.recap-char-card-grey .recap-char-pct {
    color: rgba(255, 255, 255, .3);
}

.recap-char-pct-unit {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, .4);
}

.recap-char-pts {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: .05em;
}


/* ── ENQUÊTE ── */
.recap-enquete-block {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.recap-enquete-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    flex-wrap: wrap;
}

.recap-enquete-pct {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, .75);
}

/* Badges */
.recap-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: .3rem .8rem;
    border-radius: 1px;
}

.badge-ok {
    background: rgba(26, 143, 160, .15);
    border: 1px solid rgba(26, 143, 160, .4);
    color: #1a8fa0;
}

.badge-no {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--white-010);
    color: var(--text-muted);
}

.recap-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, .2);
    letter-spacing: .08em;
}

.recap-gauge-wrap {
    flex: none;
    width: 160px;
    margin-left: auto;
    height: 3px;
    background: var(--glass-b);
    border-radius: 2px;
    overflow: hidden;
    min-width: 60px;
    align-self: center;
}

.recap-gauge-fill {
    height: 100%;
    background: rgba(26, 143, 160, .65);
    border-radius: 2px;
    transition: width 1.2s cubic-bezier(.4, 0, .2, 1);
}

.book-cta {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: center;
    background: rgba(192, 0, 26, .10);
    border: 1px solid rgba(192, 0, 26, .38);
    padding: 2rem 2.2rem;
    border-radius: 2px;
    box-shadow: 0 6px 40px rgba(192, 0, 26, .18), 0 4px 30px rgba(0, 0, 0, .4);
}

.book-cta-cover {
    width: 300px;
    flex-shrink: 0;
    box-shadow: 0 8px 32px rgba(192, 0, 26, .55);
}

.book-cta-info {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex: 1;
}

.book-cta-lbl {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .22em;
    color: var(--red-dim);
    text-transform: uppercase;
}

.book-title-cta {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: .06em;
    color: #fff;
    line-height: 1.15;
}

.book-award {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .38);
    text-transform: uppercase;
    line-height: 1.7;
}

.book-link {
    display: inline-block;
    margin-top: .6rem;
    padding: .6rem 1.6rem;
    background: var(--red-012);
    border: 1px solid var(--red);
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .15em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all .2s;
    align-self: flex-start;
}

.book-link:hover {
    background: rgba(192, 0, 26, .28);
    color: #ff3040;
}

.fin-link-btn {
    border: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    padding: 1rem 2rem;
    border-radius: 1px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--red-dim), var(--red));
    color: #fff;
    box-shadow: 0 4px 30px var(--red-035);
    transition: all .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
}

.fin-link-btn:hover {
    box-shadow: 0 6px 50px rgba(192, 0, 26, .55);
    transform: translateY(-1px);
}

.fin-wrapper,
.credits-page {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fin-wrapper {
    padding: 3rem 1rem;
    justify-content: flex-start;
}

.fin-card {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fin-card .page-subtitle {
    font-size: clamp(28px, 5vw, 40px);
}

.fin-separator {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, .1);
    margin: 0;
}

.replay-btn,
.credits-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .45);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .18em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 1px;
    transition: all .25s;
    box-sizing: border-box;
}

.replay-btn:hover,
.credits-back:hover {
    border-color: var(--red-dim);
    color: rgba(255, 255, 255, .75);
    background: var(--red-006);
}

.replay-btn {
    width: 100%;
    cursor: pointer;
}

.replay-btn-secondary {
    border-color: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .3);
}

.replay-btn-secondary:hover {
    border-color: rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .55);
    background: transparent;
}

.fin-btns {
    display: flex;
    gap: .75rem;
}

.fin-btns .replay-btn {
    flex: 1;
}

.credits-back {
    margin-top: 64px;
}

/* ══ EN-TÊTE PARTAGÉ (fin.php / stats.php) ══ */
.page-header {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.page-series {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: rgba(192, 0, 26, .65);
}

.page-subtitle {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: rgba(255, 255, 255, .7);
    letter-spacing: .06em;
}

/* ══ STATS DASHBOARD ══ */
.stats-wrapper {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    padding: 3rem 1.5rem;
    max-width: 860px;
    margin: 0 auto;
}

.stats-header {
    margin-bottom: 2.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: rgba(245, 240, 232, .04);
    border: 1px solid rgba(255, 255, 255, .07);
    padding: 1.2rem 1rem;
    border-radius: 2px;
}

.stat-card-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: rgba(192, 0, 26, .65);
    margin-bottom: .4rem;
}

.stat-card-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.stat-card-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, .3);
    margin-top: .4rem;
}

.stats-section-title {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: rgba(192, 0, 26, .55);
    margin-bottom: 1rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.ending-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.ending-label {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .05em;
    color: rgba(255, 255, 255, .55);
}

.ending-count {
    font-family: var(--font-mono);
    font-size: 13px;
    color: #fff;
    min-width: 3rem;
    text-align: right;
}

.ending-pct {
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, .3);
    min-width: 4rem;
    text-align: right;
}

.ending-bar-wrap {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, .06);
    border-radius: 2px;
    overflow: hidden;
}

.ending-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red-dim), var(--red));
    border-radius: 2px;
}

.stats-avg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
    margin-top: 1.5rem;
}

.avg-item {
    background: rgba(245, 240, 232, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    padding: .9rem 1rem;
    border-radius: 2px;
}

.avg-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .25);
    margin-bottom: .3rem;
}

.avg-value {
    font-size: 22px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: rgba(255, 255, 255, .8);
}

.stats-back {
    margin-top: 3rem;
}

.empty-notice {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255, 255, 255, .25);
    padding: 2rem 0;
    text-align: center;
    letter-spacing: .1em;
}

/* ══ CRÉDITS ══ */
.credits-page {
    padding: 60px 24px 80px;
}

.credits-header {
    margin-bottom: 64px;
}

.credits-grid {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.credits-block {
    border-left: 2px solid var(--red-dim);
    padding-left: 20px;
}

.credits-role {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 10px;
}

.credits-name {
    font-family: var(--font-heading);
    font-size: 20px;
    color: #fff;
    line-height: 1.35;
}

.credits-name a {
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .05em;
    display: block;
    margin-top: 6px;
    transition: color .2s;
}

.credits-name a:hover {
    color: var(--red);
}

.credits-name ul {
    list-style: none;
    margin-top: 4px;
}

.credits-name ul li {
    font-family: 'Times New Roman', Times, serif;
    font-size: 20px;
    color: rgba(255, 255, 255, .7);
    line-height: 1.5;
}

.credits-name ul li::before {
    content: '— ';
    color: var(--red-dim);
}

.credits-sep {
    width: 40px;
    height: 1px;
    background: var(--red-dim);
    margin: 0 auto;
    opacity: .5;
}

.credits-section-sep {
    width: 100%;
    max-width: 560px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--red-dim), transparent);
    margin: 16px 0;
    opacity: .4;
}

.credits-section-title {
    font-family: var(--font-heading);
    font-size: 15px;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .22);
    text-align: center;
    margin-bottom: 32px;
}

.credits-note {
    font-size: 20px;
    line-height: 1.7;
    color: rgba(255, 255, 255, .5);
    margin-top: 8px;
    font-style: italic;
}

.credits-note a {
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 10px;
    transition: color .2s;
}

.credits-note a:hover {
    color: var(--red);
}

.credits-block-dim {
    border-left: 2px solid rgba(138, 0, 18, .35);
    padding-left: 20px;
}

.credits-disclaimer-text {
    font-size: 20px;
    line-height: 1.75;
    color: var(--white-035);
    font-style: italic;
}

.credits-disclaimer-text+.credits-disclaimer-text {
    margin-top: 12px;
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE ❶ — TABLETTE + MOBILE  (max-width : 900px)
   S'applique à tous les écrans jusqu'à 900px de large.
   Les règles du bloc ❷ ci-dessous surchargent celles-ci pour ≤ 640px.
══════════════════════════════════════════════════════════════════ */
@media(max-width:900px) {

    /* Portrait du personnage — masqué sur petit écran */
    #portrait-panel {
        display: none !important;
    }

    /* Récap nav — panneau plein écran coulissant */
    .scene-recap {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 300;
        background: var(--bg-deep);
        border-right: none;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.22, .61, .36, 1);
        overflow-y: auto;
        padding: .75rem 1rem 2rem;
    }

    .scene-recap.nav-open {
        transform: translateX(0);
    }

    /* Bouton fermeture (✕) visible en mode drawer */
    .topbar-btn.recap-close-btn {
        display: flex;
    }

    /* Backdrop masqué — panel plein écran, pas besoin */
    .nav-backdrop {
        display: none !important;
    }

    /* Layout — une seule colonne */
    .game-layout {
        grid-template-columns: 1fr !important;
        grid-template-areas: none !important;
    }

    .scene-recap {
        grid-column: 1;
    }

    /* Topbar fixe mobile */
    .game-topbar-mobile {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
        padding: .75rem 1.25rem;
        margin-bottom: 0;
        background: linear-gradient(135deg, rgba(10, 28, 48, .72) 0%, rgba(14, 55, 70, .68) 100%);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid rgba(26, 143, 160, .18);
    }

    /* Compensation topbar fixe (68px) + marges réduites */
    #page-game {
        padding: 76px 0.5rem 4rem;
    }

    /* scrollIntoView laisse 80px en haut pour la topbar */
    html {
        scroll-padding-top: 80px;
    }

    /* Marge supérieure sur la zone de jeu pour éviter que le premier
       titre soit masqué par la topbar fixe */
    .game-layout {
        margin-top: 0.5rem;
    }

    /* Padding interne réduit sur la carte texte */
    .scene-card {
        padding: 1.25rem 1rem 4rem;
    }

    /* Page de fin — CTA livre en colonne sur tablette/mobile */
    .book-cta {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .book-cta-cover {
        width: 100%;
        max-width: 280px;
    }

    /* Zones tactiles minimum 48px (accessibilité tactile) */
    .choice-btn {
        min-height: 52px;
        padding: .85rem 1rem;
    }

    .pause-btn {
        min-height: 52px;
    }

    .topbar-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Fragments — 2 colonnes sur tablette */
    .ach-list {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE ❷ — MOBILE UNIQUEMENT  (max-width : 640px)
   Surcharge les règles du bloc ❶ pour les petits écrans.
══════════════════════════════════════════════════════════════════ */
@media(max-width:640px) {

    /* Topbar fixe — padding légèrement augmenté côté 640 */
    #page-game {
        padding: 76px 1rem 4rem;
    }

    /* Page de fin — couverture réduite sur petit écran */
    .book-cta {
        padding: 1.5rem 1.25rem;
        gap: 1.25rem;
    }

    .book-cta-cover {
        max-width: 220px;
    }

    /* Portrait inline dans les bulles de dialogue */
    .portrait {
        width: 70px;
    }

    .portrait img {
        width: 70px;
        height: 70px;
    }

    .portrait-fallback {
        width: 70px;
        height: 70px;
        font-size: 15px;
    }

    .dlg-body {
        min-height: 70px;
    }

    /* Texte légèrement réduit sur très petits écrans */
    .dlg-text {
        font-size: 15px;
    }

    /* Fragments — 1 colonne sur mobile */
    .ach-list {
        grid-template-columns: 1fr;
    }
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE ❸ — GRAND ÉCRAN UNIQUEMENT  (min-width : 901px)
══════════════════════════════════════════════════════════════════ */
@media(min-width:901px) {

    /* Achievements — afficher la description en colonne sur desktop */
    .ach-block .ach-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ach-block .ach-desc {
        display: block;
        font-size: 10px;
        color: var(--white-035);
        font-family: 'Times New Roman', Times, serif;
        font-style: italic;
        line-height: 1.4;
        margin-top: .15rem;
    }

    .ach-block .ach-list {
        gap: .75rem;
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Utility classes (inline-style replacements) ── */
.slot-disabled {
    opacity: .35;
}

.credits-meta {
    font-size: 15px;
    color: rgba(255, 255, 255, .45);
}

.mt-section {
    margin-top: 48px;
}

.mt-lg {
    margin-top: 2.5rem;
}

.stat-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, .6);
}

.btn-muted {
    border-color: rgba(255, 255, 255, .2);
    color: rgba(255, 255, 255, .4);
}