* { box-sizing: border-box; }
:root {
  --bg: #06101d;
  --panel: rgba(8, 24, 43, .92);
  --panel2: rgba(11, 35, 61, .88);
  --line: rgba(255,255,255,.12);
  --text: #eef7ff;
  --muted: #91a9be;
  --accent: #19a7ff;
  --accent2: #5fd2ff;
  --good: #6ee7a8;
  --warn: #ffd166;
  --danger: #ff6b6b;
}
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; overflow: hidden; }
body { display:flex; flex-direction:column; }
button { font: inherit; }
.topbar {
  min-height: 72px; display:flex; align-items:center; justify-content:space-between; gap:18px;
  padding: 10px 18px; border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, #0b1d31 0%, #071522 100%);
  z-index: 5;
}
.brand { display:flex; align-items:center; gap:10px; min-width:230px; }
.brand-mark { width:48px; height:48px; border-radius:12px; display:grid; place-items:center; font-weight:900; letter-spacing:-1px; background:linear-gradient(135deg, #1ea7ff, #0e5dc7); box-shadow: 0 0 28px rgba(30,167,255,.2); }
.brand-mark {
  overflow: hidden;
  padding: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}
.brand strong { display:block; font-size:15px; }
.brand span { display:block; font-size:12px; color:var(--muted); margin-top:2px; }
.stats { display:flex; align-items:stretch; gap:8px; overflow:auto; scrollbar-width:none; }
.stats > div { min-width:105px; padding:7px 11px; border:1px solid var(--line); border-radius:11px; background:rgba(255,255,255,.035); }
.stats span { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); }
.stats strong { display:block; margin-top:2px; font-size:15px; }
main { flex:1; min-height:0; }
.map-shell { position:relative; width:100%; height:100%; background:#06111f; overflow:hidden; touch-action:none; user-select:none; }
#stadiumCanvas { width:100%; height:100%; display:block; cursor:grab; }
#stadiumCanvas.dragging { cursor:grabbing; }
.map-help { position:absolute; left:14px; top:14px; display:flex; flex-wrap:wrap; gap:7px; pointer-events:none; }
.map-help span { font-size:11px; color:#b8ccdc; padding:6px 8px; border-radius:999px; background:rgba(5,16,29,.74); border:1px solid rgba(255,255,255,.08); backdrop-filter: blur(7px); }
.zoom-controls { position:absolute; right:14px; top:14px; display:flex; flex-direction:column; gap:7px; }
.zoom-controls button { width:40px; height:40px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--text); font-weight:800; font-size:20px; cursor:pointer; }
.zoom-controls button:hover { background:#123554; }
.minimap-wrap { position:absolute; right:14px; bottom:14px; width:160px; aspect-ratio:1/1; padding:5px; border-radius:13px; border:1px solid var(--line); background:rgba(5,15,27,.86); box-shadow:0 16px 50px rgba(0,0,0,.25); opacity:0; transform:translateY(8px); pointer-events:none; transition:.18s ease; }
.minimap-wrap.visible { opacity:1; transform:none; }
#minimap { width:100%; height:100%; display:block; border-radius:9px; }
.selection-panel { position:absolute; left:14px; bottom:14px; width:min(330px, calc(100vw - 28px)); padding:15px; border:1px solid var(--line); border-radius:15px; background:var(--panel); box-shadow:0 20px 60px rgba(0,0,0,.32); backdrop-filter:blur(12px); }
.selection-title { font-weight:800; font-size:15px; margin-bottom:10px; }
.selection-row, .selection-total { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:5px 0; }
.selection-row span { color:var(--muted); font-size:13px; }
.selection-total { border-top:1px solid var(--line); margin-top:6px; padding-top:10px; }
.selection-total strong { font-size:24px; color:#fff; }
.selection-actions { display:grid; grid-template-columns: .7fr 1.3fr; gap:8px; margin-top:11px; }
.selection-actions button { border:0; border-radius:10px; padding:11px; font-weight:800; cursor:pointer; }
.secondary { color:var(--text); background:rgba(255,255,255,.08); }
.primary { color:#04111d; background:linear-gradient(135deg,#76d8ff,#19a7ff); }
.primary:disabled { opacity:.35; cursor:not-allowed; }
.selection-panel small { display:block; color:var(--muted); margin-top:8px; font-size:10px; }
.tooltip { position:absolute; z-index:8; max-width:260px; padding:11px 12px; background:#f8fbff; color:#10243a; border-radius:10px; box-shadow:0 12px 35px rgba(0,0,0,.3); pointer-events:none; font-size:12px; }
.tooltip strong { display:block; font-size:13px; margin-bottom:3px; }
.tooltip span { color:#587087; }
.toast { position:absolute; left:50%; top:18px; transform:translateX(-50%); z-index:10; padding:10px 14px; background:#f8fbff; color:#0d2438; border-radius:999px; box-shadow:0 10px 30px rgba(0,0,0,.3); font-size:13px; font-weight:700; }

@media (max-width: 760px) {
  .topbar { min-height:64px; padding:8px 10px; }
  .brand { min-width:0; }
  .brand-mark { width:38px; height:38px; border-radius:10px; }
  .brand strong { font-size:13px; max-width:150px; }
  .brand span { font-size:10px; }
  .stats { margin-left:auto; }
  .stats > div { min-width:78px; padding:6px 8px; }
  .stats > div:nth-child(2), .stats > div:nth-child(4) { display:none; }
  .stats strong { font-size:13px; }
  .map-help { left:8px; top:8px; right:58px; }
  .map-help span:nth-child(1), .map-help span:nth-child(3) { display:none; }
  .map-help span:nth-child(2)::before { content:"Pinch / trascina"; font-size:11px; }
  .map-help span:nth-child(2) { font-size:0; }
  .zoom-controls { right:8px; top:8px; }
  .zoom-controls button { width:38px; height:38px; }
  .selection-panel { left:8px; bottom:8px; width:min(310px, calc(100vw - 16px)); padding:12px; }
  .minimap-wrap { width:112px; right:8px; bottom:160px; }
}


/* V8: contrasto maggiore tra ambiente e aree interattive */
.map-shell {
  background:
    radial-gradient(circle at 30% 30%, rgba(18,86,120,.18), transparent 38%),
    linear-gradient(180deg, #08131e, #0d1822);
}

/* V9: sfondo esterno blu petrolio anziché nero */
.map-shell {
  background:
    radial-gradient(circle at 28% 28%, rgba(39,111,143,.28), transparent 42%),
    linear-gradient(180deg, #17364a, #102d3f);
}

/* V10: tutto il reticolato/viewport 1000x1000 è ora blu lago, non nero */
.map-shell {
  background: #28566f !important;
}
#stadiumCanvas {
  background: #28566f;
}

/* V11 - colore esterno matrice 1000x1000 */
.map-shell, #stadiumCanvas {
  background: #4b7185 !important;
}


/* V14 — modalità pan/selezione e inspector celle */
.mode-controls {
  position:absolute;
  right:66px;
  top:14px;
  display:flex;
  gap:7px;
  z-index:7;
}
.mode-btn {
  border:1px solid var(--line);
  border-radius:10px;
  padding:9px 12px;
  background:var(--panel);
  color:var(--text);
  cursor:pointer;
  font-weight:800;
  font-size:12px;
}
.mode-btn.active {
  background:linear-gradient(135deg,#76d8ff,#19a7ff);
  color:#04111d;
  border-color:transparent;
}
.cell-inspector {
  position:absolute;
  right:14px;
  top:148px;
  width:205px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(8,24,43,.92);
  backdrop-filter:blur(10px);
  z-index:6;
  pointer-events:none;
}
.cell-inspector > div {
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:3px 0;
  font-size:11px;
}
.cell-inspector span { color:var(--muted); }
.cell-inspector strong {
  max-width:125px;
  text-align:right;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
#stadiumCanvas.selecting-mode { cursor:crosshair; }

@media (max-width:760px) {
  .mode-controls {
    left:8px;
    right:auto;
    top:50px;
  }
  .mode-btn { padding:8px 10px; font-size:11px; }
  .cell-inspector {
    right:8px;
    top:132px;
    width:165px;
  }
}

/* V15 — tooltip area acquistata */
.tooltip small{display:block;margin-top:7px;padding-top:6px;border-top:1px solid rgba(255,255,255,.12);opacity:.72}


/* V21 — doppia fascia di prezzo */
.selection-row strong {
  font-variant-numeric: tabular-nums;
}


/* =========================================================
   V22 — Scheda persistente area acquistata
   ========================================================= */

.purchase-card{
  position:absolute;
  z-index:40;
  right:18px;
  top:18px;
  width:min(340px,calc(100% - 36px));
  max-height:calc(100% - 36px);
  overflow:auto;
  border-radius:18px;
  background:rgba(10,22,31,.96);
  border:1px solid rgba(255,255,255,.16);
  box-shadow:0 18px 50px rgba(0,0,0,.38);
  backdrop-filter:blur(14px);
  color:#fff;
}

.purchase-card[hidden]{
  display:none !important;
}

.purchase-card-close{
  position:absolute;
  z-index:2;
  top:9px;
  right:10px;
  width:34px;
  height:34px;
  border:0;
  border-radius:999px;
  background:rgba(0,0,0,.48);
  color:#fff;
  font-size:25px;
  line-height:30px;
  cursor:pointer;
}

.purchase-card-media{
  position:relative;
  min-height:118px;
  background:rgba(255,255,255,.06);
  overflow:hidden;
  border-radius:18px 18px 0 0;
}

.purchase-card-media img{
  display:block;
  width:100%;
  height:160px;
  object-fit:cover;
}

.purchase-card-placeholder{
  min-height:118px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(circle at 28% 25%,rgba(255,255,255,.18),transparent 30%),
    linear-gradient(135deg,rgba(43,110,148,.9),rgba(16,52,72,.94));
}

.purchase-card-placeholder span{
  width:70px;
  height:70px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.25);
  font-size:23px;
  font-weight:900;
  letter-spacing:.04em;
}

.purchase-card-body{
  padding:17px 18px 19px;
}

.purchase-card-kicker{
  font-size:10px;
  letter-spacing:.16em;
  font-weight:900;
  color:rgba(255,255,255,.58);
  margin-bottom:5px;
}

.purchase-card h3{
  margin:0;
  font-size:21px;
  line-height:1.18;
}

.purchase-card-owner{
  margin-top:6px;
  color:rgba(255,255,255,.72);
  font-size:13px;
}

.purchase-card-stats{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:15px;
}

.purchase-card-stats div{
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  padding:10px 11px;
}

.purchase-card-stats span,
.purchase-card-stats strong{
  display:block;
}

.purchase-card-stats span{
  font-size:10px;
  color:rgba(255,255,255,.55);
  text-transform:uppercase;
  letter-spacing:.08em;
}

.purchase-card-stats strong{
  margin-top:3px;
  font-size:15px;
}

.purchase-card-description{
  margin:15px 0 0;
  color:rgba(255,255,255,.79);
  font-size:13px;
  line-height:1.5;
}

.purchase-card-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  margin-top:15px;
  padding:0 14px;
  border-radius:11px;
  background:#fff;
  color:#102431;
  font-size:13px;
  font-weight:800;
  text-decoration:none;
}

.purchase-card-link[hidden]{
  display:none !important;
}

@media (max-width:700px){
  .purchase-card{
    position:fixed;
    left:10px;
    right:10px;
    top:auto;
    bottom:10px;
    width:auto;
    max-height:min(64vh,520px);
    border-radius:18px;
  }

  .purchase-card-media{
    min-height:88px;
  }

  .purchase-card-media img{
    height:120px;
  }

  .purchase-card-placeholder{
    min-height:88px;
  }

  .purchase-card-placeholder span{
    width:58px;
    height:58px;
    font-size:19px;
  }
}


/* V23 — il tooltip hover diventa cliccabile */
.tooltip.purchase-tooltip,
#tooltip.purchase-tooltip{
  pointer-events:auto;
  cursor:pointer;
}


/* V25 — nella scheda pubblica non viene mostrato il prezzo pagato */
.purchase-card-stats-single{
  grid-template-columns:1fr;
}


/* V27 — checkout simulato */
.checkout-backdrop{
  position:fixed; inset:0; z-index:100;
  display:flex; align-items:center; justify-content:center;
  padding:18px; background:rgba(4,12,18,.72);
  backdrop-filter:blur(6px);
}
.checkout-backdrop[hidden]{display:none!important}
.checkout-modal{
  position:relative; width:min(560px,100%); max-height:92vh; overflow:auto;
  border-radius:20px; padding:24px;
  color:#fff; background:#102431;
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 24px 70px rgba(0,0,0,.48);
}
.checkout-close{
  position:absolute; right:12px; top:12px; width:36px; height:36px;
  border:0; border-radius:50%; cursor:pointer;
  color:#fff; background:rgba(255,255,255,.1); font-size:24px;
}
.checkout-kicker{font-size:10px;font-weight:900;letter-spacing:.16em;opacity:.55}
.checkout-modal h2{margin:5px 0 18px}
.checkout-summary{
  display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:18px;
}
.checkout-summary>div{
  padding:11px 12px; border-radius:12px;
  background:rgba(255,255,255,.065); border:1px solid rgba(255,255,255,.08);
}
.checkout-summary span,.checkout-summary strong{display:block}
.checkout-summary span{font-size:10px;text-transform:uppercase;letter-spacing:.07em;opacity:.58}
.checkout-summary strong{margin-top:3px}
.checkout-summary .checkout-total{grid-column:1/-1}
.checkout-summary .checkout-total strong{font-size:22px}
#checkoutForm{display:grid;gap:12px}
#checkoutForm label{display:grid;gap:6px;font-size:12px;font-weight:700}
#checkoutForm input,#checkoutForm textarea{
  width:100%; box-sizing:border-box; border-radius:10px;
  border:1px solid rgba(255,255,255,.15); background:rgba(255,255,255,.07);
  color:#fff; padding:11px 12px; font:inherit; outline:none;
}
#checkoutForm textarea{resize:vertical}
#checkoutForm input:focus,#checkoutForm textarea:focus{border-color:rgba(255,255,255,.5)}
#checkoutForm small{font-weight:400;opacity:.55}
.checkout-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:5px}
@media(max-width:600px){
  .checkout-backdrop{align-items:flex-end;padding:8px}
  .checkout-modal{max-height:94vh;border-radius:18px;padding:20px 16px}
  .checkout-summary{grid-template-columns:1fr}
  .checkout-summary .checkout-total{grid-column:auto}
  .checkout-actions{flex-direction:column-reverse}
  .checkout-actions button{width:100%}
}


/* V28 — coordinate e localizzazione area */
.purchase-card-stats-single{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.purchase-card-locate{
  width:100%; margin-top:12px; padding:11px 14px;
  border:0; border-radius:10px; cursor:pointer;
  font-weight:800;
}
@media(max-width:600px){
  .purchase-card-stats-single{grid-template-columns:1fr}
  .purchase-card-locate{min-height:46px;font-size:15px}
}


/* V33 — Le mie aree */
.my-areas-btn{
  margin-left:auto;
  margin-right:14px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.08);
  color:#fff;
  padding:9px 14px;
  border-radius:10px;
  font-weight:800;
  cursor:pointer;
}
.my-areas-backdrop{
  position:fixed; inset:0; z-index:95;
  background:rgba(4,12,18,.62);
  backdrop-filter:blur(5px);
}
.my-areas-backdrop[hidden]{display:none!important}
.my-areas-panel{
  position:absolute; top:0; right:0; height:100%;
  width:min(430px,100%);
  box-sizing:border-box; overflow:auto;
  padding:22px;
  background:#102431;
  color:#fff;
  border-left:1px solid rgba(255,255,255,.12);
  box-shadow:-18px 0 50px rgba(0,0,0,.35);
}
.my-areas-header{
  display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
}
.my-areas-header h2{margin:5px 0 0}
.my-areas-intro{opacity:.68; font-size:13px; margin:10px 0 18px}
.my-areas-list{display:grid; gap:10px}
.my-area-item{
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.09);
}
.my-area-item h3{margin:0 0 6px;font-size:16px}
.my-area-meta{
  display:grid; grid-template-columns:1fr 1fr;
  gap:6px; margin:8px 0 12px;
}
.my-area-meta div{
  padding:8px 9px;
  border-radius:9px;
  background:rgba(255,255,255,.045);
}
.my-area-meta span,.my-area-meta strong{display:block}
.my-area-meta span{
  font-size:9px; text-transform:uppercase; letter-spacing:.08em; opacity:.52
}
.my-area-meta strong{margin-top:2px;font-size:12px}
.my-area-actions{display:flex; gap:8px}
.my-area-actions button{
  flex:1; border:0; border-radius:9px; padding:9px 10px;
  cursor:pointer; font-weight:800;
}
.my-area-actions .locate{background:#fff;color:#102431}
.my-area-actions .edit{background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.12)}
.my-areas-empty{
  padding:18px; border-radius:14px;
  background:rgba(255,255,255,.05); opacity:.7; text-align:center;
}
@media(max-width:760px){
  .topbar{flex-wrap:wrap}
  .my-areas-btn{order:3; margin:8px 0 0; width:100%}
  .my-areas-panel{width:100%}
  .my-area-meta{grid-template-columns:1fr}
}


/* V34 — finestra Modifica area riordinata */
#editAreaModal .checkout-modal{
  width:min(600px,calc(100vw - 32px));
  padding:28px;
}
#editAreaModal .checkout-kicker{
  margin-bottom:5px;
}
#editAreaModal h2{
  margin:0;
  padding-right:48px;
  font-size:28px;
  line-height:1.15;
}
.edit-area-intro{
  margin:8px 0 22px;
  max-width:480px;
  font-size:13px;
  line-height:1.45;
  opacity:.62;
}
#editAreaForm.edit-area-form{
  display:flex;
  flex-direction:column;
  gap:15px;
}
#editAreaForm.edit-area-form label{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:7px;
  width:100%;
  margin:0;
  font-size:12px;
  line-height:1.25;
  font-weight:800;
  color:rgba(255,255,255,.9);
}
#editAreaForm.edit-area-form input,
#editAreaForm.edit-area-form textarea{
  display:block;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  margin:0;
  padding:11px 12px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:10px;
  background:rgba(255,255,255,.07);
  color:#fff;
  font:inherit;
  font-size:14px;
  line-height:1.35;
}
#editAreaForm.edit-area-form textarea{
  min-height:100px;
  resize:vertical;
}
#editAreaForm.edit-area-form input[type="file"]{
  padding:9px;
  cursor:pointer;
}
#editAreaForm.edit-area-form small{
  display:block;
  margin:0;
  font-size:11px;
  line-height:1.35;
  font-weight:400;
  opacity:.55;
}
#editAreaForm .checkout-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:9px;
  margin-top:7px;
  padding-top:15px;
  border-top:1px solid rgba(255,255,255,.09);
}
#editAreaForm .checkout-actions button{
  min-height:42px;
  padding:10px 16px;
  border-radius:10px;
  cursor:pointer;
  font-weight:800;
}
@media(max-width:600px){
  #editAreaModal{
    align-items:flex-end;
    padding:8px;
  }
  #editAreaModal .checkout-modal{
    width:100%;
    max-height:94vh;
    padding:22px 16px 16px;
    border-radius:18px;
  }
  #editAreaModal h2{font-size:24px}
  .edit-area-intro{margin-bottom:18px}
  #editAreaForm .checkout-actions{
    flex-direction:column-reverse;
  }
  #editAreaForm .checkout-actions button{
    width:100%;
  }
}


