:root {
  --accent: #7ED321;
  --accent-dark: #5FA716;
  --bg: #0a0a0a;
  --surface: rgba(255,255,255,0.07);
  --surface-2: rgba(255,255,255,0.12);
  --text: #FFFFFF;
  --text-2: rgba(235, 235, 245, 0.55);
  --separator: rgba(255,255,255,0.1);
  --on-accent: #0a0a0a;

  --glass-bg: rgba(255,255,255,0.08);
  --glass-bg-strong: rgba(255,255,255,0.13);
  --glass-border: rgba(255,255,255,0.18);
  --glass-specular: rgba(255,255,255,0.35);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --glass-blur: blur(40px) saturate(200%);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #e8e8ed;
    --surface: rgba(255,255,255,0.55);
    --surface-2: rgba(255,255,255,0.75);
    --text: #000000;
    --text-2: rgba(60, 60, 67, 0.6);
    --separator: rgba(0,0,0,0.1);
    --on-accent: #fff;

    --glass-bg: rgba(255,255,255,0.45);
    --glass-bg-strong: rgba(255,255,255,0.65);
    --glass-border: rgba(255,255,255,0.8);
    --glass-specular: rgba(255,255,255,0.9);
    --glass-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    --glass-blur: blur(40px) saturate(180%);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
  /* Gradiente di sfondo profondo */
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(126,211,33,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(0,122,255,0.06) 0%, transparent 50%);
  min-height: 100dvh;
}

/* ── Header ─────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 12px;
}
.logo { width: 40px; height: 40px; border-radius: 9px; }
.app-header h1 { font-size: 22px; font-weight: 700; margin: 0; }

/* ── View / Layout ───────────────────────────────── */
.view { padding: 0 16px; max-width: 480px; margin: 0 auto; }
.view.tab-enter { animation: tabEnter 0.22s ease; }
@keyframes tabEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.subtitle { color: var(--text-2); font-size: 15px; margin: 4px 0 12px; }
.section-title { font-size: 28px; font-weight: 700; margin: 8px 0 16px; }
.wall-title { font-size: 20px; font-weight: 600; margin: 14px 0 10px; }

/* ── Phone frame ─────────────────────────────────── */
.phone-frame {
  position: relative;
  aspect-ratio: 9 / 19.5;
  max-height: 68vh;
  margin: 0 auto;
  border-radius: 44px;
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.6),
    0 0 0 1px var(--glass-border),
    inset 0 1px 0 var(--glass-specular);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.phone-frame:active {
  transform: scale(0.985);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--glass-border);
}
.phone-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--text-2);
  font-size: 17px;
  padding: 20px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  border: none;
  border-radius: 18px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow:
    0 4px 20px rgba(126,211,33,0.35),
    inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:active {
  box-shadow: 0 2px 10px rgba(126,211,33,0.2), inset 0 1px 0 rgba(255,255,255,0.25);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--accent);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-specular);
}

.hint { color: var(--text-2); font-size: 13px; line-height: 1.45; }

/* ── Cards (Liquid Glass) ────────────────────────── */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-specular);
  position: relative;
}
.card h2 { font-size: 17px; margin: 0 0 12px; }

/* ── Suggestion form ────────────────────────────── */
#suggest-form { display: flex; gap: 8px; }
#suggest-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 16px;
}
#suggest-form input::placeholder { color: var(--text-2); }
#suggest-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126,211,33,0.2);
}
#suggest-form .btn { width: auto; margin: 0; padding: 12px 18px; }

