/**
 * Cinetici - Design System v3.0
 * PHP 8.4 pur - Plus Jakarta Sans - Dark UI
 */

[x-cloak] { display: none !important; }

/* ──────────────────────────────────────
   CSS VARIABLES
   ────────────────────────────────────── */
:root {
    --bg:       #09090f;
    --bg2:      #0f0f1a;
    --bg3:      #141422;
    --bg4:      #1c1c30;
    --acc:      #7c6cf5;
    --acc2:     #a296f8;
    --acc3:     #c8bffe;
    --acc-dim:  rgba(124,108,245,.15);
    --acc-glow: rgba(124,108,245,.3);
    --teal:     #26d9a9;
    --gold:     #f5c842;
    --blu:      #0ea5e9;
    --tx:       #f0f0f8;
    --tx2:      rgba(240,240,248,.65);
    --tx3:      rgba(240,240,248,.35);
    --bdr:      rgba(255,255,255,.07);
    --bdr2:     rgba(255,255,255,.13);
    --r:        10px;
    --r2:       16px;
    --r3:       24px;
    --danger:   #ef4444;
    --success:  #22c55e;
    --warning:  #f59e0b;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--tx);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc2); }

img { max-width: 100%; display: block; }

/* ──────────────────────────────────────
   TYPOGRAPHY
   ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--tx);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--tx2); }
.text-dim   { color: var(--tx3); }
.text-acc   { color: var(--acc); }
.text-teal  { color: var(--teal); }
.text-gold  { color: var(--gold); }
.text-blu   { color: var(--blu); }

/* ──────────────────────────────────────
   BUTTONS
   ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--r);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--acc);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--acc2);
    box-shadow: 0 0 20px var(--acc-glow);
}

.btn-secondary {
    background: var(--bg4);
    color: var(--tx);
    border: 1px solid var(--bdr2);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg3);
    border-color: var(--acc);
}

.btn-ghost {
    background: transparent;
    color: var(--tx2);
    border: 1px solid var(--bdr);
}
.btn-ghost:hover:not(:disabled) {
    color: var(--tx);
    border-color: var(--bdr2);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

/* ──────────────────────────────────────
   BOUTONS — retour visuel immédiat
   Un clic doit se VOIR avant la réponse du serveur : une soumission /generate peut
   prendre plusieurs secondes (appel WaveSpeed + reprises). Sans retour, le bouton
   paraît mort, l'utilisateur reclique, et chaque clic lançait une génération de plus.
   Piloté par app.js (classes .btn-fired et .btn-busy).
   ────────────────────────────────────── */

/* 1. Enfoncement instantané — CSS pur, aucune latence, aucun JS à attendre. */
.btn:active:not(:disabled):not(.btn-busy) {
    transform: scale(0.955);
    transition: transform 0.05s ease;
}

/* 2. Éclair de confirmation : une onde part du bouton au moment du clic. */
.btn-fired {
    animation: btnFired 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes btnFired {
    0%   { box-shadow: 0 0 0 0 rgba(124, 108, 245,.75), 0 0 0 0 rgba(255, 255, 255, .35) inset; }
    100% { box-shadow: 0 0 0 16px rgba(124, 108, 245,0), 0 0 0 0 rgba(255, 255, 255, 0) inset; }
}

/* 3. « Action lancée » : tient tant que la requête est en vol, et bloque les re-clics. */
.btn-busy {
    pointer-events: none;
    position: relative;
    overflow: hidden;
}
.btn-busy::before {
    content: '';
    flex: 0 0 auto;
    width: 0.95em;
    height: 0.95em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.btn-busy::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 35%;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.85;
    animation: btnSweep 0.9s ease-in-out infinite;
}
@keyframes btnSweep {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(400%); }
}

@media (prefers-reduced-motion: reduce) {
    .btn:active:not(:disabled):not(.btn-busy) { transform: none; }
    .btn-fired { animation: none; }
    .btn-busy::after { animation: none; opacity: 0.5; }
    .btn-busy::before { animation-duration: 1.5s; }
}

/* ──────────────────────────────────────
   FORMS
   ────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tx2);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg2);
    border: 1px solid var(--bdr2);
    border-radius: var(--r);
    color: var(--tx);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--acc);
    box-shadow: 0 0 0 3px var(--acc-dim);
}

.form-input::placeholder { color: var(--tx3); }

.form-textarea { resize: vertical; min-height: 100px; }

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ──────────────────────────────────────
   CARDS
   ────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: var(--r2);
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--bdr2);
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ──────────────────────────────────────
   BADGES & PILLS
   ────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-acc    { background: var(--acc-dim); color: var(--acc2); }
.badge-teal   { background: rgba(38,217,169,.15); color: var(--teal); }
.badge-gold   { background: rgba(245,200,66,.15); color: var(--gold); }
.badge-blu    { background: rgba(14,165,233,.15); color: var(--blu); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }

/* ──────────────────────────────────────
   STATUS DOTS (storyboard tracks)
   ────────────────────────────────────── */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-pending    { background: var(--tx3); }
.dot-generating { background: var(--gold); animation: pulse 1.5s infinite; }
.dot-done-img   { background: var(--acc); }
.dot-done-vid   { background: var(--blu); }
.dot-done-vox   { background: var(--teal); }
.dot-failed     { background: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ──────────────────────────────────────
   TRACKS (shot editor)
   ────────────────────────────────────── */
.track {
    border-radius: var(--r);
    padding: 1rem;
    background: var(--bg3);
    border: 1px solid var(--bdr);
}

.track-image { border-top: 3px solid var(--acc); }
.track-video { border-top: 3px solid var(--blu); }
.track-voice { border-top: 3px solid var(--teal); }

/* ──────────────────────────────────────
   LAYOUT HELPERS
   ────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex   { display: flex; }
.grid   { display: grid; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }

.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }

.text-center { text-align: center; }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-lg     { font-size: 1.125rem; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.hidden { display: none !important; }

/* ──────────────────────────────────────
   AUTH CONTAINER
   ────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg2);
    border: 1px solid var(--bdr);
    border-radius: var(--r3);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

/* ──────────────────────────────────────
   STORYBOARD LAYOUT (3 columns)
   ────────────────────────────────────── */
.storyboard {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.storyboard-scenes {
    background: var(--bg2);
    border-right: 1px solid var(--bdr);
    overflow-y: auto;
    padding: 1rem;
}

.storyboard-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.storyboard-bible {
    background: var(--bg2);
    border-left: 1px solid var(--bdr);
    overflow-y: auto;
    padding: 1rem;
    transition: transform 0.3s ease;
}

/* ──────────────────────────────────────
   FILMSTRIP
   ────────────────────────────────────── */
.filmstrip {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    background: var(--bg3);
    border-bottom: 1px solid var(--bdr);
}

.filmstrip-item {
    flex-shrink: 0;
    width: 120px;
    border-radius: var(--r);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filmstrip-item.active {
    border-color: var(--acc);
}

.filmstrip-item:hover {
    border-color: var(--bdr2);
}

.filmstrip-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.filmstrip-dots {
    display: flex;
    gap: 4px;
    padding: 0.375rem;
    justify-content: center;
    background: var(--bg2);
}

/* ──────────────────────────────────────
   NAVBAR
   ────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1.5rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--bdr);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tx);
}

.navbar-brand span {
    color: var(--acc);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ──────────────────────────────────────
   CREDIT BADGE
   ────────────────────────────────────── */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--acc-dim);
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--acc2);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
a.credit-badge:hover {
    background: var(--acc-glow);
    color: var(--tx);
}

/* Le solde vient d'augmenter (retour de paiement) : on le fait remarquer. */
.credit-badge.credit-bump {
    animation: creditBump 1.2s cubic-bezier(0.22, 1, 0.36, 1) 2;
}
@keyframes creditBump {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(38, 217, 169, 0); }
    35%      { transform: scale(1.14); box-shadow: 0 0 0 8px rgba(38, 217, 169, .28); }
}

@media (prefers-reduced-motion: reduce) {
    .credit-badge.credit-bump { animation: none; }
}

/* ──────────────────────────────────────
   TABLES
   ────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bdr);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tx3);
}

.table tr:hover td {
    background: var(--bg3);
}

/* ──────────────────────────────────────
   MODALS
   ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--bdr2);
    border-radius: var(--r3);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* ──────────────────────────────────────
   NOTIFICATIONS / TOASTS
   ────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--r);
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast-success { background: rgba(34,197,94,.15); color: var(--success); border: 1px solid rgba(34,197,94,.3); }
.toast-error   { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.toast-info    { background: var(--acc-dim); color: var(--acc2); border: 1px solid var(--acc-glow); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ──────────────────────────────────────
   LOADING / SKELETON
   ────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r);
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bdr2);
    border-top-color: var(--acc);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ──────────────────────────────────────
   SCROLLBAR
   ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx3); }

/* ──────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────── */
@media (max-width: 1024px) {
    .storyboard {
        grid-template-columns: 1fr;
    }
    .storyboard-scenes,
    .storyboard-bible {
        display: none;
    }
}

@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
    .container { padding: 0 1rem; }
    .auth-card { padding: 1.5rem; }
}