/* V35 — persistenza locale demo */
.reset-demo-data{
  margin:-6px 0 16px;
  padding:8px 10px;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:rgba(255,255,255,.75);
  font-size:11px;
  font-weight:700;
  cursor:pointer;
}
.reset-demo-data:hover{
  background:rgba(255,255,255,.09);
  color:#fff;
}


/* V36 — account utente demo */
.account-btn{
  margin-left:auto;
  border:1px solid rgba(255,255,255,.16);
  background:#fff;
  color:#102431;
  padding:9px 14px;
  border-radius:10px;
  font-weight:900;
  cursor:pointer;
}
.my-areas-btn{margin-left:0}
.auth-modal{width:min(500px,calc(100vw - 32px))}
.auth-intro{
  margin:8px 0 20px;
  font-size:13px;
  line-height:1.45;
  opacity:.62;
}
.auth-profile{
  display:flex;
  align-items:center;
  gap:13px;
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.09);
}
.auth-avatar{
  width:46px;height:46px;
  border-radius:50%;
  display:grid;place-items:center;
  background:rgba(255,255,255,.12);
  font-weight:900;
  font-size:18px;
}
.auth-profile strong,.auth-profile span{display:block}
.auth-profile span{margin-top:3px;font-size:12px;opacity:.58}
@media(max-width:760px){
  .account-btn{order:2;margin-left:auto}
  .my-areas-btn{order:3;width:100%;margin-top:8px}
}


/* V37 — login demo più ordinato */
#authModal .auth-modal{
  width:min(520px,calc(100vw - 32px));
  padding:28px;
}
#authModal h2{
  margin:0;
  padding-right:48px;
  font-size:28px;
  line-height:1.15;
}
#authModal .auth-intro{
  margin:9px 0 22px;
  max-width:440px;
  font-size:13px;
  line-height:1.5;
  opacity:.62;
}
.auth-form{
  display:flex;
  flex-direction:column;
  gap:15px;
}
.auth-form label{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:7px;
  width:100%;
  margin:0;
}
.auth-form label > span{
  font-size:12px;
  line-height:1.2;
  font-weight:800;
  color:rgba(255,255,255,.92);
}
.auth-form input{
  display:block;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  margin:0;
  padding:12px 13px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:10px;
  background:rgba(255,255,255,.07);
  color:#fff;
  font:inherit;
  font-size:14px;
  line-height:1.35;
  outline:none;
}
.auth-form input:focus{
  border-color:rgba(255,255,255,.52);
  background:rgba(255,255,255,.09);
}
.auth-note{
  margin:0;
  padding:10px 12px;
  border-radius:10px;
  background:rgba(255,255,255,.045);
  font-size:11px;
  line-height:1.45;
  opacity:.62;
}
.auth-submit{
  width:100%;
  min-height:44px;
  margin-top:2px;
  border:0;
  border-radius:10px;
  cursor:pointer;
  font-weight:900;
}
#authLoggedIn .checkout-actions{
  margin-top:14px;
}
@media(max-width:600px){
  #authModal{
    align-items:flex-end;
    padding:8px;
  }
  #authModal .auth-modal{
    width:100%;
    max-height:94vh;
    padding:22px 16px 16px;
    border-radius:18px;
  }
  #authModal h2{
    font-size:24px;
  }
}


/* V38 — stato architettura backend */
.backend-status-btn{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.78);
  padding:9px 12px;
  border-radius:10px;
  font-weight:800;
  cursor:pointer;
}
.backend-status-modal{width:min(620px,calc(100vw - 32px))}
.backend-status-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:18px 0;
}
.backend-status-grid>div{
  padding:14px;
  border-radius:13px;
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.09);
}
.backend-status-grid span,
.backend-status-grid strong,
.backend-status-grid small{display:block}
.backend-status-grid span{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  opacity:.52;
}
.backend-status-grid strong{margin-top:4px;font-size:15px}
.backend-status-grid small{margin-top:5px;line-height:1.4;opacity:.6}
.backend-status-note{
  margin:0;
  padding:11px 12px;
  border-radius:10px;
  background:rgba(255,255,255,.045);
  font-size:11px;
  line-height:1.45;
  opacity:.66;
}
@media(max-width:650px){
  .backend-status-btn{order:1}
  .backend-status-grid{grid-template-columns:1fr}
}


/* V39 — connessione Supabase reale opzionale */
.backend-test-btn{
  width:100%;
  min-height:42px;
  margin-top:12px;
  border:0;
  border-radius:10px;
  cursor:pointer;
  font-weight:900;
}
.backend-state-ok{color:#8de6b2!important}
.backend-state-warn{color:#ffd47d!important}


/* V40 — fotografia fornita dall'utente dietro la mappa */
.map-shell{
  background-image:
    linear-gradient(rgba(2,10,18,.54),rgba(2,10,18,.68)),
    url("assets/sinigaglia-background.jpg") !important;
  background-position:center center !important;
  background-size:cover !important;
  background-repeat:no-repeat !important;
  background-color:#06111f !important;
}
#stadiumCanvas{background:transparent !important;}


/* V41 — fix definitivo sfondo:
   la foto è applicata direttamente anche al Canvas come background CSS.
   Il disegno Canvas copre la matrice 1000×1000, mentre fuori dalla matrice
   resta visibile il background fotografico. */
.map-shell,
#stadiumCanvas{
  background:
    linear-gradient(rgba(2,10,18,.52), rgba(2,10,18,.66)),
    url("assets/sinigaglia-background.jpg") center center / cover no-repeat !important;
}


/* V42 — fix reale:
   il Canvas ora usa un contesto con alpha:true, quindi le aree cancellate
   sono davvero trasparenti e lasciano vedere la fotografia sottostante. */
.map-shell{
  background:
    linear-gradient(rgba(2,10,18,.52), rgba(2,10,18,.66)),
    url("assets/sinigaglia-background.jpg") center center / cover no-repeat !important;
}
#stadiumCanvas{
  background: transparent !important;
}

/* V44 — Supabase Auth */
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:14px 0 16px}
.auth-tab{border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.05);color:inherit;border-radius:10px;padding:10px 12px;cursor:pointer;font-weight:700}
.auth-tab.active{background:rgba(77,181,217,.18);border-color:rgba(77,181,217,.55)}
.auth-form[hidden]{display:none!important}

/* V45 — registrazione e fit iniziale */
.auth-success{
  padding:18px;
  border:1px solid rgba(110,231,168,.35);
  background:rgba(110,231,168,.08);
  border-radius:14px;
  text-align:center;
}
.auth-success[hidden]{display:none!important}
.auth-success-icon{
  width:48px;height:48px;margin:0 auto 10px;border-radius:999px;
  display:grid;place-items:center;font-size:26px;font-weight:900;
  background:rgba(110,231,168,.18);color:#9af0bf;
}
.auth-success h3{margin:0 0 8px;font-size:20px}
.auth-success p{margin:0 0 15px;font-size:12px;line-height:1.5;opacity:.78}

/* La matrice deve essere visivamente evidente rispetto alla fotografia. */
#stadiumCanvas{outline:none}

/* V46 — mostra/nascondi password */
.password-field{
  position:relative;
  width:100%;
}
.password-field input{
  width:100%;
  padding-right:48px !important;
}
.password-toggle{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:8px;
  background:transparent;
  color:inherit;
  cursor:pointer;
  opacity:.72;
  font-size:17px;
  line-height:1;
}
.password-toggle:hover,
.password-toggle.is-visible{
  opacity:1;
  background:rgba(255,255,255,.09);
}

/* V47 — canvas principale sempre sopra la fotografia */
.map-shell{isolation:isolate}
#stadiumCanvas{
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  z-index:1 !important;
  background:transparent !important;
}
.map-help,.zoom-controls,.mode-controls,.cell-inspector,.selection-panel,.minimap-wrap,.tooltip,.toast{
  z-index:3;
}

