/* =====================================================
   FlashStories - Base stylesheet (Step 1)
   ===================================================== */

:root {
  --bg: #0e0e12;
  --bg-panel: #17171d;
  --bg-elev: #1e1e26;
  --border: #2a2a34;
  --text: #e6e6ea;
  --text-muted: #9797a5;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --success: #22c55e;
  --error: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
          Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 100vh;
}

/* ---------- Login / 2FA / setup ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-container { width: 100%; max-width: 480px; }
.login-container .wide { max-width: 640px; }
.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-card.wide { max-width: 640px; }
.brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 24px;
}
.logo-dot {
  /* Ora il logo e' un <img> con alpha trasparente — solo altezza fissa,
     larghezza libera cosi' lo spazio si adatta alla forma del logo. */
  height: 60px;
  width: auto;                              /* si adatta al logo */
  max-width: 120px;
  display: block;
  filter: drop-shadow(0 6px 20px rgba(249, 115, 22, 0.35));
}

/* Logo full: usato nel login card (icona + testo) — deprecato */
.logo-full {
  display: block;
  width: 220px;
  height: auto;
  margin: 0 auto 8px;
  filter: drop-shadow(0 8px 24px rgba(249, 115, 22, 0.25));
}

/* Logo login: variante 3D neon del logo-icon, coerente con topbar */
.logo-login {
  display: block;
  width: 110px;
  height: auto;
  margin: 0 auto 6px;
  filter: drop-shadow(0 6px 24px rgba(236, 72, 153, 0.35));
}
.brand-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fb923c, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Logo icon nella topbar: altezza fissa, larghezza libera → mai croppato */
.topbar .logo-dot {
  height: 40px;
  width: auto;                    /* rispetta le proporzioni naturali */
  max-width: none;
  background-color: transparent;
  box-shadow: none;
}
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.3px; }
.tagline { color: var(--text-muted); font-size: 13px; }