/* ──────────────────────────────────────
   VOILE PLEIN ÉCRAN — GÉNÉRATION D'UNE SCÈNE
   Rendu par views/projects/show.php tant que `sceneGenerating` est vrai. Il couvre
   l'écran (donc bloque toute interaction), floute l'arrière-plan et montre en clair
   où en est le pipeline, piste par piste. Il disparaît de lui-même à la fin.
   ────────────────────────────────────── */
.scene-veil {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(16px) saturate(0.7);
    -webkit-backdrop-filter: blur(16px) saturate(0.7);
    animation: sgFade 0.25s ease-out;
    outline: none;
}
@keyframes sgFade { from { opacity: 0; } to { opacity: 1; } }

.scene-veil-card {
    width: min(460px, 92vw);
    padding: 2.25rem 2rem 1.75rem;
    border-radius: 22px;
    background: rgba(13, 13, 21, .94);
    border: 1px solid var(--bdr2);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255,255,255,.04) inset;
    text-align: center;
    animation: sgPop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sgPop {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* Anneau : dégradé conique qui tourne + halo qui pulse */
.sg-ring-wrap {
    position: relative;
    width: 116px;
    height: 116px;
    margin: 0 auto 1.5rem;
}
.sg-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--acc), var(--acc2), #38bdf8, var(--acc));
    animation: sgSpin 1.5s linear infinite;
}
.sg-ring::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: rgb(13, 13, 21);
}
.sg-ring::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px solid var(--acc);
    animation: sgPulse 1.9s ease-out infinite;
}
@keyframes sgSpin { to { transform: rotate(360deg); } }
@keyframes sgPulse {
    0%        { transform: scale(0.9); opacity: .6; }
    70%, 100% { transform: scale(1.3);  opacity: 0; }
}
.sg-ring-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tx);
    letter-spacing: -0.02em;
}

