
    :root{
      --bg:#0b0f14;
      --panel:#0f1620cc;
      --stroke:#ffffff1a;
      --stroke2:#ffffff2b;
      --txt:#e9eef5;
      --muted:#a9b4c2;
      --gold:#d7b56d;
      --accent:#7fd1ff;
      --danger:#ff5a5a;
      --ok:#69f0ae;
      --shadow: 0 20px 60px rgba(0,0,0,.45);
      --radius: 16px;
      --radius2: 22px;
    }

    *{ box-sizing:border-box; }
    html,body{ height:100%; margin:0; background:var(--bg); color:var(--txt); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; }
    #map{ height:100%; width:100%; }

    /* Top bar */
    .topbar{
      position:fixed; inset: 14px 14px auto 14px;
      display:flex; gap:12px; align-items:center; justify-content:space-between;
      padding:12px 14px;
      background: linear-gradient(180deg, #101927cc, #0f1620aa);
      border:1px solid var(--stroke);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
      z-index: 9999;
      pointer-events: auto;
    }
    .brand{
      display:flex; align-items:center; gap:12px;
      font-weight:700; letter-spacing:.4px;
    }
    .dot{ width:10px; height:10px; border-radius:999px; background: var(--gold); box-shadow: 0 0 20px rgba(215,181,109,.35); }
    .actions{ display:flex; gap:10px; align-items:center; }
    .btn{
      appearance:none; border:none; cursor:pointer;
      padding:10px 12px;
      border-radius: 14px;
      color:var(--txt);
      background: #121c2b;
      border:1px solid var(--stroke);
      transition: .15s ease;
      display:flex; align-items:center; gap:8px;
      font-weight:600;
    }
    .btn:hover{ transform: translateY(-1px); border-color: var(--stroke2); }
    .btn.primary{ background: linear-gradient(180deg, #1a2a42, #121c2b); border-color:#2b3f5f; }
    .btn.primary .pill{ background: #0e141e; border:1px solid var(--stroke); }
    .btn.danger{ background: #2a1216; border-color:#5f2b36; color:#ffd8d8; }
    .pill{
      padding:3px 8px; border-radius:999px;
      font-size:12px; color:var(--muted);
    }

    /* Search */
    .search{
      width:min(520px, 55vw);
      display:flex; gap:10px; align-items:center;
      background:#0e141ecc;
      border:1px solid var(--stroke);
      border-radius: 14px;
      padding:10px 12px;
    }
    .search input{
      width:100%;
      background:transparent;
      border:none; outline:none;
      color:var(--txt);
      font-size:14px;
    }
    .hint{ color:var(--muted); font-size:12px; line-height:1.3; }

    /* Right drawer (list) */
    .drawer{
      position:fixed; top:80px; right:14px; bottom:14px;
      width: 360px;
      background: linear-gradient(180deg, #0f1620dd, #0f1620aa);
      border:1px solid var(--stroke);
      border-radius: var(--radius2);
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
      z-index: 9998;
      display:flex; flex-direction:column;
      overflow:hidden;
    }
    .drawer header{
      padding:14px 14px 10px 14px;
      border-bottom:1px solid var(--stroke);
    }
    .drawer header .title{
      display:flex; justify-content:space-between; align-items:center; gap:10px;
    }
    .drawer header h3{ margin:0; font-size:15px; letter-spacing:.3px; }
    .drawer header .sub{ margin-top:6px; color:var(--muted); font-size:12px; }
    .list{ padding:12px; overflow:auto; }
    .card{
      background:#0b111b;
      border:1px solid var(--stroke);
      border-radius: 16px;
      padding:12px;
      margin-bottom:10px;
      transition:.15s ease;
    }
    .card:hover{ border-color:var(--stroke2); transform: translateY(-1px); }
    .card .row1{
      display:flex; align-items:center; justify-content:space-between; gap:10px;
      margin-bottom:8px;
    }
    .card b{ font-size:14px; }
    .tag{
      font-size:12px; color:var(--muted);
      border:1px solid var(--stroke);
      padding:3px 8px; border-radius:999px;
    }
    .card .desc{ color:var(--muted); font-size:12px; white-space:pre-wrap; margin-top:6px; }
    .thumbs{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
    .thumbs img{ width:76px; height:76px; object-fit:cover; border-radius:14px; border:1px solid var(--stroke); cursor: zoom-in; }
    .card .ops{ display:flex; gap:8px; margin-top:10px; }
    .smallbtn{
      flex:1;
      padding:9px 10px;
      border-radius: 14px;
      border:1px solid var(--stroke);
      background:#101927;
      color:var(--txt);
      cursor:pointer;
      font-weight:700;
      font-size:13px;
    }
    .smallbtn:hover{ border-color:var(--stroke2); transform: translateY(-1px); }
    .smallbtn.ghost{ background:#0e141e; }
    .smallbtn.primary{ background: linear-gradient(180deg, #1a2a42, #101927); border-color:#2b3f5f; }

    /* Context menu on map */
    .ctx{
      position:fixed;
      min-width: 220px;
      padding:10px;
      background: linear-gradient(180deg, #111b2bbb, #0f1620cc);
      border:1px solid var(--stroke2);
      border-radius: 18px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(10px);
      z-index: 10000;
      display:none;
    }
    .ctx .ctxTitle{
      font-size:12px; color:var(--muted);
      margin: 2px 6px 10px;
    }
    .ctx button{
      width:100%;
      text-align:left;
      padding:10px 12px;
      border-radius: 14px;
      border:1px solid var(--stroke);
      background:#0e141e;
      color:var(--txt);
      cursor:pointer;
      font-weight:700;
      margin-bottom:8px;
      display:flex; justify-content:space-between; align-items:center;
    }
    .ctx button:hover{ border-color:var(--stroke2); transform: translateY(-1px); }
    .ctx .kbd{ font-size:12px; color:var(--muted); border:1px solid var(--stroke); padding:2px 8px; border-radius:999px; }

    /* Modal */
    .backdrop{
      position:fixed; inset:0;
      background: rgba(0,0,0,.55);
      display:none;
      z-index: 11000;
    }
    .modal{
      position:fixed;
      inset:auto 0 0 0;
      margin:auto;
      width:min(820px, calc(100% - 28px));
      transform: translateY(20px);
      opacity:0;
      background: linear-gradient(180deg, #0f1620, #0b111b);
      border:1px solid var(--stroke2);
      border-radius: 22px;
      box-shadow: var(--shadow);
      padding:14px;
      z-index: 11001;
      display:none;
      transition:.18s ease;
      top: 90px;
      bottom: auto;
    }
    .modal.open{ transform: translateY(0); opacity:1; }
    .modal header{
      display:flex; justify-content:space-between; align-items:center; gap:12px;
      padding:6px 6px 12px 6px;
      border-bottom:1px solid var(--stroke);
      margin-bottom:12px;
    }
    .modal header h2{ margin:0; font-size:16px; letter-spacing:.3px; }
    .xbtn{
      width:40px; height:40px; border-radius:14px;
      border:1px solid var(--stroke);
      background:#111a28;
      color:var(--txt); cursor:pointer; font-weight:900;
    }
    .grid{
      display:grid;
      grid-template-columns: 1.1fr .9fr;
      gap:12px;
    }
    @media (max-width: 860px){
      .drawer{ width: calc(100% - 28px); left:14px; right:14px; top:80px; }
      .grid{ grid-template-columns: 1fr; }
      .search{ width:min(520px, 65vw); }
    }
    .field label{
      display:flex; justify-content:space-between; align-items:center;
      color:var(--muted); font-size:12px; margin: 0 0 6px 2px;
    }
    input[type="text"], textarea{
      width:100%;
      border-radius: 16px;
      border:1px solid var(--stroke);
      background:#0b111b;
      color:var(--txt);
      padding:12px;
      outline:none;
      font-size:14px;
    }
    textarea{ min-height:140px; resize:vertical; }
    .rowBtns{ display:flex; gap:10px; margin-top:10px; }
    .rowBtns .btn{ flex:1; justify-content:center; }
    .drop{
      border:1px dashed var(--stroke2);
      background: #0b111b;
      border-radius: 18px;
      padding:12px;
      min-height: 180px;
    }
    .drop .dropTitle{
      display:flex; justify-content:space-between; align-items:center;
      margin-bottom:8px;
    }
    .drop .dropTitle b{ font-size:13px; }
    .drop .dropTitle span{ font-size:12px; color:var(--muted); }
    .previews{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
    .previews .p{
      position:relative;
      width:110px; height:110px;
      border-radius: 18px;
      overflow:hidden;
      border:1px solid var(--stroke);
    }
    .previews img{ width:100%; height:100%; object-fit:cover; cursor: zoom-in; }
    .rm{
      position:absolute; top:8px; right:8px;
      width:28px; height:28px;
      border-radius: 12px;
      border:1px solid var(--stroke2);
      background: rgba(15,22,32,.75);
      color:var(--txt);
      cursor:pointer;
      font-weight:900;
    }
    .coordline{
      margin-top:10px;
      color:var(--muted);
      font-size:12px;
      display:flex; gap:10px; flex-wrap:wrap;
    }
    .coordline .chip{
      border:1px solid var(--stroke);
      background:#0e141e;
      border-radius:999px;
      padding:4px 10px;
    }

    /* Lightbox immagine */
    .lightbox-backdrop{
      position:fixed; inset:0;
      background: rgba(0,0,0,.72);
      display:none;
      z-index: 12000;
    }
    .lightbox{
      position:fixed;
      inset: 0;
      margin:auto;
      width: min(1100px, calc(100% - 28px));
      height: min(86vh, 900px);
      background: linear-gradient(180deg, #0f1620, #0b111b);
      border:1px solid var(--stroke2);
      border-radius: 22px;
      box-shadow: var(--shadow);
      display:none;
      z-index: 12001;
      overflow:hidden;
    }
    .lightbox header{
      display:flex; align-items:center; justify-content:space-between;
      padding:12px 12px;
      border-bottom:1px solid var(--stroke);
    }
    .lightbox header b{ font-size:14px; color:var(--muted); font-weight:700; }
    .lightbox .xbtn2{
      width:42px; height:42px;
      border-radius: 14px;
      border:1px solid var(--stroke);
      background:#111a28;
      color:var(--txt);
      cursor:pointer;
      font-weight:900;
    }
    .lightbox .content{
      height: calc(100% - 60px);
      display:flex;
      align-items:center;
      justify-content:center;
      padding: 14px;
    }
    .lightbox img{
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      border-radius: 18px;
      border:1px solid var(--stroke);
    }

    /* Background fuori bounds (zoom-out) */
    #map,
    .leaflet-container{
      background:
        radial-gradient(1200px 900px at 30% 20%, rgba(215,181,109,.10), transparent 55%),
        radial-gradient(900px 700px at 80% 70%, rgba(127,209,255,.08), transparent 55%),
        linear-gradient(180deg, #070a10, #0b0f14) !important;
    }

    /* Grid labels */
    .grid-label{
  color: rgba(233,238,245,.92);
  background: rgba(15,22,32,.78);
  border: 1px solid rgba(255,255,255,.18);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  user-select: none;
  pointer-events: none;
}


    /* Etichetta grande "alpha" dentro ogni cella */
   .grid-cell-label{
  background: transparent !important;
  border: none !important;
display:none;
  color: rgba(233,238,245,.30);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 2px;
  text-shadow: 0 10px 30px rgba(0,0,0,.35);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}
.grid-cell-label-inner{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transform: none !important;
  font-size: var(--gridCellFont, 26px);
}

    /* HUD coordinate (sempre visibile mentre muovi il mouse) */
.coordHud{
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 10002;
  background: linear-gradient(180deg, #111b2bbb, #0f1620cc);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  min-width: 220px;
  pointer-events: none;
}
.coordHudTitle{
  font-size: 12px;
  color: rgba(169,180,194,.95);
  margin-bottom: 6px;
}
.coordHudRow{
  font-weight: 900;
  letter-spacing: .4px;
  color: rgba(233,238,245,.92);
  font-size: 13px;
}

.showCellLabels .grid-cell-label{ display:block; }

  
/* --- FIX MODAL VISIBILITY (v3.1) --- */
.backdrop{
  position: fixed !important;
  inset: 0 !important;
  z-index: 999 !important;
  background: rgba(0,0,0,.55) !important;
}
.modal{
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 1000 !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.55) !important;
}


/* ===== FIX MODALS + INPUTS (v4.4) ===== */
.backdrop{ position: fixed !important; inset:0 !important; z-index: 999 !important; background: rgba(0,0,0,.55) !important; }
.modal{ position: fixed !important; top:50% !important; left:50% !important; transform: translate(-50%,-50%) translateY(10px) !important; z-index:1000 !important; opacity:0 !important; pointer-events:none !important; }
.modal.open{ opacity:1 !important; transform: translate(-50%,-50%) translateY(0) !important; pointer-events:auto !important; }
input[type="text"], input[type="password"], textarea, select{
  background: rgba(10, 14, 22, 0.65) !important;
  color: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
}
input::placeholder, textarea::placeholder{ color: rgba(255,255,255,0.45) !important; }
input:focus, textarea:focus, select:focus{
  border-color: rgba(255,255,255,0.22) !important;
  box-shadow: 0 0 0 3px rgba(255, 215, 128, 0.10) !important;
  outline: none !important;
}
#loginModal{
  border: 1px solid rgba(255,255,255,0.12) !important;
  background: radial-gradient(120% 140% at 20% 0%, rgba(255,255,255,0.08) 0%, rgba(10,14,22,0.85) 42%, rgba(6,10,18,0.92) 100%) !important;
}



/* ===== Extra polish (separated v1) ===== */
#loginModal{
  border: 1px solid rgba(255,255,255,0.12);
  background: radial-gradient(120% 140% at 20% 0%, rgba(255,255,255,0.08) 0%, rgba(10,14,22,0.85) 42%, rgba(6,10,18,0.92) 100%);
}
input[type="text"], input[type="password"], textarea, select{
  background: rgba(10, 14, 22, 0.65) !important;
  color: rgba(255,255,255,0.92) !important;
}



/* --- extras for separated v2 --- */
.tableWrap{margin-top:12px;overflow:auto;border:1px solid rgba(255,255,255,0.08);border-radius:14px;}
.tbl{width:100%;border-collapse:collapse;font-size:13px;}
.tbl th,.tbl td{padding:10px 12px;text-align:left;border-top:1px solid rgba(255,255,255,0.06);}
.tbl thead th{background:rgba(255,255,255,0.04);border-top:none;}
.row.cols2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.row.cols3{display:grid;grid-template-columns:1fr 1fr 180px;gap:12px;}
.row.inline{display:flex;gap:10px;align-items:center;}
.msg{margin-top:10px;font-size:12px;opacity:.9;white-space:pre-wrap;}
.hint{margin-top:8px;font-size:12px;opacity:.65;}

/* Nasconde completamente l'elenco laterale */
#toggleDrawerBtn { display: none !important; }
.drawer { display: none !important; }
body.spawnPick .topbar,
body.spawnPick .drawer,
body.spawnPick .modal,
body.spawnPick .backdrop,
body.spawnPick .ctx{
  display:none !important;
}
body.spawnPick #map{
  position:fixed;
  inset:0;
  z-index: 1;
}

.spawnPickBar{
  position:fixed;
  top:12px;
  left:50%;
  transform:translateX(-50%);
  z-index: 10000;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  width:min(980px, calc(100vw - 24px));
  background: linear-gradient(180deg, #111b2bee, #0f1620dd);
  border:1px solid var(--stroke2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding:10px 12px;
}



/* ===== Categories left panel ===== */
.catpanel{
  position: fixed;
  left: 14px;
  top: 78px;
  width: 300px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 92px);
  z-index: 9999;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,14,20,.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  overflow: hidden;
}
.catpanel.collapsed{
  width: 52px;
}
.catpanel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.catpanel-body{
  padding: 10px;
  overflow:auto;
  max-height: calc(100vh - 150px);
}
.catpanel.collapsed .catpanel-body{
  display:none;
}
.catpanel-actions{
  display:flex;
  gap:10px;
  margin-bottom: 10px;
}
.catlist{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding: 6px 2px;
}
.catrow{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  cursor: pointer;
  user-select:none;
}
.catrow:hover{
  background: rgba(0,0,0,.28);
}
.catrow input{
  accent-color: #d7b56d;
}
@media (max-width: 700px){
  .catpanel{ left: 8px; top: 74px; width: min(330px, calc(100vw - 16px)); }
}
/* ===== LOG: scrollbar visibile + area scrollabile ===== */
#logTableWrap{
  max-height: 55vh;        /* altezza massima della tabella log */
  overflow-y: scroll;      /* forza la scrollbar verticale visibile */
  overflow-x: auto;        /* orizzontale se serve */
  scrollbar-gutter: stable;/* riserva spazio scrollbar (browser moderni) */
}

/* Se vuoi anche il contenuto sopra (statistiche + tabella online) scrollabile */
#logModal .body{
  max-height: 72vh;
  overflow-y: auto;
}

/* Chrome/Edge/Safari - stile scrollbar */
#logTableWrap::-webkit-scrollbar{
  width: 10px;
  height: 10px;
}
#logTableWrap::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
}
#logTableWrap::-webkit-scrollbar-thumb{
  background: rgba(215,181,109,0.40);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
}
#logTableWrap::-webkit-scrollbar-thumb:hover{
  background: rgba(215,181,109,0.60);
}

/* Firefox */
#logTableWrap{
  scrollbar-width: thin;
  scrollbar-color: rgba(215,181,109,0.55) rgba(255,255,255,0.06);
}
/* ===== CATEGORIES PANEL: collapse che resta riapribile ===== */
#catPanel{
  position: fixed;
  left: 12px;
  top: 92px;
  width: 260px;
  z-index: 9999;
}

/* header sempre visibile */
#catPanel .catpanel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

/* corpo scrollabile e ordinato */
#catPanel .catpanel-body{
  max-height: 65vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

/* stato collassato = pannello diventa "linguetta" */
#catPanel.is-collapsed{
  width: 46px;
  overflow: visible;
}

/* nel collassato nascondo il body, ma NON l'header */
#catPanel.is-collapsed .catpanel-body{
  display: none !important;
}

/* nel collassato, in header tengo solo il pulsante */
#catPanel.is-collapsed .catpanel-title{
  display:none !important;
}

/* tab laterale sempre cliccabile */
#catPanel .catCollapseBtn{
  width: 34px;
  height: 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  user-select:none;
}

/* ===== FILTRI: layout più pulito (se stanno dentro il pannello) ===== */
#catPanel .catpanel-filters{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin: 10px 0 12px;
}

