/* Palette delicata ma festosa */
:root {
  --bg: #05040a;
  --bg-elevated: #0e0c18;
  --bg-soft: #151226;
  --accent: #ff6fb5;
  --accent-soft: rgba(255, 111, 181, 0.15);
  --accent-strong: #ff9f9f;
  --text: #fdf8ff;
  --text-soft: #b8b0c7;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --error: #ff4b6f;
  --success: #4fd18b;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #23153f 0, #05040a 40%, #f490de79 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  position: relative;
  overflow-x: hidden;
}

/* Pagine galleria (classe su html da app.js): limita pull-to-refresh / bounce che su mobile sembrano ricariche */
html.gallery-scroll-reduce,
html.gallery-scroll-reduce body.page-gallery {
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background-image: url("/assets/logo-cloe-18.png");
  background-repeat: repeat;
  background-size: 260px auto;
  opacity: 0.05;
  transform: rotate(-30deg);
  transform-origin: center;
  pointer-events: none;
  z-index: -1;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero-banner {
  position: relative;
  max-width: 1200px;
  margin: 14px auto 4px;
  padding: 16px 18px;
  border-radius: 28px;
  background: radial-gradient(circle at top left, rgba(255, 111, 181, 0.16), transparent 50%),
    radial-gradient(circle at bottom right, rgba(111, 164, 255, 0.18), transparent 55%),
    rgba(9, 7, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 55px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-text h1 {
  font-size: 26px;
  margin: 6px 0 4px;
}

.hero-text p {
  margin: 0;
  font-size: 16px;
  color: var(--text-soft);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(5, 4, 10, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-badge::after {
  content: "♥";
  font-size: 13px;
  color: var(--accent-strong);
  animation: pulse-heart 1.4s ease-in-out infinite;
}

.hero-countdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.hero-countdown-label {
  font-size: 12px;
  color: var(--text-soft);
}

.hero-countdown-values {
  display: flex;
  gap: 6px;
}

.count-box {
  min-width: 60px;
  padding: 6px 8px;
  border-radius: 16px;
  background: rgba(5, 4, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.count-box strong {
  display: block;
  font-size: 17px;
}

.count-box small {
  font-size: 11px;
  color: var(--text-soft);
}

.hero-countdown-sub {
  font-size: 12px;
  color: var(--text-soft);
}

.hero-confetti {
  position: absolute;
  inset: -20%;
  background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.22) 0, transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(255, 111, 181, 0.18) 0, transparent 55%),
    radial-gradient(circle at 40% 80%, rgba(111, 164, 255, 0.2) 0, transparent 60%);
  opacity: 0.35;
  mix-blend-mode: screen;
  pointer-events: none;
}

.hero-confetti-left {
  animation: floatConfetti 26s linear infinite;
}

.hero-confetti-right {
  animation: floatConfetti 26s linear infinite reverse;
}

.invite-strip {
  display: none;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgb(67 14 30);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  display: flex;
  align-items: center;
}

.logo-image {
  height: 60px;
  width: auto;
  display: block;
}

.top-message {
  flex: 1;
  text-align: center;
  font-size: 16px;
  color: var(--text-soft);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-soft);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at top left, rgba(255, 111, 181, 0.4), #150817);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-circle.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.menu-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0;
  cursor: pointer;
  gap: 3px;
}

.menu-toggle span {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: var(--text-soft);
}

.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 850px);
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto 24px;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-card,
.upload-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(30, 22, 54, 0.85));
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
}

.upload-card {
  position: relative;
}

.public-upload-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(5, 4, 10, 0.78);
  border-radius: inherit;
  font-size: 13px;
  color: var(--text-soft);
  pointer-events: none;
}

.public-upload-overlay[hidden] {
  display: none !important;
}

.public-upload-overlay img {
  width: 48px;
  height: auto;
}

.private-message-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(30, 10, 40, 0.9));
  border-radius: var(--radius-lg);
  padding: 16px 18px 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
}

.private-message-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.profile-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(30, 10, 40, 0.9));
  border-radius: var(--radius-lg);
  padding: 14px 18px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.profile-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.profile-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
}

