:root {
  --bg: #0b0a09;
  --bar: #14110e;
  --ink: #f3eadc;
  --line: #3a3229;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { padding-bottom: var(--safe-bottom); }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 8px;
  padding: calc(8px + var(--safe-top)) 10px 10px;
  background: var(--bar);
}
body.lista-on .toolbar,
body.lista-on .feed,
body.lista-on .fondo,
body.elenco-on .feed,
body.elenco-on .fondo,
body.inserisci-on .toolbar,
body.inserisci-on .feed,
body.inserisci-on .fondo,
body.versioni-on .toolbar,
body.versioni-on .feed,
body.versioni-on .fondo,
body.riepilogo-on .toolbar,
body.riepilogo-on .feed,
body.riepilogo-on .fondo,
body.suggerimenti-on .toolbar,
body.suggerimenti-on .feed,
body.suggerimenti-on .fondo { display: none; }
.btn-menu {
  position: fixed;
  top: calc(8px + var(--safe-top));
  right: 10px;
  z-index: 80;
  background: var(--bar);
  border-radius: 10px;
}
.menu-slot { width: 48px; height: 48px; }
.datebar {
  display: grid;
  grid-template-columns: auto 1fr 48px;
  align-items: center;
  gap: 8px;
}
.vista-tasti {
  display: flex;
  gap: 6px;
}
.vista-btn {
  appearance: none;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0a09;
  color: var(--ink);
  font: 600 0.9rem system-ui, sans-serif;
}
.vista-btn[aria-pressed="true"] {
  border-color: #cbbba4;
  background: #2a241e;
}
.n-eventi {
  min-width: 72px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0a09;
  color: var(--ink);
  text-align: center;
}
.n-eventi small {
  font: 500 0.62rem/1.1 system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: #b8aa96;
  white-space: nowrap;
}
.n-eventi strong {
  font: 600 1.1rem/1 system-ui, sans-serif;
}

.nav {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
}
.nav svg { width: 26px; height: 26px; }

.date-pick {
  position: relative;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0a09;
  cursor: pointer;
}
.date-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 500 0.98rem/1.15 system-ui, sans-serif;
  text-align: center;
  padding: 0 8px;
  pointer-events: none;
  text-transform: capitalize;
}
#data {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  color-scheme: dark;
}
#data::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.filtri {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
#citta,
#tipo {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0a09;
  color: var(--ink);
  font: 500 1.05rem system-ui, sans-serif;
  text-align: left;
  padding: 0 10px;
  color-scheme: dark;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0 16px;
}
.card + .card::before {
  content: "";
  display: block;
  height: 36px;
  margin: 18px 24px 22px;
  background: center / contain no-repeat url("/images/stacco-eventi.svg");
  pointer-events: none;
}
.fondo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 16px calc(22px + var(--safe-bottom));
}
.fondo-tasti {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #17130f;
  color: var(--ink);
  font: 600 1rem system-ui, sans-serif;
  text-decoration: none;
}
.site-footer {
  width: min(720px, 100%);
  margin: 8px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: center;
  font: 400 0.85rem/1.5 system-ui, sans-serif;
  color: #b8aa96;
}
.card {
  display: block;
  width: 100%;
  background: #000;
}
.card-foto {
  position: relative;
  background: #000;
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100svh - 80px - var(--safe-top));
  object-fit: contain;
  background: #000;
}
.card-foto.is-annullato img,
.lista-riga img.is-annullato {
  opacity: 0.5;
}
.annullato-banda {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 18px;
  background: rgba(176, 18, 18, 0.2);
  color: #fff;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.annullato-banda strong {
  font: 900 2rem/1.05 system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.annullato-banda span {
  font: 600 1rem/1.3 system-ui, sans-serif;
}
.info {
  padding: 14px 16px 4px;
  background: var(--bg);
}
.info h2 {
  margin: 0 0 8px;
  font: 500 1.15rem/1.3 system-ui, sans-serif;
}
.info .desc {
  margin: 0 0 12px;
  font: 400 0.95rem/1.4 system-ui, sans-serif;
  color: #d8cbb8;
  white-space: pre-wrap;
}
.lista-annullato {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e08b7a;
}
.lista-ingresso {
  font-size: 0.85rem;
  color: #d8cbb8;
}
.info dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0;
}
.info dt {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a8d7a;
}
.info dd {
  margin: 3px 0 0;
  font-size: 0.95rem;
}
.links {
  display: flex;
  gap: 10px;
  margin: 14px 0 8px;
}
.ext-link {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #17130f;
}
.ext-link svg { width: 22px; height: 22px; }
.ext-link.ext-testo {
  width: auto;
  min-width: 44px;
  padding: 0 12px;
  font: 600 0.85rem system-ui, sans-serif;
  letter-spacing: 0.02em;
}
.ext-link.share {
  appearance: none;
  cursor: pointer;
  font: inherit;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 40;
  background: #efe6d6;
  color: #1a1612;
  padding: 10px 16px;
  border-radius: 999px;
  font: 500 0.9rem system-ui, sans-serif;
  white-space: nowrap;
}
.toast[hidden] { display: none; }

