/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0a12;
    --text: #d0d0d8;
    --accent: #e94560;
    --accent-2: #5c7cfa;
    --border: #2a2a3a;
    --muted: #6a6a7a;

    --toaster-bg: #1a1a2e;
    --toaster-bg-alt: #16213e;
    --toaster-text: #e8e8f0;
    --toaster-accent: var(--accent);
    --toaster-border: #2a2a44;
    --toaster-radius: 12px;
    --toaster-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    --toaster-font: 'Georgia', 'Times New Roman', serif;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'SF Mono', 'Cascadia Code', 'Courier New', monospace;
}

html {
    font-size: 18px;
}

body {
    font-family: var(--toaster-font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: background var(--transition), color var(--transition);
}

/* ─── Contenu principal ──────────────────────────────── */
main#contenu {
    max-width: 640px;
    width: 100%;
    text-align: center;
    margin-bottom: 3rem;
}

main#contenu h1 {
    font-size: 2.2rem;
    font-weight: normal;
    margin-bottom: 1rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.sous-titre {
    color: var(--muted);
    font-style: italic;
    font-size: 1rem;
}

.description-page {
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.fin-texte {
    opacity: 0.7;
    animation: finPulse 4s ease-in-out infinite;
}

@keyframes finPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

/* ─── Navigation / Liens ──────────────────────────────── */
nav#liens {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    max-width: 600px;
}

nav#liens a {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
}

nav#liens a:hover {
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.2);
}

nav#liens a:active {
    transform: translateY(0);
}

/* Lien accident (surprise) */
.lien-accident {
    border-style: dashed !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    animation: accidentBlink 2s ease-in-out infinite;
    font-weight: bold;
    position: relative;
}
.lien-accident:hover {
    animation: accidentGlitch 0.3s ease-in-out infinite;
    border-color: #ffcc00 !important;
    color: #ffcc00 !important;
}

@keyframes accidentBlink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@keyframes accidentGlitch {
    0%,100% { transform: none; }
    20% { transform: translate(2px, -1px); }
    40% { transform: translate(-3px, 1px); }
    60% { transform: translate(-1px, -2px); }
    80% { transform: translate(1px, 2px); }
}

/* ─── Toaster ─────────────────────────────────────────── */
#toaster-container {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
}

.toaster {
    position: relative;
    background: var(--toaster-bg);
    color: var(--toaster-text);
    border: 2px solid var(--toaster-border);
    border-radius: var(--toaster-radius);
    box-shadow: var(--toaster-shadow), 0 0 60px rgba(233, 69, 96, 0.12), 0 0 0 1px rgba(255,255,255,0.03);
    padding: 1rem 1.5rem;
    max-width: 380px;
    min-width: 200px;
    font-family: var(--toaster-font);
    font-size: 0.9rem;
    line-height: 1.6;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    animation: toasterIn 0.4s ease-out forwards;
    transition: transform 0.4s ease, max-width 0.3s ease, font-size 0.3s ease,
                background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.toaster::before {
    content: var(--toaster-icone, '🗣');
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.toaster .toaster-texte {
    display: inline;
}

.toaster .toaster-fermer {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px;
    transition: color var(--transition);
}

.toaster .toaster-fermer:hover {
    color: var(--accent);
}

/* Lien [répondre] dans le toaster */
.toaster .toaster-repondre {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.toaster .toaster-repondre:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Positions supplémentaires pour toasters doubles */
#toaster-container-1.position-haut-gauche {
    top: 16px; left: 16px;
}
#toaster-container-2.position-bas-droite {
    bottom: 20px; right: 20px;
}
#toaster-container-2.position-bas-gauche {
    bottom: 20px; left: 16px;
}

/* ─── Tailles ───────────────────────────────────────── */

.toaster.taille-minuscule {
    max-width: 170px;
    min-width: 100px;
    padding: 0.5rem 0.8rem;
    font-size: 0.7rem;
    border-radius: 8px;
}
.toaster.taille-minuscule::before { font-size: 0.6rem; }

.toaster.taille-petit {
    max-width: 260px;
    min-width: 150px;
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    border-radius: 10px;
}

.toaster.taille-normal {
    max-width: 380px;
    min-width: 200px;
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
}

.toaster.taille-grand {
    max-width: 520px;
    min-width: 280px;
    padding: 1.3rem 2rem;
    font-size: 1.1rem;
}
.toaster.taille-grand::before { font-size: 1.2rem; }

