/* ============================================================
   Neiri Chronicles — tema dark-fantasy (palette blu/oro)
   Palette approvata dall'utente. Testi predisposti in più lingue.
   ============================================================ */
/* Font del gioco: variante Neiri con glifi Latin estesi
   (assets/fonts/alagard_neiri.ttf), self-hosted come woff2 + ttf fallback. */
@font-face {
    font-family: 'Alagard';
    src: url('../fonts/alagard.woff2') format('woff2'),
         url('../fonts/alagard.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* --- Palette approvata --- */
    --bg:        #0B0F14;
    --bg-soft:   #15212E;
    --panel:     #1B2C3B;
    --panel-2:   #22384B;
    --border:    #2C4356;
    --text:      #E9F0F3;
    --muted:     #9FB2C2;
    --accent:    #2691F2;
    --accent-2:  #52ACEC;
    --gold:      #D6AE59;
    --gold-soft: #F5D366;
    --heraldic:  #992317;
    --nature:    #4E512C;
    /* derivati semantici */
    --danger:    #C0473B;
    --success:   #3FA98A;
    --radius:    12px;
    --shadow:    0 10px 30px rgba(0,0,0,.5);
    /* Font del gioco (Alagard) con fallback di sistema per leggibilità */
    --font-game: 'Alagard', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    font-family: var(--font-game);
    background:
        radial-gradient(1200px 600px at 50% -200px, rgba(38,145,242,.22), transparent),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.lang-ja {
    --font-game: 'Alagard', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', 'Meiryo', serif;
}

main { flex: 1; }

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, .brand-name { font-family: var(--font-game); letter-spacing: .3px; }

.container { width: min(1120px, 92%); margin: 0 auto; }

/* ---------------- Header ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(11,15,20,.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

/* HOME: l'header resta sopra la title screen, senza occupare spazio nel flow.
   Le pagine interne mantengono invece l'header sticky standard. */
body.has-hero .site-header {
    position: fixed;
    left: 0;
    right: 0;
    background:
        linear-gradient(180deg, rgba(11, 15, 20, .88), rgba(11, 15, 20, .58));
    border-bottom-color: rgba(214, 174, 89, .22);
}

.header-inner { display: flex; align-items: center; gap: 18px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-name { font-size: 20px; font-weight: 700; }
.main-nav { display: flex; gap: 6px; margin-left: 8px; flex: 1; }
.main-nav a {
    color: var(--muted); padding: 8px 14px; border-radius: 8px;
    font-weight: 500; font-size: 15px; transition: .15s;
}
.main-nav a:hover { color: var(--text); background: var(--panel); }
.main-nav a.active { color: var(--gold-soft); background: var(--panel); }
.mobile-menu-trigger { display: none; }
.studio-mark {
    width: 40px;
    height: auto;
    display: block;
    flex: 0 0 auto;
    opacity: .95;
}
.lang-switcher {
    position: relative;
    display: flex;
    align-items: center;
}
.lang-trigger {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(214,174,89,.34);
    border-radius: 8px;
    background: rgba(11,15,20,.52);
    color: var(--gold-soft);
    cursor: pointer;
    font-family: inherit;
    transition: .15s;
}
.lang-trigger:hover,
.lang-trigger[aria-expanded="true"] {
    color: #fff;
    background: rgba(255,255,255,.08);
    border-color: rgba(245,211,102,.58);
}
.lang-trigger svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1200;
    min-width: 168px;
    padding: 6px;
    border: 1px solid rgba(214,174,89,.28);
    border-radius: 8px;
    background: rgba(11,15,20,.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.lang-menu[hidden] { display: none; }
.lang-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.1;
}
.lang-menu a:hover {
    color: var(--text);
    background: rgba(255,255,255,.06);
}
.lang-menu a.active {
    color: #16110a;
    background: var(--gold-soft);
}
.lang-menu a span { font-size: 11px; }
.lang-menu a small {
    color: inherit;
    font-size: 12px;
}
.auth-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
    color: var(--gold-soft); font-weight: 600; font-size: 14px;
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
}
.inline { display: inline; margin: 0; }

/* ---------------- Bottoni ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: 15px; cursor: pointer; transition: .18s;
    font-family: inherit;
}
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-primary {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    color: #fff; box-shadow: 0 6px 18px rgba(38,145,242,.4);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); color: #fff; }
.btn-gold {
    background: linear-gradient(180deg, var(--gold-soft), var(--gold));
    color: #2a1c06;
}
.btn-gold:hover { transform: translateY(-1px); filter: brightness(1.05); color: #2a1c06; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel); color: var(--text); }
.btn-disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: .58;
    filter: grayscale(.18);
}
.btn-disabled:hover,
.btn:disabled:hover {
    transform: none;
    background: transparent;
    color: var(--text);
}
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------------- Flash ---------------- */
.flash-area { margin-top: 16px; display: grid; gap: 8px; }
.flash {
    padding: 12px 16px; border-radius: 10px; font-weight: 500;
    border: 1px solid var(--border);
}
.flash-success { background: rgba(63,169,138,.12); border-color: rgba(63,169,138,.4); color: #8fe3c8; }
.flash-error   { background: rgba(192,71,59,.14); border-color: rgba(192,71,59,.45); color: #f0a79e; }

/* ============================================================
   HERO CINEMATICO — title screen ricostruita a layer
   Tecnica: scroll-driven animations (animation-timeline: scroll())
   con custom properties aggiornate via JS (assets/js/parallax.js)
   come fallback per i browser senza scroll-timeline.
   ============================================================ */
/* ============================================================
   HERO — ricostruzione fedele della title screen del gioco.
   Riferimento: scripts/Main.gd
     - _build_opening_screen()      (z-order: bg < portrait/title)
     - _layout_opening_screen()     (posizioni dei tre asset)
     - _transition_opening_to_main_menu() ("press any key": il portrait
       scivola via in basso-destra e svanisce)
   Composizione:
     BG  = game_intro_anime  (cover, allineato in alto)
     SX  = title_game_anime  (sinistra, centrato verticalmente)
     DX  = portrait_intro    (basso-destra, sporge oltre i bordi)
   Lo scroll guida due progressi via assets/js/parallax.js:
     --portrait-p = uscita iniziale del portrait
     --p          = avanzamento del resto della scena, dopo il portrait
   ============================================================ */
.cinematic {
    /* la "scena" alta serve a dare margine di scroll all'effetto */
    position: relative;
    height: 280vh;            /* include una fase iniziale dedicata al portrait */
    --p: 0;                   /* progresso 0..1 della scena, aggiornato da JS */
    --portrait-p: 0;          /* progresso 0..1 dell'uscita portrait */
}
.cinematic .stage {
    position: sticky; top: 0;
    /* Full viewport reale: 100svh evita il "salto" delle barre mobile,
       100vh come fallback per browser senza unità svh. Lo stage è sticky a
       top:0; sulla home l'header è fixed, quindi la hero parte già sotto di lui. */
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}
.cinematic .layer {
    position: absolute;
    background-repeat: no-repeat;
    will-change: transform, opacity;
}

/* Background: game_intro_anime a copertura piena, allineato in alto
   (replica STRETCH_KEEP_ASPECT_COVERED + ancoraggio top di Main.gd). */
.cinematic .layer-bg {
    inset: 0;
    background-image: var(--img-bg);
    background-position: center top;
    background-size: cover;
    z-index: 1;
}

/* Title a sinistra, centrato verticalmente.
   Nel gioco: x ~ viewport*0.055, larghezza ~min(52%,620)*0.9, aspect 1086/1448. */
.cinematic .layer-title {
    left: 5.5%;
    top: 50%;
    width: min(46vw, 560px);
    aspect-ratio: 1448 / 1086;
    --te: calc(2 * var(--portrait-p) - var(--portrait-p) * var(--portrait-p));
    transform:
        translateY(-50%)
        translateX(calc(var(--te) * -22vw));
    background-image: var(--img-title);
    background-position: center;
    background-size: contain;
    z-index: 3;
    opacity: calc(1 - var(--te));
}

/* Portrait a destra/basso. Nel gioco è ancorato in basso a destra e sporge
   oltre i bordi (position = viewport - size*0.92 , viewport - size*0.9).
   EFFETTO "press any key" (Main.gd _transition_opening_to_main_menu):
     - vettore di uscita = +(viewport.x*0.32, viewport.y*0.18)  -> basso-destra
     - durata 1.05s, easing QUART/EASE_IN  (qui mappato su --p)
     - fade alpha->0 su ~0.8 del percorso (1.05*0.8)
   Mappiamo l'easing EASE_IN di Godot (cubic-ish) su --p con una potenza:
   pe = p^2 approssima TRANS_QUART/EASE_IN nella prima metà del moto. */
.cinematic .layer-portrait {
    right: -4vw;             /* sporge oltre il bordo destro come nel gioco */
    bottom: -6vh;            /* ancorato in basso, leggermente fuori */
    width: min(70vw, 64.4vh); /* ridotto del 30% (×0.7 da min(100vw,92vh)) */
    aspect-ratio: 1 / 1;
    z-index: 4;
    /* USCITA allo scroll = MIRROR ESATTO dell'intro (portrait-enter), al contrario.
       Intro:   da translate(8vw,6vh)+opacity0  ->  translate(0,0)+opacity1
       Uscita:  da translate(0,0)+opacity1      ->  translate(8vw,6vh)+opacity0
       Stessa MAGNITUDINE (8vw / 6vh) e stesso feel della curva dell'intro
       (cubic-bezier .16,.84,.32,1 = ease-out marcata, veloce->lento). Sul
       progresso lineare --p l'approssimiamo con l'ease-out quadratica
       e(p) = 2p - p^2 (mirror della p^2 usata altrove), così il movimento è
       simmetrico all'entrata sia su transform sia su opacity. */
    --pe: calc(2 * var(--portrait-p) - var(--portrait-p) * var(--portrait-p));
    transform:
        translate(
            calc(var(--pe) * 8vw),
            calc(var(--pe) * 6vh)
        );
    /* fade 1 -> 0 con la stessa easing del movimento (mirror dell'intro) */
    opacity: calc(1 - var(--pe));
}
/* INNER: porta l'immagine + intro one-shot al load.
   Entra SFUMANDO da BASSO-DESTRA (stessa direzione dell'uscita, al contrario):
   parte spostato in basso-destra con opacity 0 -> scivola in posizione con
   opacity 1. transform/opacity dell'inner si compongono con quelli dell'outer. */
.cinematic .portrait-inner {
    position: absolute; inset: 0;
    background-image: var(--img-portrait);
    background-position: center bottom;
    background-size: contain;
    background-repeat: no-repeat;
    will-change: transform, opacity;
    animation: portrait-enter 1.05s cubic-bezier(.16,.84,.32,1) both;
}
/* Entrata: da basso-destra (+) verso la posizione (0), fade 0 -> 1. */
@keyframes portrait-enter {
    from { transform: translate(8vw, 6vh); opacity: 0; }
    to   { transform: translate(0, 0);     opacity: 1; }
}

/* Testo centrale che sostituisce logo e portrait durante la loro uscita. */
.cinematic .hero-tagline {
    position: absolute;
    left: 50%;
    top: 50%;
    transform:
        translate(-50%, -50%)
        translateY(calc((1 - var(--portrait-p)) * 2vh))
        scale(calc(.97 + var(--portrait-p) * .03));
    z-index: 5;
    width: min(82vw, 980px);
    text-align: center;
    opacity: clamp(0, calc((var(--portrait-p) - .38) / .34), 1);
    pointer-events: none;
}
.cinematic .hero-tagline p {
    font-family: var(--font-game);
    font-size: clamp(26px, 3.6vw, 48px);
    line-height: 1.18;
    color: #fff;
    margin: 0;
    text-shadow:
        0 4px 18px rgba(0,0,0,.96),
        0 2px 4px rgba(0,0,0,1),
        0 0 18px rgba(11,15,20,.9);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Velo scuro che entra a fine transizione (verso le sezioni) */
.cinematic .veil {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 45%, var(--bg) 100%);
    opacity: calc(0.25 + var(--p) * 0.75);
    pointer-events: none;
    z-index: 2;
}

/* SLOT VIDEO predisposto: nascosto finché non viene agganciato un file.
   Quando presente, il <video> copre la scena come layer di sfondo. */
.cinematic .layer-video {
    inset: 0;
    z-index: 1;
}
.cinematic .layer-video video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Prompt "Scroll to begin" (analogo a opening_prompt_label del gioco) */
.cinematic .scroll-cue {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
    z-index: 1000;
    color: #fff;
    font-family: var(--font-game); letter-spacing: 2.5px; font-size: 18px;
    text-transform: uppercase;
    opacity: 1;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-align: center;
    text-shadow:
        0 4px 18px rgba(0,0,0,.96),
        0 2px 4px rgba(0,0,0,1),
        0 0 18px rgba(11,15,20,.9);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    transition:
        left .22s ease,
        right .22s ease,
        bottom .22s ease,
        transform .22s ease,
        font-size .22s ease;
}
.cinematic .scroll-cue .scroll-label {
    display: block;
    min-width: 128px;
}
.cinematic .scroll-cue .scroll-pointer {
    --scroll-pointer-rotation: 0deg;
    display: block;
    width: 54px; height: 54px;
    object-fit: contain;
    image-rendering: pixelated;
    filter:
        drop-shadow(0 8px 14px rgba(0,0,0,.76))
        drop-shadow(0 0 10px rgba(245,211,102,.62));
    animation: bob 1.45s ease-in-out infinite;
}
.cinematic .scroll-cue.is-at-bottom .scroll-pointer {
    --scroll-pointer-rotation: 180deg;
    transform: rotate(180deg);
}
.cinematic .scroll-cue.is-docked {
    left: auto;
    right: 28px;
    bottom: 24px;
    transform: none;
    z-index: 1000;
    font-size: 15px;
    letter-spacing: 2px;
}
.cinematic .scroll-cue.is-docked .scroll-label {
    min-width: 94px;
}
.cinematic .scroll-cue.is-at-bottom .scroll-label {
    min-width: 132px;
}
@keyframes bob {
    0%,100% { transform: translateY(0) rotate(var(--scroll-pointer-rotation, 0deg)); }
    50% { transform: translateY(6px) rotate(var(--scroll-pointer-rotation, 0deg)); }
}

/* Il mapping scroll -> custom properties resta in JS: dobbiamo separare
   l'uscita del portrait dal resto della scena, cosa non espressiva con un
   singolo scroll-timeline progressivo. */

/* ---------------- Hero statico (fallback / pagine interne) ---------------- */
.hero { padding: 84px 0 64px; text-align: center; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); margin: 0 0 14px; }
.hero .lead { font-size: clamp(16px, 2.4vw, 21px); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.tagline { color: var(--gold-soft); text-transform: uppercase; letter-spacing: 3px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }

/* ============================================================
   SEZIONI SCROLLABILI (scaffold) — contenuti SEGNAPOSTO (TBD)
   ============================================================ */
section.block { padding: 56px 0; position: relative; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 8px; }
.section-head p { color: var(--muted); margin: 0; }
.section-head .section-note {
    max-width: 760px;
    margin: 12px auto 0;
    font-size: 15px;
    line-height: 1.6;
}

.intro-block {
    isolation: isolate;
    overflow: hidden;
    padding-top: clamp(68px, 7vw, 108px);
    padding-bottom: clamp(70px, 8vw, 116px);
    background:
        linear-gradient(180deg, rgba(5, 9, 13, .92), rgba(5, 9, 13, .6) 36%, rgba(5, 9, 13, .94)),
        radial-gradient(circle at 50% 38%, rgba(245, 211, 102, .1), transparent 42%),
        url('../img/game/backgrounds/dungeon_room_intro.webp') center center / cover no-repeat,
        var(--bg);
    border-top: 1px solid rgba(214, 177, 82, .16);
    border-bottom: 1px solid rgba(214, 177, 82, .16);
}

.intro-block::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(0,0,0,.72), transparent 24%, transparent 76%, rgba(0,0,0,.72)),
        radial-gradient(circle at 50% 54%, transparent 0 42%, rgba(0,0,0,.38) 76%);
    pointer-events: none;
}

.intro-block .section-head h2,
.intro-block .section-head p {
    text-shadow: 0 3px 16px rgba(0, 0, 0, .86);
}

.intro-block .placeholder-band {
    border-color: rgba(245,211,102,.28);
    background:
        linear-gradient(180deg, rgba(7, 13, 18, .82), rgba(4, 8, 12, .9)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.025), rgba(255,255,255,.025) 12px, transparent 12px, transparent 24px);
    box-shadow: 0 22px 60px rgba(0,0,0,.34);
}

/* Reveal-on-scroll leggero per le sezioni (parallax "leggibile") */
.reveal {
    opacity: 0; transform: translateY(28px);
    transition: opacity .7s ease, transform .7s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Banda segnaposto evidente per contenuti ancora da definire */
.placeholder-band {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: repeating-linear-gradient(
        135deg, transparent, transparent 12px,
        rgba(255,255,255,.02) 12px, rgba(255,255,255,.02) 24px);
    padding: 40px 28px;
    text-align: center;
    color: var(--muted);
}
.placeholder-band .tbd {
    display: inline-block; margin-bottom: 8px;
    font-family: var(--font-game); letter-spacing: 2px;
    text-transform: uppercase; font-size: 12px; color: var(--gold-soft);
    border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px;
}

/* ---------------- Newsletter ---------------- */
.newsletter-block {
    scroll-margin-top: 128px;
    background:
        linear-gradient(180deg, rgba(5,14,18,.96), rgba(12,27,36,.98)),
        var(--bg-soft);
}
.newsletter-panel {
    max-width: 860px;
    margin: 0 auto;
    padding: 34px;
    border: 1px solid rgba(245,211,102,.24);
    border-radius: var(--radius);
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,.018), rgba(255,255,255,.018) 12px, transparent 12px, transparent 24px),
        rgba(255,255,255,.04);
    text-align: center;
    box-shadow: 0 22px 70px rgba(0,0,0,.24);
}
.newsletter-copy {
    max-width: 680px;
    margin: 0 auto 24px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.7;
    white-space: pre-line;
}
.newsletter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    max-width: 640px;
    margin: 0 auto;
}
.newsletter-form input[type="email"] {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(245,211,102,.26);
    border-radius: 10px;
    padding: 0 16px;
    color: var(--text);
    background: rgba(2,7,10,.72);
    font-family: inherit;
    font-size: 15px;
}
.newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--gold-soft);
    box-shadow: 0 0 0 3px rgba(245,211,102,.18);
}
.newsletter-note {
    max-width: 560px;
    margin: 14px auto 20px;
    color: rgba(184,197,207,.78);
    font-size: 13px;
    line-height: 1.55;
}
.newsletter-discord {
    min-width: 150px;
}