/* V47 — messaggi Auth persistenti, per vedere l'errore reale */
.auth-status-box{
  margin:10px 0 12px;
  padding:10px 12px;
  border-radius:10px;
  font-size:12px;
  line-height:1.45;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
}
.auth-status-box[hidden]{display:none!important}
.auth-status-box.info{border-color:rgba(95,210,255,.35);background:rgba(95,210,255,.08)}
.auth-status-box.error{border-color:rgba(255,107,107,.45);background:rgba(255,107,107,.10);color:#ffd8d8}
.auth-status-box.success{
  border-color:rgba(74,222,128,.65);
  background:rgba(34,197,94,.22);
  color:#b9ffd0;
  font-weight:700;
}
/* V48 — FIX DEFINITIVO MAPPA
   Il canvas torna nel normale flusso del layout.
   In V47 position:absolute poteva far collassare/alterare l'area della mappa. */
.map-shell{
  position:relative !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  isolation:isolate;
}
#stadiumCanvas{
  position:relative !important;
  inset:auto !important;
  display:block !important;
  width:100% !important;
  height:100% !important;
  z-index:1 !important;
  background:transparent !important;
}

/* V49 — community first */
.community-message{
 position:absolute;left:50%;top:14px;transform:translateX(-50%);z-index:3;
 max-width:min(560px,calc(100vw - 420px));padding:8px 14px;
 border:1px solid rgba(255,255,255,.09);border-radius:12px;
 background:rgba(5,16,29,.60);backdrop-filter:blur(8px);
 text-align:center;pointer-events:none
}
.community-message strong{display:block;font-size:13px;line-height:1.25;color:#fff}
.community-message span{display:block;margin-top:2px;font-size:10px;color:#b8ccdc}
.selection-panel.selection-panel-community{
 width:min(250px,calc(100vw - 28px));padding:11px 12px;border-radius:13px;
 background:rgba(7,21,40,.84);box-shadow:0 12px 34px rgba(0,0,0,.24)
}
.selection-panel-community .selection-title{margin-bottom:5px;font-size:13px;color:#dcecf8}
.selection-community-count{display:flex;align-items:baseline;gap:7px}
.selection-community-count strong{font-size:23px;line-height:1;color:#fff}
.selection-community-count span{font-size:11px;color:var(--muted)}
.selection-financial-hidden{display:none!important}
.selection-panel-community .selection-actions{grid-template-columns:.65fr 1.35fr;gap:7px;margin-top:9px}
.selection-panel-community .selection-actions button{padding:9px 8px;font-size:11px}
@media(max-width:760px){
 .community-message{top:52px;max-width:calc(100vw - 24px);padding:7px 10px}
 .community-message strong{font-size:11px}.community-message span{font-size:9px}
 .selection-panel.selection-panel-community{width:min(235px,calc(100vw - 16px));padding:10px}
}

/* V50 — claim community più evidente */
.community-message{
  padding:11px 18px;
  max-width:min(650px,calc(100vw - 390px));
}
.community-message strong{
  font-size:18px;
  line-height:1.25;
  font-weight:800;
  letter-spacing:.1px;
}
.community-message span{
  margin-top:4px;
  font-size:11px;
}
@media(max-width:760px){
  .community-message strong{font-size:15px}
  .community-message span{font-size:10px}
}

/* V51 — rifiniture tipografiche */
.community-message strong{
  font-size:20px;
}
@media(max-width:760px){
  .community-message strong{font-size:16px}
}

.brand{
  font-size:1.16em;
}

/* V53 — ispettore cella più leggibile */
.cell-inspector{
  width:310px;
  max-width:calc(100vw - 28px);
}
.cell-inspector > div{
  gap:14px;
}
.cell-inspector strong{
  max-width:210px;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  text-align:right;
  line-height:1.25;
}
@media(max-width:760px){
  .cell-inspector{
    width:min(290px,calc(100vw - 20px));
  }
  .cell-inspector strong{
    max-width:195px;
  }
}

/* V54 — ispettore cella decisamente più ampio e prezzo sempre visibile */
.cell-inspector{
  width:390px;
  max-width:calc(100vw - 28px);
  padding:16px 18px;
}
.cell-inspector > div{
  display:grid;
  grid-template-columns:88px minmax(0,1fr);
  align-items:start;
  gap:18px;
  padding:6px 0;
}
.cell-inspector span{
  font-size:14px;
}
.cell-inspector strong{
  max-width:none;
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
  text-align:left;
  font-size:14px;
  line-height:1.35;
}
@media(max-width:760px){
  .cell-inspector{
    width:min(350px,calc(100vw - 20px));
    padding:14px 15px;
  }
  .cell-inspector > div{
    grid-template-columns:78px minmax(0,1fr);
    gap:12px;
  }
  .cell-inspector span,
  .cell-inspector strong{
    font-size:13px;
  }
}

/* V59 — opzione immagine condivisa tra le aree dello stesso utente */
.apply-all-areas-option{
  display:flex !important;
  flex-direction:row !important;
  align-items:flex-start;
  gap:10px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  background:rgba(255,255,255,.04);
  cursor:pointer;
}
.apply-all-areas-option input{
  width:17px !important;
  height:17px;
  margin:2px 0 0;
  flex:0 0 auto;
}
.apply-all-areas-option span{
  font-size:13px;
  line-height:1.35;
}

/* V60 — Stripe test mode */
.stripe-test-note{
  margin:10px 0 14px;
  padding:10px 12px;
  border-radius:10px;
  font-size:12px;
  line-height:1.4;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.11);
  opacity:.9;
}


/* V61 Layout 2 — claim community ad alto contrasto + controlli più grandi */
.community-message{
  background:linear-gradient(135deg,#f2c94c,#e4aa22) !important;
  border:1px solid rgba(255,235,158,.95) !important;
  box-shadow:0 8px 26px rgba(0,0,0,.28),0 0 0 1px rgba(77,50,0,.10) inset;
  backdrop-filter:none !important;
}
.community-message strong{
  color:#071b2d !important;
  text-shadow:none !important;
}
.community-message span{
  color:#17344a !important;
  font-weight:650;
}

.mode-controls{
  gap:10px;
}
.mode-btn{
  min-width:112px;
  min-height:46px;
  padding:12px 18px;
  border-radius:12px;
  font-size:15px;
  box-shadow:0 7px 20px rgba(0,0,0,.22);
}
@media(max-width:760px){
  .mode-controls{gap:8px}
  .mode-btn{
    min-width:98px;
    min-height:42px;
    padding:10px 14px;
    font-size:13px;
  }
}

/* V62 — le celle temporaneamente riservate vengono mostrate in ambra sulla mappa.
   Il disegno vero è sul canvas; qui manteniamo solo la documentazione visuale. */


/* =========================================================
   V64 — responsive mobile-first senza alterare la mappa
   ========================================================= */

/* Il controllo tecnico resta nel DOM per i test, ma non compete più con l'UX. */
.backend-status-btn{
  display:none !important;
}

/* Foto reale dedicata: nascosta su desktop perché lì è già il grande sfondo. */
.mobile-stadium-hero{
  display:none;
}

/* Desktop: un po' più leggibile senza cambiare la composizione approvata. */
.community-message span{
  line-height:1.35;
}

/* ------------------------- MOBILE ------------------------- */
@media(max-width:760px){
  html,body{
    width:100%;
    height:100%;
    overflow:hidden;
  }

  /* Header: una sola riga compatta. */
  .topbar{
    flex:0 0 auto;
    min-height:54px !important;
    height:54px;
    box-sizing:border-box;
    padding:6px 8px !important;
    gap:6px !important;
    flex-wrap:nowrap !important;
    overflow:hidden;
  }
  .brand{
    min-width:0 !important;
    flex:1 1 auto;
    gap:7px;
    overflow:hidden;
  }
  .brand-mark{
    width:36px !important;
    height:36px !important;
    border-radius:10px;
    flex:0 0 36px;
    font-size:15px;
  }
  .brand strong{
    font-size:13px !important;
    line-height:1.1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .brand span{
    display:none !important;
  }

  .stats{
    order:initial !important;
    flex:0 0 auto;
    margin:0 !important;
    overflow:visible;
  }
  .stats > div{
    display:none !important;
  }
  .stats > div:first-child{
    display:block !important;
    min-width:48px;
    padding:4px 7px;
    border-radius:9px;
  }
  .stats span{
    font-size:8px;
  }
  .stats strong{
    margin-top:0;
    font-size:12px;
  }

  .account-btn,
  .my-areas-btn{
    order:initial !important;
    flex:0 0 auto;
    width:auto !important;
    min-height:36px;
    margin:0 !important;
    padding:7px 9px !important;
    border-radius:9px;
    font-size:11px;
    line-height:1;
    white-space:nowrap;
  }
  .my-areas-btn{
    max-width:76px;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* Foto indipendente dalla mappa: il Sinigaglia resta riconoscibile
     anche quando la mappa è grande e non lascia vedere lo sfondo laterale. */
  .mobile-stadium-hero{
    display:flex;
    flex:0 0 132px;
    min-height:132px;
    box-sizing:border-box;
    align-items:flex-end;
    position:relative;
    overflow:hidden;
    background:
      linear-gradient(180deg,rgba(3,12,21,.18),rgba(3,12,21,.78)),
      url("assets/sinigaglia-background.jpg") center 46% / cover no-repeat;
    border-bottom:1px solid rgba(255,255,255,.12);
  }
  .mobile-stadium-hero-content{
    width:100%;
    box-sizing:border-box;
    padding:12px 14px 11px;
    text-shadow:0 2px 12px rgba(0,0,0,.7);
  }
  .mobile-stadium-hero strong{
    display:block;
    color:#fff;
    font-size:18px;
    line-height:1.08;
    font-weight:900;
  }
  .mobile-stadium-hero span{
    display:block;
    max-width:520px;
    margin-top:5px;
    color:rgba(255,255,255,.92);
    font-size:11px;
    line-height:1.3;
  }
  .mobile-stadium-hero small{
    display:inline-block;
    margin-top:7px;
    padding:4px 7px;
    border-radius:999px;
    background:rgba(242,201,76,.94);
    color:#071b2d;
    text-shadow:none;
    font-size:9px;
    line-height:1;
    font-weight:900;
  }

  main{
    flex:1 1 auto;
    min-height:0;
  }
  .map-shell{
    height:100% !important;
    min-height:0 !important;
    /* Su mobile la foto ha una fascia propria: qui privilegiamo la leggibilità della mappa. */
    background:#17374a !important;
  }

  /* Il claim è già nella fascia fotografica. */
  .community-message{
    display:none !important;
  }

  /* Le istruzioni desktop diventano superflue con touch. */
  .map-help{
    display:none !important;
  }

  /* I due strumenti restano sempre visibili ma non coprono lo stadio. */
  .mode-controls{
    left:8px !important;
    right:auto !important;
    top:8px !important;
    gap:6px !important;
    z-index:9;
  }
  .mode-btn{
    min-width:0 !important;
    min-height:38px !important;
    padding:8px 11px !important;
    border-radius:10px !important;
    font-size:12px !important;
    box-shadow:0 5px 16px rgba(0,0,0,.24);
  }

  .zoom-controls{
    right:8px !important;
    top:8px !important;
    gap:6px !important;
    z-index:9;
  }
  .zoom-controls button{
    width:38px !important;
    height:38px !important;
    border-radius:10px !important;
    font-size:18px !important;
  }

  /* Su touch non esiste hover: niente grande pannello vuoto permanente. */
  .cell-inspector{
    display:none !important;
  }

  /* Nessuna minimappa sovrapposta sul telefono. */
  .minimap-wrap{
    display:none !important;
  }

  /* Barra di selezione più compatta e leggibile. */
  .selection-panel.selection-panel-community{
    left:8px !important;
    right:8px !important;
    bottom:8px !important;
    width:auto !important;
    max-width:none !important;
    box-sizing:border-box;
    padding:9px 10px !important;
    border-radius:13px !important;
    display:grid;
    grid-template-columns:minmax(100px,.8fr) minmax(160px,1.2fr);
    grid-template-areas:
      "title actions"
      "count actions";
    column-gap:10px;
    row-gap:2px;
    align-items:center;
    background:rgba(7,21,40,.94) !important;
    backdrop-filter:blur(12px);
    z-index:10;
  }
  .selection-panel-community .selection-title{
    grid-area:title;
    margin:0 !important;
    font-size:11px !important;
    line-height:1.1;
    color:#b9ccdc;
  }
  .selection-community-count{
    grid-area:count;
    gap:5px;
    min-width:0;
  }
  .selection-community-count strong{
    font-size:22px !important;
  }
  .selection-community-count span{
    font-size:9px !important;
    white-space:nowrap;
  }
  .selection-panel-community .selection-actions{
    grid-area:actions;
    display:grid;
    grid-template-columns:.65fr 1.35fr !important;
    gap:6px !important;
    margin:0 !important;
  }
  .selection-panel-community .selection-actions button{
    min-height:38px;
    padding:7px 6px !important;
    border-radius:9px;
    font-size:10px !important;
    line-height:1.15;
  }

  .toast{
    top:58px !important;
    max-width:calc(100vw - 28px);
    box-sizing:border-box;
    white-space:normal;
    text-align:center;
    font-size:11px;
  }

  .tooltip{
    max-width:min(270px,calc(100vw - 24px));
  }

  .purchase-card{
    top:8px;
    right:8px;
    width:calc(100% - 16px);
    max-height:calc(100% - 16px);
  }
}

/* Telefoni molto stretti */
@media(max-width:390px){
  .my-areas-btn{
    max-width:54px;
    padding-left:7px !important;
    padding-right:7px !important;
  }
  .stats > div:first-child{
    min-width:42px;
    padding-left:5px;
    padding-right:5px;
  }
  .mobile-stadium-hero{
    flex-basis:122px;
    min-height:122px;
  }
  .mobile-stadium-hero strong{
    font-size:17px;
  }
  .selection-panel.selection-panel-community{
    grid-template-columns:92px 1fr;
  }
}

/* Landscape mobile: foto presente ma più bassa, mappa protagonista. */
@media(max-width:900px) and (orientation:landscape) and (max-height:520px){
  .topbar{
    height:48px;
    min-height:48px !important;
  }
  .brand-mark{
    width:32px !important;
    height:32px !important;
    flex-basis:32px;
  }
  .mobile-stadium-hero{
    display:flex;
    flex-basis:72px;
    min-height:72px;
    background-position:center 48%;
  }
  .mobile-stadium-hero-content{
    padding:7px 12px;
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:10px;
    align-items:end;
  }
  .mobile-stadium-hero strong{
    font-size:14px;
    white-space:nowrap;
  }
  .mobile-stadium-hero span{
    margin:0;
    font-size:9px;
  }
  .mobile-stadium-hero small{
    margin:0;
    white-space:nowrap;
  }
  .mode-btn{
    min-height:34px !important;
    padding:6px 9px !important;
    font-size:11px !important;
  }
  .zoom-controls button{
    width:34px !important;
    height:34px !important;
  }
  .selection-panel.selection-panel-community{
    left:8px !important;
    right:auto !important;
    width:min(340px,45vw) !important;
  }
}


/* =========================================================
   V64.2 — rifinitura mobile dopo test reale su smartphone
   ========================================================= */

.selection-mobile-total{
  display:none;
}

@media(max-width:760px){
  /* Ancora un po' più compatto: la mappa deve arrivare prima. */
  .topbar{
    height:50px !important;
    min-height:50px !important;
    padding:5px 7px !important;
  }
  .brand-mark{
    width:34px !important;
    height:34px !important;
    flex-basis:34px !important;
  }
  .brand strong{
    font-size:12px !important;
  }
  .account-btn,
  .my-areas-btn{
    min-height:34px !important;
    padding:6px 8px !important;
    font-size:10px !important;
  }
  .my-areas-btn{
    max-width:none !important;
  }

  /* Vendute resta come dato di prova sociale, ma in formato minimo. */
  .stats > div:first-child{
    min-width:44px !important;
    padding:3px 6px !important;
  }

  /* Foto più bassa, ma ancora ben riconoscibile. */
  .mobile-stadium-hero{
    flex-basis:116px !important;
    min-height:116px !important;
  }
  .mobile-stadium-hero-content{
    padding:9px 12px 8px !important;
  }
  .mobile-stadium-hero strong{
    font-size:17px !important;
  }
  .mobile-stadium-hero span{
    margin-top:3px !important;
    font-size:10px !important;
  }
  .mobile-stadium-hero small{
    margin-top:5px !important;
    padding:4px 7px !important;
  }

  /* Controlli principali compatti; zoom chiaramente secondario. */
  .mode-controls{
    top:6px !important;
  }
  .mode-btn{
    min-height:36px !important;
    padding:7px 10px !important;
    font-size:11px !important;
  }
  .zoom-controls{
    top:6px !important;
  }
  .zoom-controls button{
    width:34px !important;
    height:34px !important;
    font-size:16px !important;
  }

  /* Barra intelligente:
     con 0 celle diventa una piccola informazione;
     con una selezione mostra celle + totale + azioni. */
  .selection-panel.selection-panel-community{
    grid-template-columns:minmax(118px,.82fr) minmax(168px,1.18fr);
    padding:8px 9px !important;
  }

  .selection-community-count{
    flex-wrap:wrap;
    column-gap:5px;
    row-gap:1px;
  }
  .selection-mobile-total{
    display:inline-block;
    margin-left:2px;
    color:#f2c94c !important;
    font-size:13px !important;
    line-height:1;
    white-space:nowrap;
  }

  .selection-panel.is-empty{
    right:auto !important;
    width:auto !important;
    min-width:190px;
    display:block !important;
    padding:8px 11px !important;
  }
  .selection-panel.is-empty .selection-title,
  .selection-panel.is-empty #selectedCount,
  .selection-panel.is-empty .selection-mobile-total,
  .selection-panel.is-empty .selection-actions{
    display:none !important;
  }
  .selection-panel.is-empty .selection-community-count{
    display:block;
  }
  .selection-panel.is-empty #selectionCountLabel{
    display:block;
    font-size:10px !important;
    color:#c6d8e6 !important;
    white-space:nowrap;
  }

  .selection-panel.has-selection .selection-title{
    display:block;
  }
  .selection-panel.has-selection .selection-actions{
    display:grid;
  }
}

/* Landscape: niente pulsanti troncati e ancora più spazio alla mappa. */
@media(max-width:900px) and (orientation:landscape) and (max-height:520px){
  .topbar{
    height:44px !important;
    min-height:44px !important;
  }
  .mobile-stadium-hero{
    flex-basis:64px !important;
    min-height:64px !important;
  }
}


/* =========================================================
   V64.3 — gerarchia emozionale mobile + layout tablet touch
   ========================================================= */

/* SMARTPHONE: il messaggio viene prima del prezzo */
@media(max-width:760px){
  .mobile-stadium-hero strong{
    color:#f2c94c !important;
    text-shadow:0 2px 10px rgba(0,0,0,.88),0 0 1px rgba(0,0,0,.9);
  }
  .mobile-stadium-hero small{
    margin-top:4px !important;
    padding:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    color:rgba(255,255,255,.82) !important;
    text-shadow:0 1px 5px rgba(0,0,0,.9) !important;
    font-size:9px !important;
    font-weight:650 !important;
    letter-spacing:.01em;
  }
}

/* TABLET: esperienza touch dedicata.
   Non modifichiamo desktop >= 1101px e conserviamo il mobile <= 760px. */
@media(min-width:761px) and (max-width:1100px){
  html,body{
    width:100%;
    height:100%;
    overflow:hidden;
  }

  .topbar{
    flex:0 0 auto;
    height:58px;
    min-height:58px !important;
    padding:6px 10px !important;
    gap:8px !important;
    flex-wrap:nowrap !important;
    overflow:hidden;
  }
  .brand{
    min-width:170px !important;
    flex:1 1 auto;
    gap:8px;
  }
  .brand-mark{
    width:38px !important;
    height:38px !important;
    flex:0 0 38px;
    border-radius:10px;
    font-size:16px;
  }
  .brand strong{font-size:13px !important}
  .brand span{font-size:9px !important}

  .account-btn,.my-areas-btn{
    flex:0 0 auto;
    min-height:38px;
    padding:7px 12px !important;
    margin:0 !important;
    border-radius:10px;
    font-size:11px;
    white-space:nowrap;
  }

  .stats{
    order:initial !important;
    flex:0 0 auto;
    margin:0 !important;
  }
  .stats>div{
    display:none !important;
  }
  .stats>div:first-child{
    display:block !important;
    min-width:54px;
    padding:5px 8px;
    border-radius:10px;
  }
  .stats span{font-size:8px}
  .stats strong{font-size:13px;margin-top:0}

  /* Foto reale panoramica, indipendente dallo zoom */
  .mobile-stadium-hero{
    display:flex;
    flex:0 0 108px;
    min-height:108px;
    box-sizing:border-box;
    align-items:flex-end;
    position:relative;
    overflow:hidden;
    background:
      linear-gradient(90deg,rgba(3,12,21,.76),rgba(3,12,21,.18) 65%,rgba(3,12,21,.36)),
      url("assets/sinigaglia-background.jpg") center 46% / cover no-repeat;
    border-bottom:1px solid rgba(255,255,255,.12);
  }
  .mobile-stadium-hero-content{
    width:100%;
    padding:10px 16px;
    box-sizing:border-box;
  }
  .mobile-stadium-hero strong{
    display:block;
    color:#f2c94c;
    font-size:20px;
    line-height:1.08;
    font-weight:900;
    text-shadow:0 2px 10px rgba(0,0,0,.9);
  }
  .mobile-stadium-hero span{
    display:block;
    margin-top:3px;
    color:#fff;
    font-size:11px;
    text-shadow:0 1px 6px rgba(0,0,0,.9);
  }
  .mobile-stadium-hero small{
    display:block;
    margin-top:4px;
    color:rgba(255,255,255,.82);
    font-size:9px;
    font-weight:650;
    text-shadow:0 1px 5px rgba(0,0,0,.9);
  }

  main{flex:1 1 auto;min-height:0}
  .map-shell{
    height:100% !important;
    min-height:0 !important;
    background:#17374a !important;
  }

  /* Eliminiamo elementi desktop che sul touch rubano la scena */
  .community-message,.map-help,.cell-inspector,.minimap-wrap{
    display:none !important;
  }

  .mode-controls{
    left:12px !important;
    right:auto !important;
    top:10px !important;
    gap:7px !important;
  }
  .mode-btn{
    min-width:0 !important;
    min-height:40px !important;
    padding:8px 13px !important;
    border-radius:10px !important;
    font-size:12px !important;
  }
  .zoom-controls{
    right:12px !important;
    top:10px !important;
    gap:6px !important;
  }
  .zoom-controls button{
    width:38px !important;
    height:38px !important;
    border-radius:10px !important;
    font-size:17px !important;
  }

  /* Stessa logica di selezione moderna dello smartphone */
  .selection-panel.selection-panel-community{
    left:12px !important;
    right:12px !important;
    bottom:10px !important;
    width:auto !important;
    max-width:560px !important;
    box-sizing:border-box;
    padding:9px 11px !important;
    border-radius:13px !important;
    display:grid;
    grid-template-columns:minmax(130px,.8fr) minmax(210px,1.2fr);
    grid-template-areas:"title actions" "count actions";
    column-gap:12px;
    row-gap:2px;
    align-items:center;
    background:rgba(7,21,40,.94) !important;
    backdrop-filter:blur(12px);
  }
  .selection-panel-community .selection-title{
    grid-area:title;margin:0 !important;font-size:11px !important;color:#b9ccdc
  }
  .selection-community-count{
    grid-area:count;gap:6px;flex-wrap:wrap
  }
  .selection-community-count strong{font-size:23px !important}
  .selection-community-count span{font-size:9px !important}
  .selection-mobile-total{
    display:inline-block;
    color:#f2c94c !important;
    font-size:14px !important;
  }
  .selection-panel-community .selection-actions{
    grid-area:actions;
    display:grid;
    grid-template-columns:.65fr 1.35fr !important;
    gap:7px !important;
    margin:0 !important;
  }
  .selection-panel-community .selection-actions button{
    min-height:40px;
    padding:7px 8px !important;
    border-radius:9px;
    font-size:10px !important;
  }
  .selection-panel.is-empty{
    right:auto !important;
    width:auto !important;
    min-width:210px;
    display:block !important;
    padding:9px 12px !important;
  }
  .selection-panel.is-empty .selection-title,
  .selection-panel.is-empty #selectedCount,
  .selection-panel.is-empty .selection-mobile-total,
  .selection-panel.is-empty .selection-actions{
    display:none !important;
  }
  .selection-panel.is-empty #selectionCountLabel{
    display:block;
    font-size:10px !important;
    color:#c6d8e6 !important;
    white-space:nowrap;
  }
}


/* =========================================================
   V64.5 — scheda area: protagonista il contenuto del proprietario
   ========================================================= */

.purchase-card.no-owner-image .purchase-card-media{
  display:none;
}

.purchase-card.has-owner-image .purchase-card-media{
  min-height:0;
  background:#071722;
}

.purchase-card.has-owner-image .purchase-card-media img{
  height:190px;
  object-fit:cover;
}

.purchase-card-body{
  padding:18px 18px 19px;
}

.purchase-card-kicker{
  color:#f2c94c;
  letter-spacing:.13em;
  font-size:9px;
  margin-bottom:7px;
}

.purchase-card h3{
  font-size:23px;
  line-height:1.14;
}

.purchase-card-owner{
  margin-top:5px;
  font-size:13px;
  color:rgba(255,255,255,.68);
}

.purchase-card-description{
  margin:13px 0 0;
  padding:12px 13px;
  border-radius:11px;
  background:rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.06);
  color:rgba(255,255,255,.86);
  font-size:13px;
  line-height:1.48;
}

/* I dati tecnici restano disponibili ma non competono con foto/nome/messaggio. */
.purchase-card-stats{
  margin-top:14px;
  gap:6px;
}
.purchase-card-stats div{
  padding:8px 10px;
  background:rgba(255,255,255,.035);
}
.purchase-card-stats span{
  font-size:8px;
  color:rgba(255,255,255,.43);
}
.purchase-card-stats strong{
  margin-top:2px;
  font-size:12px;
  color:rgba(255,255,255,.78);
}

.purchase-card-locate{
  margin-top:14px;
}

/* Nessun logo/monogramma SemmCumasch come riempitivo. */
.purchase-card-placeholder,
.purchase-card-placeholder span{
  display:none !important;
}

@media(max-width:700px){
  .purchase-card.has-owner-image .purchase-card-media img{
    height:145px;
  }
  .purchase-card-body{
    padding:15px 15px 16px;
  }
  .purchase-card h3{
    font-size:21px;
  }
}


/* =========================================================
   V64.7 — editor area realmente usabile
   ========================================================= */

/* Più spazio cliccabile sulla X: non serve centrare il simbolo al pixel. */
#editAreaClose,
#myAreasClose,
.purchase-card-close,
.checkout-close{
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  min-height:48px !important;
  display:grid !important;
  place-items:center !important;
  padding:0 !important;
  line-height:1 !important;
  z-index:20 !important;
  touch-action:manipulation;
}

/* Nell'editor il pulsante di salvataggio resta SEMPRE raggiungibile. */
#editAreaModal .checkout-modal{
  max-height:min(92vh,820px) !important;
  overflow-y:auto !important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

#editAreaForm .checkout-actions{
  position:sticky;
  bottom:-1px;
  z-index:12;
  margin:10px -4px -4px !important;
  padding:14px 4px 4px !important;
  background:linear-gradient(
    180deg,
    rgba(16,36,49,0) 0%,
    rgba(16,36,49,.96) 24%,
    #102431 48%
  );
}

#editAreaSubmit:disabled{
  opacity:.62;
  cursor:wait;
}

/* Piccolo margine di sicurezza: la X non compete con la scrollbar. */
#editAreaModal .checkout-close{
  right:18px !important;
  top:14px !important;
}