.profile-content {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at top left, rgba(255, 111, 181, 0.4), #150817);
  border: 2px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-placeholder {
  font-size: 26px;
  color: var(--text);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-form .btn {
  font-size: 13px;
}

.info-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(30, 10, 40, 0.9));
  border-radius: var(--radius-lg);
  padding: 14px 18px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.info-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.info-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
}

.info-image-wrapper {
  margin-top: 8px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.info-image {
  display: block;
  width: 100%;
  height: auto;
}

.welcome-card h1 {
  font-size: 26px;
  margin: 0 0 8px;
}

.welcome-card p {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 16px;
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.name-form label {
  font-size: 13px;
  color: var(--text-soft);
}

input[type="text"],input[type="password"],
input[type="file"],
textarea {
  font-family: inherit;
}

input[type="text"],input[type="password"],
.comment-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]::placeholder,input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
span.refresh-label {
  font-size: 14px;
}

input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 111, 181, 0.3);
  background: rgba(0, 0, 0, 0.55);
}

.btn {
  border: none;
  border-radius: 10px !important;
  padding: 8px 16px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease,
    color 0.15s ease, border-color 0.15s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #05040a;
  box-shadow: 0 10px 30px rgba(255, 111, 181, 0.4);
}

.btn.ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-subtle);
}

.btn.full-width {
  width: 100%;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

img.side-menu-logo-fh {
  width: 100%;
}

.upload-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.upload-subtitle {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--text-soft);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.private-message-card textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 180px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgb(181 179 179 / 53%);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-size: 14px;
}

.private-message-card textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.file-input-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-soft);
  font-size: 20px;
  cursor: pointer;
}

.file-input-label.has-selection {
  background: rgba(255, 111, 181, 0.16);
  border-style: solid;
  border-color: var(--accent-strong);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 111, 181, 0.5);
}

.file-input-label.has-selection::after {
  content: "✔ Hai selezionato file, ora premi “Carica per Cloe”.";
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent-strong);
}

.upload-form .file-input-label.has-selection ~ .btn.primary.full-width {
  animation: pulse-upload 0.9s ease-in-out infinite;
  box-shadow: 0 0 20px 4px rgba(255, 111, 181, 0.9);
  transform: scale(1.03);
}

.file-input-hint {
  font-size: 12px;
  opacity: 0.8;
}

input[type="file"] {
  display: none;
}

.upload-note {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-soft);
}

@keyframes pulse-upload {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(255, 111, 181, 0.6);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 12px 2px rgba(255, 111, 181, 0.9);
  }
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(255, 111, 181, 0.6);
  }
}

.feed-panel {
  background: rgba(6, 5, 14, 0.9);
  border-radius: var(--radius-lg);
  padding: 14px 16px 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.feed-panel[hidden],
.private-message-card[hidden],
.profile-card[hidden] {
  display: none !important;
}

.gallery-section {
  background: rgba(6, 5, 14, 0.9);
  border-radius: var(--radius-lg);
  padding: 14px 16px 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-height: 120px;
  margin-top: 22px;
}

.gallery-section[hidden] {
  display: none !important;
}

.gallery-section .feed-header {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 12px;
}

.gallery-section .feed-header h2 {
  flex: 1 1 100%;
}

.gallery-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-soft);
  max-width: 640px;
}

.gallery-empty {
  min-height: 72px;
}

.gallery-empty code {
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.gallery-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin: 12px 0 4px;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-soft, rgba(255, 255, 255, 0.55));
}

.gallery-footer[hidden] {
  display: none !important;
}

/* :not([hidden]) evita che display:flex annulli l'attributo hidden del browser */
.gallery-footer .gallery-status-loading:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gallery-footer-spinner {
  width: 22px;
  height: 22px;
  border-width: 3px;
  flex-shrink: 0;
}

.gallery-footer .gallery-status-more,
.gallery-footer .gallery-status-end {
  margin: 0;
  line-height: 1.35;
  max-width: 22rem;
}