.newsletter-dialog {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, .58);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
}
.newsletter-dialog.is-open {
    opacity: 1;
    pointer-events: auto;
}
.newsletter-dialog__panel {
    display: grid;
    grid-template-columns: 150px minmax(0, 520px);
    align-items: end;
    gap: 0;
    width: min(720px, 100%);
    transform: translateY(12px) scale(.98);
    transition: transform .24s ease;
}
.newsletter-dialog.is-open .newsletter-dialog__panel {
    transform: translateY(0) scale(1);
}
.newsletter-dialog__portrait {
    align-self: end;
    height: 172px;
    overflow: hidden;
    z-index: 2;
    filter: drop-shadow(0 14px 18px rgba(0,0,0,.45));
}
.newsletter-dialog__portrait img {
    display: block;
    width: 178px;
    height: 178px;
    object-fit: cover;
    object-position: center bottom;
}
.newsletter-dialog__content {
    position: relative;
    margin-left: -18px;
}
.newsletter-dialog__name {
    display: inline-block;
    margin: 0 0 -1px 28px;
    padding: 7px 20px 6px;
    border: 2px solid rgba(245,211,102,.88);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    color: #2b1806;
    background: linear-gradient(180deg, #f9df8b, #b8892e);
    font-family: var(--font-game);
    font-size: 18px;
    line-height: 1;
    text-shadow: 0 1px rgba(255,255,255,.35);
}
.newsletter-dialog__box {
    min-height: 128px;
    padding: 26px 28px 22px;
    border: 2px solid rgba(245,211,102,.88);
    border-radius: 8px;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(15,31,42,.96), rgba(5,13,18,.98)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.025), rgba(255,255,255,.025) 10px, transparent 10px, transparent 20px);
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,.04),
        0 22px 70px rgba(0,0,0,.42);
}
.newsletter-dialog__box p {
    margin: 0 0 20px;
    color: var(--text);
    font-family: var(--font-game);
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.18;
    text-shadow: 0 2px 0 rgba(0,0,0,.38);
}
.newsletter-dialog__box .btn {
    min-width: 112px;
}
body.has-newsletter-dialog {
    overflow: hidden;
}