@media(max-width:600px){
  #editAreaModal .checkout-modal{
    max-height:92dvh !important;
  }
  #editAreaForm .checkout-actions{
    padding-bottom:max(6px,env(safe-area-inset-bottom)) !important;
  }
}

.edit-area-save-status{margin-top:10px;padding:10px 12px;border-radius:10px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.055);font-size:12px;line-height:1.4;font-weight:700}.edit-area-save-status[data-type="success"]{border-color:rgba(93,211,145,.48);background:rgba(49,156,98,.14);color:#aaf1c7}.edit-area-save-status[data-type="error"]{border-color:rgba(255,118,118,.46);background:rgba(176,57,57,.14);color:#ffc1c1}




/* =========================================================
   V64.10 — rifinitura ellisse
   ========================================================= */
/* Nessuna modifica tariffaria: l'ellisse è puramente grafica. */


/* =========================================================
   V64.11 — "Le mie aree" più visuale e meno tecnica
   ========================================================= */
.my-areas-list{gap:12px}

.my-area-item{
  padding:12px;
  border-radius:16px;
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.10);
}

.my-area-card-main{
  display:grid;
  grid-template-columns:92px minmax(0,1fr);
  gap:12px;
  align-items:center;
}

.my-area-thumb{
  width:92px;
  height:76px;
  overflow:hidden;
  border-radius:12px;
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.08);
  display:grid;
  place-items:center;
}
.my-area-thumb img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}
.my-area-thumb.no-image span{
  font-size:24px;
  color:rgba(255,255,255,.38);
}

