/* ==========================================================================
   INTERFACE NOVA — socle commun (couleurs, typographie, composants)
   Tout est préfixé « nv- » pour ne jamais entrer en conflit avec l'interface
   classique. Ce fichier ne change rien tant qu'une page n'utilise pas ces
   classes : il est sans effet sur l'ancienne interface.
   ========================================================================== */

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('fonts/outfit-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('fonts/outfit-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Fonds : du plus profond au plus proche de l'œil */
    --nv-bg: #060a13;
    --nv-bg-2: #0a101d;
    --nv-surface: #0f1728;
    --nv-surface-2: #152036;
    --nv-surface-3: #1c2a46;
    --nv-line: rgba(150, 175, 230, .13);
    --nv-line-2: rgba(150, 175, 230, .26);

    /* Textes */
    --nv-text: #f0f4ff;
    --nv-text-2: #b6c2dc;
    --nv-text-3: #8290b0;
    /* Texte atténué : utilisé par nova-alliance-plus.css (Conseil, Diplomatie…), jamais défini avant le 16/11 */
    --nv-muted: var(--nv-text-2);

    /* Couleur du joueur : bleu Suprem par défaut, remplacée par la couleur
       d'ère / Premium quand le thème du compte en fournit une. */
    --nv-accent: #4f8cff;
    --nv-accent-hi: #86b4ff;
    --nv-accent-lo: #2f66e0;
    --nv-accent-ink: #051230;
    --nv-accent-soft: rgba(79, 140, 255, .14);

    /* Couleurs de sens : toujours les mêmes partout */
    --nv-gold: #f6c453;
    --nv-gold-soft: rgba(246, 196, 83, .14);
    --nv-green: #34d399;
    --nv-green-soft: rgba(52, 211, 153, .14);
    --nv-red: #ff5a6e;
    --nv-red-soft: rgba(255, 90, 110, .14);
    --nv-amber: #ffab40;
    --nv-amber-soft: rgba(255, 171, 64, .14);
    --nv-violet: #a78bfa;

    --nv-r-sm: 10px;
    --nv-r: 14px;
    --nv-r-lg: 20px;
    --nv-r-pill: 999px;

    --nv-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --nv-shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);

    --nv-font: 'Outfit', 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    --nv-ease: cubic-bezier(.2, .8, .2, 1);

    /* Dimensions de la coque */
    --nv-side-w: 236px;
    --nv-top-h: 60px;
    --nv-tab-h: 62px;
    --nv-safe-b: env(safe-area-inset-bottom, 0px);
    --nv-safe-t: env(safe-area-inset-top, 0px);
}

/* --------------------------------------------------------------------------
   Base des pages 100 % Nova (<body class="nv-page">)
   -------------------------------------------------------------------------- */