.sg-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tx);
    margin: 0 0 0.25rem;
}
.sg-sub {
    font-size: 0.8rem;
    color: var(--tx3);
    margin: 0 0 1.5rem;
}

/* Une ligne par piste : libellé · barre · compteur */
.sg-tracks { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.5rem; }
.sg-track  { display: flex; align-items: center; gap: 0.65rem; }
.sg-track-name {
    width: 54px;
    flex: 0 0 auto;
    text-align: left;
    font-size: 0.72rem;
    color: var(--tx2);
}
.sg-track-n {
    width: 40px;
    flex: 0 0 auto;
    text-align: right;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--tx2);
}
.sg-bar {
    flex: 1;
    height: 8px;
    border-radius: 99px;
    background: var(--bg4);
    overflow: hidden;
}
.sg-bar > i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--acc), var(--acc2));
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
    min-width: 3px;
}
.sg-bar > i::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
    animation: sgShine 1.4s linear infinite;
}
@keyframes sgShine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.sg-note {
    font-size: 0.7rem;
    color: var(--tx3);
    margin: 0;
    line-height: 1.5;
}

/* Détail par plan dans le voile de génération : état réel + ancienneté, pour distinguer
   une génération lente d'une génération bloquée. */
.sg-shots {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 190px;
    overflow-y: auto;
    margin-bottom: 1rem;
    text-align: left;
}
.sg-shot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    padding: 0.28rem 0.45rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, .03);
}
.sg-shot-late { background: rgba(245, 200, 66, .12); }
.sg-shot-n    { color: var(--tx2); min-width: 52px; font-weight: 600; }
.sg-shot-age  { margin-left: auto; color: var(--tx3); font-variant-numeric: tabular-nums; }

.sg-chip {
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    color: var(--tx3);
    white-space: nowrap;
}
.sg-chip.sg-done       { background: rgba(38, 217, 169, .15); color: var(--teal); }
.sg-chip.sg-generating,
.sg-chip.sg-launching  { background: rgba(245, 200, 66, .15); color: var(--gold); }
.sg-chip.sg-queued     { background: rgba(14, 165, 233, .15); color: var(--blu); }
.sg-chip.sg-failed     { background: rgba(239, 68, 68, .15);  color: var(--danger); }