#catPanel .catpanel-filters .row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

#catPanel .catpanel-filters input,
#catPanel .catpanel-filters select{
  width:100%;
}

/* scrollbar gradevole (facoltativo) */
#catPanel .catpanel-body::-webkit-scrollbar{ width:10px; }
#catPanel .catpanel-body::-webkit-scrollbar-track{ background: rgba(255,255,255,.05); border-radius: 999px; }
#catPanel .catpanel-body::-webkit-scrollbar-thumb{ background: rgba(215,181,109,.45); border-radius: 999px; }
#catPanel .catpanel-body{ scrollbar-width: thin; scrollbar-color: rgba(215,181,109,.55) rgba(255,255,255,.06); }


/* ===== MODALI PIÙ LARGHE ===== */
#monstersModal{ width: min(1200px, calc(100vw - 28px)) !important; }
#usersModal{    width: min(1100px, calc(100vw - 28px)) !important; }
#logModal{      width: min(1350px, calc(100vw - 28px)) !important; }

/* Se vuoi che la lista “schede mob” sfrutti meglio la larghezza */
#monstersGrid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* ===== DRAG MODALI ===== */
.modal header{
  cursor: grab;
  user-select: none;
}
.modal.dragging header{ cursor: grabbing; }

/* Questa classe “stacca” il modal dal centering (che ora è con !important) */
.modal.freepos{
  top: var(--freeTop) !important;
  left: var(--freeLeft) !important;
  transform: translate(0,0) !important;
  margin: 0 !important;
}
.modal.freepos.open{
  transform: translate(0,0) !important;
}
/* ===== BACKDROP NON BLOCCA LA MAPPA (tasto destro incluso) ===== */
.backdrop{
  pointer-events: none !important;  /* lascia passare i click alla mappa */
}
/* ===== DRAG CATEGORIE: maniglia ===== */
#catPanel .catpanel-header,
.catpanel-head{
  cursor: grab;
  user-select: none;
}
#catPanel.dragging .catpanel-header,
.catpanel.dragging .catpanel-head{
  cursor: grabbing;
}
/* Non oscurare mai la mappa quando un modal è aperto */
.backdrop{
  background: transparent !important;
  backdrop-filter: none !important; /* nel caso lo aggiungessi in futuro */
}

