:root {
  --giallo: #ffd500;
  --nero: #111;
  --bg: #f5f5f4;
  --surface: #fff;
  --txt: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e4e4e4;
  --border-strong: #c9c9c7;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.6rem;
}
.dark {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --txt: #f2f2f2;
  --muted: #9a9a9a;
  --border: #2c2c2c;
  --border-strong: #3d3d3d;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --txt: #f2f2f2;
    --muted: #9a9a9a;
    --border: #2c2c2c;
    --border-strong: #3d3d3d;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--txt);
  line-height: 1.5;
}
a {
  color: inherit;
}

.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 16px;
  background: var(--nero);
  color: #fff;
  border-bottom: 5px solid var(--giallo);
  position: relative;
}
.logo {
  flex: none;
  height: 72px;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
}
.hero-txt h1 {
  margin: 0;
  font-size: var(--fs-xl);
  color: var(--giallo);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hero-txt .evento {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
  opacity: 0.85;
}
.hero-txt .claim {
  margin: 6px 0 0;
  font-size: var(--fs-base);
}
.theme-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
.privacy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}
.scroll-all {
  display: block;
  width: 100%;
  margin: 4px 0 14px;
  padding: 14px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--nero);
  background: var(--giallo);
  border: 0;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.scroll-all:hover {
  filter: brightness(0.95);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 8px;
}
.tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--txt);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.tab.active {
  background: var(--giallo);
  color: var(--nero);
  border-color: var(--giallo);
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.card:hover {
  border-color: var(--giallo);
  box-shadow: 0 6px 20px rgba(255, 213, 0, 0.22);
}
.card-img {
  display: block;
  aspect-ratio: 4 / 5;
  background: var(--border);
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-body {
  padding: 8px 10px 0;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-weight: 700;
  font-size: var(--fs-lg);
}
.card-stile {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 10px;
}
.card-actions button,
.card-actions a {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
}
/* Azione primaria (è una pagina di VOTO): il like domina. */
.card-actions .like {
  font-weight: 800;
  color: var(--txt);
  background: color-mix(in srgb, var(--giallo) 16%, var(--surface));
  border-color: var(--giallo);
  flex: 1 0 auto;
}
.like.voted {
  background: var(--giallo) !important;
  border-color: var(--giallo);
  color: var(--nero) !important;
}
.like.bump {
  transform: scale(1.15);
  transition: transform 0.15s;
}

/* Sezioni per categoria (home anteprima) */
.cat {
  margin: 0 0 26px;
}
.cat-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin: 18px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 5px solid var(--giallo);
  padding-left: 10px;
}
.cat-more {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  min-height: 44px;
  background: transparent;
  color: var(--txt);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--giallo);
  border-radius: 999px;
}
.cat-more:hover {
  background: color-mix(in srgb, var(--giallo) 18%, var(--surface));
}

.skeleton .card-img {
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.18s ease;
}
.modal[hidden] {
  display: none;
}
.modal-box {
  background: var(--bg);
  width: 100%;
  max-width: 1100px;
  max-height: 92vh;
  overflow: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px;
  animation: slideUp 0.2s ease;
}
@media (min-width: 640px) {
  .modal {
    align-items: center;
  }
  .modal-box {
    border-radius: 18px;
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: -16px;
  background: var(--bg);
  padding: 4px 0 10px;
}
.modal-head h2 {
  margin: 0;
}
.icon-btn {
  border: 0;
  background: var(--surface);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: var(--txt);
}

/* Lightbox locandina (qualità massima) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.18s ease;
}
.lightbox[hidden] {
  display: none;
}
.lb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  max-height: 100%;
  animation: popIn 0.2s ease;
}
.lb-inner img {
  max-width: 100%;
  max-height: 78vh;
  height: auto;
  width: auto;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}
.lb-meta {
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.lb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.lb-actions .like,
.lb-actions .download,
.lb-actions .share {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  min-height: 46px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lb-actions .like.voted {
  background: var(--giallo);
  border-color: var(--giallo);
  color: var(--nero);
}
.lb-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 31;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 31;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav[hidden] {
  display: none;
}
.lb-prev {
  left: 12px;
}
.lb-next {
  right: 12px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 28px 16px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nero);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 20;
  box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