.login-form {
  display: flex; flex-direction: column; gap: 14px;
}
.login-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.login-form input {
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.login-form input:focus { border-color: var(--accent); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary.big { padding: 16px 28px; font-size: 16px; width: 100%; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--bg-elev); }
.btn-ghost.btn-danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.btn-ghost.btn-danger:hover { background: rgba(239, 68, 68, 0.15); color: #fecaca; }

.btn-link {
  background: transparent; border: none;
  color: var(--accent); cursor: pointer;
  text-decoration: underline; font: inherit;
}

/* ---------- Password visibility toggle (auth.js) ---------- */
.pw-wrapper {
  position: relative;
  display: block;
  width: 100%;
}
.pw-wrapper input[type="password"],
.pw-wrapper input[type="text"] {
  width: 100%;
  padding-right: 44px !important;
}
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-toggle svg { display: block; }
/* Nel modal admin gli input hanno padding leggermente diverso */
.modal .pw-wrapper input { padding-right: 44px !important; }

.banner {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.banner-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.banner-info  { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.steps { margin: 10px 0 20px; padding-left: 20px; color: var(--text-muted); font-size: 14px; }
.steps li { margin: 6px 0; }
.steps strong { color: var(--text); }
.steps code { background: var(--bg-elev); padding: 2px 6px; border-radius: 4px; }

.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 640px) { .two-cols { grid-template-columns: 1fr; } }
.qr { width: 100%; max-width: 240px; border-radius: 8px; background: white; padding: 8px; }
.backup-codes { list-style: none; padding: 0; display: grid; gap: 4px; }
.backup-codes code {
  display: inline-block; padding: 6px 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 6px; font-family: ui-monospace, monospace;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand {
  flex-direction: row;
  margin-bottom: 0;
  align-items: center;         /* logo + testo perfettamente allineati */
  gap: 12px;
}
.topbar .brand h1 {
  font-size: 20px;
  line-height: 1;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* ---------- Admin dropdown (task #99) ---------- */
.admin-menu {
  position: relative;
  display: inline-block;
}
.admin-menu-btn {
  cursor: pointer;
}
.admin-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 1000;
  display: none;
}
.admin-menu.open .admin-menu-panel { display: block; }
.admin-menu-panel a,
.admin-menu-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.admin-menu-panel a:hover,
.admin-menu-panel button:hover {
  background: rgba(255, 255, 255, 0.06);
}
.admin-menu-panel .admin-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.user-chip {
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  display: inline-flex; gap: 6px; align-items: center;
}
.role-badge {
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
  text-transform: uppercase; font-weight: 600;
}
.role-admin   { background: rgba(236, 72, 153, 0.2);  color: #f9a8d4; }
.role-curator { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.role-editor  { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

/* ---------- Container / cards ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 12px;
}
.panel-header h2 {
  margin: 0;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}
.icon-sec {
  height: 26px;
  width: auto;                    /* larghezza libera → rispetta proporzioni */
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  object-fit: contain;
}
.icon-lnk {
  height: 18px;
  width: auto;
  vertical-align: middle;
  margin-right: 6px;
  object-fit: contain;
}
.gradient-text h2 {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Layout multi-panel compatto ---------- */
.two-panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.three-panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .two-panel-row, .three-panel-row { grid-template-columns: 1fr; }
}
.two-panel-row .card,
.three-panel-row .card { margin-bottom: 0; }

/* ---------- Configurazione: cluster raggruppati ---------- */
.cfg-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.cfg-group {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.cfg-group h4 {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.cfg-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.cfg-inline > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  flex: 1 1 140px;
}
.cfg-inline .cfg-lbl {
  color: var(--text-muted);
  font-size: 11px;
}
.cfg-inline .cfg-lbl b {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}
.cfg-inline select,
.cfg-inline input[type="range"] {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.cfg-inline input[type="range"] {
  padding: 0;
  height: 24px;
}
.cfg-inline .check-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
.cfg-inline .check-inline span {
  font-size: 12px;
  color: var(--text);
}

/* ---------- Config grid vecchio (retro-compat) ---------- */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.config-cell {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.config-label {
  display: block; font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.config-cell input[type="number"],
.config-cell select,
.config-cell input[type="range"] {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; outline: none;
}
.config-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.radio-group { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.radio-group label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.radio-group select {
  width: auto; display: inline-block; margin: 0 4px;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  color: var(--text-muted);
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 13px;
}
.dropzone.compact {
  padding: 10px 8px;
  font-size: 12px;
}
.dropzone p { margin: 0; }
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.06);
}

/* ---------- Preview canvas ----------
   Grid layout a 3 righe:
     row 1: "topbar"   (bottone ↻ Aggiorna frame, centrato)
     row 2: "preview mixer"
     row 3: "footer"   (Applica + Reset + status, centrato)
   Il preview-frame conserva le sue dimensioni originali (720px 16:9 o 400px 9:16),
   il mixer occupa una colonna a larghezza fissa a DESTRA. */
#preview-wrap {
  display: grid;
  grid-template-columns: minmax(0, 720px) 96px;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "topbar  topbar"
    "preview mixer"
    "footer  footer";
  gap: 14px;
  justify-content: center;
  align-items: start;
  width: 100%;
}
#preview-wrap[data-aspect="9:16"] {
  grid-template-columns: minmax(0, 400px) 96px;
}
#preview-wrap #preview-frame { grid-area: preview; }
#preview-wrap .color-mixer {
  grid-area: mixer;
  align-self: center;
  height: 85%;
  max-height: 350px;
}
#preview-wrap[data-aspect="9:16"] .color-mixer {
  max-height: 600px;
}
#preview-wrap .preview-topbar {
  grid-area: topbar;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
#preview-wrap .preview-footer {
  grid-area: footer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

/* Fader mixer stile bilanciamento nero (sinistra dei clip) */
.color-mixer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 96px;
}
.mixer-lbl-top {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.2;
}
.mixer-lbl-top small { color: var(--warn); font-size: 9px; letter-spacing: 0; }
.mixer-lbl-val { font-size: 13px; color: var(--text); }
.mixer-lbl-val b { color: var(--accent); font-weight: 700; }
.fader-vertical {
  writing-mode: vertical-lr;
  direction: rtl;              /* inverte l'asse: MAX in alto, MIN in basso */
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 30px;
  height: 100%;
  flex: 1 1 auto;              /* riempie l'altezza del mixer */
  min-height: 200px;
  background: transparent;
  cursor: ns-resize;
  /* Colora thumb e track riempito in rosso (brief Mario) */
  accent-color: #ef4444;
}
/* Fallback per browser che non supportano appearance slider-vertical:
   ruoto un range orizzontale (rotate 90 = max in alto). */
@supports not (appearance: slider-vertical) {
  .fader-vertical {
    transform: rotate(-90deg);
    width: 240px;
    height: 30px;
    margin: 105px -105px;
    direction: ltr;   /* rotate copre l'inversione: bottom-left → top-left = max */
  }
}

/* Overlay nero applicato SOLO sul frame — z-index 1 (sotto guide/elementi) */
#pv-black-overlay {
  position: absolute;
  inset: 0;
  background: black;
  opacity: 0.20;
  z-index: 1;
  pointer-events: none;
  border-radius: 12px;
}
#preview-frame {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16/9;
  background:
    radial-gradient(1200px 800px at 40% 60%, rgba(30, 40, 60, 0.6), rgba(10, 15, 25, 0.95)),
    linear-gradient(180deg, #1a2030 0%, #0d1220 100%);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  user-select: none;
  touch-action: none;
}
#preview-wrap[data-aspect="9:16"] #preview-frame {
  aspect-ratio: 9/16;
  max-width: 400px;
}

/* Character */
#pv-character {
  position: absolute;
  cursor: grab;
  transform: translate(-50%, -50%);
  z-index: 3;
}
#pv-character:active { cursor: grabbing; }
.pv-char-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(236, 72, 153, 0.35));
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 40px;
  min-height: 40px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
/* Asset reale caricato: nascondi placeholder e mostra il PNG dell'utente */
#pv-character.has-image .pv-char-inner {
  background: transparent;
  border: none;
  color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: none;
}
/* Regola dedicata gia' aggiornata piu' su in .pv-char-inner + .has-image */

/* CTA preview */
#pv-cta {
  position: absolute;
  cursor: grab;
  transform: translate(-50%, -50%);
  z-index: 3;
  min-width: 40px;
  min-height: 40px;
}
#pv-cta:active { cursor: grabbing; }
.pv-cta-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(245, 158, 11, 0.35));
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
/* Asset reale caricato: nascondi placeholder e mostra il video */
#pv-cta.has-video .pv-cta-inner { display: none; }
.pv-cta-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: none;
  pointer-events: none;    /* click passa al div padre per il drag */
  /* chromakey verde 0x00FF00 non applicabile via CSS: si vede il green screen in preview.
     Nel render finale FFmpeg lo rimuove. Facciamo un blend-mode per attenuarlo. */
  mix-blend-mode: screen;
}
#pv-cta.has-video .pv-cta-inner { display: none; }
#pv-cta.has-video .pv-cta-video { display: block; }