.gallery-footer .gallery-status-more {
  color: var(--accent-strong, #ff6fb5);
  opacity: 0.95;
}

.gallery-footer .gallery-status-error {
  margin: 0;
  line-height: 1.35;
  max-width: 22rem;
  color: var(--error, #ff4b6f);
  font-size: 12px;
}

.gallery-sentinel {
  height: 8px;
  margin: 16px 0 8px;
}

.side-menu-galleries {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-menu-galleries[hidden] {
  display: none !important;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.feed-header h2 {
  margin: 0;
  font-size: 18px;
}

.feed-layout-toggle {
  display: none;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
}

.layout-btn {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-soft);
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}

.layout-btn.active {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: rgba(255, 111, 181, 0.1);
}

.refresh-button {
  gap: 6px;
}

.refresh-progress {
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
}

.refresh-bg,
.refresh-fg {
  fill: none;
  stroke-width: 3;
}

.refresh-bg {
  stroke: rgba(255, 255, 255, 0.16);
}

.refresh-fg {
  stroke: var(--accent-strong);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

.empty-feed {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  padding: 26px 12px;
}

/* .empty-feed imposta display:flex e maschera l’attributo HTML hidden */
.empty-feed[hidden],
.gallery-empty[hidden] {
  display: none !important;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.feed-item {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--bg-soft);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.feed-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 111, 181, 0.4);
}

.feed-thumb-slot {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
}

/* Galleria foto: numero progressivo (allineato alla modale) */
.feed-item-index {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.4);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  user-select: none;
}

.feed-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

/* Galleria / board video: anteprima immagine (server o IndexedDB dopo modale); niente download del file in griglia */
.feed-thumb-wrap {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #141414;
}

.feed-thumb-wrap .feed-thumb {
  position: relative;
  z-index: 1;
  height: 100%;
}

.feed-thumb-wrap video.gallery-video-poster-source {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

/* Spinner anteprima (sopra overlay info durante il caricamento) */
.thumb-loading-spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent-strong, #ff6fb5);
  border-radius: 50%;
  animation: cloe-thumb-spin 0.7s linear infinite;
}

.thumb-loading-spinner--large {
  width: 42px;
  height: 42px;
  border-width: 4px;
}

@keyframes cloe-thumb-spin {
  to {
    transform: rotate(360deg);
  }
}

.feed-item > .thumb-loading-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.feed-item > .thumb-loading-layer.thumb-loading-layer--video {
  flex-direction: column;
  gap: 10px;
  background: rgba(8, 6, 14, 0.78);
  backdrop-filter: blur(8px);
}

.feed-item > .thumb-loading-layer.thumb-loading-layer--video-pending .thumb-loading-spinner {
  opacity: 0.9;
}

.thumb-loading-label {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  max-width: 12rem;
  padding: 0 10px;
}

.thumb-loading-label--hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.feed-item > .thumb-loading-layer.thumb-loading-layer--done {
  opacity: 0;
}

.modal-media-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 4, 10, 0.5);
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.modal-media-loading--with-hint {
  flex-direction: column;
  gap: 14px;
}

.modal-media-loading-hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  max-width: 16rem;
  padding: 0 12px;
  line-height: 1.35;
}

.modal-media-loading.modal-media-loading--done {
  opacity: 0;
}

/* Sopra thumb e video: like, commenti, nome (non coperti dalla miniatura galleria video) */
.feed-item > .feed-overlay {
  z-index: 2;
  pointer-events: none;
}

.feed-item > .feed-overlay * {
  pointer-events: auto;
}

/* Galleria foto SSR: l’overlay deve ricevere il tap (altrimenti il gradiente con pointer-events:none non consegna bene il click su alcuni mobile). */
#gallery-feed-foto .feed-item > .feed-overlay {
  pointer-events: auto;
}

.feed-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent 55%);
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-soft);
}

.feed-uploader-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 70%;
}

.feed-uploader {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-likes {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.feed-likes .heart {
  color: var(--accent-strong);
  font-size: 20px !important;
}
.feed-comments {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-soft);
  opacity: 0.9;
}

.feed-comments-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  color: #fff !important;
  filter: invert(1);
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  max-width: 80vw;
  height: 100vh;
  background: rgba(5, 4, 10, 0.98);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.85);
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  box-sizing: border-box;
  overflow-x: hidden;
  min-height: 0;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.side-menu-title {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 42px;
}
.side-menu-close {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 22px;
  cursor: pointer;
  position: absolute;
  right: 15px;
  top: 13px;
}