.toaster.taille-immense {
    max-width: 700px;
    min-width: 350px;
    padding: 2rem 3rem;
    font-size: 1.3rem;
    border-radius: 20px;
    text-align: center;
}
.toaster.taille-immense::before {
    display: block;
    font-size: 2.5rem;
    margin: 0 0 0.8rem 0;
}

/* ─── Styles visuels ────────────────────────────────── */

.toaster.style-chuchote {
    font-style: italic;
    opacity: 0.95;
    --toaster-bg: #2d2d4a;
    --toaster-border: #606090;
    box-shadow: 0 4px 24px rgba(233, 69, 96, 0.2);
    letter-spacing: 0.03em;
}

.toaster.style-dramatique {
    --toaster-bg: #422828;
    --toaster-border: var(--accent);
    box-shadow: 0 8px 40px rgba(233, 69, 96, 0.55);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.toaster.style-urgent {
    --toaster-bg: #303008;
    --toaster-border: #ff9900;
    box-shadow: 0 0 40px rgba(255, 153, 0, 0.55);
    animation: toasterUrgentBordure 0.8s ease-in-out infinite;
    font-weight: 600;
}

.toaster.style-solennel {
    --toaster-bg: #1a281a;
    --toaster-border: #7ab87a;
    font-family: 'Georgia', 'Times New Roman', serif;
    text-align: center;
    box-shadow: 0 0 60px rgba(74, 138, 74, 0.35);
    letter-spacing: 0.04em;
    font-style: italic;
}

.toaster.style-glitch {
    --toaster-bg: #1e1e1e;
    --toaster-border: #0f0;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.05em;
    box-shadow: 0 0 35px rgba(0, 255, 0, 0.25);
}

/* ─── Animations d'entrée ──────────────────────────── */

.toaster.anim-apparaitre {
    animation: toasterIn 0.4s ease-out forwards;
}

.toaster.anim-glisser-gauche {
    animation: toasterSlideLeft 0.5s ease-out forwards;
}

.toaster.anim-glisser-droite {
    animation: toasterSlideRight 0.5s ease-out forwards;
}

.toaster.anim-rebondir {
    animation: toasterBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toaster.anim-trembler {
    animation: toasterIn 0.3s ease-out forwards, toasterShake 0.6s ease-in-out 0.3s 3;
}

.toaster.anim-flotter {
    animation: toasterIn 0.5s ease-out forwards, toasterFloat 4s ease-in-out 0.5s infinite;
}

.toaster.anim-dactylographier .toaster-texte {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--accent);
    animation: typewriter 3s steps(80, end), blinkCursor 0.7s step-end infinite;
    max-width: fit-content;
}

/* ─── Mouvements continus ──────────────────────────── */

.toaster.bouger-trembler {
    animation: toasterMicroShake 0.15s ease-in-out infinite;
}

.toaster.bouger-flotter {
    animation: toasterFloat 4s ease-in-out infinite;
}

.toaster.bouger-secouer {
    animation: toasterShake 0.6s ease-in-out;
}

.toaster.bouger-tourner {
    animation: toasterTilt 6s ease-in-out infinite;
}

.toaster.bouger-pulsation {
    animation: toasterPulse 2s ease-in-out infinite;
}

/* ─── Styles extrêmes (rares, surprenants) ──────────── */

/* Possession : le toaster prend le contrôle de l'écran */
.toaster.style-possession {
    --toaster-bg: #0a0000;
    --toaster-border: #ff0040;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 85vw !important;
    width: 600px;
    padding: 3rem !important;
    font-size: 1.5rem !important;
    text-align: center;
    z-index: 99999 !important;
    box-shadow: 0 0 120px rgba(255,0,60,0.7), 0 0 300px rgba(255,0,60,0.3), 0 0 0 2000px rgba(0,0,0,0.85) !important;
    animation: possessionEntree 0.4s cubic-bezier(0.2, 0, 0.2, 1.2) forwards !important;
}
.toaster.style-possession::before {
    font-size: 4rem !important;
    display: block !important;
    margin: 0 0 1.5rem 0 !important;
}
@keyframes possessionEntree {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Glitch extrême : distorsion visuelle */
.toaster.style-glitch-extreme {
    --toaster-bg: #000;
    --toaster-border: #ff0080;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 50px rgba(255,0,128,0.5), 4px 0 0 rgba(0,255,255,0.3), -4px 0 0 rgba(255,0,0,0.3) !important;
    animation: glitchExtreme 0.25s ease-in-out infinite !important;
    text-shadow: 2px 0 0 rgba(255,0,0,0.6), -2px 0 0 rgba(0,255,255,0.6) !important;
}
@keyframes glitchExtreme {
    0%,100% { transform: none; }
    8% { transform: translate(-6px, 2px) skew(2deg); }
    16% { transform: translate(5px, -1px) skew(-1deg); }
    24% { transform: translate(-3px, -3px); }
    36% { transform: translate(8px, 1px) skew(3deg); }
    48% { transform: none; }
    62% { transform: translate(-5px, -2px) skew(-2deg); }
    74% { transform: translate(2px, 3px) skew(1deg); }
}

/* ─── Animations d'entrée spectaculaires ────────────── */

/* Flashbang : flash lumineux puis apparition */
.toaster.anim-flashbang {
    animation: flashbangEntree 0.9s ease-out forwards;
}
@keyframes flashbangEntree {
    0% { opacity: 0; transform: scale(0.3); box-shadow: 0 0 0 2000px rgba(255,255,255,0.9), 0 0 0 0 rgba(255,255,255,0); }
    15% { opacity: 1; box-shadow: 0 0 0 2000px rgba(255,255,255,0.9), 0 0 0 0 rgba(255,255,255,0); }
    40% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 80px rgba(233,69,96,0.5), 0 0 0 2000px rgba(0,0,0,0.7); }
    65% { box-shadow: 0 0 0 2000px rgba(0,0,0,0.5), 0 0 40px rgba(233,69,96,0.3); }
    100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2000px rgba(0,0,0,0), var(--toaster-shadow); }
}