/* ---------------- Gameplay teaser ---------------- */
.gameplay-teaser {
    position: relative;
    min-height: clamp(150px, 19vw, 244px);
    margin: 0 0 22px;
    overflow: visible;
}
.teaser-party,
.teaser-enemies {
    position: absolute;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    gap: clamp(4px, 1vw, 12px);
}
.teaser-party { left: clamp(16px, 6vw, 84px); }
.teaser-enemies { right: clamp(16px, 6vw, 84px); }
.teaser-sprite {
    width: clamp(150px, 18vw, 230px);
    height: auto;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 16px 12px rgba(0, 0, 0, .45));
}
.teaser-aelor {
    margin-left: clamp(-42px, -3vw, -18px);
}
.teaser-goblin-stack,
.teaser-skeleton-mage {
    width: clamp(166px, 19vw, 244px);
}
.teaser-skeleton-mage {
    width: clamp(149px, 17.1vw, 220px);
    margin-left: clamp(-52px, -4vw, -24px);
}

/* ---------------- Aelor journey ---------------- */
.story-video-section {
    position: relative;
    padding-top: clamp(72px, 8vw, 118px);
    padding-bottom: clamp(78px, 9vw, 128px);
    background:
        linear-gradient(180deg, rgba(21, 33, 46, .96), rgba(7, 12, 18, .98)),
        radial-gradient(circle at 50% 0%, rgba(214, 177, 82, .16), transparent 42%),
        var(--bg-soft);
    border-top: 1px solid rgba(214, 177, 82, .18);
    border-bottom: 1px solid rgba(214, 177, 82, .18);
}
.story-video-section::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(245, 211, 102, .12), transparent);
    opacity: .55;
}
.story-video-section .container {
    position: relative;
    z-index: 1;
    width: min(1280px, 94%);
}
.story-video-head {
    margin-bottom: clamp(22px, 3vw, 34px);
}
.story-video-frame {
    position: relative;
    width: min(980px, 100%);
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(214, 177, 82, .48);
    border-radius: var(--radius);
    background: #05080c;
    box-shadow:
        0 34px 110px rgba(0, 0, 0, .55),
        0 0 0 1px rgba(255, 255, 255, .04) inset;
}
.story-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------------- World / Lore ---------------- */
.world-showcase {
    display: grid;
    gap: 22px;
}
.world-map {
    margin: 0;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid rgba(214, 177, 82, .34);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}