.side-menu-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
}

.side-menu-text {
  margin: 0 0 4px;
}

.side-menu-logo {
  height:110px;
  width: auto;
  display: block;
}

.side-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 500;
}

.side-menu-link::before {
  content: "→";
  font-size: 11px;
}

.side-menu-reset {
  margin-top: 8px;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.status-message {
  margin-top: 6px;
  font-size: 12px;
  min-height: 16px;
}

.status-message.error {
  color: var(--error);
}

.status-message.success {
  color: var(--success);
}

.toast {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: rgba(96, 23, 94, 0.78);
  backdrop-filter: blur(4px);
  font-size: 24px;
  line-height: 1.4;
  color: var(--text);
  z-index: 60;
}

.audio-player {
  max-width: 1200px;
  margin: 14px auto 4px;
  padding: 0;
}

span#audio-title {
  margin-top: 10px;
}

.audio-player-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: radial-gradient(circle at top left, rgba(255, 111, 181, 0.16), transparent 50%),
    radial-gradient(circle at bottom right, rgba(111, 164, 255, 0.18), transparent 55%),
    rgba(9, 7, 24, 0.9);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 18px;
  box-shadow: 0 26px 55px rgba(0, 0, 0, 0.7);
}

.audio-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audio-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.audio-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.audio-player audio {
  width: 100%;
}

.audio-player audio::-webkit-media-controls-panel {
  background: transparent;
}

.audio-player audio::-webkit-media-controls-play-button,
.audio-player audio::-webkit-media-controls-timeline,
.audio-player audio::-webkit-media-controls-volume-slider {
  filter: hue-rotate(320deg) saturate(1.4);
}

.site-footer {
  padding: 10px 18px 16px;
  text-align: center;
  font-size: 11px;
  color: #333;
  opacity: 0.85;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

.dialog-overlay[hidden] {
  display: none !important;
}

.dialog-card {
  background: rgba(6, 5, 14, 0.98);
  border-radius: 24px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.85);
  max-width: 360px;
  width: calc(100% - 40px);
  position: relative;
}

.dialog-card-loading {
  text-align: center;
  padding-top: 26px;
  padding-bottom: 20px;
}

.dialog-loader-gif {
  display: block;
  width: 96px;
  height: auto;
  margin: 0 auto 10px;
  border-radius: 999px;
  box-shadow: 0 0 25px rgba(255, 111, 181, 0.6);
}

.dialog-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.dialog-text {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--text-soft);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal[hidden] {
  display: none !important;
}

/* Modale media (mobile): niente zoom da doppio tap / pinch; i commenti restano scrollabili */
#media-modal .modal-media,
#media-modal .modal-media-loading,
#media-modal .modal-media img,
#media-modal .modal-media video,
#media-modal .modal-nav,
#media-modal .modal-close,
#media-modal .modal-media-index {
  touch-action: manipulation;
}

#media-modal .modal-media img,
#media-modal .modal-media video {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#media-modal .modal-info {
  touch-action: pan-y;
}