/* Déchirure : entre par le haut en déchirant l'écran */
.toaster.anim-dechirure {
    animation: dechirureEntree 0.6s cubic-bezier(0.2, 0, 0.1, 1) forwards;
}
@keyframes dechirureEntree {
    0% { transform: translateY(-120vh) scale(1, 0.1); opacity: 0; }
    50% { transform: translateY(-10px) scale(1, 1.2); opacity: 1; }
    100% { transform: translateY(0) scale(1, 1); opacity: 1; }
}

/* ─── Mouvements extrêmes ───────────────────────────── */

/* Séisme : secousses violentes */
.toaster.bouger-seisme {
    animation: seismeViolent 0.12s ease-in-out infinite !important;
}
@keyframes seismeViolent {
    0%,100% { transform: translate(0,0) rotate(0deg); }
    20% { transform: translate(-8px, 3px) rotate(-2deg); }
    40% { transform: translate(6px, -4px) rotate(1.5deg); }
    60% { transform: translate(-4px, -2px) rotate(-3deg); }
    80% { transform: translate(7px, 5px) rotate(2deg); }
}

/* Poursuite : le toaster suit la souris (contrôlé par JS) */
.toaster.bouger-poursuite {
    transition: left 0.15s ease-out, top 0.15s ease-out !important;
    position: fixed !important;
}

/* Rotation 3D */
.toaster.bouger-spin {
    animation: spin3D 3s linear infinite;
}
@keyframes spin3D {
    0% { transform: perspective(600px) rotateY(0deg); }
    100% { transform: perspective(600px) rotateY(360deg); }
}

/* ─── Tailles extrêmes ──────────────────────────────── */

.toaster.taille-ecran {
    max-width: 80vw !important;
    width: 650px;
    min-width: 350px;
    padding: 3rem 4rem !important;
    font-size: 1.4rem !important;
    border-radius: 20px !important;
    border-width: 4px !important;
}
.toaster.taille-ecran::before {
    font-size: 3rem !important;
    display: block !important;
    margin: 0 0 1rem 0 !important;
}