.my-area-summary{min-width:0}
.my-area-item .my-area-summary h3{
  margin:4px 0 2px;
  font-size:17px;
  line-height:1.15;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.my-area-owner{
  margin:0 0 5px;
  color:rgba(255,255,255,.60);
  font-size:11px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.my-area-status{
  display:inline-flex;
  align-items:center;
  width:max-content;
  max-width:100%;
  padding:3px 7px;
  border-radius:999px;
  font-size:8px;
  line-height:1;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.my-area-status.is-ready{
  color:#aaf1c7;
  background:rgba(49,156,98,.15);
  border:1px solid rgba(93,211,145,.28);
}
.my-area-status.is-pending{
  color:#f2c94c;
  background:rgba(242,201,76,.10);
  border:1px solid rgba(242,201,76,.24);
}

.my-area-primary-meta{
  display:flex;
  align-items:center;
  gap:5px;
  margin-top:6px;
  color:rgba(255,255,255,.88);
  font-size:12px;
}
.my-area-primary-meta span{opacity:.36}
.my-area-primary-meta strong{font-size:12px}

.my-area-secondary-meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin:11px 1px 10px;
  padding-top:9px;
  border-top:1px solid rgba(255,255,255,.07);
  color:rgba(255,255,255,.43);
  font-size:9px;
}
.my-area-code{
  white-space:nowrap;
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
}

.my-area-actions{margin-top:0}
.my-area-actions button{min-height:38px}

@media(max-width:420px){
  .my-area-card-main{grid-template-columns:76px minmax(0,1fr);gap:10px}
  .my-area-thumb{width:76px;height:68px}
  .my-area-secondary-meta{display:grid;gap:3px}
}


/* =========================================================
   V64.12 — rifinitura Le mie aree + popup mappa
   ========================================================= */

/* Il badge positivo viene eliminato: compare solo se manca
   ancora una vera personalizzazione. */
.my-area-status.is-ready{display:none}
.my-area-thumb.no-image span{
  font-size:19px;
  opacity:.55;
}

/* Popup area sulla mappa: stesso linguaggio visivo della scheda pubblica. */
.purchase-tooltip{
  background:rgba(7,25,43,.96) !important;
  color:#f5f9ff !important;
  border:1px solid rgba(255,255,255,.13) !important;
  border-radius:14px !important;
  box-shadow:0 14px 38px rgba(0,0,0,.34) !important;
  padding:13px 15px !important;
  min-width:210px;
  max-width:290px;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.purchase-tooltip *{color:inherit}
.purchase-tooltip strong,
.purchase-tooltip b{
  color:#fff !important;
  font-weight:900;
}
.purchase-tooltip .muted,
.purchase-tooltip small{
  color:rgba(231,241,251,.62) !important;
}
.purchase-tooltip::after{
  border-top-color:rgba(7,25,43,.96) !important;
}

@media(max-width:600px){
  .purchase-tooltip{
    min-width:180px;
    max-width:min(250px,78vw);
    padding:11px 13px !important;
    border-radius:12px !important;
  }
}


/* =========================================================
   V64.13 — micro-rifinitura popup area acquistata
   ========================================================= */
/* CTA più corta e leggibile; il popup resta compatto. */
.purchase-tooltip strong:first-child,
.purchase-tooltip b:first-child{
  font-size:14px;
  line-height:1.2;
}
.purchase-tooltip .purchase-title,
.purchase-tooltip .area-title{
  font-size:14px !important;
  line-height:1.2 !important;
  font-weight:900 !important;
}

/* V65.0 — ambiente pagamenti esplicito */
.stripe-test-note.is-live{
  background:rgba(76,165,114,.08);
  border-color:rgba(108,211,151,.16);
  opacity:.82;
}


/* =========================================================
   V65.1 — riepilogo acquisto prima di Stripe
   ========================================================= */

#checkoutModal .checkout-modal{
  width:min(620px,calc(100vw - 32px));
}

.checkout-purchase-intro{
  margin:10px 0 14px;
  padding:12px 13px;
  border-radius:12px;
  background:rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.075);
}
.checkout-purchase-intro strong,
.checkout-purchase-intro span{
  display:block;
}
.checkout-purchase-intro strong{
  font-size:14px;
  color:#fff;
}
.checkout-purchase-intro span{
  margin-top:4px;
  font-size:11px;
  line-height:1.45;
  color:rgba(255,255,255,.62);
}

.checkout-summary-v651{
  display:grid;
  gap:0;
  margin:0 0 12px;
  padding:0;
  overflow:hidden;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.035);
}
.checkout-summary-v651 .checkout-summary-row,
.checkout-summary-v651 .checkout-total{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:0;
  padding:10px 13px;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.07);
}
.checkout-summary-v651 .checkout-summary-row[hidden]{
  display:none !important;
}
.checkout-summary-v651 .checkout-summary-row span{
  font-size:11px;
  color:rgba(255,255,255,.58);
}
.checkout-summary-v651 .checkout-summary-row strong{
  font-size:13px;
  color:#fff;
  white-space:nowrap;
}
.checkout-summary-v651 .checkout-total{
  border-bottom:0;
  padding:13px;
  background:rgba(242,201,76,.08);
}
.checkout-summary-v651 .checkout-total span{
  font-size:12px;
  font-weight:800;
  color:rgba(255,255,255,.82);
}
.checkout-summary-v651 .checkout-total strong{
  font-size:24px;
  color:#f2c94c;
  letter-spacing:-.02em;
}

.checkout-what-you-get{
  margin:0 0 12px;
  padding:11px 13px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.025);
  color:rgba(255,255,255,.68);
  font-size:10px;
  line-height:1.6;
}
.checkout-what-you-get-title{
  margin-bottom:3px;
  color:rgba(255,255,255,.92);
  font-size:10px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
}

#checkoutModal .stripe-test-note{
  margin:0 0 14px;
  padding:10px 12px;
}

#checkoutSubmit{
  position:relative;
}
#checkoutSubmit:disabled{
  opacity:.66;
  cursor:wait;
}

@media(max-width:600px){
  #checkoutModal{
    align-items:flex-end;
    padding:8px;
  }
  #checkoutModal .checkout-modal{
    width:100%;
    max-height:94dvh;
    overflow-y:auto;
    padding:20px 15px 15px;
    border-radius:18px;
  }
  .checkout-purchase-intro{
    margin-top:7px;
  }
  .checkout-summary-v651 .checkout-total strong{
    font-size:21px;
  }
  .checkout-what-you-get{
    font-size:9px;
  }
}


/* =========================================================
   V65.2 — riepilogo e personalizzazione separati
   ========================================================= */

.checkout-customize-section{
  margin-top:14px;
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.032);
  border:1px solid rgba(255,255,255,.08);
}

.checkout-section-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.checkout-section-kicker{
  display:block;
  margin-bottom:3px;
  color:#f2c94c;
  font-size:8px;
  font-weight:900;
  letter-spacing:.12em;
}
.checkout-section-heading h3{
  margin:0;
  color:#fff;
  font-size:17px;
  line-height:1.2;
}
.checkout-section-note{
  flex:0 0 auto;
  padding:5px 8px;
  border-radius:999px;
  background:rgba(255,255,255,.055);
  color:rgba(255,255,255,.58);
  font-size:8px;
  font-weight:800;
  white-space:nowrap;
}

.checkout-fields-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.checkout-customize-section > label,
.checkout-fields-grid > label{
  margin:0 0 10px;
}
.checkout-customize-section label{
  font-size:11px;
}
.checkout-customize-section input,
.checkout-customize-section textarea{
  margin-top:5px;
}
.checkout-customize-section textarea{
  min-height:82px;
  resize:vertical;
}
.checkout-customize-section small{
  display:block;
  margin-top:4px;
  color:rgba(255,255,255,.47);
  font-size:8px;
  line-height:1.35;
}
.checkout-apply-all{
  margin:2px 0 0 !important;
  padding:9px 10px !important;
  border-radius:10px;
  background:rgba(255,255,255,.03);
}

.checkout-actions-sticky{
  position:sticky;
  bottom:-1px;
  z-index:20;
  margin:14px -2px -2px !important;
  padding:14px 2px 2px !important;
  background:linear-gradient(
    180deg,
    rgba(12,30,45,0) 0%,
    rgba(12,30,45,.94) 34%,
    rgba(12,30,45,1) 62%
  );
}

@media(max-width:700px){
  .checkout-section-heading{
    display:block;
  }
  .checkout-section-note{
    display:inline-flex;
    margin-top:7px;
  }
  .checkout-fields-grid{
    grid-template-columns:1fr;
    gap:0;
  }
  .checkout-customize-section{
    padding:12px;
  }
  .checkout-actions-sticky{
    grid-template-columns:.7fr 1.3fr !important;
  }
}

@media(min-width:701px){
  #checkoutModal .checkout-modal{
    max-height:88vh;
    overflow-y:auto;
  }
}


/* =========================================================
   V65.3 — rifiniture responsive checkout + home
   ========================================================= */

/* Checkout: separazione più netta tra i riquadri del riepilogo. */
.checkout-summary-v651{
  gap:8px !important;
  padding:0 !important;
  background:transparent !important;
  border:0 !important;
  overflow:visible !important;
}
.checkout-summary-v651 .checkout-summary-row,
.checkout-summary-v651 .checkout-total{
  border:1px solid rgba(255,255,255,.09) !important;
  border-radius:12px !important;
  background:rgba(255,255,255,.035);
}
.checkout-summary-v651 .checkout-total{
  background:rgba(242,201,76,.08) !important;
}

/* Personalizzazione: Immagine/Logo e Link partono dalla stessa quota. */
.checkout-fields-grid{
  align-items:start;
}
.checkout-fields-grid > label{
  display:flex;
  flex-direction:column;
  min-width:0;
  margin-top:0 !important;
}
.checkout-fields-grid > label > input{
  width:100%;
  box-sizing:border-box;
  margin-top:5px !important;
}
.checkout-fields-grid > label > small{
  min-height:12px;
}

/* Pulsanti finali più coerenti su desktop/tablet. */
.checkout-actions-sticky{
  display:grid !important;
  grid-template-columns:160px minmax(240px,1fr);
  gap:10px !important;
  align-items:center;
}
.checkout-actions-sticky .secondary,
.checkout-actions-sticky .primary{
  min-height:46px;
  border-radius:12px !important;
  font-weight:900;
  font-size:14px;
}
#checkoutSubmit{
  border:0 !important;
  box-shadow:none !important;
}

/* Smartphone: niente sticky, quindi i pulsanti non coprono mai i campi. */
@media(max-width:700px){
  .checkout-actions-sticky{
    position:static !important;
    display:flex !important;
    flex-direction:column !important;
    margin:16px 0 0 !important;
    padding:0 !important;
    background:none !important;
    gap:10px !important;
  }
  #checkoutSubmit{
    order:1;
    width:100%;
    min-height:52px;
    font-size:16px;
  }
  #checkoutCancel{
    order:2;
    width:100%;
    min-height:48px;
    font-size:15px;
  }
  .checkout-summary-v651{
    gap:8px !important;
  }
  .checkout-fields-grid > label > small{
    min-height:0;
  }
}

/* Tablet: pulsanti ben separati ma compatti. */
@media(min-width:701px) and (max-width:1100px){
  .checkout-actions-sticky{
    grid-template-columns:140px minmax(260px,1fr);
    gap:12px !important;
  }
}

/* Cartello oro più in alto su desktop/tablet. */
@media(min-width:761px){
  .mobile-stadium-hero{ transform:translateY(-20px) !important; }
  .mobile-stadium-hero-content{ transform:translateY(-20px) !important; }
}

/* Istruzioni superiori più compatte per non entrare nel cartello. */
@media(min-width:761px){
  .tooltip{ max-width:470px !important; }
}

@media(min-width:761px){
  .community-claim,
  .map-claim,
  .stadium-claim,
  .claim-banner,
  .hero-claim{
    transform:translateY(-20px);
  }

  .map-instructions,
  .map-hints,
  .desktop-hints,
  .interaction-hints{
    max-width:470px;
    gap:8px !important;
  }
}


/* V65.3 — correzione esatta cartello oro e istruzioni desktop */
@media(min-width:761px){
  .community-message{
    top:-6px !important;
    transform:none !important;
    z-index:8;
  }

  .map-help{
    left:14px !important;
    top:14px !important;
    max-width:440px;
    gap:6px !important;
    z-index:7;
  }

  .map-help span{
    padding:5px 7px;
    font-size:10px;
    white-space:nowrap;
  }
}