.nv-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(79, 140, 255, .13), transparent 60%),
        radial-gradient(900px 500px at -10% 30%, rgba(52, 211, 153, .05), transparent 60%),
        var(--nv-bg);
    background-attachment: fixed;
    color: var(--nv-text);
    font-family: var(--nv-font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
.nv-page *, .nv-page *::before, .nv-page *::after,
.nv-scope *, .nv-scope *::before, .nv-scope *::after { box-sizing: border-box; }
.nv-scope { font-family: var(--nv-font); color: var(--nv-text); -webkit-font-smoothing: antialiased; }
.nv-page h1, .nv-page h2, .nv-page h3, .nv-page h4, .nv-page p { margin: 0; }
:where(.nv-page) a { color: var(--nv-accent-hi); text-decoration: none; }
.nv-page img { max-width: 100%; }
.nv-page button, .nv-scope button { font-family: inherit; }
.nv-page ::selection { background: rgba(79, 140, 255, .4); }
.nv-num { font-variant-numeric: tabular-nums; }
.nv-hidden, [hidden].nv-hidden-strict { display: none !important; }

/* Titres */
.nv-eyebrow {
    font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--nv-accent-hi);
}
.nv-h1 { font-size: clamp(26px, 4.4vw, 40px); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; }
.nv-h2 { font-size: clamp(19px, 2.6vw, 24px); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.nv-h3 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.nv-muted { color: var(--nv-text-2); }
.nv-dim { color: var(--nv-text-3); }

/* --------------------------------------------------------------------------
   Boutons : une seule action principale par écran (pleine couleur),
   le reste en bouton discret.
   -------------------------------------------------------------------------- */
.nv-btn {
    --_bg: var(--nv-surface-3);
    --_fg: var(--nv-text);
    --_bd: var(--nv-line-2);
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px;
    border: 1px solid var(--_bd); border-radius: var(--nv-r);
    background: var(--_bg); color: var(--_fg);
    font: 600 15px/1 var(--nv-font); letter-spacing: .01em; text-decoration: none; white-space: nowrap;
    cursor: pointer; user-select: none;
    transition: transform .12s var(--nv-ease), filter .15s, background .15s, border-color .15s, box-shadow .15s;
}
.nv-btn:hover { filter: brightness(1.12); }
.nv-btn:active { transform: translateY(1px) scale(.985); }
.nv-btn:focus-visible { outline: 2px solid var(--nv-accent-hi); outline-offset: 2px; }
.nv-btn[disabled], .nv-btn.is-disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.nv-btn--primary {
    --_bg: linear-gradient(180deg, var(--nv-accent-hi), var(--nv-accent) 45%, var(--nv-accent-lo));
    --_fg: #fff; --_bd: transparent;
    box-shadow: 0 6px 18px -6px var(--nv-accent), inset 0 1px 0 rgba(255, 255, 255, .28);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.nv-btn--gold {
    --_bg: linear-gradient(180deg, #ffe08a, var(--nv-gold) 50%, #d99a1f);
    --_fg: #2a1c00; --_bd: transparent;
    box-shadow: 0 6px 18px -6px var(--nv-gold), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.nv-btn--green {
    --_bg: linear-gradient(180deg, #6ee7b7, var(--nv-green) 50%, #12a372);
    --_fg: #022416; --_bd: transparent;
    box-shadow: 0 6px 18px -6px var(--nv-green), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.nv-btn--danger { --_bg: var(--nv-red-soft); --_fg: #ffb3bd; --_bd: rgba(255, 90, 110, .4); }
.nv-btn--ghost { --_bg: transparent; --_bd: var(--nv-line-2); }
.nv-btn--quiet { --_bg: transparent; --_bd: transparent; --_fg: var(--nv-text-2); padding: 0 10px; }
.nv-btn--sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: var(--nv-r-sm); }
.nv-btn--lg { min-height: 54px; padding: 0 26px; font-size: 17px; border-radius: var(--nv-r-lg); font-weight: 700; }
.nv-btn--block { display: flex; width: 100%; }
.nv-btn--icon { width: 44px; padding: 0; }
.nv-btn--icon.nv-btn--sm { width: 34px; }

/* --------------------------------------------------------------------------
   Cartes et surfaces
   -------------------------------------------------------------------------- */
.nv-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, .028), transparent 40%), var(--nv-surface);
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-lg);
    padding: 18px;
}
.nv-card--flat { background: var(--nv-surface); }
.nv-card--raised { box-shadow: var(--nv-shadow); }
.nv-card--accent { border-color: color-mix(in srgb, var(--nv-accent) 45%, transparent); background: linear-gradient(180deg, var(--nv-accent-soft), transparent 70%), var(--nv-surface); }
.nv-card--gold { border-color: rgba(246, 196, 83, .4); background: linear-gradient(180deg, var(--nv-gold-soft), transparent 70%), var(--nv-surface); }
.nv-card--danger { border-color: rgba(255, 90, 110, .5); background: linear-gradient(180deg, var(--nv-red-soft), transparent 70%), var(--nv-surface); }
.nv-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.nv-card-head .nv-h2, .nv-card-head .nv-h3 { display: flex; align-items: center; gap: 8px; }

.nv-section { margin-top: 22px; }
.nv-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }

/* Pastilles */
.nv-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 26px; padding: 0 10px;
    border-radius: var(--nv-r-pill);
    background: var(--nv-surface-2); border: 1px solid var(--nv-line);
    color: var(--nv-text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.nv-chip--accent { background: var(--nv-accent-soft); border-color: transparent; color: var(--nv-accent-hi); }
.nv-chip--gold { background: var(--nv-gold-soft); border-color: transparent; color: var(--nv-gold); }
.nv-chip--green { background: var(--nv-green-soft); border-color: transparent; color: var(--nv-green); }
.nv-chip--red { background: var(--nv-red-soft); border-color: transparent; color: #ff8f9d; }
.nv-chip--amber { background: var(--nv-amber-soft); border-color: transparent; color: var(--nv-amber); }

.nv-badge {
    display: inline-grid; place-items: center;
    min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: var(--nv-r-pill);
    background: var(--nv-red); color: #fff;
    font: 700 11px/1 var(--nv-font); font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--nv-bg-2);
}
.nv-badge--green { background: var(--nv-green); color: #022416; }
.nv-badge--accent { background: var(--nv-accent); }
.nv-badge:empty, .nv-badge[data-count="0"] { display: none; }

/* Barres de progression */
.nv-bar {
    position: relative; height: 8px; border-radius: var(--nv-r-pill);
    background: rgba(255, 255, 255, .07); overflow: hidden;
}
.nv-bar > i {
    position: absolute; inset: 0 auto 0 0; width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--nv-accent-lo), var(--nv-accent-hi));
    transition: width .6s var(--nv-ease);
}
.nv-bar--green > i { background: linear-gradient(90deg, #12a372, #6ee7b7); }
.nv-bar--gold > i { background: linear-gradient(90deg, #d99a1f, #ffe08a); }
.nv-bar--red > i { background: linear-gradient(90deg, #d93a50, #ff8f9d); }
.nv-bar--live > i::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: translateX(-100%); animation: nv-sheen 2.2s infinite;
}
@keyframes nv-sheen { to { transform: translateX(100%); } }

/* Listes de lignes cliquables */
.nv-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--nv-r);
    background: var(--nv-surface-2); border: 1px solid var(--nv-line);
    color: inherit; text-decoration: none;
}
a.nv-row:hover, button.nv-row:hover { border-color: var(--nv-line-2); background: var(--nv-surface-3); }
.nv-row-ico {
    flex: 0 0 auto; display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--nv-accent-soft); font-size: 20px;
}
.nv-row-main { flex: 1 1 auto; min-width: 0; }
.nv-row-title { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nv-row-sub { display: block; font-size: 13px; color: var(--nv-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nv-stack { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); } /* 15/11 : une ligne longue ne déborde plus de l'écran */

/* Champs */
.nv-field { display: grid; gap: 6px; }
.nv-field > span { font-size: 13px; font-weight: 600; color: var(--nv-text-2); }
.nv-input, .nv-select {
    width: 100%; min-height: 48px; padding: 0 14px;
    border-radius: var(--nv-r); border: 1px solid var(--nv-line-2);
    background: rgba(4, 8, 16, .6); color: var(--nv-text);
    font: 500 16px/1.2 var(--nv-font); /* 16 px : évite le zoom automatique sur iPhone */
    transition: border-color .15s, box-shadow .15s;
}
.nv-input::placeholder { color: var(--nv-text-3); }
.nv-input:focus, .nv-select:focus { outline: none; border-color: var(--nv-accent); box-shadow: 0 0 0 3px var(--nv-accent-soft); }

/* Squelettes de chargement */
.nv-skel {
    border-radius: var(--nv-r);
    background: linear-gradient(90deg, var(--nv-surface-2) 25%, var(--nv-surface-3) 37%, var(--nv-surface-2) 63%);
    background-size: 400% 100%; animation: nv-skel 1.3s ease infinite;
    min-height: 16px;
}
@keyframes nv-skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.nv-empty { padding: 22px 14px; text-align: center; color: var(--nv-text-3); font-size: 14px; }

/* --------------------------------------------------------------------------
   Messages éclair (toasts) et feuille du bas (bottom sheet / fenêtre)
   -------------------------------------------------------------------------- */
.nv-toasts {
    position: fixed; z-index: 2147483000; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--nv-tab-h) + var(--nv-safe-b) + 14px);
    display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none;
}
.nv-toast {
    pointer-events: none; /* un message ne doit jamais avaler le clic destiné au bouton qu’il recouvre */
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: var(--nv-r);
    background: rgba(18, 27, 46, .96); border: 1px solid var(--nv-line-2);
    box-shadow: var(--nv-shadow-lg); color: var(--nv-text);
    font: 600 14.5px/1.3 var(--nv-font);
    animation: nv-toast-in .28s var(--nv-ease);
    pointer-events: none;
}
.nv-toast--ok { border-color: rgba(52, 211, 153, .55); }
.nv-toast--err { border-color: rgba(255, 90, 110, .6); }
.nv-toast--gold { border-color: rgba(246, 196, 83, .6); }
.nv-toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes nv-toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.nv-sheet-back {
    position: fixed; inset: 0; z-index: 2147482000;
    background: rgba(2, 5, 12, .66); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .2s;
    display: flex; align-items: flex-end; justify-content: center;
}
.nv-sheet-back.is-open { opacity: 1; }
.nv-sheet {
    width: min(720px, 100%); max-height: min(88dvh, 880px);
    display: flex; flex-direction: column;
    background: var(--nv-bg-2); color: var(--nv-text);
    border: 1px solid var(--nv-line-2); border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: var(--nv-shadow-lg);
    transform: translateY(24px); transition: transform .28s var(--nv-ease);
    font-family: var(--nv-font);
}
.nv-sheet-back.is-open .nv-sheet { transform: none; }
.nv-sheet:focus { outline: none; }
.nv-sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: var(--nv-line-2); margin: 9px auto 0; flex: 0 0 auto; }
.nv-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 10px; flex: 0 0 auto; }
.nv-sheet-body { padding: 4px 18px calc(20px + var(--nv-safe-b)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 900px) {
    .nv-sheet-back { align-items: center; }
    .nv-sheet { border-radius: 22px; border-bottom: 1px solid var(--nv-line-2); transform: translateY(12px) scale(.98); }
    .nv-sheet-grip { display: none; }
    .nv-sheet-head { padding-top: 18px; }
    .nv-toasts { bottom: 24px; }
}

/* Petites animations de récompense */
@keyframes nv-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes nv-pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(79, 140, 255, .6); } 100% { box-shadow: 0 0 0 12px rgba(79, 140, 255, 0); } }
@keyframes nv-pulse-gold { 0% { box-shadow: 0 0 0 0 rgba(246, 196, 83, .65); } 100% { box-shadow: 0 0 0 13px rgba(246, 196, 83, 0); } }
@keyframes nv-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 110, .65); } 100% { box-shadow: 0 0 0 12px rgba(255, 90, 110, 0); } }
@keyframes nv-float-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-38px); } }
.nv-pop { animation: nv-pop .35s var(--nv-ease); }
.nv-pulse { animation: nv-pulse-ring 1.6s infinite; }
.nv-pulse--gold { animation: nv-pulse-gold 1.6s infinite; }
.nv-pulse--red { animation: nv-pulse-red 1.6s infinite; }

@media (prefers-reduced-motion: reduce) {
    .nv-page *, .nv-scope *, .nv-toast, .nv-sheet, .nv-sheet-back { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* Tiroir de discussion du jeu : fermé, il sort entièrement de l'écran (son bord dépassait à droite) */
html.nova-on .chat-drawer:not(.is-open),
.nv-page .chat-drawer:not(.is-open) { transform: translateX(calc(100% + 48px)) !important; }