.toaster.taille-gigantesque {
    max-width: 95vw !important;
    width: 800px;
    min-width: 400px;
    padding: 4rem !important;
    font-size: 1.8rem !important;
    font-weight: 900 !important;
    border-radius: 30px !important;
    border-width: 6px !important;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.toaster.taille-gigantesque::before {
    font-size: 5rem !important;
    display: block !important;
    margin: 0 0 1.5rem 0 !important;
}

@keyframes toasterIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes toasterOut {
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}
@keyframes toasterSlideLeft {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toasterSlideRight {
    from { opacity: 0; transform: translateX(-60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toasterBounce {
    0% { opacity: 0; transform: translateY(30px) scale(0.8); }
    50% { opacity: 1; transform: translateY(-10px) scale(1.05); }
    70% { transform: translateY(3px) scale(0.98); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes toasterShake {
    0%,100% { transform: translateX(0); }
    10%,50%,90% { transform: translateX(-4px); }
    30%,70% { transform: translateX(4px); }
}
@keyframes toasterFloat {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes toasterMicroShake {
    0%,100% { transform: translate(0,0); }
    25% { transform: translate(1px,-0.5px); }
    50% { transform: translate(-0.5px,1px); }
    75% { transform: translate(0.5px,0.5px); }
}
@keyframes toasterTilt {
    0%,100% { transform: rotate(0deg); }
    25% { transform: rotate(0.5deg); }
    75% { transform: rotate(-0.5deg); }
}
@keyframes toasterPulse {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes toasterUrgentBordure {
    0%,100% { border-color: #ff9900; }
    50% { border-color: #ffcc00; box-shadow: 0 0 50px rgba(255,153,0,0.6); }
}
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}
@keyframes blinkCursor {
    0%,100% { border-color: var(--accent); }
    50% { border-color: transparent; }
}

.toaster-sortie {
    animation: toasterOut 0.25s ease-in forwards;
}

/* ─── Positions toaster ───────────────────────────────── */

/* Bas droite */
#toaster-container.position-bas-droite {
    bottom: 20px;
    right: 20px;
}

/* Bas gauche */
#toaster-container.position-bas-gauche {
    bottom: 20px;
    left: 20px;
}

/* Centre */
#toaster-container.position-centre {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#toaster-container.position-centre .toaster {
    max-width: 500px;
    font-size: 1rem;
    padding: 1.5rem 2rem;
    text-align: center;
}

/* Haut pleine largeur */
#toaster-container.position-haut-plein {
    top: 0;
    left: 0;
    right: 0;
}
#toaster-container.position-haut-plein .toaster {
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    text-align: center;
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
}

/* ─── États d'humeur du toaster ───────────────────────── */
.humeur-calme .toaster {
    --toaster-bg: #2a2a48;
    --toaster-border: #5a5a80;
    --toaster-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.humeur-intrigue .toaster {
    --toaster-bg: #2f2f55;
    --toaster-border: #6a6a90;
}

.humeur-agace .toaster {
    --toaster-bg: #3d2a38;
    --toaster-border: #8a5a7a;
    animation: toasterAgace 2s ease-in-out infinite;
}

@keyframes toasterAgace {
    0%, 100% { box-shadow: 0 4px 20px rgba(233, 69, 96, 0.15); }
    50% { box-shadow: 0 4px 28px rgba(233, 69, 96, 0.4); }
}

.humeur-dramatique .toaster {
    --toaster-bg: #422828;
    --toaster-border: var(--accent);
    --toaster-shadow: 0 8px 40px rgba(233, 69, 96, 0.55);
    font-size: 1rem;
}

.humeur-chaotique .toaster {
    --toaster-bg: #3a284a;
    --toaster-border: #b45af8;
    animation: toasterChaos 0.3s ease-in-out infinite;
}

@keyframes toasterChaos {
    0% { transform: translate(0, 0); }
    25% { transform: translate(2px, -1px); }
    50% { transform: translate(-1px, 2px); }
    75% { transform: translate(1px, 1px); }
    100% { transform: translate(0, 0); }
}

/* ─── Indicateur d'humeur ────────────────────────────── */

#humeur-indicateur {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    z-index: 5000;
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.8s ease, transform 0.8s ease;
    text-shadow: 0 0 8px rgba(0,0,0,0.5);
}
#humeur-indicateur:hover {
    opacity: 0.8;
}

/* ─── Accessibility ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .toaster,
    .toaster-sortie,
    nav#liens a,
    .humeur-chaotique .toaster,
    .humeur-agace .toaster {
        animation: none !important;
        transition: none !important;
    }
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
    html { font-size: 16px; }
    body { padding: 1rem; }
    main#contenu h1 { font-size: 1.6rem; }
    .toaster { max-width: 280px; font-size: 0.85rem; }
    nav#liens { flex-direction: column; align-items: center; }
    nav#liens a { width: 100%; text-align: center; }
}
