:root{
  --bg:#0b0b0f;
  --panel:rgba(255,255,255,.06);
  --panel2:rgba(255,255,255,.10);
  --text:#eaeaea;
  --muted:rgba(234,234,234,.82);
  --border:rgba(255,255,255,.12);
  --shadow:0 18px 60px rgba(0,0,0,.55);
  --radius:18px;
}

*{ box-sizing:border-box; }

html, body { height: 100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% 0%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(900px 600px at 80% 20%, rgba(255,255,255,.05), transparent 60%),
    var(--bg);
  color:var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:48px 22px;
}

h1{
  margin:0 0 10px 0;
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing:1px;
}

h2{
  margin:26px 0 14px;
  font-size: clamp(22px, 3.2vw, 32px);
}

.sub{
  margin:0 0 18px 0;
  color:var(--muted);
}

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

input{
  width:min(340px, 100%);
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.28);
  color:#fff;
  outline:none;
}

button{
  padding:12px 16px;
  border-radius:12px;
  border:0;
  background:#fff;
  color:#000;
  font-weight:800;
  cursor:pointer;
}

button:disabled{ opacity:.6; cursor:not-allowed; }

.status{ margin-top:14px; }

/* Top actions (indietro + esci) */
.top-actions{
  display:flex;
  gap:12px;
  align-items:center;
  margin: 14px 0 18px;
  flex-wrap:wrap;
}

.btn-ghost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.08);
  color:#fff;
  text-decoration:none;
  font-weight:800;
  -webkit-tap-highlight-color: transparent;
}

/* ✅ per photos.html (btn-lite) */
.btn-lite{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.08);
  color:#fff;
  text-decoration:none;
  font-weight:800;
  -webkit-tap-highlight-color: transparent;
}

/* HUB */
.hub{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:14px;
  margin-top:18px;
}

.hub-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  height:84px;
  border-radius:16px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  color:#fff;
  font-weight:900;
  text-decoration:none;
  letter-spacing:.3px;
  box-shadow: var(--shadow);
  transition: transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.hub-btn:hover{ transform: translateY(-1px); }

/* GRID THUMBNAILS */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap:14px;
  margin-top:12px;
  align-items:start; /* evita “salti” mentre carica su Safari */
}

.card{
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
  position:relative; /* ✅ serve per il watermark */
}

/* Thumb: stabile e iOS-friendly */
.thumb{
  width:100%;
  aspect-ratio: 1 / 1;   /* quadrata */
  object-fit: cover;     /* non deforma */
  display:block;
  cursor:pointer;
  background: rgba(0,0,0,.35); /* placeholder */
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;  /* riduce menu long-press su iOS */
  -webkit-tap-highlight-color: transparent; /* niente flash blu */
}

.card .cap{
  padding:10px 12px;
  font-size:14px;
  color:var(--muted);
}

/* VIDEO THUMB */
.vip-video{
  width:100%;
  aspect-ratio: 1 / 1;     /* griglia coerente con foto */
  object-fit: cover;
  display:block;
  background:#000;
  cursor:pointer;
}

/* LOGOUT */
.logout{
  background: rgba(255,255,255,.08);
  border:1px solid var(--border);
  color:#fff;
  -webkit-tap-highlight-color: transparent;
}

/* MODAL */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  background: rgba(0,0,0,.72);
  z-index:9999;
}

.modal.open{ display:flex; }

.modal-content{
  width: min(980px, 96vw);
  max-height:86vh;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.18);
  box-shadow: 0 30px 120px rgba(0,0,0,.8);
  background:#000;
}

/* wrapper per watermark in modal */
.modal-wrap{
  position:relative;
}

/* Immagine/video in modal sempre contenuti bene */
.modal-content img,
.modal-content video{
  width:100%;
  height:100%;
  max-height:86vh;
  object-fit: contain;
  display:block;
  background:#000;
}

.modal-close{
  position:absolute;
  top:14px;
  right:14px;
  border:0;
  border-radius:999px;
  width:44px;
  height:44px;
  font-size:22px;
  background: rgba(255,255,255,.14);
  color:#fff;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ===== WATERMARK ===== */
.wm{
  position:absolute;
  top:10px;
  right:10px;
  padding:6px 8px;

  font-size:11px;
  line-height:1.25;
  letter-spacing:.2px;

  border-radius:12px;
  background: rgba(0,0,0,.38);
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.86);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  pointer-events:none;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;

  white-space: pre-line; /* ✅ fa andare a capo il testo con \n */

  opacity:.85;
}

/* watermark nella MODAL (più visibile) */
.wm--modal{
  top:14px;
  right:14px;
  font-size:12px;
  opacity:.92;
  background: rgba(0,0,0,.48);
}

/* piccolo miglioramento: se schermo stretto */
@media (max-width:560px){
  .hub{ grid-template-columns:1fr; }
  .wrap{ padding:34px 16px; }
}