/* Subtitle */
#pv-subtitle {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 4;
  text-align: center;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: "DejaVu Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;       /* mai wrap durante il drag */
  pointer-events: auto;
}
#pv-subtitle:active { cursor: grabbing; }
/* ==== Preset colore sub — bordo nero standard ==== */
#pv-subtitle.style-white_black {
  color: #ffffff;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-yellow_black {
  color: #ffed4a;
  font-style: italic;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-cyan_black {
  color: #00ffff;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-green_neon {
  color: #00ff00;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-pink_hot {
  color: #ff69b4;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-orange_black {
  color: #ffa500;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-red_black {
  color: #ff0000;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-gold_black {
  color: #ffd700;
  font-style: italic;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-sky_blue {
  color: #87ceeb;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
#pv-subtitle.style-purple_black {
  color: #ee82ee;
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}
/* ==== Bordi colorati ==== */
#pv-subtitle.style-white_blue {
  color: #ffffff;
  -webkit-text-stroke: 1.5px #0000ff;
  text-shadow: 2px 2px 0 #0000ff, -2px 2px 0 #0000ff, 2px -2px 0 #0000ff, -2px -2px 0 #0000ff;
}
#pv-subtitle.style-white_red {
  color: #ffffff;
  -webkit-text-stroke: 1.5px #ff0000;
  text-shadow: 2px 2px 0 #ff0000, -2px 2px 0 #ff0000, 2px -2px 0 #ff0000, -2px -2px 0 #ff0000;
}
#pv-subtitle.style-yellow_red {
  color: #ffed4a;
  font-style: italic;
  -webkit-text-stroke: 1.5px #ff0000;
  text-shadow: 2px 2px 0 #ff0000, -2px 2px 0 #ff0000, 2px -2px 0 #ff0000, -2px -2px 0 #ff0000;
}
#pv-subtitle.with-box {
  background: rgba(0, 0, 0, 0.5);
}

/* =====================================================
   Anteprima effetti animati sub.

   IMPORTANTE — le animation vanno sul FIGLIO #pv-sub-text (span del testo),
   NON sul div padre #pv-subtitle. Il padre e' un contenitore draggable con
   anche il resize handle come children; toccando il transform del padre
   spostiamo sia testo che handle e diventa incoerente.

   Cicli infinite loop 2-2.5s con fase attiva marcata (30-40% del ciclo)
   cosi' l'utente vede subito l'effetto senza aspettare 90% di stato fermo.
   ===================================================== */

/* FADE — appare/scompare dolcemente */
@keyframes fxFade {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: 1; }
}
#pv-subtitle.fx-fade #pv-sub-text {
  animation: fxFade 2s infinite ease-in-out;
  display: inline-block;
}

/* POP — parte piccolo e scatta a dimensione piena (TikTok style) */
@keyframes fxPop {
  0%       { transform: scale(0.4); opacity: 0; }
  20%      { transform: scale(1.0); opacity: 1; }
  80%      { transform: scale(1.0); opacity: 1; }
  100%     { transform: scale(0.4); opacity: 0; }
}
#pv-subtitle.fx-pop #pv-sub-text {
  animation: fxPop 2s infinite cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center center;
  display: inline-block;
}

/* BOUNCE — rimbalzo con overshoot marcato */
@keyframes fxBounce {
  0%       { transform: scale(0.3); opacity: 0; }
  15%      { transform: scale(1.25); opacity: 1; }
  25%      { transform: scale(0.9);  opacity: 1; }
  35%      { transform: scale(1.05); opacity: 1; }
  45%      { transform: scale(1);    opacity: 1; }
  85%      { transform: scale(1);    opacity: 1; }
  100%     { transform: scale(0.3); opacity: 0; }
}
#pv-subtitle.fx-bounce #pv-sub-text {
  animation: fxBounce 2.2s infinite ease-out;
  transform-origin: center center;
  display: inline-block;
}

/* SLIDE UP — entra scivolando dal basso */
@keyframes fxSlideUp {
  0%       { transform: translateY(40px); opacity: 0; }
  25%      { transform: translateY(0);    opacity: 1; }
  75%      { transform: translateY(0);    opacity: 1; }
  100%     { transform: translateY(-20px); opacity: 0; }
}
#pv-subtitle.fx-slide_up #pv-sub-text {
  animation: fxSlideUp 2.2s infinite ease-in-out;
  display: inline-block;
}

/* GLOW PULSE — halo giallo brillante che pulsa */
@keyframes fxGlowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 0 transparent);
    transform: scale(1);
  }
  50% {
    filter:
      drop-shadow(0 0 12px #ffed4a)
      drop-shadow(0 0 24px #ffa500);
    transform: scale(1.05);
  }
}
#pv-subtitle.fx-glow_pulse #pv-sub-text {
  animation: fxGlowPulse 1.2s infinite ease-in-out;
  transform-origin: center center;
  display: inline-block;
}

/* TYPEWRITER — ogni carattere e' un <span class="fx-ch"> con animation-delay
   progressivo. Compaiono in sequenza da sinistra a destra. Ciclo lungo per
   permettere a tutti i char di apparire e poi ricominciare. */
@keyframes fxTypeChar {
  0%       { opacity: 0; }
  30%      { opacity: 1; }
  90%      { opacity: 1; }
  100%     { opacity: 0; }
}
#pv-subtitle.fx-typewriter .fx-ch {
  opacity: 0;
  display: inline-block;
  animation: fxTypeChar 3s infinite linear;
}

/* KARAOKE WORD — simula il karaoke ASS dell'output finale:
   ogni parola parte grigia (non ancora letta), diventa giallo brillante
   quando "letta", poi resta color base. animation-delay progressivo crea
   l'effetto lettura sincronizzata da sinistra a destra. */