/* ===== NO TEXT/IMAGE SELECTION (UI) ===== */
html, body{
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* Permetti comunque di selezionare testo nei campi */
input, textarea, select{
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  user-select: text !important;
}

/* Evita trascinamento immagini/icone (drag ghost) */
img, svg{
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none; /* se vuoi che le immagini non intercettino click */
}
img[data-lightbox="1"]{
  pointer-events: auto;
  cursor: zoom-in;
}
/* Se hai icone cliccabili dentro bottoni/link, riabilita il click lì */
button img, a img, .clickable img, .icon img{
  pointer-events: auto;
}
/* (facoltativo) se vuoi che il modal “prenda” i click, ma il resto no:
   lo fa già, perché .modal.open ha pointer-events:auto nel tuo CSS :contentReference[oaicite:2]{index=2} */

/* ===== Marketplace ===== */
.marketList{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: calc(80vh - 190px);
  overflow:auto;
  padding-right: 4px;
}
.marketCard{
  border:1px solid var(--stroke2);
  border-radius:16px;
  background: linear-gradient(180deg, #0f1620, #0b111b);
  box-shadow: var(--shadow2);
  padding:12px;
}
.marketCardHead{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.marketTitle{
  font-weight:700;
  letter-spacing:.2px;
}
.marketMeta{
  color: var(--muted);
  font-size:12px;
  margin-top:2px;
}
.marketPriceRow{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:8px;
  align-items:center;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  font-size:12px;
}
.marketImgs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.marketImgs img{
  width:86px;
  height:86px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid var(--stroke2);
}
.marketActions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
  justify-content:flex-end;
}
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 720px){
  .grid2{ grid-template-columns: 1fr; }
}
/* ===== /Marketplace ===== */



/* ===============================
   MARKETPLACE (UI migliorata)
================================= */
#marketModal{
  width: min(1320px, calc(100% - 28px)) !important;
}
#marketModal .body{
  max-height: 78vh;
  overflow: auto;
}
.marketList{
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.marketCard{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,12,18,.72);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.marketThumb{
  width: 100%;
  aspect-ratio: 16 / 10;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.10);
  position: relative;
}
.marketThumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  pointer-events: auto;
}
.marketThumb.ph{
  display:flex;
  align-items:center;
  justify-content:center;
}
.marketThumb .phTxt{
  opacity:.7;
  font-size: 12px;
}
.marketInfo{
  padding: 10px 12px 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.marketTop{
  display:flex;
  gap:10px;
  align-items:flex-start;
  justify-content: space-between;
}
.marketTitle{
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}
.marketMeta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:10px;
  flex-wrap: wrap;
  opacity: .95;
}
.marketSeller{
  font-size: 12px;
  opacity: .9;
}
.marketBadges{
  display:flex;
  gap:8px;
  align-items:center;
}
.badgePrice, .badgeQty{
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.25);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badgePrice{
  font-weight: 700;
}
.marketThumbs{
  display:flex;
  gap:6px;
}
.marketMini{
  width: 44px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.12);
  pointer-events: auto;
}