.sg-skip {
    border: none;
    background: rgba(239, 68, 68, .85);
    color: #fff;
    font-size: 0.62rem;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
}

.sg-warn {
    font-size: 0.7rem;
    color: var(--gold);
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.sg-close {
    margin-top: 0.9rem;
    border: 1px solid var(--bdr2);
    background: transparent;
    color: var(--tx2);
    font-size: 0.72rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--r);
    cursor: pointer;
    font-family: inherit;
}
.sg-close:hover { background: rgba(255, 255, 255, .05); }

@media (prefers-reduced-motion: reduce) {
    .scene-veil, .scene-veil-card { animation: none; }
    .sg-ring::after, .sg-bar > i::after { animation: none; opacity: 0; }
    .sg-ring { animation-duration: 3s; }
}

/* ── Confirmation avant de refaire une scène déjà produite ── */
.sg-modal {
    position: fixed;
    inset: 0;
    z-index: 410;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 12, .6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: sgFade 0.2s ease-out;
}
.sg-confirm { padding: 1.75rem 1.75rem 1.5rem; }
.sg-confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--gold);
    background: rgba(245, 200, 66, .12);
    border: 1px solid rgba(245, 200, 66, .35);
}
.sg-recap {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}
.sg-recap > div {
    flex: 1;
    max-width: 110px;
    padding: 0.55rem 0.4rem;
    border-radius: var(--r);
    background: var(--bg4);
    border: 1px solid var(--bdr);
}
.sg-recap span { display: block; font-size: 0.66rem; color: var(--tx3); }
.sg-recap b    { display: block; font-size: 0.95rem; color: var(--teal); font-variant-numeric: tabular-nums; }

.sg-warn {
    font-size: 0.76rem;
    line-height: 1.55;
    color: var(--tx2);
    text-align: left;
    padding: 0.7rem 0.8rem;
    border-radius: var(--r);
    background: rgba(245, 200, 66, .08);
    border-left: 3px solid var(--gold);
    margin: 0 0 0.85rem;
}
.sg-warn strong { color: var(--tx); }

.sg-cost {
    font-size: 0.76rem;
    color: var(--tx2);
    margin: 0 0 1.25rem;
}
.sg-cost b { color: var(--acc2); }

.sg-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ──────────────────────────────────────
   GARDE-SESSION — préavis avant déconnexion pour inactivité
   Construit par app.js cinq minutes avant la coupure.
   ────────────────────────────────────── */
.sess-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;              /* au-dessus de tout, y compris le voile de génération */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 12, .62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: sgFade 0.25s ease-out;
}
.sess-card {
    width: min(420px, 92vw);
    padding: 2rem 1.75rem 1.5rem;
    border-radius: 22px;
    text-align: center;
    background: rgba(13, 13, 21, .96);
    border: 1px solid var(--bdr2);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .7);
    animation: sgPop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Anneau qui se vide au rythme réel du compte à rebours */
.sess-ring-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 1.25rem; }
.sess-ring      { width: 100%; height: 100%; transform: rotate(-90deg); }
.sess-ring circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}
.sess-ring-bg { stroke: var(--bg4); }
.sess-ring-fg {
    stroke: var(--gold);
    transition: stroke-dashoffset 0.5s linear, stroke 0.4s ease;
}
.sess-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tx);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Dernière minute : bascule en rouge et pulse pour ne pas passer inaperçu */
.sess-critical .sess-ring-fg { stroke: var(--danger); }
.sess-critical .sess-count   { color: var(--danger); animation: sessBeat 1s ease-in-out infinite; }
.sess-critical .sess-card    { animation: sessAlert 1s ease-in-out infinite; }
@keyframes sessBeat {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
@keyframes sessAlert {
    0%, 100% { box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 0 0 rgba(239, 68, 68, .5); }
    50%      { box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 0 12px rgba(239, 68, 68, 0); }
}

.sess-title { font-size: 1.1rem; font-weight: 700; color: var(--tx); margin: 0 0 0.5rem; }
.sess-text  { font-size: 0.8rem; line-height: 1.6; color: var(--tx2); margin: 0 0 1.4rem; }
.sess-actions { display: flex; gap: 0.5rem; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
    .sess-modal, .sess-card { animation: none; }
    .sess-critical .sess-count, .sess-critical .sess-card { animation: none; }
}