html.modal-media-open {
  overflow: hidden;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

.modal-content {
  position: relative;
  display: flex;
  gap: 16px;
  width: min(900px, 96vw);
  max-height: 90vh;
  background: #05040a;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1;
}

/* Modale gallerie: massima area su desktop (like + commenti a destra) */
@media (min-width: 901px) {
  .modal--gallery .modal-content.modal-content--max {
    width: min(98vw, 1800px);
    max-width: 98vw;
    height: min(96vh, 1100px);
    max-height: 96vh;
    padding: 12px 16px 12px 12px;
    align-items: stretch;
  }

  .modal--gallery .modal-content--max .modal-media {
    flex: 1.35;
    min-width: 0;
    min-height: 0;
    align-self: stretch;
    border-radius: 16px;
  }

  .modal--gallery .modal-content--max .modal-media img,
  .modal--gallery .modal-content--max .modal-media video {
    max-width: 100%;
    max-height: min(94vh, 1080px);
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .modal--gallery .modal-content--max .modal-info {
    flex: 0 0 min(380px, 34vw);
    max-height: 96vh;
    overflow-y: auto;
    padding-right: 4px;
  }
}

.main-layout.gallery-page-main {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(1680px, 100%);
  width: 100%;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

@media (min-width: 1100px) {
  .main-layout.gallery-page-main {
    max-width: min(96vw, 1680px);
  }
}

.gallery-feed-panel {
  min-height: 60vh;
  touch-action: pan-y;
}

.feed-header--gallery {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.gallery-page-head {
  flex: 1 1 220px;
  min-width: 0;
}

.gallery-page-head h2 {
  margin: 4px 0 6px;
  font-size: 18px;
}

.gallery-subtitle--inline {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-soft);
}

.feed-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.gallery-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  margin-bottom: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(255, 111, 181, 0.35),
    rgba(111, 90, 180, 0.45)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-back-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  text-decoration: none;
}

a.gallery-link-other {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 111, 181, 0.55);
  background: rgba(255, 111, 181, 0.12);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

a.gallery-link-other:hover {
  background: rgba(255, 111, 181, 0.22);
  text-decoration: none;
}

/* Blocco sotto la hero: ringraziamento + accesso gallerie (ben distanziato) */
.gallery-links-banner {
  max-width: 1200px;
  margin: 28px auto 36px;
  padding: 0 18px;
}

.gallery-links-banner[hidden] {
  display: none !important;
}

.gallery-links-banner-inner {
  position: relative;
  background: linear-gradient(
    155deg,
    rgba(255, 111, 181, 0.14),
    rgba(35, 22, 58, 0.96) 45%,
    rgba(12, 10, 28, 0.98)
  );
  border-radius: 26px;
  padding: 28px 32px 30px;
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 111, 181, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 111, 181, 0.45);
  overflow: hidden;
}

.gallery-links-banner-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 111, 181, 0.85),
    rgba(167, 139, 250, 0.75),
    transparent
  );
  pointer-events: none;
}

.gallery-links-kicker {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent-strong);
  font-weight: 600;
}

.gallery-links-thanks {
  margin: 0 0 20px;
  font-size: 17px;
  line-height: 1.65;
  color: rgba(245, 242, 255, 0.92);
  text-align: center;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.gallery-links-thanks-break {
  display: block;
  height: 0.65em;
}

.gallery-links-thanks strong {
  color: #ffc8e8;
  font-weight: 600;
}

.gallery-links-sign {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-style: italic;
  text-align: right;
  color: var(--accent-strong);
  padding-right: 8px;
}

.gallery-links-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  max-width: 540px;
  margin: 0 auto;
  padding-top: 4px;
}