@keyframes fxKaraokeWord {
  0%       { color: #888; transform: scale(0.96); }
  30%      { color: #888; transform: scale(0.96); }
  45%      { color: #ffed4a; transform: scale(1.1); text-shadow: 0 0 8px #ffed4a; }
  60%      { color: inherit; transform: scale(1); text-shadow: none; }
  100%     { color: inherit; transform: scale(1); text-shadow: none; }
}
#pv-subtitle.fx-karaoke_word .fx-word {
  display: inline-block;
  color: #888;
  animation: fxKaraokeWord 2.5s infinite ease-in-out;
  transform-origin: center center;
}

/* WAVE COLOR — ogni parola cicla su una palette di 6 tinte vivaci */
@keyframes fxWaveColor {
  0%       { color: #ffffff; }
  16%      { color: #ffed4a; }
  33%      { color: #00ffff; }
  50%      { color: #00ff00; }
  66%      { color: #ff69b4; }
  83%      { color: #ffa500; }
  100%     { color: #ffffff; }
}
#pv-subtitle.fx-wave_color .fx-word {
  display: inline-block;
  animation: fxWaveColor 2.5s infinite linear;
}

/* ==== 8 NUOVI EFFETTI ==== */

/* ZOOM OUT — parte gigante e si rimpicciolisce */
@keyframes fxZoomOut {
  0%       { transform: scale(2.2); opacity: 0; }
  25%      { transform: scale(1);   opacity: 1; }
  75%      { transform: scale(1);   opacity: 1; }
  100%     { transform: scale(2.2); opacity: 0; }
}
#pv-subtitle.fx-zoom_out #pv-sub-text {
  animation: fxZoomOut 2.2s infinite ease-in-out;
  transform-origin: center center;
  display: inline-block;
}

/* ROTATE IN — entra ruotato di -30° */
@keyframes fxRotateIn {
  0%       { transform: rotate(-30deg) scale(0.6); opacity: 0; }
  25%      { transform: rotate(0deg)   scale(1);   opacity: 1; }
  75%      { transform: rotate(0deg)   scale(1);   opacity: 1; }
  100%     { transform: rotate(30deg)  scale(0.6); opacity: 0; }
}
#pv-subtitle.fx-rotate_in #pv-sub-text {
  animation: fxRotateIn 2.5s infinite ease-in-out;
  transform-origin: center center;
  display: inline-block;
}

/* SHAKE — vibrazione all'entrata */
@keyframes fxShake {
  0%   { transform: rotate(0) scale(0.7); opacity: 0; }
  10%  { transform: rotate(4deg)  scale(1); opacity: 1; }
  20%  { transform: rotate(-4deg) scale(1); }
  30%  { transform: rotate(3deg)  scale(1); }
  40%  { transform: rotate(-2deg) scale(1); }
  50%  { transform: rotate(0)     scale(1); opacity: 1; }
  90%  { transform: rotate(0)     scale(1); opacity: 1; }
  100% { transform: rotate(0)     scale(0.7); opacity: 0; }
}
#pv-subtitle.fx-shake #pv-sub-text {
  animation: fxShake 2.5s infinite linear;
  transform-origin: center center;
  display: inline-block;
}

/* OUTLINE PULSE — bordo (text-shadow) che pulsa in dimensione */
@keyframes fxOutlinePulse {
  0%, 100% {
    text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
  }
  50% {
    text-shadow:
      4px 4px 0 #000, -4px 4px 0 #000, 4px -4px 0 #000, -4px -4px 0 #000,
      6px 0 0 #000, -6px 0 0 #000, 0 6px 0 #000, 0 -6px 0 #000;
  }
}
#pv-subtitle.fx-outline_pulse #pv-sub-text {
  animation: fxOutlinePulse 1.4s infinite ease-in-out;
  display: inline-block;
}

/* RAINBOW — il colore dell'intero blocco cicla su 6 tinte vivaci */
@keyframes fxRainbow {
  0%   { color: #ff0000; }
  16%  { color: #ff8000; }
  33%  { color: #ffff00; }
  50%  { color: #00ff00; }
  66%  { color: #00ffff; }
  83%  { color: #ff00ff; }
  100% { color: #ff0000; }
}
#pv-subtitle.fx-rainbow #pv-sub-text {
  animation: fxRainbow 3s infinite linear;
  display: inline-block;
}

/* FADE UP — invisibile schiacciato verticalmente, appare mentre si espande */
@keyframes fxFadeUp {
  0%       { opacity: 0; transform: scaleY(1.4); }
  25%      { opacity: 1; transform: scaleY(1);   }
  75%      { opacity: 1; transform: scaleY(1);   }
  100%     { opacity: 0; transform: scaleY(0.6); }
}
#pv-subtitle.fx-fade_up #pv-sub-text {
  animation: fxFadeUp 2.5s infinite ease-in-out;
  transform-origin: center center;
  display: inline-block;
}

/* STRETCH — allungamento elastico X/Y pulsante */
@keyframes fxStretch {
  0%   { transform: scale(1, 1); opacity: 0; }
  15%  { transform: scale(1.4, 0.7); opacity: 1; }
  30%  { transform: scale(0.85, 1.15); opacity: 1; }
  45%  { transform: scale(1.05, 0.95); opacity: 1; }
  60%  { transform: scale(1, 1); opacity: 1; }
  90%  { transform: scale(1, 1); opacity: 1; }
  100% { transform: scale(1, 1); opacity: 0; }
}
#pv-subtitle.fx-stretch #pv-sub-text {
  animation: fxStretch 2.5s infinite ease-out;
  transform-origin: center center;
  display: inline-block;
}

/* WORD POP — ogni parola scala 130→100 in sequenza */
@keyframes fxWordPop {
  0%       { opacity: 0; transform: scale(1.3); }
  30%      { opacity: 1; transform: scale(1); }
  70%      { opacity: 1; transform: scale(1); }
  100%     { opacity: 0; transform: scale(1); }
}
#pv-subtitle.fx-word_pop .fx-word {
  display: inline-block;
  opacity: 0;
  animation: fxWordPop 2.5s infinite ease-out;
  transform-origin: center center;
}

/* WORD BOUNCE — ogni parola 70 → 120 → 100 in sequenza */
@keyframes fxWordBounce {
  0%       { opacity: 0; transform: scale(0.7); }
  20%      { opacity: 1; transform: scale(1.2); }
  40%      { opacity: 1; transform: scale(1); }
  70%      { opacity: 1; transform: scale(1); }
  100%     { opacity: 0; transform: scale(0.7); }
}
#pv-subtitle.fx-word_bounce .fx-word {
  display: inline-block;
  opacity: 0;
  animation: fxWordBounce 2.5s infinite ease-out;
  transform-origin: center center;
}

/* Resize handle (bottom-right su ogni elemento draggabile)
   Di default nascosta: appare solo quando l'elemento e' selezionato
   (click nel preview) o durante hover. Al click fuori scompare. */
.pv-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  z-index: 20;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  opacity: 0;                     /* nascosta di default */
  pointer-events: none;
  transition: opacity 0.15s, transform 0.1s;
  touch-action: none;
}
/* Selezione esplicita: click sull'elemento nel preview.
   NIENTE outline viola — solo la maniglia di resize appare. */
.pv-drag.pv-selected .pv-resize {
  opacity: 0.95;
  pointer-events: auto;
}
.pv-resize:hover { opacity: 1; transform: scale(1.2); }
.pv-resize::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  border-radius: 1px;
}

/* Guide lines (mostrate durante drag e su snap) */
.pv-guide {
  position: absolute;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 2;
}
.pv-guide.pv-guide-v {
  top: 0;
  bottom: 0;
  width: 1px;
}
.pv-guide.pv-guide-h {
  left: 0;
  right: 0;
  height: 1px;
}
.pv-guide.active { opacity: 0.8; }
.pv-guide.snap {
  background: var(--accent-2);
  opacity: 1;
  filter: drop-shadow(0 0 4px var(--accent-2)) drop-shadow(0 0 8px var(--accent-2));
  animation: pv-guide-flash 0.3s ease-out;
}
.pv-guide.snap.pv-guide-v { width: 3px; }
.pv-guide.snap.pv-guide-h { height: 3px; }
@keyframes pv-guide-flash {
  0%   { filter: drop-shadow(0 0 0 transparent); }
  30%  { filter: drop-shadow(0 0 8px var(--accent-2)) drop-shadow(0 0 16px var(--accent-2)); }
  100% { filter: drop-shadow(0 0 4px var(--accent-2)) drop-shadow(0 0 8px var(--accent-2)); }
}

/* Pulse sull'elemento draggato quando snappa (feeling di scatto) */
@keyframes pv-snap-pulse {
  0%   { filter: brightness(1); }
  35%  { filter: brightness(1.3) drop-shadow(0 0 10px var(--accent-2)); }
  100% { filter: brightness(1); }
}
.pv-drag.snapping {
  animation: pv-snap-pulse 0.28s ease-out;
}

/* Safe zones ai bordi: linee arancioni (background pieno, come le centrali).
   Cosi' lo snap flash + glow funziona identico a tutte le altre linee. */
.pv-guide.pv-guide-edge {
  background: var(--warn);
  opacity: 0.35;
}
.pv-guide.pv-guide-edge.active { opacity: 0.7; }
/* Quando snappa: la regola .pv-guide.snap (background magenta + glow + animation)
   fa gia' il lavoro. Nessun override necessario. */

.preview-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Apply row (salva default utente) ---------- */
.apply-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
#apply-status.saved  { color: var(--success); }
#apply-status.error  { color: var(--error); }
#apply-status.saving { color: var(--accent); }

/* ---------- Render actions ---------- */
.render-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}
#render-queue {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
#render-queue h3 { margin: 0 0 10px; font-size: 15px; }

/* Progress bar visuale del sub-job */
.pbar-wrap {
  position: relative;
  height: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-width: 120px;
}
.pbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease-out;
  border-radius: 8px;
  position: relative;
}
/* Effetto scan luminoso per rendere visibile il progresso */
.pbar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%);
  animation: pbar-scan 1.4s linear infinite;
}
@keyframes pbar-scan {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.pbar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
/* Stati particolari */
.pbar-fill.done {
  background: linear-gradient(90deg, var(--success), #22c55e);
}
.pbar-fill.failed {
  background: linear-gradient(90deg, var(--error), #ef4444);
}
.pbar-fill.done::after,
.pbar-fill.failed::after,
.pbar-fill.cancelled::after {
  animation: none;
  background: none;
}
.pbar-fill.cancelled {
  background: linear-gradient(90deg, var(--text-muted), #64748b);
}

/* ---------- Grid asset ---------- */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.asset-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  color: var(--text);
  position: relative;
}
.asset-item .fname { font-weight: 600; word-break: break-all; }
.asset-item .fsize { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.asset-item .btn-del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(239, 68, 68, 0.15); color: #fca5a5;
  border: none; border-radius: 6px; padding: 2px 6px; cursor: pointer;
  font-size: 11px;
}

/* ---------- Bundles table ---------- */
#bundles-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#bundles-table th, #bundles-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
#bundles-table th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }
.badge-ok    { color: var(--success); }
.badge-miss  { color: var(--warn); }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  max-width: 320px;
}
.toast.toast-ok    { border-left: 3px solid var(--success); }
.toast.toast-err   { border-left: 3px solid var(--error); }
.toast.toast-info  { border-left: 3px solid var(--accent); }

/* ---------- Admin: info ruoli ---------- */
.roles-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.role-info-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  border-left-width: 3px;
}
.role-info-card.role-editor  { border-left-color: #cbd5e1; }
.role-info-card.role-curator { border-left-color: #93c5fd; }
.role-info-card.role-admin   { border-left-color: #f9a8d4; }
.role-info-title { margin-bottom: 10px; }
.role-info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.role-info-card ul li {
  padding: 4px 0;
  padding-left: 18px;
  position: relative;
}
.role-info-card ul li:before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}
.role-info-card ul li b { color: var(--warn); }

/* ---------- API keys form ---------- */
.apikey-form {
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(180px, 1fr) minmax(220px, 2fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}
.apikey-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.apikey-form .compact-select {
  width: 100%;
}
@media (max-width: 720px) {
  .apikey-form {
    grid-template-columns: 1fr;
  }
}
#provider-info {
  padding: 8px 12px;
  background: var(--bg-elev);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  min-height: 22px;
}
#provider-info:empty { display: none; }
#provider-info a { color: var(--accent); text-decoration: none; }
#provider-info a:hover { text-decoration: underline; }

/* ---------- Provider links (siti senza API) ---------- */
.providers-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.provider-link {
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s, transform 0.05s;
}
.provider-link:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--accent);
}
.provider-link .arr {
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Sessions live table ---------- */
.tbl-sessions {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}
.tbl-sessions thead th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  white-space: nowrap;
}
.tbl-sessions tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tbl-sessions tbody tr:last-child td { border-bottom: none; }
.tbl-sessions tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* Column widths bilanciati */
.tbl-sessions .c-user   { width: 14%; }
.tbl-sessions .c-role   { width: 9%; }
.tbl-sessions .c-ip     { width: 13%; font-family: ui-monospace, monospace; font-size: 12px; }
.tbl-sessions .c-device { width: 26%; color: var(--text-muted); }
.tbl-sessions .c-time   { width: 12%; }

/* ---------- Admin table ---------- */
#users-table table, #audit-table table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
#users-table th, #users-table td,
#audit-table th, #audit-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
#users-table th, #audit-table th {
  color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase;
}
#library-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 10px 0;
}
#library-stats .stat {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 18px; min-width: 140px;
}
#library-stats .stat .n { font-size: 20px; font-weight: 700; }
#library-stats .stat .l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