.world-map::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(6, 8, 12, 0) 58%, rgba(6, 8, 12, .26) 100%),
        radial-gradient(circle at 18% 22%, rgba(214, 177, 82, .18), transparent 34%);
}
.world-map img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: pixelated;
}
.world-copy > p,
.lore-copy {
    color: var(--text);
}
.world-copy > p,
.lore-copy > p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.75;
}
.world-copy > p {
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
}
.lore-points {
    display: grid;
    gap: 12px;
}
.lore-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.lore-points div {
    border-left: 2px solid var(--gold-soft);
    background: rgba(255, 255, 255, .035);
    padding: 16px;
}
.lore-points span {
    display: block;
    margin-bottom: 4px;
    color: var(--gold-soft);
    font-family: var(--font-game);
    font-size: 11px;
    text-transform: uppercase;
}
.lore-points strong {
    display: block;
    font-size: 16px;
    line-height: 1.45;
}
.lore-points p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}
.lore-copy-wide {
    max-width: 1080px;
    margin: 0 auto;
}

/* ---------------- Timeline ---------------- */
.timeline-wrap {
    overflow-x: auto;
    padding: 10px 2px 8px;
}
.timeline-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: 0;
    min-width: 980px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.timeline-track::before {
    content: "";
    position: absolute;
    left: 5%;
    right: 5%;
    top: 27px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-soft) 0 50%, rgba(255,255,255,.18) 50% 100%);
}
.timeline-step {
    position: relative;
    display: grid;
    gap: 8px;
    align-content: start;
    min-height: 150px;
    padding: 0 12px;
    text-align: center;
}
.timeline-dot {
    position: relative;
    z-index: 1;
    justify-self: center;
    width: 18px;
    height: 18px;
    margin-top: 19px;
    border-radius: 999px;
    border: 2px solid rgba(214, 177, 82, .7);
    background: var(--bg);
    box-shadow: 0 0 0 5px rgba(11,15,20,.88);
}
.timeline-step.is-complete .timeline-dot {
    background: var(--gold-soft);
}
.timeline-step.is-current .timeline-dot {
    width: 26px;
    height: 26px;
    margin-top: 15px;
    background: var(--gold);
    border-color: #fff1ad;
    box-shadow: 0 0 0 6px rgba(214,177,82,.18), 0 0 24px rgba(214,177,82,.65);
}
.timeline-time {
    margin-top: 8px;
    color: var(--gold-soft);
    font-family: var(--font-game);
    font-size: 11px;
    text-transform: uppercase;
}
.timeline-step strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
}
.timeline-step small {
    justify-self: center;
    width: max-content;
    max-width: 100%;
    padding: 3px 9px;
    color: #241606;
    background: var(--gold-soft);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.timeline-step.is-future {
    opacity: .72;
}
.timeline-note {
    max-width: 760px;
    margin: 20px auto 0;
    color: var(--muted);
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
}

/* ---------------- Feature grid ---------------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 18px; }
.feature {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px 22px;
}
.feature .icon { font-size: 28px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; font-size: 19px; }
.feature p { color: var(--muted); margin: 0; font-size: 15px; }

/* ---------------- Help us ---------------- */
.help-panel {
    max-width: 980px;
    margin: 0 auto;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,.035);
}
.help-lead {
    max-width: 780px;
    margin: 0 auto 26px;
    color: var(--text);
    text-align: center;
    font-size: 18px;
    line-height: 1.7;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.help-grid div {
    border-left: 2px solid var(--gold-soft);
    padding: 12px 14px;
    background: rgba(255,255,255,.035);
}
.help-grid strong {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-soft);
    font-size: 16px;
}
.help-grid p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}
.help-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 28px;
    flex-wrap: wrap;
}