/* Editor annuncio */
#listingModal{
  width: min(980px, calc(100% - 28px)) !important;
}
#listingModal .body{
  max-height: 78vh;
  overflow:auto;
}
#listingDrop.over{
  outline: 2px solid rgba(127,209,255,.55);
}
#listingPreviews{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap:10px;
  margin-top:10px;
}
.listingP{
  position:relative;
  border:1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  overflow:hidden;
  background: rgba(255,255,255,.06);
}
.listingP img{
  width:100%;
  height:92px;
  object-fit:cover;
  display:block;
  pointer-events:auto;
}
.listingP .rm{
  position:absolute;
  top:6px;
  right:6px;
  width:26px;
  height:26px;
  border-radius: 10px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.45);
  color:#fff;
  cursor:pointer;
}


/* ==========================================================
   MARKETPLACE – dimensioni più grandi + dati più visibili
   Patch CSS (solo UI) – v1
   ========================================================== */

/* Modal più grande */
#marketModal{
  width: min(1500px, calc(100vw - 28px)) !important;
}

/* Corpo scrollabile più alto */
#marketModal .body{
  max-height: 82vh !important;
  overflow: auto !important;
}

/* Griglia annunci: card più larghe così testo/immagini si leggono meglio */
.marketList{
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
  gap: 16px !important;
}