.gallery-links-actions .btn {
  flex: 1 1 200px;
  min-width: min(100%, 200px);
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.gallery-links-actions .mio-video-cta {
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.92rem;
}

/* Pagina “Il mio video” (MP4 locale, no YouTube embed) */
.page-mio-video .mio-video-main {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(920px, 100%);
  padding-top: 10px;
}

.mio-video-panel {
  background: rgba(6, 5, 14, 0.92);
  border-radius: var(--radius-lg);
  padding: 24px 24px 30px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.mio-video-back {
  display: inline-block;
  margin-bottom: 12px;
}

.mio-video-title {
  margin: 0 0 18px;
  font-size: 24px;
}

.mio-video-thanks {
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.65;
  color: rgba(245, 242, 255, 0.92);
}

.mio-video-thanks strong {
  color: #ffc8e8;
}

.mio-video-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #050308;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Embed YouTube 16:9 responsive */
.mio-video-wrap--youtube {
  background: #000;
}

.mio-video-iframe-inner {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.mio-video-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
}

.mio-video-note {
  margin: 20px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
  opacity: 0.92;
}

.mio-video-fallback {
  margin: 14px 0 0;
  font-size: 14px;
  text-align: center;
  color: var(--text-soft);
}

.mio-video-fallback-link {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.mio-video-fallback-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .gallery-links-banner {
    margin: 22px auto 28px;
  }

  .gallery-links-banner-inner {
    padding: 22px 18px 24px;
  }

  .gallery-links-thanks {
    font-size: 16px;
    text-align: left;
  }

  .gallery-links-kicker {
    text-align: left;
  }

  .gallery-links-sign {
    text-align: right;
    margin-bottom: 18px;
  }
}

@media (max-width: 480px) {
  .gallery-links-actions {
    flex-direction: column;
  }

  .gallery-links-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

a.side-menu-action {
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  display: block;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 4, 10, 0.65);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.modal-media {
  flex: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #151226, #05040a);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}

.modal-media-index--foto {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 15;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.38);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  user-select: none;
}

.modal-media img,
.modal-media video {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 4, 10, 0.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.modal-nav:hover {
  background: rgba(255, 255, 255, 0.08);
}
.modal-nav-prev {
  left: 10px;
   z-index:112212121;
}
.modal-nav-next {
  right: 10px;
  z-index:112212121;
}

@media (max-width: 600px) {
  .modal-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
    top: auto;
    transform: none;
    bottom: 10px;
  }
  .modal-nav-prev {
    left: 10px;
  }
  .modal-nav-next {
    right: 10px;
  }
}

.modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-uploader {
  font-weight: 500;
}

.modal-date {
  font-size: 11px;
  color: var(--text-soft);
}

.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.like-button {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.like-button .heart {
  font-size: 16px;
  transition: transform 0.12s ease;
}

.like-button.liked {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.like-button.liked .heart {
  color: var(--accent-strong);
  transform: scale(1.1);
}

.comments-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.comments-section h3 {
  margin: 4px 0 6px;
  font-size: 14px;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-item {
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.comment-meta {
  font-size: 11px;
  color: var(--text-soft);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-author {
  font-weight: 500;
}

.comment-text {
  word-break: break-word;
}

.comment-form {
  display: flex;
  gap: 6px;
}

.comment-form input[type="text"] {
  flex: 1;
}

@keyframes pulse-heart {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 111, 181, 0.7));
  }
  50% {
    transform: scale(1.2);
    filter: drop-shadow(0 0 10px rgba(255, 111, 181, 0.9));
  }
}

@keyframes floatConfetti {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-12px, -18px, 0);
  }
  100% {
    transform: translate3d(12px, 18px, 0);
  }
}

@keyframes refreshProgress {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@media (max-width: 900px) {

  section.audio-player {
    margin-left: 12px !important;
    margin-right: 12px !important;
}

  .hero-banner {
    margin-inline: 12px;
    padding: 14px 14px;
  }

  .invite-strip {
    margin-inline: 12px;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-countdown {
    align-items: flex-start;
  }

  .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-content {
    flex-direction: column;
    max-height: 94vh;
  }

  .modal-media img,
  .modal-media video {
    max-height: 50vh;
  }
}

@media (max-width: 600px) {
  /* In mobile, mostra il media del modal in 1:1 a tutta larghezza */
  .modal-media {
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
  }

  .modal-media img,
  .modal-media video {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: none;
    object-fit: cover;
    border-radius: 12px;
  }
}


img.side-menu-logo-fhw {
  max-width: 253px;
  padding: 16px;
  filter: grayscale(1);
  padding-right: 20px;
}

@media (max-width: 600px) {
  .top-bar {
    padding-inline: 12px;
    flex-wrap: wrap;
  }

  .hero-banner {
    margin-top: 10px;
  }

  .main-layout {
    padding: 12px;
  }

  /* Evita scroll orizzontale del menu laterale su mobile */
  .side-menu {
    max-width: 82vw;
    overflow-x: hidden;
  }



  .top-message {
    order: 2;
    flex: 1 0 100%;
    margin-top: 4px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
    margin-top: 12px !important;
}


  .logo {
    order: 1;
  }

  .top-right {
    order: 1;
    margin-left: auto;
  }

  .welcome-card,
  .upload-card,
  .feed-panel {
    border-radius: 18px;
  }

  .feed-layout-toggle {
    display: inline-flex;
  }

  .feed-grid.one-col {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .feed-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* In modalità una colonna, usa proporzione 1:1 per le card della dashboard e gallerie */
  .feed-grid.one-col .feed-thumb-slot {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .feed-grid.one-col .feed-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .feed-grid.one-col .feed-thumb-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .feed-grid.one-col .feed-thumb-wrap .feed-thumb {
    height: 100%;
    min-height: 0;
  }
}