/* ---------- Library page ---------- */
.compact-header { padding: 12px 16px !important; }
.stats-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stats-tiles .stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stats-tiles .stat .n {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stats-tiles .stat .l {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stats-tiles .stat.ok  { border-left: 3px solid var(--success); }
.stats-tiles .stat.rej { border-left: 3px solid var(--warn); }

.inline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.upload-row input[type="file"] {
  flex: 1 1 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.radio-group.inline {
  flex-direction: row;
  gap: 12px;
}

.compact-select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.library-grid .lib-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  position: relative;
  transition: transform 0.1s ease;
}
.library-grid .lib-item:hover { transform: translateY(-2px); }
.library-grid .lib-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 6px;
  background: linear-gradient(90deg,
    var(--bg-panel) 0%, rgba(255,255,255,0.05) 50%, var(--bg-panel) 100%);
  background-size: 200% 100%;
  animation: libSkel 1.4s ease-in-out infinite;
  display: block;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity .18s ease-out;
}
.library-grid .lib-item img[src] {
  animation: none;
  opacity: 1;
}
@keyframes libSkel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.library-grid .lib-item .lib-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-panel);
  border-radius: 6px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
}
.library-grid .lib-item .lib-img-placeholder::after { content: "🎬"; }
.library-grid .lib-item img.lib-img-fail {
  padding: 20% 25%;
  object-fit: contain;
  opacity: .55;
}
.library-grid .lib-item .lib-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.library-grid .lib-item .lib-type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
.lib-type.stock { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.lib-type.ai    { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
.library-grid .lib-item .btn-del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: none; border-radius: 4px;
  padding: 2px 6px; cursor: pointer;
  font-size: 10px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 460px;
}
.modal h3 { margin: 0 0 14px; }
.modal .form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.modal .form-row label { font-size: 12px; color: var(--text-muted); }
.modal input, .modal select {
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: 8px; font-size: 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* =====================================================
   Rename panel — scelta nome file output nel render
   ===================================================== */
.rename-panel {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.06));
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.rename-panel-header {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rename-panel-header strong {
  font-size: 15px;
  color: var(--text);
}
.rename-panel-body {
  display: flex; flex-direction: column; gap: 8px;
}
.rename-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(220px, 1.5fr);
  align-items: center;
  gap: 12px;
}
.rename-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.rename-idx {
  font-weight: 700; color: var(--text);
  min-width: 24px;
}
.rename-voice {
  font-family: ui-monospace, monospace; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rename-arrow { color: var(--text-muted); font-size: 14px; }
.rename-input-wrap {
  display: flex; align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev);
}
.rename-input-wrap:focus-within {
  border-color: rgba(139,92,246,0.7);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
}
.rename-input-wrap input.bundle-name-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 9px 12px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  outline: none;
}
.rename-input-wrap input.bundle-name-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}
.rename-ext {
  display: flex; align-items: center;
  padding: 0 12px;
  background: rgba(139,92,246,0.15);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  border-left: 1px solid var(--border);
}