/* Card più “premium” e leggibile */
.marketCard{
  border: 1px solid rgba(215,181,109,.28) !important;
  background: rgba(10,12,18,.78) !important;
}
.marketCard:hover{
  border-color: rgba(215,181,109,.45) !important;
}

/* Immagine principale più grande e pulita */
.marketThumb{
  aspect-ratio: 16 / 9 !important;
}
.marketThumb img{
  filter: saturate(1.05) contrast(1.05);
}

/* Area info: più respiro e font più grandi */
.marketInfo{
  padding: 12px 14px 14px !important;
  gap: 10px !important;
}
.marketTitle{
  font-size: 16px !important;
  line-height: 1.25 !important;
}

/* Metadati disposti meglio */
.marketMeta{
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

/* Venditore più visibile */
.marketSeller{
  font-size: 13px !important;
  color: rgba(233,238,245,.92) !important;
}
.marketSeller::before{
  content: "👤 ";
  opacity: .95;
}

/* Badge prezzo/quantità più evidenti */
.marketBadges{
  width: 100% !important;
  justify-content: flex-start !important;
  gap: 10px !important;
}
.badgePrice, .badgeQty{
  font-size: 14px !important;
  padding: 6px 10px !important;
  border-width: 1px !important;
  letter-spacing: .2px;
}
.badgePrice{
  font-weight: 900 !important;
  border-color: rgba(215,181,109,.42) !important;
  background: rgba(215,181,109,.12) !important;
}
.badgeQty{
  border-color: rgba(127,209,255,.28) !important;
  background: rgba(127,209,255,.10) !important;
}

/* Miniature più grandi (se ci sono più immagini) */
.marketThumbs{
  gap: 8px !important;
}
.marketMini{
  width: 56px !important;
  height: 44px !important;
  border-radius: 12px !important;
}

/* Mobile: modal quasi full-screen */
@media (max-width: 720px){
  #marketModal{
    width: calc(100vw - 16px) !important;
  }
  .marketList{
    grid-template-columns: 1fr !important;
  }
}