.menu[hidden] { display: none; }
.menu { position: fixed; inset: 0; z-index: 60; }
.menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.menu-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(300px, 86vw);
  background: #1c1814;
  padding: calc(58px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
  box-shadow: -8px 0 30px rgba(0,0,0,0.4);
}
.menu-panel ul { list-style: none; margin: 0; padding: 0; }
.menu-panel li { border-top: 1px solid var(--line); }
.menu-panel a,
.menu-panel button {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 1.08rem/1.3 system-ui, sans-serif;
  padding: 16px 4px;
  min-height: 52px;
  text-decoration: none;
}
.menu-panel button svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.lista[hidden] { display: none !important; }
.lista {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
body.elenco-on {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.elenco-on .lista {
  position: relative;
  inset: auto;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}
body.elenco-on .lista-head { display: none; }
body.elenco-on .lista-riga {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}
body.elenco-on .lista-riga-main {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
body.elenco-on .lista-riga img {
  width: 116px;
  height: 156px;
}
body.elenco-on .lista-meta time {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}
.lista-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + var(--safe-top)) 58px 10px 10px;
  background: var(--bar);
}
.lista-head h1 {
  margin: 0;
  font: 600 1.05rem/1.2 system-ui, sans-serif;
  flex: 1;
}
.lista-share {
  margin-left: auto;
  color: var(--ink);
}
.lista-share svg { width: 22px; height: 22px; }
.lista-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 10px calc(20px + var(--safe-bottom));
}
.lista-riga {
  appearance: none;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid #2a241e;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.lista-riga:active,
.lista-riga-main:active { background: #221d18; }
.lista-riga img {
  width: 58px;
  height: 78px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  display: block;
}
.lista-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.lista-meta time {
  font-size: 0.78rem;
  color: #d8cbb8;
}
.lista-meta strong {
  font: 500 0.98rem/1.3 system-ui, sans-serif;
}
.lista-citta,
.lista-via,
.lista-visite,
.lista-autore {
  font-size: 0.82rem;
  color: #9a8d7a;
}

.inserisci[hidden] { display: none !important; }
.inserisci {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow-y: auto;
  background: var(--bg);
  padding-bottom: calc(24px + var(--safe-bottom));
}
.inserisci-body {
  padding: 18px 18px calc(24px + var(--safe-bottom));
}
.inserisci-body p {
  margin: 0 0 18px;
  font: 400 1.02rem/1.5 system-ui, sans-serif;
  color: #d8cbb8;
}
.inserisci-body label {
  display: block;
  margin: 0 0 16px;
  font: 500 0.82rem system-ui, sans-serif;
  color: #9a8d7a;
}
.inserisci-body input[type="text"],
.inserisci-body input[name="nome"],
.inserisci-body textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #17130f;
  color: var(--ink);
  font: 400 1rem system-ui, sans-serif;
}
.inserisci-body textarea {
  min-height: 10rem;
  resize: vertical;
}
#invia-prev {
  display: block;
  width: 100%;
  max-height: 46vh;
  margin: 0 0 14px;
  object-fit: contain;
  background: #000;
  border-radius: 12px;
}
#invia-prev[hidden] { display: none; }
.invia-tasti {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}
.invia-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #17130f;
  color: var(--ink);
  font: 600 0.95rem system-ui, sans-serif;
  text-align: center;
  cursor: pointer;
}
.invia-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.invia-submit {
  appearance: none;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 18px;
  border: 0;
  border-radius: 12px;
  background: #cbbba4;
  color: #1a1510;
  font: 700 1.05rem system-ui, sans-serif;
  cursor: pointer;
}
.inserisci .form-error {
  color: #e08b7a;
  margin: 0 0 10px;
}
.inserisci .form-ok {
  color: #8fbf9a;
  margin: 0 0 10px;
}