/* ---------------- Personaggi ---------------- */
.char-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.char-grid-preview {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}
.char-grid.is-hiding-others .char:not(.is-selected) {
    opacity: 0;
    transform: translateY(10px) scale(.94);
    pointer-events: none;
    filter: blur(1px);
}
.char-grid.is-focus-mode .char.is-selected:not([open]) {
    grid-column: 1 / 2;
    grid-row: 1;
    z-index: 2;
}
.char-grid.is-focus-mode .char.is-selected[open] {
    grid-row: 1;
    z-index: 2;
}
.char {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; text-align: center;
    transition:
        opacity .44s ease,
        filter .44s ease,
        border-color .28s ease,
        box-shadow .28s ease,
        background .28s ease,
        transform .44s cubic-bezier(.22,.78,.2,1);
}
.char:hover { transform: translateY(-2px); border-color: rgba(242,207,121,.38); }
.char-grid-preview .char:hover { transform: none; border-color: var(--border); }
.char[open] {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: var(--char-face-width, 220px) minmax(0, 1fr);
    border-color: rgba(242,207,121,.62);
    background: rgba(255,255,255,.045);
    box-shadow: 0 18px 44px rgba(0,0,0,.24);
    text-align: left;
    transform: none;
}
.char.is-opening { animation: char-open-glow .72s ease both; }
.char summary {
    display: block;
    cursor: pointer;
    list-style: none;
}
.char summary::-webkit-details-marker { display: none; }
.char summary:focus-visible { outline: 3px solid rgba(242,207,121,.45); outline-offset: -3px; }
.char .portrait {
    aspect-ratio: 3/4;
    background: var(--bg-soft) center/cover no-repeat;
    transition: aspect-ratio .25s ease, min-height .25s ease;
}
.char .portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
.char .char-body { padding: 14px; }
.char h3 { margin: 0 0 2px; font-size: 18px; }
.char .cls { color: var(--gold-soft); font-size: 13px; text-transform: capitalize; }
.char-more {
    display: inline-block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.char[open] summary {
    display: block;
    align-self: start;
    border-right: 1px solid rgba(255,255,255,.1);
    text-align: center;
}
.char[open] .portrait {
    aspect-ratio: 3/4;
    min-height: 0;
}
.char[open] .char-body { padding: 14px; }
.char[open] .char-more { color: var(--gold-soft); }
.char-expanded {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 26px 30px;
    position: relative;
    min-height: 0;
    overflow: hidden;
    text-align: left;
}
.char.is-opening .char-expanded { animation: char-copy-in .68s cubic-bezier(.2,.8,.2,1) .1s both; }
.char.is-closing .char-expanded { animation: char-copy-out .24s ease both; }
.char-profile-block {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 14px;
}
.char-profile-block:first-child { border-top: 0; padding-top: 0; }
.char-profile-block span {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.char-profile-block p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
}

@keyframes char-open-glow {
    from { box-shadow: 0 8px 24px rgba(0,0,0,.14); }
    to { box-shadow: 0 18px 44px rgba(0,0,0,.24); }
}
@keyframes char-copy-in {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes char-copy-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(12px); }
}