/* ==========================================================
   MARKETPLACE – estetica annunci (solo CSS) – v2
   Migliora visibilità: immagine, titolo, venditore, prezzo, quantità
   (Compatibile con il renderer attuale che usa #marketGrid .card)
   ========================================================== */

/* Modal marketplace più ampio */
#marketModal{
  width: min(1500px, calc(100vw - 28px)) !important;
}

/* Griglia annunci (usa #marketGrid nel JS attuale) */
#marketGrid{
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)) !important;
  gap: 16px !important;
  margin-top: 12px !important;
}

/* Card annuncio */
#marketGrid .card{
  padding: 0 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  border: 1px solid rgba(215,181,109,.30) !important;
  background: rgba(10,12,18,.78) !important;
}

/* Immagine principale (più grande) */
#marketGrid .card > img{
  width: 100% !important;
  height: 190px !important;
  object-fit: contain !important;
  background: rgba(0,0,0,.35) !important;
  object-position: center !important;
  border-radius: 0 !important;
  margin: 0 !important;
  display: block !important;
  pointer-events: auto !important; /* importante: nel tuo CSS globale le img sono pointer-events:none */
  filter: saturate(1.06) contrast(1.06);
}

/* Riga titolo + quantità */
#marketGrid .card .row1{
  padding: 12px 14px 0 14px !important;
  margin: 0 !important;
  display:flex !important;
  align-items:flex-start !important;
  justify-content: space-between !important;
  gap: 10px !important;
}
#marketGrid .card .row1 b{
  font-size: 16px !important;
  line-height: 1.25 !important;
  letter-spacing: .2px;
  max-width: 100%;
}