/* =====================================================
   Asset list compatto — usato solo per voice-over
   ===================================================== */
.asset-grid.asset-list-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.asset-grid.asset-list-compact .asset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  min-height: 32px;
}
.asset-grid.asset-list-compact .asset-item .fname {
  flex: 1;
  font-weight: 500;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}
.asset-grid.asset-list-compact .asset-item .fsize {
  color: var(--text-muted);
  font-size: 11px;
  margin: 0;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.asset-grid.asset-list-compact .asset-item .btn-del {
  position: static;
  padding: 2px 8px;
  flex-shrink: 0;
}

/* =====================================================
   Preview: sfondo B-roll random + canvas chromakey CTA
   ===================================================== */
#pv-broll-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0 !important;
  pointer-events: none;
  border-radius: inherit;
}
#pv-black-overlay { z-index: 1 !important; }
.pv-guide { z-index: 2 !important; }
/* Character/CTA/Subtitle DEVONO stare sopra al B-roll bg */
#pv-character { z-index: 10 !important; }
#pv-cta       { z-index: 10 !important; }
#pv-subtitle  { z-index: 10 !important; }

/* Il video sorgente della CTA e' invisibile (feed per il canvas) */
.pv-cta-video {
  opacity: 0 !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
  z-index: 1;
}
/* Canvas CTA: sovrapposto al video, mostra il chromakey live.
   object-fit: contain per mantenere l'aspect ratio della CTA
   (evita distorsioni quando il div contenitore non e' delle
   stesse proporzioni del video). */