/* ---------------- Form / Auth ---------------- */
.auth-wrap { max-width: 440px; margin: 60px auto; padding: 0 20px; }
.card-panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
}
.card-panel h1 { font-size: 28px; margin: 0 0 6px; text-align: center; }
.card-panel .sub { color: var(--muted); text-align: center; margin: 0 0 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
.form-control {
    width: 100%; padding: 12px 14px; border-radius: 10px;
    background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
    font-size: 15px; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(38,145,242,.25); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-actions { margin-top: 22px; }
.form-actions .btn { width: 100%; }
.form-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ---------------- Forum ---------------- */
.page-head { padding: 48px 0 24px; }
.page-head h1 { font-size: clamp(28px,4vw,40px); margin: 0 0 6px; }
.page-head .crumb { color: var(--muted); font-size: 14px; }
.list { display: grid; gap: 12px; }
.list-row {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.list-row:hover { border-color: var(--accent); }
.list-row .main h3 { margin: 0 0 4px; font-size: 18px; }
.list-row .main p { margin: 0; color: var(--muted); font-size: 14px; }
.list-row .meta { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; margin-right: 6px; }
.pill-lock { background: var(--danger); }

.thread-post {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 14px; display: grid; grid-template-columns: 160px 1fr; gap: 20px;
}
.thread-post .who { border-right: 1px solid var(--border); padding-right: 16px; }
.thread-post .who .name { font-weight: 700; color: var(--gold-soft); }
.thread-post .who .role { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.thread-post .who .since { font-size: 12px; color: var(--muted); margin-top: 6px; }
.thread-post .content { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.thread-post .content .when { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.role-admin .name::after { content: " ★"; color: var(--gold); }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; background: var(--bg-soft); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; flex-wrap: wrap; gap: 12px; }
.footer-inner p { color: var(--muted); margin: 0; font-size: 14px; }
.footer-rights {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.footer-studio-mark {
    width: 24px;
    height: auto;
    display: inline-block;
}
.footer-nav { display: flex; gap: 18px; }
.footer-nav a { color: var(--muted); font-size: 14px; }

/* ---------------- Utility ---------------- */
.text-center { text-align: center; }
.mt-3 { margin-top: 24px; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 28px 0; }

/* ---------------- Responsive ---------------- */
@media (min-width: 761px) and (max-width: 1040px) {
    .char-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .char-grid-preview { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .char-grid.is-focus-mode .char.is-selected:not([open]) { grid-column: 1 / 2; }
    .char[open] { grid-template-columns: var(--char-face-width, 220px) minmax(0, 1fr); }
}

/* ---------------- Accessibilità: niente parallax ---------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cinematic { height: auto; --p: 0; }
    .cinematic .stage { position: relative; height: 86vh; }
    .cinematic .layer,
    .cinematic .scroll-cue,
    .cinematic .veil { transform: none !important; opacity: 1 !important; transition: none !important; }
    /* niente slide: portrait e tagline restano entrambi visibili e fermi */
    .cinematic .layer-portrait { opacity: 1 !important; transform: none !important; }
    /* nessuna intro animation: il ritratto resta in posizione, opaco */
    .cinematic .portrait-inner {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    .cinematic .layer-title { transform: translateY(-50%) !important; opacity: 1 !important; }
    .cinematic .hero-tagline {
        opacity: 1 !important;
        transform: translateY(-50%) !important;
        top: 22%;
    }
    .cinematic .scroll-cue .scroll-pointer { animation: none; }
    .reveal { opacity: 1 !important; transform: none !important; transition: none; }
}