/* Quantità come badge evidente */
#marketGrid .card .row1 .tag{
  font-size: 13px !important;
  font-weight: 900 !important;
  color: rgba(233,238,245,.95) !important;
  border: 1px solid rgba(127,209,255,.35) !important;
  background: rgba(127,209,255,.12) !important;
  padding: 6px 10px !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
}

/* Prezzo più visibile */
#marketGrid .card .desc{
  padding: 10px 14px 0 14px !important;
  margin: 0 !important;
  font-size: 13px !important;
  color: rgba(233,238,245,.86) !important;
}
#marketGrid .card .desc b{
  font-size: 18px !important;
  font-weight: 1000 !important;
  letter-spacing: .2px;
  color: rgba(233,238,245,.98) !important;
}

/* Venditore più evidente */
#marketGrid .card .hint{
  padding: 8px 14px 0 14px !important;
  margin: 0 !important;
  font-size: 13px !important;
  color: rgba(233,238,245,.90) !important;
  opacity: 1 !important;
}

/* Area bottoni */
#marketGrid .card > div[style*="display:flex"]{
  padding: 12px 14px 14px 14px !important;
  margin-top: 0 !important;
}
#marketGrid .card .btn{
  width: 100% !important;
  justify-content: center !important;
  border-radius: 14px !important;
  font-weight: 800 !important;
}

/* Hover più “premium” */
#marketGrid .card:hover{
  transform: translateY(-1px);
  border-color: rgba(215,181,109,.46) !important;
}

/* Mobile: una colonna e immagine leggermente più bassa */
@media (max-width: 720px){
  #marketGrid{
    grid-template-columns: 1fr !important;
  }
  #marketGrid .card > img{
    height: 170px !important;
  }
}

/* ==========================================================
   DETTAGLIO ANNUNCIO (modal visualizzazione)
   ========================================================== */
#listingViewModal{
  width: min(1250px, calc(100% - 28px)) !important;
}
#listingViewModal .body{
  max-height: 82vh;
  overflow: auto;
}
.listingViewLayout{
  display:grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 900px){
  .listingViewLayout{ grid-template-columns: 1fr; }
}