.vista-riepilogo[hidden] { display: none !important; }
.vista-riepilogo {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow-y: auto;
  background: var(--bg);
  padding-bottom: calc(24px + var(--safe-bottom));
}
.riepilogo-wrap {
  margin: 12px 12px calc(20px + var(--safe-bottom));
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #14110e;
}
.riepilogo-tabella {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  color: var(--ink);
  font: 400 0.92rem/1.4 system-ui, sans-serif;
}
.riepilogo-tabella th,
.riepilogo-tabella td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #2a241e;
}
.riepilogo-tabella th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1c1814;
  font: 600 0.72rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9a8d7a;
  white-space: nowrap;
}
.riepilogo-tabella tbody tr:nth-child(odd) {
  background: #17130f;
}
.riepilogo-tabella tbody tr:nth-child(even) {
  background: #221c18;
}
.riepilogo-tabella td:nth-child(1),
.riepilogo-tabella td:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.riepilogo-tabella td:nth-child(3) {
  width: 2.2rem;
  text-align: center;
  font-weight: 700;
  color: #e0a14a;
}
.riepilogo-fine {
  display: block;
  margin-top: 3px;
  color: #9a8d7a;
  font-size: 0.88em;
}
.riepilogo-tabella .riepilogo-vuoto {
  text-align: center;
  color: #9a8d7a;
}

.vista-versioni[hidden] { display: none !important; }
.vista-versioni {
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow-y: auto;
  background: var(--bg);
  padding-bottom: calc(24px + var(--safe-bottom));
}
.ver-corrente {
  margin: 12px 16px 0;
  color: #9a8d7a;
  font-size: 0.9rem;
}
.pub-versioni {
  list-style: none;
  margin: 12px 12px 0;
  padding: 0 0 40px;
  display: grid;
  gap: 10px;
}
.pub-versioni li {
  background: #17130f;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.pub-versioni li.now { border-color: #e0a14a; }
.pub-versioni .ver-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.pub-versioni .ver-num {
  font: 600 0.95rem ui-monospace, monospace;
  color: #e0a14a;
}
.pub-versioni h3 {
  margin: 0;
  font: 500 1rem/1.3 system-ui, sans-serif;
}
.pub-versioni time {
  color: #9a8d7a;
  font-size: 0.85rem;
}
.pub-versioni p {
  margin: 8px 0 0;
  color: #d8cbb8;
  font-size: 0.9rem;
  line-height: 1.4;
}
.pagina-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + var(--safe-top)) 10px 10px;
  background: var(--bar);
}
.pagina-head h1 {
  margin: 0;
  font: 600 1.05rem/1.2 system-ui, sans-serif;
  flex: 1;
}
.pagina-articolo {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 18px calc(28px + var(--safe-bottom));
  font: 400 1rem/1.55 system-ui, sans-serif;
}
.pagina-articolo h2 {
  margin: 1.4em 0 0.5em;
  font: 600 1.05rem/1.3 system-ui, sans-serif;
}
.pagina-articolo p,
.pagina-articolo li {
  color: #d8cbb8;
}
.pagina-articolo a {
  color: #efe6d6;
}
.pagina-articolo ul {
  padding-left: 1.15em;
}
.pagina-articolo code {
  font: 500 0.9em ui-monospace, monospace;
  color: var(--ink);
}