/* ── Suggestions list ───────────────────────────── */
.suggestions { list-style: none; margin: 14px 0 0; padding: 0; }
.suggestions li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  border-top: 1px solid var(--separator);
  font-size: 16px;
}
.vote-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  box-shadow: inset 0 1px 0 var(--glass-specular);
}
.vote-btn:active { transform: scale(0.94); }
.vote-btn.voted {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(126,211,33,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ── Gallery ─────────────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.gallery button {
  position: relative;
  border: none;
  padding: 0;
  background: var(--glass-bg);
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 9 / 19.5;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px var(--glass-border);
}
.gallery button:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  letter-spacing: 0.01em;
}

/* ── Overlay (feed verticale snap) ──────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
}
.overlay.opening { animation: overlayIn 0.22s ease; }
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.overlay-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.12s ease;
}
.overlay-close:active { transform: scale(0.9); }

.overlay-counter {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 14px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 55;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  white-space: nowrap;
}

/* Feed a scorrimento verticale */
.overlay-feed {
  position: absolute;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.overlay-feed::-webkit-scrollbar { display: none; }

/* Ogni slide = uno schermo intero */
.feed-slide {
  height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.feed-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Nessun blocco al long press — su iOS serve per "Salva nella Libreria Foto" */
}

/* Info bar sovrapposta in basso */
.feed-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 56px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.78) 55%);
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.feed-info-text { flex: 1; min-width: 0; }
.feed-info-text .wall-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
.feed-info-text .subtitle {
  margin: 0 0 8px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}
.feed-stats {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
}
.feed-stat { display: flex; align-items: center; gap: 4px; }

/* Azioni destra: like + download verticali */
.feed-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.feed-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 54px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.12s ease, background 0.15s ease;
  text-decoration: none;
}
.feed-action-btn:active { transform: scale(0.88); }
.feed-action-btn.liked {
  background: rgba(255,45,85,0.7);
  border-color: rgba(255,45,85,0.5);
}
.feed-action-icon { font-size: 24px; line-height: 1; }
.feed-action-hint { cursor: default; font-size: 11px; width: 60px; }

/* ── Tab bar (Liquid Glass pill) ─────────────────── */
.tabbar {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  padding: 5px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-specular),
    inset 0 -1px 0 rgba(0,0,0,0.1);
  z-index: 40;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 28px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.12s ease;
  letter-spacing: 0.01em;
}
.tab:active { transform: scale(0.93); }
.tab.active {
  color: var(--text);
  background: var(--glass-bg-strong);
  box-shadow:
    0 2px 12px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.1);
}
.tab-icon { font-size: 20px; }

/* ── Notify bottom sheet ─────────────────────────── */
.notify-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.notify-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 61;
  padding: 0 12px calc(16px + env(safe-area-inset-bottom));
  animation: sheetUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sheetUp {
  from { transform: translateY(110%); }
  to   { transform: translateY(0); }
}

.notify-sheet-inner {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 28px 20px 20px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-specular);
  text-align: center;
}
.notify-sheet-icon { font-size: 44px; margin-bottom: 12px; }
.notify-sheet-title { font-size: 20px; font-weight: 700; margin: 0 0 10px; }
.notify-sheet-body  { font-size: 15px; color: var(--text-2); margin: 0 0 20px; line-height: 1.5; }

/* ── Admin mode tabs ─────────────────────────────── */
.mode-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-tab-active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(126,211,33,0.3);
}

.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--glass-border);
  border-radius: 18px;
  background: var(--glass-bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 4px;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(126,211,33,0.08);
}
.drop-zone-icon { font-size: 36px; }
.drop-zone-text { font-size: 15px; color: var(--text-2); line-height: 1.5; }
.drop-zone-text small { font-size: 13px; }
/* Input invisibile ma coprente — il click sulla drop-zone apre il file picker */
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.bulk-preview { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.bulk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}
.bulk-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.bulk-item-info { flex: 1; min-width: 0; }
.bulk-item-date { font-weight: 700; font-size: 13px; color: var(--accent); }
.bulk-item-name { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-item input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg-strong);
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}
.bulk-item input:focus { outline: 2px solid var(--accent); }

/* ── Admin forms ─────────────────────────────────── */
#login-form, #publish-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input, #publish-form input {
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 16px;
}
#login-form input::placeholder, #publish-form input::placeholder { color: var(--text-2); }
#publish-form input[type="file"] { padding: 10px; }
#login-form input:focus, #publish-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126,211,33,0.2);
}
#login-form .btn, #publish-form .btn { margin: 4px 0 0; }