.listingViewMain{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  border-radius: 18px;
  overflow:hidden;
  min-height: 380px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.listingViewMainImg{
  width:100%;
  height: min(56vh, 520px);
  object-fit: contain;
  background: rgba(0,0,0,.35);
  cursor: zoom-in;
  pointer-events: auto !important;
}
.listingViewNoImg{
  padding: 22px;
  color: var(--muted);
  font-weight: 700;
}

.listingViewThumbs{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.listingViewThumb{
  width:100%;
  height: 86px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  cursor: zoom-in;
  pointer-events: auto !important;
}
.listingViewThumb:hover{
  border-color: rgba(215,181,109,.45);
}

.listingViewRight{
  position: sticky;
  top: 0;
}
@media (max-width: 900px){
  .listingViewRight{ position: static; }
}

.listingViewInfo{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,12,18,.72);
  border-radius: 18px;
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.listingViewRow{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  align-items:baseline;
}
.listingViewRow .k{
  color: var(--muted);
  font-size: 12px;
}
.listingViewRow .v{
  font-weight: 900;
  font-size: 14px;
}


/* ===== INBOX ===== */
#inboxPanel{
  left: auto;
  right: 14px;
  top: 74px;
  width: min(520px, calc(100vw - 24px));
  z-index: 9999;
}
#inboxPanel.collapsed{
  width: 220px;
}
#inboxPanel .catpanel-body{
  max-height: 70vh;
  overflow: auto;
}
.inboxDot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:#ff3b3b;
  box-shadow: 0 0 0 3px rgba(255,59,59,.18);
}
.inboxHint{
  font-size:12px;
  opacity:.82;
  padding: 8px 0 10px;
}
.inboxSplit{
  display:grid;
  grid-template-columns: 190px 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 720px){
  #inboxPanel{ width: min(560px, calc(100vw - 16px)); }
  .inboxSplit{ grid-template-columns: 1fr; }
}
.inboxThreads{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  border-radius: 14px;
  overflow: hidden;
}
.threadItem{
  padding: 10px 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.threadItem:first-child{ border-top: none; }
.threadItem:hover{ background: rgba(255,255,255,.05); }
.threadItem.active{ background: rgba(215,181,109,.14); }
.threadTop{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.threadUser{ font-weight:800; font-size:12px; letter-spacing:.2px; }
.threadTime{ font-size:11px; opacity:.65; white-space:nowrap; }
.threlistingPrev{ font-size:12px; opacity:.82; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.threadUnread{
  font-size:11px;
  font-weight:800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,59,59,.14);
  border: 1px solid rgba(255,59,59,.45);
  color: #ffd8d8;
  white-space:nowrap;
}
.inboxChat{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  border-radius: 14px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height: 280px;
}
.inboxChatHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}
.inboxChatWith{
  font-weight:900;
  letter-spacing:.25px;
  font-size:12px;
}
.inboxMsgs{
  padding: 10px 10px;
  overflow: auto;
  flex: 1;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.msgRow{
  display:flex;
}
.msgRow.me{ justify-content:flex-end; }
.bubble{
  max-width: 86%;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(16,25,39,.55);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.msgRow.me .bubble{
  background: rgba(215,181,109,.18);
  border-color: rgba(215,181,109,.35);
}
.bubbleMeta{
  margin-top: 4px;
  font-size: 10px;
  opacity: .65;
}
.inboxSend{
  display:flex;
  gap:8px;
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.16);
}
.inboxSend textarea{
  flex:1;
  resize:none;
  min-height: 40px;
}
.inboxSend .btn{ white-space:nowrap; }

/* Scrollbar scura e discreta (niente barra bianca) */
#inboxPanel .catpanel-body,
.inboxThreads,
.inboxMsgs{
  scrollbar-width: thin;                 /* Firefox */
  scrollbar-color: rgba(215,181,109,.42) rgba(0,0,0,.10);
}

#inboxPanel .catpanel-body::-webkit-scrollbar,
.inboxThreads::-webkit-scrollbar,
.inboxMsgs::-webkit-scrollbar{
  width: 10px;
}
#inboxPanel .catpanel-body::-webkit-scrollbar-track,
.inboxThreads::-webkit-scrollbar-track,
.inboxMsgs::-webkit-scrollbar-track{
  background: rgba(0,0,0,.12);
}
#inboxPanel .catpanel-body::-webkit-scrollbar-thumb,
.inboxThreads::-webkit-scrollbar-thumb,
.inboxMsgs::-webkit-scrollbar-thumb{
  background: rgba(215,181,109,.28);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,.12);
}
#inboxPanel .catpanel-body::-webkit-scrollbar-thumb:hover,
.inboxThreads::-webkit-scrollbar-thumb:hover,
.inboxMsgs::-webkit-scrollbar-thumb:hover{
  background: rgba(215,181,109,.42);
}
/* ===== /INBOX ===== */


/* ===== Global scrollbar (Chrome/Edge/Safari + Firefox) ===== */

/* Firefox */
* {
  scrollbar-width: thin;                                /* auto | thin | none */
  scrollbar-color: rgba(215,181,109,.65) rgba(10,14,20,.65);
}

/* WebKit (Chrome/Edge/Safari) */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(10,14,20,.65);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(215,181,109,.85),
    rgba(215,181,109,.45)
  );
  border-radius: 999px;
  border: 2px solid rgba(10,14,20,.75); /* crea “spazio” attorno */
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(215,181,109,1),
    rgba(215,181,109,.6)
  );
}

*::-webkit-scrollbar-corner {
  background: rgba(10,14,20,.65);
}