.pv-cta-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
  object-fit: contain;
  image-rendering: auto;
}
#pv-cta.has-video .pv-cta-inner { display: none !important; }
#pv-cta.has-video .pv-cta-canvas { display: block; }

/* =====================================================
   Character: <img> reale (sostituisce background-image)
   ===================================================== */
.pv-char-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: none;
  pointer-events: none;
  border-radius: 6px;
}
#pv-character.has-image .pv-char-inner { display: none !important; }
#pv-character.has-image .pv-char-img   { display: block; }

/* =====================================================
   Overlay colorato: rettangolo persistente sopra B-roll
   ===================================================== */
#pv-color-rect {
  position: absolute;
  cursor: grab;
  z-index: 4;               /* sopra B-roll bg (0), sotto character (10) */
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  touch-action: none;
  min-width: 40px;
  min-height: 20px;
}
#pv-color-rect:active { cursor: grabbing; }

/* =====================================================
   Color swatches: tavolozza tipo Paint per overlay B-roll
   ===================================================== */
.color-swatches {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.color-swatches .swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  /* <span role="button"> per bypassare completamente lo styling nativo dei
     button webkit che sovrascriveva il background inline. */
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  font-size: 0;
  line-height: 0;
  vertical-align: middle;
  box-sizing: border-box;
}
.color-swatches .swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 1px var(--accent);
}
.color-swatches .swatch.active {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 3px var(--bg-panel);
  transform: scale(1.05);
}
.color-swatches .swatch-custom {
  background: linear-gradient(135deg,#f44336,#ffeb3b 25%,#4caf50 50%,#2196f3 75%,#9c27b0) !important;
  color: white;
  font-weight: 700;
  font-size: 14px !important;
  line-height: 1 !important;
}
/* Il picker nativo <input type="color"> resta agganciato all'HTML per aprirsi
   via .click() sul bottone "+", ma non deve essere visibile: alcuni browser
   ignorano width:0 e mostrano comunque un rettangolo nero grande. */
#cfg-color-rect-color {
  display: none !important;
}

/* =====================================================
   Preset config video: riga selettore + azioni
   ===================================================== */
#preset-row {
  align-items: flex-end;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dashed var(--border);
}
#preset-row .preset-actions {
  display: inline-flex;
  gap: 6px;
  padding-bottom: 2px;
}
.btn-ghost.small { padding: 6px 10px; font-size: 12px; }

/* =====================================================
   Coda render compatta (tabella densa)
   ===================================================== */
.btn-primary.btn-compact {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
}
.render-actions { text-align: right; }

#render-queue { margin-top: 12px; }
.queue-title { margin-bottom: 6px; font-size: 12px; }

.queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.queue-table thead th {
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.queue-table tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-table .col-thumb { width: 52px; }
.queue-table .col-prog  { width: 140px; }
.queue-table .col-act   { width: 108px; text-align: right; }
.queue-table .col-title { max-width: 0; }

.queue-thumb {
  width: 44px;
  height: 25px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.queue-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
}
.queue-status.s-running   { background: rgba(139,92,246,0.25); color: #c4b5fd; }
.queue-status.s-done      { background: rgba(34,197,94,0.25);  color: #86efac; }
.queue-status.s-failed    { background: rgba(239,68,68,0.25);  color: #fca5a5; }
.queue-status.s-cancelled { background: rgba(148,163,184,0.2); color: #cbd5e1; }
.queue-status.s-queued    { background: rgba(148,163,184,0.15); color: #cbd5e1; }

.btn-ghost.xs {
  padding: 3px 7px;
  font-size: 11px;
  border-radius: 5px;
  margin-left: 2px;
}


/* =====================================================================
   Fase A frontend: Coda persistente & Video pronti
   ===================================================================== */
#section-user-queue { margin-top: 24px; }

.bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0 16px 0;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bulk-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-danger {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.12) !important;
}

.queue-hint {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(96, 165, 250, 0.08);
  border-left: 3px solid #60a5fa;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.queue-empty-hint .empty-queue {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
}

.queue-full { display: block; }

/* Job card — dark theme */
.job-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.job-card.status-running { border-color: #3b82f6; }
.job-card.status-done { border-color: #10b981; }
.job-card.status-failed { border-color: #dc2626; }
.job-card.status-partial { border-color: #f59e0b; }
.job-card.status-cancelled { border-color: var(--border); }

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}
.job-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.job-header-left .muted { color: var(--text-muted); }

.job-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.job-status-badge.s-queued    { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.job-status-badge.s-running   { background: rgba(59, 130, 246, 0.20); color: #93c5fd; }
.job-status-badge.s-done      { background: rgba(16, 185, 129, 0.20); color: #6ee7b7; }
.job-status-badge.s-failed    { background: rgba(220, 38, 38, 0.20); color: #fca5a5; }
.job-status-badge.s-partial   { background: rgba(245, 158, 11, 0.20); color: #fcd34d; }
.job-status-badge.s-cancelled { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.expires-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 500;
}

.job-body { padding: 8px 14px; background: var(--bg-panel); }

.sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sub-row:last-child { border-bottom: none; }

.sub-thumb {
  flex: 0 0 68px;
  width: 68px;
  height: 40px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty { font-size: 18px; opacity: 0.45; color: var(--text-muted); }

.sub-info { flex: 1; min-width: 0; }
.sub-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.sub-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.job-footer {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  flex-wrap: wrap;
}


/* =====================================================================
   Coda persistente — override colori (Mario preference)
   Colori piu' sobri, senza effetto scan luminoso.
   ===================================================================== */
#section-user-queue .pbar-fill {
  /* Solid teal-blue elegante, no gradient purple */
  background: #3b82f6;
}
#section-user-queue .pbar-fill.done {
  background: #10b981;   /* verde emerald sobrio */
}
#section-user-queue .pbar-fill.failed {
  background: #dc2626;   /* rosso pieno */
}
#section-user-queue .pbar-fill.cancelled {
  background: #9ca3af;   /* grigio neutro */
}
/* Rimuovi effetto scan luminoso dentro la coda persistente */
#section-user-queue .pbar-fill::after {
  display: none !important;
  animation: none !important;
  background: none !important;
}
#section-user-queue .pbar-wrap {
  height: 16px;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
#section-user-queue .pbar-label {
  color: #fff;
  font-size: 11px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   RESPONSIVE MOBILE (Task #79)
   Aggiunto 12/07 — dashboard + workspace + coda + player usabili da smartphone.
   Breakpoint principale 768px (tablet portrait / phone landscape).
   ========================================================================== */

/* Tablet portrait e sotto (<= 900px) */
@media (max-width: 900px) {
  body { font-size: 14px; }
  .app-shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    max-height: none;
    height: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    border-right: none;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }
  .sidebar-menu {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 0;
  }
  .sidebar-menu-item, .menu-item, .sidebar a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 13px;
  }
  .main-content, main, .content-area {
    padding: 12px;
  }
  .card {
    padding: 12px !important;
  }
}

/* Smartphone portrait (<= 640px) */
@media (max-width: 640px) {
  /* Grid due colonne → una colonna */
  .grid-2, .row-2, .two-panel-row, .three-panel-row,
  .config-grid, .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  /* Tabelle: scroll orizzontale invece che overflow */
  .table-wrap, .queue-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    font-size: 12px;
    min-width: 520px;
  }
  th, td { padding: 6px 8px !important; }
  /* Bottoni: piu' spazio tap-friendly, 44px min height (Apple HIG) */
  button, .btn, input[type=button], input[type=submit] {
    min-height: 40px;
    font-size: 14px;
  }
  /* Header hero e nomi lunghi non escono */
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  h3 { font-size: 16px !important; }
  /* Coda render: bottoni azioni impilati verticalmente */
  .queue-actions, .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .queue-actions button, .row-actions button {
    flex: 1 1 calc(50% - 3px);
  }
  /* Modal responsive: quasi tutto lo schermo */
  .modal, .modal-content {
    width: 92vw !important;
    max-width: 92vw !important;
    max-height: 88vh !important;
    padding: 16px !important;
  }
  /* Toast in alto invece che in basso destra */
  .toast, #toast-container {
    left: 8px !important;
    right: 8px !important;
    top: 8px !important;
    bottom: auto !important;
    width: auto !important;
  }
  /* Upload area piu' piccola */
  .upload-drop-zone, .drop-zone {
    padding: 20px 12px;
    font-size: 13px;
  }
  /* Workspace: thumb queue piu' piccoli */
  .queue-thumb { max-width: 64px; }
  .thumb-empty { font-size: 20px; }
  /* Sidebar mobile: chip look */
  .sidebar { padding: 6px 8px; }
  .sidebar-menu-item, .menu-item, .sidebar a {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 6px;
  }
  /* Nascondi elementi non essenziali su mobile */
  .desktop-only { display: none !important; }
  /* Config video: form label sopra input */
  label {
    display: block;
    margin-bottom: 4px;
  }
  input[type=text], input[type=number], input[type=email],
  select, textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;  /* iOS Safari zoom prevent: >=16px */
  }
}

/* Landscape phone (<= 900px height + landscape) */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar { max-height: 40px; overflow-x: auto; }
  h1 { font-size: 20px; }
}

/* ==========================================================================
   COOKIE NOTICE — banner minimale in basso + modal dettagli
   Attivato aggiungendo class .cn-visible via JS (cookie-notice.js).
   ========================================================================== */
#cookie-notice {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9998;
  background: #0f172a;
  color: #f1f5f9;
  padding: 12px 20px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
#cookie-notice.cn-visible { display: block; }
#cookie-notice .cn-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
#cookie-notice .cn-text { flex: 1; min-width: 240px; }
#cookie-notice a { color: #7dd3fc; text-decoration: underline; }
.cn-btn {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.cn-btn:hover { background: #2563eb; }
#cn-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#cn-modal.cn-visible { display: flex; }
#cn-modal .cn-modal-inner {
  background: #fff;
  color: #0f172a;
  padding: 24px 28px;
  border-radius: 10px;
  max-width: 520px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#cn-modal h3 { margin: 0 0 12px; font-size: 18px; }
#cn-modal p { margin: 8px 0; font-size: 14px; }
#cn-modal ul { margin: 8px 0 12px 20px; font-size: 13px; }
#cn-modal code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}
#cn-modal .cn-btn { margin-top: 12px; }
@media (max-width: 640px) {
  #cookie-notice { padding: 10px 12px; font-size: 13px; }
  #cookie-notice .cn-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .cn-btn { width: 100%; }
}