/* Su tablet più stretto evitiamo qualsiasi contatto tra istruzioni e claim. */
@media(min-width:761px) and (max-width:1100px){
  .map-help{
    max-width:360px;
  }
  .map-help span:nth-child(3){
    display:none;
  }
}


/* V65.4 — micro-correzione finale cartello oro desktop/tablet.
   Checkout/pagamento NON modificato. */
@media (min-width:761px){
  .community-message{
    /* centrato sulla mappa e abbastanza alto da coprire ESTERNO LAGO,
       senza invadere i comandi sulla destra */
    left:50% !important;
    right:auto !important;
    top:-10px !important;
    transform:translateX(-50%) !important;
    max-width:min(520px, 58vw) !important;
    z-index:8 !important;
  }
}

/* Tablet: cartello un po' più compatto per lasciare liberi i comandi */
@media (min-width:761px) and (max-width:1100px){
  .community-message{
    max-width:470px !important;
  }
}


/* V65.5 — solo micro-regolazione verticale del cartello oro.
   Centralità invariata. Tutto il resto invariato. */
@media (min-width:761px){
  .community-message{
    top:-5px !important;
  }
}

/* V65.6 — cartello oro: altri 5 px verso il basso. */
@media (min-width:761px){
  .community-message{
    top:0px !important;
  }
}


/* =========================================================
   V65.7 — conferma post-pagamento
   ========================================================= */
.payment-success-modal{
  width:min(520px,calc(100vw - 32px)) !important;
  text-align:center;
}
.payment-success-icon{
  width:54px;
  height:54px;
  margin:2px auto 10px;
  display:grid;
  place-items:center;
  border-radius:50%;
  border:1px solid rgba(242,201,76,.45);
  background:rgba(242,201,76,.10);
  color:#f2c94c;
  font-size:28px;
  font-weight:900;
}
.payment-success-modal .checkout-kicker{
  text-align:center;
}
.payment-success-modal h2{
  margin-bottom:8px;
}
.payment-success-text,
.payment-success-note{
  margin:0 auto 14px;
  max-width:430px;
  color:rgba(255,255,255,.66);
  font-size:12px;
  line-height:1.5;
}
.payment-success-summary{
  display:grid;
  gap:8px;
  margin:16px 0 14px;
  text-align:left;
}
.payment-success-summary > div{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  padding:11px 13px;
  border:1px solid rgba(255,255,255,.09);
  border-radius:11px;
  background:rgba(255,255,255,.035);
}
.payment-success-summary span{
  color:rgba(255,255,255,.52);
  font-size:11px;
}
.payment-success-summary strong{
  color:#fff;
  font-size:13px;
  text-align:right;
}
.payment-success-actions{
  display:grid;
  grid-template-columns:1fr 1.4fr;
  gap:10px;
  margin-top:14px;
}
.payment-success-actions button{
  min-height:46px;
  border-radius:12px !important;
  font-weight:900;
}
@media(max-width:600px){
  .payment-success-modal{
    width:100% !important;
    max-height:92dvh;
    overflow-y:auto;
  }
  .payment-success-actions{
    display:flex;
    flex-direction:column;
  }
  #paymentSuccessLocate{order:1;}
  #paymentSuccessMyAreas{order:2;}
}


/* =========================================================
   V65.8 — Admin
   ========================================================= */
.admin-btn{
  border:1px solid rgba(242,201,76,.42);
  background:rgba(242,201,76,.09);
  color:#f2c94c;
  border-radius:10px;
  padding:8px 12px;
  font-weight:900;
  cursor:pointer;
}
.admin-backdrop{
  position:fixed;
  inset:0;
  z-index:140;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(2,9,17,.78);
  backdrop-filter:blur(8px);
}
.admin-backdrop[hidden]{display:none!important;}
.admin-panel{
  position:relative;
  width:min(940px,calc(100vw - 32px));
  max-height:90vh;
  overflow:auto;
  padding:22px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:18px;
  background:#0c1e2d;
  box-shadow:0 24px 80px rgba(0,0,0,.45);
}
.admin-heading{
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding-right:34px;
}
.admin-heading h2{margin:3px 0 5px;}
.admin-heading p{margin:0;color:rgba(255,255,255,.58);font-size:12px;}
.admin-kicker{font-size:9px;font-weight:900;letter-spacing:.13em;color:#f2c94c;}
.admin-toolbar{
  display:grid;
  grid-template-columns:1fr 190px;
  gap:10px;
  margin:18px 0 10px;
}
.admin-toolbar input,.admin-toolbar select{
  width:100%;box-sizing:border-box;
  border:1px solid rgba(255,255,255,.12);
  border-radius:11px;background:#091725;color:#fff;padding:11px 12px;
}
.admin-summary{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;}
.admin-summary span{
  padding:7px 10px;border-radius:999px;background:rgba(255,255,255,.05);
  color:rgba(255,255,255,.65);font-size:11px;
}
.admin-summary strong{color:#fff;}
.admin-list{display:grid;gap:10px;}
.admin-area-item{
  padding:14px;border:1px solid rgba(255,255,255,.09);
  border-radius:13px;background:rgba(255,255,255,.025);
}
.admin-area-top{display:flex;justify-content:space-between;gap:15px;align-items:flex-start;}
.admin-area-top h3{margin:4px 0;font-size:16px;}
.admin-area-top p{margin:0;color:rgba(255,255,255,.52);font-size:11px;}
.admin-area-code{font-size:9px;letter-spacing:.08em;color:#f2c94c;font-weight:900;}
.admin-state{padding:5px 8px;border-radius:999px;font-size:9px;font-weight:900;white-space:nowrap;}
.admin-state.is-active{background:rgba(76,210,142,.12);color:#77e5ad;}
.admin-state.is-suspended{background:rgba(255,98,98,.12);color:#ff9696;}
.admin-state.is-pending{background:rgba(242,201,76,.12);color:#f2c94c;}
.admin-area-meta{display:flex;gap:12px;flex-wrap:wrap;margin:11px 0;color:rgba(255,255,255,.58);font-size:10px;}
.admin-area-meta b{color:#fff;}
.admin-area-actions{display:flex;gap:8px;justify-content:flex-end;}
.admin-area-actions button{min-height:38px;border-radius:10px;padding:0 12px;font-weight:900;}
.admin-area-actions .danger{border:1px solid rgba(255,98,98,.35);background:rgba(255,98,98,.10);color:#ff9696;}
.admin-empty{text-align:center;padding:28px;color:rgba(255,255,255,.5);}
@media(max-width:700px){
  .admin-panel{width:100%;max-height:94dvh;padding:16px;}
  .admin-heading{display:block;}
  .admin-heading #adminRefresh{margin-top:12px;}
  .admin-toolbar{grid-template-columns:1fr;}
  .admin-area-top{display:block;}
  .admin-state{display:inline-block;margin-top:8px;}
  .admin-area-actions{display:grid;grid-template-columns:1fr;margin-top:12px;}
}


/* =========================================================
   V65.9 — anteprima contenuti per moderazione
   ========================================================= */
.admin-preview-backdrop{
  position:fixed;inset:0;z-index:155;display:grid;place-items:center;
  padding:18px;background:rgba(2,9,17,.82);backdrop-filter:blur(8px);
}
.admin-preview-backdrop[hidden]{display:none!important;}
.admin-preview-panel{
  position:relative;width:min(620px,calc(100vw - 32px));max-height:92vh;overflow:auto;
  padding:22px;border:1px solid rgba(255,255,255,.11);border-radius:18px;
  background:#0c1e2d;box-shadow:0 24px 80px rgba(0,0,0,.5);
}
.admin-preview-panel h2{margin:4px 0 14px;}
.admin-preview-media{
  min-height:150px;max-height:300px;display:grid;place-items:center;overflow:hidden;
  border:1px solid rgba(255,255,255,.09);border-radius:13px;background:rgba(255,255,255,.025);
}
.admin-preview-media img{display:block;width:100%;max-height:300px;object-fit:contain;}
.admin-preview-no-image{display:grid;place-items:center;gap:6px;color:rgba(255,255,255,.42);}
.admin-preview-no-image span{font-size:34px}.admin-preview-no-image strong{font-size:11px;}
.admin-preview-fields{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:12px 0;}
.admin-preview-fields>div{
  padding:11px 12px;border:1px solid rgba(255,255,255,.08);border-radius:11px;
  background:rgba(255,255,255,.025);min-width:0;
}
.admin-preview-fields span{display:block;margin-bottom:5px;color:rgba(255,255,255,.48);font-size:9px;font-weight:800;}
.admin-preview-fields strong,.admin-preview-fields p{margin:0;color:#fff;font-size:12px;line-height:1.45;overflow-wrap:anywhere;}
.admin-preview-wide{grid-column:1/-1;}
.admin-preview-fields a{color:#f2c94c;font-size:12px;font-weight:900;overflow-wrap:anywhere;}
.admin-preview-fields em{color:rgba(255,255,255,.42);font-size:11px;font-style:normal;}
.admin-preview-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:12px;}
.admin-preview-actions button{min-height:44px;border-radius:11px;font-weight:900;}
.admin-preview-actions .danger{border:1px solid rgba(255,98,98,.35);background:rgba(255,98,98,.10);color:#ff9696;}
@media(max-width:650px){
  .admin-preview-panel{width:100%;padding:16px;}
  .admin-preview-fields{grid-template-columns:1fr;}
  .admin-preview-wide{grid-column:auto;}
  .admin-preview-actions{grid-template-columns:1fr;}
}


/* =========================================================
   V65.13 — motivo e storico moderazione
   ========================================================= */
.admin-moderation-box{
  margin:12px 0;
  padding:12px;
  border:1px solid rgba(242,201,76,.16);
  border-radius:12px;
  background:rgba(242,201,76,.035);
  text-align:left;
}
.admin-moderation-box label{
  display:block;margin-bottom:6px;color:#f2c94c;
  font-size:10px;font-weight:900;letter-spacing:.04em;
}
.admin-moderation-box textarea{
  width:100%;box-sizing:border-box;resize:vertical;min-height:78px;
  padding:10px 11px;border:1px solid rgba(255,255,255,.11);
  border-radius:10px;background:#091725;color:#fff;
  font:inherit;font-size:12px;line-height:1.45;
}
.admin-moderation-box small{
  display:block;margin-top:8px;padding:8px 9px;border-radius:8px;
  background:rgba(255,255,255,.035);color:rgba(255,255,255,.58);
  font-size:9px;line-height:1.45;overflow-wrap:anywhere;
}
.admin-moderation-box p{
  margin:7px 0 0;color:rgba(255,255,255,.40);
  font-size:9px;line-height:1.4;
}
.admin-moderation-reason{
  margin:9px 0 3px;padding:8px 10px;
  border-left:3px solid rgba(255,98,98,.55);
  border-radius:7px;background:rgba(255,98,98,.055);
  color:rgba(255,255,255,.68);font-size:10px;line-height:1.4;
}
.admin-moderation-reason b{color:#ffaaaa;}

.remove-image-option{border-color:rgba(255,98,98,.18)!important;}
.remove-image-option span{color:rgba(255,190,190,.88);}

/* V65.14.3 — messaggi visibili sopra le finestre modali */
.toast{
  position:fixed !important;
  z-index:10000 !important;
  top:18px !important;
}
@media(max-width:700px){
  .toast{
    top:12px !important;
    max-width:calc(100vw - 28px);
    white-space:normal;
    text-align:center;
  }
}

/* V65.14.4 — errore file persistente e leggibile */
.file-error-message{
  margin-top:8px;
  padding:9px 11px;
  border:1px solid rgba(255,98,98,.35);
  border-radius:9px;
  background:rgba(255,98,98,.10);
  color:#ffb0b0;
  font-size:11px;
  line-height:1.4;
  font-weight:800;
}
.file-error-message[hidden]{
  display:none !important;
}

/* V65.16 — selettore lingua */
.language-switch{display:flex;align-items:center;gap:3px;padding:3px;border:1px solid rgba(255,255,255,.16);border-radius:10px;background:rgba(5,18,36,.58);flex:0 0 auto}.lang-btn{border:0;border-radius:7px;background:transparent;color:rgba(255,255,255,.72);padding:6px 8px;font:inherit;font-size:12px;font-weight:800;cursor:pointer}.lang-btn.active{background:rgba(255,255,255,.15);color:#fff}@media(max-width:700px){.language-switch{padding:2px;gap:1px}.lang-btn{padding:5px 6px;font-size:11px}}

/* V65.16.1 — rifiniture layout IT/EN */

/* Smartphone: manteniamo entrambe le bandierine senza comprimere SemmCumasch.
   La mini-statistica "Vendute" resta disponibile su tablet/desktop. */
@media(max-width:480px){
  .topbar{gap:5px !important}
  .stats{display:none !important}
  .brand{flex:1 1 auto !important; min-width:122px !important}
  .brand strong{
    font-size:12.5px !important;
    letter-spacing:-.15px;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  .language-switch{flex:0 0 auto;margin-left:2px}
  .lang-btn{padding:5px 6px !important;font-size:10.5px !important}
  .account-btn,.my-areas-btn{padding:7px 8px !important}
}

/* Desktop: la terza istruzione inglese è più lunga.
   La forziamo su una seconda riga a sinistra, così non entra nel cartello oro. */
@media(min-width:1101px){
  .map-help{
    max-width:470px !important;
  }
  .map-help span:nth-child(3){
    flex-basis:100%;
    width:max-content;
    max-width:100%;
  }
}

/* V65.16.2 — terza istruzione desktop compatta */
@media(min-width:1101px){
  .map-help span:nth-child(3){
    flex-basis:auto !important;
    width:fit-content !important;
    max-width:max-content !important;
    align-self:flex-start;
  }
}

/* V65.16.3 — desktop: 2 istruzioni sopra, terza sotto e compatta */
@media(min-width:1101px){
  .map-help{
    display:grid !important;
    grid-template-columns:max-content max-content !important;
    grid-auto-rows:auto;
    justify-content:start;
    align-items:start;
    column-gap:6px !important;
    row-gap:6px !important;
    max-width:none !important;
  }
  .map-help span{
    width:max-content !important;
    max-width:none !important;
    white-space:nowrap !important;
  }
  .map-help span:nth-child(3){
    grid-column:1 / 2 !important;
    grid-row:2 !important;
    justify-self:start !important;
  }
}

/* V65.20 — Come funziona */
.how-it-works-btn{
  position:absolute;left:50%;top:112px;transform:translateX(-50%);
  z-index:8;border:1px solid rgba(156,231,255,.58);border-radius:999px;
  padding:7px 14px;background:rgba(5,24,45,.88);color:#e9f8ff;
  font:700 12px/1 system-ui,sans-serif;cursor:pointer;
  box-shadow:0 5px 18px rgba(0,0,0,.22);backdrop-filter:blur(8px);
}
.how-it-works-btn:hover{background:rgba(12,49,79,.96);transform:translateX(-50%) translateY(-1px)}
.how-it-works-modal{max-width:570px}
.how-intro{margin:4px 0 18px;color:#c7d7e8;line-height:1.5}
.how-steps{display:grid;gap:10px}
.how-step{
  display:grid;grid-template-columns:38px 1fr;gap:12px;align-items:start;
  padding:13px;border:1px solid rgba(156,231,255,.18);border-radius:14px;
  background:rgba(255,255,255,.035)
}
.how-number{
  width:34px;height:34px;border-radius:50%;display:grid;place-items:center;
  font-weight:900;color:#071528;background:#9ce7ff
}
.how-step strong{display:block;margin:1px 0 5px;font-size:15px}
.how-step p{margin:0;color:#c7d7e8;line-height:1.45;font-size:13px}
.how-closing{
  margin:16px 0 13px;padding:12px 14px;text-align:center;border-radius:12px;
  font-weight:800;color:#f4cf72;background:rgba(244,207,114,.08);
  border:1px solid rgba(244,207,114,.22)
}
.how-explore{width:100%}
@media(max-width:700px){
  .how-it-works-btn{top:102px;padding:7px 12px;font-size:11px}
  .how-it-works-modal{width:min(92vw,520px);max-height:88vh;overflow:auto}
  .how-step{grid-template-columns:32px 1fr;padding:11px;gap:9px}
  .how-number{width:30px;height:30px}
}

/* V65.20.1 — Come funziona nella barra comandi */
.mode-controls .how-it-works-btn{
  position:static;
  left:auto;top:auto;transform:none;
  z-index:auto;
  border:1px solid rgba(255,220,118,.95);
  border-radius:14px;
  padding:12px 16px;
  background:linear-gradient(180deg,#f6d675,#dcae3d);
  color:#172334;
  font:800 14px/1 system-ui,sans-serif;
  box-shadow:0 5px 16px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.45);
  backdrop-filter:none;
  white-space:nowrap;
}
.mode-controls .how-it-works-btn:hover{
  background:linear-gradient(180deg,#ffe494,#e7ba4b);
  transform:translateY(-1px);
}
.mode-controls .how-it-works-btn:active{transform:translateY(0)}
@media(max-width:700px){
  .mode-controls .how-it-works-btn{
    position:static;top:auto;
    padding:11px 12px;
    font-size:12px;
    border-radius:13px;
  }
}
@media(max-width:430px){
  .mode-controls{gap:7px}
  .mode-controls .mode-btn{padding-left:11px;padding-right:11px}
  .mode-controls .how-it-works-btn{padding-left:10px;padding-right:10px;font-size:11px}
}

/* V65.20.2 — solo desktop: Come funziona sotto Sposta/Seleziona */
@media (min-width:1101px){
  .mode-controls{
    flex-wrap:wrap;
    align-content:flex-start;
  }
  .mode-controls .how-it-works-btn{
    flex-basis:auto;
    margin-right:calc(100% - 190px);
    order:10;
  }
}

/* V65.20.3 — desktop: Sposta + Seleziona sopra, Come funziona sotto */
@media (min-width:1101px){
  .mode-controls{
    display:grid !important;
    grid-template-columns:max-content max-content !important;
    grid-template-rows:auto auto !important;
    column-gap:10px !important;
    row-gap:8px !important;
    flex-wrap:nowrap !important;
    align-content:start !important;
    justify-content:start !important;
  }
  .mode-controls #panModeBtn{
    grid-column:1 !important;
    grid-row:1 !important;
  }
  .mode-controls #selectModeBtn{
    grid-column:2 !important;
    grid-row:1 !important;
  }
  .mode-controls .how-it-works-btn{
    grid-column:1 / span 2 !important;
    grid-row:2 !important;
    justify-self:start !important;
    width:max-content !important;
    margin:0 !important;
    order:initial !important;
  }
}


/* =========================================================
   V65.22.0 — Fan Experience: anteprima area acquistata
   ========================================================= */
.purchase-tooltip{
  min-width:240px !important;
  max-width:300px !important;
}
.purchase-tooltip-head{
  display:flex;
  align-items:center;
  gap:10px;
}
.purchase-tooltip-image{
  width:46px;
  height:46px;
  flex:0 0 46px;
  object-fit:contain;
  border-radius:10px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.11);
  padding:4px;
}
.purchase-tooltip-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.purchase-tooltip-copy strong{
  font-size:14px !important;
  line-height:1.15 !important;
}
.purchase-tooltip-copy span{
  color:rgba(231,241,251,.72) !important;
  font-size:12px;
  line-height:1.15;
}
.purchase-tooltip-meta{
  margin-top:9px;
  font-size:11px;
  color:rgba(231,241,251,.62) !important;
}
.purchase-tooltip-cta{
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid rgba(255,255,255,.10);
  color:#fff !important;
  font-size:12px;
  font-weight:800;
}
@media(max-width:600px){
  .purchase-tooltip{
    min-width:210px !important;
    max-width:min(270px,82vw) !important;
  }
  .purchase-tooltip-image{
    width:42px;
    height:42px;
    flex-basis:42px;
  }
}


/* V65.22.1 — il popup resta raggiungibile col mouse */
#tooltip.purchase-tooltip{
  pointer-events:auto !important;
  cursor:pointer;
}
#tooltip.purchase-tooltip:hover{
  box-shadow:0 16px 42px rgba(0,0,0,.38);
}
#tooltip.purchase-tooltip .purchase-tooltip-cta{
  border-radius:8px;
  padding:8px 9px;
  margin:8px -2px -2px;
  background:rgba(20,115,170,.09);
}
#tooltip.purchase-tooltip:hover .purchase-tooltip-cta{
  background:rgba(20,115,170,.16);
}

/* V65.22.5 — spazio personale del tifoso */
.fan-space-card{overflow:hidden}
.fan-space-cover{height:82px;margin:-1px -1px 0;background:linear-gradient(135deg,rgba(19,104,157,.42),rgba(4,24,38,.92));display:flex;align-items:flex-start;padding:16px 18px}
.fan-space-cover span{font-size:10px;font-weight:900;letter-spacing:.18em;color:rgba(235,248,255,.65)}
.fan-space-avatar{width:78px!important;height:78px!important;margin:-39px 0 0 22px!important;border-radius:18px!important;border:4px solid #0c1d2b!important;background:#102b40!important;position:relative;z-index:2}
.fan-space-avatar img{object-fit:contain!important;padding:7px}
.fan-space-card .purchase-card-body{padding-top:10px}
.fan-space-card .purchase-card-owner{line-height:1.45}
.fan-space-message-label{margin-top:17px;margin-bottom:6px;font-size:10px;font-weight:900;letter-spacing:.12em;color:#8dd4ff}
.fan-space-card .purchase-card-description{margin-top:0;padding:14px;border-radius:12px;background:rgba(39,143,200,.08);border:1px solid rgba(83,175,226,.13)}
.fan-space-actions{display:flex;gap:8px;flex-wrap:wrap}
.fan-space-actions>*{flex:1 1 150px}
.fan-space-signature{display:flex;gap:10px;align-items:center;margin-top:17px;padding-top:14px;border-top:1px solid rgba(255,255,255,.08)}
.fan-space-signature>span{font-size:20px}
.fan-space-signature strong,.fan-space-signature small{display:block}
.fan-space-signature strong{font-size:11px}
.fan-space-signature small{margin-top:3px;font-size:10px;color:rgba(231,244,255,.5)}

/* =========================================================
   V65.22.6 — foto proprietario visibile + scheda distinta dal sito
   ========================================================= */

/* Colore volutamente più chiaro/blu petrolio rispetto al pannello principale del sito. */
.purchase-card.fan-space-card{
  background:#17384a !important;
  border:1px solid rgba(151,214,245,.38) !important;
  box-shadow:0 22px 65px rgba(0,0,0,.52),0 0 0 1px rgba(255,255,255,.035) inset !important;
}
.fan-space-cover{
  background:linear-gradient(135deg,#245a73,#16384a 58%,#102b3b) !important;
  border-bottom:1px solid rgba(255,255,255,.10);
}

/* La foto caricata torna protagonista: non più mini-avatar 78x78. */
.purchase-card.has-owner-image .fan-space-owner-photo{
  display:block !important;
  width:auto !important;
  height:190px !important;
  min-height:190px !important;
  margin:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:#0c2533 !important;
  overflow:hidden !important;
}
.purchase-card.has-owner-image .fan-space-owner-photo img{
  display:block !important;
  width:100% !important;
  height:190px !important;
  padding:0 !important;
  object-fit:cover !important;
  border-radius:0 !important;
}
.purchase-card.no-owner-image .fan-space-owner-photo{
  display:none !important;
}
.fan-space-card .purchase-card-body{
  background:#17384a !important;
  padding-top:18px !important;
}
.fan-space-card .purchase-card-stats>div,
.fan-space-card .purchase-card-description{
  background:rgba(4,25,36,.22) !important;
}
.fan-space-signature{
  border-top-color:rgba(255,255,255,.12) !important;
}
@media(max-width:600px){
  .purchase-card.has-owner-image .fan-space-owner-photo,
  .purchase-card.has-owner-image .fan-space-owner-photo img{
    height:155px !important;
    min-height:155px !important;
  }
}

/* =========================================================
   V65.22.7 — cornice oro sottile per separare la scheda
   ========================================================= */
.purchase-card.fan-space-card{
  border:2px solid #f2c94c !important;
  box-shadow:
    0 22px 65px rgba(0,0,0,.52),
    0 0 0 1px rgba(255,255,255,.035) inset,
    0 0 14px rgba(242,201,76,.20) !important;
}

@media(max-width:600px){.purchase-card.fan-space-card{position:fixed!important;inset:0!important;width:100vw!important;max-width:none!important;height:100dvh!important;max-height:100dvh!important;margin:0!important;border-radius:0!important;border:0!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:calc(18px + env(safe-area-inset-bottom))!important}.purchase-card.fan-space-card::before{content:"";position:sticky;display:block;top:0;z-index:6;height:4px;margin-bottom:-4px;background:#f2c94c}.fan-space-cover{height:104px!important;min-height:104px!important;padding:24px 22px 16px!important}.purchase-card.has-owner-image .fan-space-owner-photo,.purchase-card.has-owner-image .fan-space-owner-photo img{height:clamp(190px,31vh,270px)!important;min-height:190px!important}.fan-space-card .purchase-card-body{padding:22px 22px 28px!important}.fan-space-card h3{font-size:clamp(28px,8vw,38px)!important;line-height:1.08!important;margin-top:10px!important}.fan-space-card .purchase-card-owner{font-size:17px!important;margin-top:8px!important}.fan-space-card .purchase-card-stats{grid-template-columns:1fr!important;gap:10px!important;margin-top:24px!important}.fan-space-card .purchase-card-stats>div{min-height:76px!important;padding:14px 18px!important;border-radius:16px!important}.fan-space-message-label{margin-top:26px!important}.fan-space-card .purchase-card-description{padding:18px!important;font-size:17px!important;line-height:1.5!important;border-radius:16px!important}.fan-space-actions{margin-top:18px!important}.fan-space-actions>*{flex-basis:100%!important;min-height:58px!important}.fan-space-signature{margin-top:28px!important;padding-top:20px!important;padding-bottom:8px!important}.purchase-card-close{position:fixed!important;top:calc(14px + env(safe-area-inset-top))!important;right:16px!important;z-index:20!important;width:52px!important;height:52px!important;font-size:30px!important;border-radius:50%!important}}

/* =========================================================
   V65.22.9 — priorità mobile ai contenuti personali
   Ordine smartphone: nome -> messaggio -> dati tecnici.
   ========================================================= */
@media (max-width:600px){
  .fan-space-card .fan-space-message-label{
    margin-top:24px !important;
  }
  .fan-space-card .purchase-card-description{
    margin-bottom:8px !important;
  }
  .fan-space-card .purchase-card-stats{
    margin-top:28px !important;
  }
}

/* =========================================================
   V65.23.0 — personalizzazione reale dello spazio
   ========================================================= */
.fan-space-edit-button{
  min-height:44px;border:1px solid rgba(242,201,76,.55);border-radius:10px;
  background:rgba(242,201,76,.12);color:#ffe38b;font-weight:850;cursor:pointer;
}
.fan-space-edit-button:hover{background:rgba(242,201,76,.20)}
.personalization-note{
  padding:12px 14px;border-radius:12px;background:rgba(61,162,214,.08);
  border:1px solid rgba(91,183,231,.15);font-size:13px;line-height:1.45;color:rgba(235,247,255,.78);
}
.fan-personalization-form label>span:first-child{font-weight:800}
.edit-current-image{
  margin:8px 0 10px;padding:8px;border-radius:12px;background:rgba(5,28,41,.35);
  border:1px solid rgba(255,255,255,.08);
}
.edit-current-image img{
  display:block;width:100%;height:150px;object-fit:cover;border-radius:9px;background:#0b2230;
}
.edit-current-image small{display:block;margin-top:6px;color:rgba(235,247,255,.55)}
@media(max-width:600px){
  .edit-current-image img{height:190px}
  .fan-personalization-form .checkout-actions{position:sticky;bottom:0;padding-top:10px;background:linear-gradient(transparent,#0c1d2b 25%)}
}

/* V65.23.1 — respiro sotto l'ultimo comando della scheda */
.purchase-card.fan-space-card .purchase-card-body{
  padding-bottom:22px !important;
}
.purchase-card.fan-space-card #purchaseCardLink{
  margin-bottom:18px !important;
}
@media (max-width:600px){
  .purchase-card.fan-space-card .purchase-card-body{
    padding-bottom:calc(32px + env(safe-area-inset-bottom)) !important;
  }
  .purchase-card.fan-space-card #purchaseCardLink{
    margin-bottom:20px !important;
  }
}

/* V65.23.2 — correzione spaziatura ultimo link */
.purchase-card.fan-space-card #purchaseCardLink{
  margin-top:0 !important;
  margin-bottom:0 !important;
}
.purchase-card.fan-space-card .purchase-card-body{
  padding-bottom:22px !important;
}
@media (max-width:600px){
  .purchase-card.fan-space-card #purchaseCardLink{
    margin-top:0 !important;
    margin-bottom:0 !important;
  }
  .purchase-card.fan-space-card .purchase-card-body{
    padding-bottom:calc(24px + env(safe-area-inset-bottom)) !important;
  }
}

/* V65.24.0 — stato salvataggio/verifica più leggibile */
#editAreaSaveStatus[data-type="success"]{
  color:#bff5cf !important;
}
#editAreaSaveStatus[data-type="error"]{
  color:#ffd0d0 !important;
}
#editAreaSaveStatus[data-type="info"]{
  color:#a9ddff !important;
}

/* V65.26.4 — legenda stati pubblici */
.map-status-legend{
  position:absolute; left:18px; bottom:18px; z-index:12;
  display:flex; gap:12px; flex-wrap:wrap;
  padding:8px 10px; border-radius:10px;
  background:rgba(5,24,45,.86); border:1px solid rgba(255,255,255,.14);
  color:#fff; font-size:12px; line-height:1.25;
  backdrop-filter:blur(6px);
}
.map-status-legend span{display:flex;align-items:center;gap:5px}
.legend-swatch{width:11px;height:11px;border-radius:3px;display:inline-block;border:1px solid rgba(255,255,255,.55)}
.legend-swatch.is-reserved{background:rgba(255,190,52,.96)}
.legend-swatch.is-suspended{background:rgba(220,62,62,.96)}
@media (max-width:720px){
  .map-status-legend{left:10px;right:10px;bottom:10px;font-size:11px;gap:7px;padding:7px 8px}
}


/* =========================================================
   V65.26.5 — legenda impilata sopra "La tua selezione"
   ========================================================= */
.selection-panel .map-status-legend{
  position:absolute !important;
  left:0 !important;
  right:auto !important;
  bottom:calc(100% + 8px) !important;
  width:100% !important;
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:5px;
  padding:8px 10px;
  margin:0;
  border-radius:10px;
  background:rgba(5,24,45,.92);
  border:1px solid rgba(255,255,255,.14);
  color:#fff;
  font-size:11px;
  line-height:1.25;
  backdrop-filter:blur(6px);
  white-space:normal;
  pointer-events:none;
  z-index:1;
}
.selection-panel .map-status-legend span{
  width:100%;
  display:flex;
  align-items:center;
  gap:5px;
}
@media(max-width:720px){
  .selection-panel .map-status-legend{
    left:0 !important;
    right:auto !important;
    bottom:calc(100% + 7px) !important;
    width:100% !important;
    padding:7px 9px;
    gap:5px;
    font-size:10px;
  }
}


/* V65.26.6 — indicatore legenda per area acquistata.
   Il colore reale delle celle acquistate resta il colore originale della zona,
   semplicemente più scuro. */
.legend-swatch.is-purchased{
  background:rgba(70,86,101,.96);
}
.site-footer {
  margin-top: 0;
  padding: 6px 12px;
  text-align: center;
  font-size: 10px;
  line-height: 1.25;
  color: rgba(255,255,255,.65);
}
.site-footer p {
  margin: 0 auto;
  max-width: 900px;
}
/* =========================================================
   TEST-18 — contrasto claim e comandi (solo grafica)
   Nessuna modifica a mappa, prezzi, Supabase o Stripe.
   ========================================================= */

/* Sposta / Seleziona: contorno più netto su tutti i dispositivi. */
.mode-btn{
  border:2px solid rgba(232,244,252,.82) !important;
  box-shadow:0 7px 20px rgba(0,0,0,.28), 0 0 0 1px rgba(4,20,34,.72) !important;
}
.mode-btn.active{
  border-color:rgba(255,255,255,.96) !important;
  box-shadow:0 8px 22px rgba(0,0,0,.32), 0 0 0 1px rgba(4,20,34,.78) !important;
}

/* Desktop/tablet largo: il cartello oro resta oro ma viene separato
   visivamente dalle Hospitality con un bordo blu scuro più deciso. */
@media (min-width:761px){
  .community-message{
    border:3px solid rgba(5,31,50,.96) !important;
    box-shadow:0 9px 28px rgba(0,0,0,.34), 0 0 0 1px rgba(255,238,174,.70) inset !important;
  }
}

/* Smartphone/tablet responsive: più contrasto per il claim sulla foto. */
@media (max-width:1100px){
  .mobile-stadium-hero{
    background:
      linear-gradient(90deg,rgba(2,12,22,.88) 0%,rgba(2,12,22,.66) 48%,rgba(2,12,22,.18) 100%),
      linear-gradient(180deg,rgba(3,12,21,.12),rgba(3,12,21,.66)),
      url("assets/sinigaglia-background.jpg") center 46% / cover no-repeat !important;
  }
  .mobile-stadium-hero strong{
    color:#f2c94c !important;
    font-weight:950 !important;
    text-shadow:0 2px 3px rgba(0,0,0,.95),0 0 14px rgba(0,0,0,.72) !important;
  }
  .mobile-stadium-hero span{
    color:#fff !important;
    font-weight:650 !important;
    text-shadow:0 2px 8px rgba(0,0,0,.92) !important;
  }
}

/* =========================================================
   TEST-19 — ispettore cella desktop più verticale e compatto
   Solo grafica: nessuna modifica a mappa, prezzi, Supabase o Stripe.
   ========================================================= */
@media (min-width:761px){
  .cell-inspector{
    width:178px !important;
    max-width:178px !important;
    padding:12px 13px !important;
    border-radius:13px !important;
  }
  .cell-inspector > div{
    display:flex !important;
    flex-direction:column !important;
    align-items:flex-start !important;
    gap:2px !important;
    padding:7px 0 !important;
    border-bottom:1px solid rgba(255,255,255,.08);
  }
  .cell-inspector > div:last-child{
    border-bottom:0;
  }
  .cell-inspector span{
    font-size:10px !important;
    line-height:1.15 !important;
    text-transform:uppercase;
    letter-spacing:.08em;
  }
  .cell-inspector strong{
    width:100% !important;
    max-width:100% !important;
    text-align:left !important;
    font-size:12px !important;
    line-height:1.28 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  .cell-inspector > div:last-child strong{
    font-size:13px !important;
    font-weight:850 !important;
    color:#fff !important;
  }
}


/* =========================================================
   TEST-20 — claim integrato nell'header SOLO desktop largo
   Nessuna modifica a mappa, prezzi, Supabase o Stripe.
   Tablet e smartphone mantengono il layout del TEST-19.
   ========================================================= */
.desktop-header-claim{display:none;}

@media (min-width:1101px){
  .topbar{
    min-height:88px !important;
    padding:10px 18px !important;
    gap:14px !important;
  }
  .brand{
    min-width:205px !important;
    flex:0 0 auto !important;
  }
  .brand-mark{
    width:62px !important;
    height:62px !important;
    border-radius:14px !important;
  }
  .brand strong{
    font-size:17px !important;
  }
  /* Il piccolo slogan bianco accanto al logo viene tolto solo su PC. */
  .brand > span{
    display:none !important;
  }
  .desktop-header-claim{
    display:flex;
    flex:1 1 auto;
    min-width:300px;
    max-width:650px;
    margin:0 auto;
    padding:3px 14px;
    flex-direction:column;
    justify-content:center;
    text-align:center;
    line-height:1.18;
    color:#f2c94c;
    text-shadow:0 2px 3px rgba(0,0,0,.78);
  }
  .desktop-header-claim strong{
    display:block;
    font-size:18px;
    font-weight:950;
    letter-spacing:.1px;
  }
  .desktop-header-claim span{
    display:block;
    margin-top:5px;
    font-size:13px;
    font-weight:750;
    color:#f4d56c;
  }
  /* Il vecchio cartello oro sulla mappa non serve più su PC. */
  .community-message{
    display:none !important;
  }
}

/* =========================================================
   TEST-21 — rifiniture header desktop
   - IT/EN a sinistra del claim
   - claim in cornice oro con distacco scuro
   - istruzioni drag/zoom più vicine
   Solo grafica desktop.
   ========================================================= */
@media (min-width:1101px){
  .topbar{display:flex !important;}
  .brand{order:1;}
  .language-switch{
    order:2;
    flex:0 0 auto !important;
    margin-left:2px !important;
    margin-right:0 !important;
  }
  .desktop-header-claim{
    order:3;
    flex:1 1 auto;
    max-width:650px;
    margin:0 auto 0 0 !important;
    padding:9px 18px !important;
    border:2px solid #d5ad43;
    border-radius:12px;
    background:rgba(4,25,43,.34);
    box-shadow:0 0 0 2px rgba(1,10,18,.78),0 7px 18px rgba(0,0,0,.24),inset 0 0 0 1px rgba(255,235,164,.15);
  }
  #backendStatusBtn{order:4;}
  #accountBtn{order:5;}
  #myAreasBtn{order:6;}
  #adminBtn{order:7;}
  .stats{order:8;}

  .map-help{
    column-gap:7px !important;
  }
  .map-help span:nth-child(1){
    margin-right:0 !important;
  }
  .map-help span:nth-child(2){
    margin-left:0 !important;
    margin-right:14px !important;
  }
}

/* =========================================================
   TEST-21.1 — avvicina le due istruzioni drag / zoom su PC
   Unica modifica rispetto al TEST-21.
   ========================================================= */
@media (min-width:1101px){
  .map-help{
    gap:0 !important;
    column-gap:0 !important;
  }
  .map-help span:nth-child(1){
    margin-right:3px !important;
  }
  .map-help span:nth-child(2){
    margin-left:0 !important;
    margin-right:14px !important;
  }
}

/* =========================================================
   TEST-21.2 — FIX REALE posizione istruzioni desktop
   Le prime due istruzioni vengono gestite in flex, affiancate.
   ========================================================= */
@media (min-width:1101px){
  .map-help{
    display:flex !important;
    flex-wrap:wrap !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:4px !important;
    column-gap:4px !important;
    row-gap:6px !important;
    max-width:520px !important;
  }
  .map-help span:nth-child(1),
  .map-help span:nth-child(2){
    flex:0 0 auto !important;
    width:auto !important;
    max-width:none !important;
    margin:0 !important;
  }
  .map-help span:nth-child(3){
    flex:0 0 100% !important;
    width:max-content !important;
    max-width:max-content !important;
    margin:0 !important;
  }
}

/* =========================================================
   TEST-21.3 — istruzioni desktop su due righe
   Riga 1: Trascina per muovere + Rotellina / pinch per zoom
   Riga 2: Usa “Seleziona” per scegliere il tuo spazio
   ========================================================= */
@media (min-width:1101px){
  .map-help{
    width:330px !important;
    max-width:330px !important;
    display:flex !important;
    flex-wrap:wrap !important;
    column-gap:4px !important;
    row-gap:6px !important;
  }
  .map-help span:nth-child(1),
  .map-help span:nth-child(2),
  .map-help span:nth-child(3){
    flex:0 0 auto !important;
    width:auto !important;
    max-width:none !important;
    margin:0 !important;
  }
  .map-help span:nth-child(3){
    margin-right:80px !important;
  }
}

/* =========================================================
   TEST-22 — Il mio account
   ========================================================= */
.account-profile-form,.account-password-form{margin-top:16px;padding-top:15px;border-top:1px solid rgba(255,255,255,.12)}
.account-avatar-editor{display:flex;align-items:center;gap:13px;padding:10px 0 4px}
.account-avatar-preview{
  flex:0 0 120px;
  width:120px;
  height:120px;
  overflow:hidden;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  border-radius:50%;
}
.account-avatar-preview.has-photo{font-size:0}
.account-avatar-copy{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}
.account-avatar-copy strong{font-size:13px}
.account-avatar-copy span{font-size:11px;opacity:.62}
.account-avatar-copy input[type=file]{max-width:100%;font-size:11px}
#accountEmail[readonly]{opacity:.72;cursor:not-allowed}
.account-logout-actions{margin-top:16px;padding-top:14px;border-top:1px solid rgba(255,255,255,.12)}
@media(max-width:600px){.account-avatar-editor{align-items:flex-start}.auth-modal{max-height:88vh;overflow:auto}}
.auth-avatar.has-photo{font-size:0;background-size:cover;background-position:center;background-repeat:no-repeat}

/* TEST-22.1 — gestione selezione foto profilo */
.account-avatar-clear{align-self:flex-start;margin-top:2px;padding:5px 9px;border:1px solid rgba(255,255,255,.22);border-radius:8px;background:rgba(255,255,255,.06);color:inherit;font:inherit;font-size:11px;cursor:pointer}
.account-avatar-clear:hover{background:rgba(255,255,255,.11)}
.password-field-wrap{
  position:relative;
}
