:root {
  --deep: #0A1030; --blue: #121B45; --raised: #1B2660; --line: #2A3672;
  --gold: #FFC857; --amber: #FF9F45; --white: #FFF4DC; --muted: #B5BEE0;
  --serif: "Noto Serif", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 72px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--deep); color: var(--white); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; min-height: 100vh; overflow-wrap: anywhere; }
a { color: var(--gold); }
button { font: inherit; color: inherit; }
#view { max-width: 720px; margin: 0 auto; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); min-height: 100vh; }

/* Barra in basso */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: var(--blue); padding: 8px 2px calc(8px + env(safe-area-inset-bottom)); }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
#tabbar .pill { margin-bottom: 4px; width: 48px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
#tabbar svg { width: 24px; height: 24px; fill: currentColor; }
#tabbar a.active { color: var(--gold); }
#tabbar a.active .pill { background: var(--gold); color: var(--deep); }

/* Titoli */
h1.screen-title { font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 44px; margin: 0;
  padding: calc(env(safe-area-inset-top) + 24px) 20px 8px; }
h2.section-title { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 28px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.gold { color: var(--gold); }

/* Caricamento ed errori */
.loading { display: flex; justify-content: center; padding: 48px 0; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.errorbox { text-align: center; padding: 48px 32px; }
.errorbox h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 8px; }
.errorbox p { margin: 4px 0; color: var(--muted); }
.notice { color: var(--gold); font-size: 12px; padding: 6px 20px; }

/* Pulsanti */
.btn { display: inline-block; border: 0; border-radius: 50px; background: var(--gold); color: var(--deep); font-weight: 600; padding: 12px 24px; text-decoration: none; cursor: pointer; text-align: center; }
.btn.outline { background: transparent; color: var(--gold); border: 1px solid var(--line); }
.btn.block { display: block; width: 100%; }
.btn.text { background: transparent; color: var(--gold); padding: 8px 12px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.errorbox .btn { margin: 12px 4px 0; }

/* Linguette */
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; padding: 0 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; background: none; border: 0; padding: 14px 16px; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }
.page-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 0 20px; min-height: 44px; }

/* Contenuto delle pagine del sito */
.content { padding: 8px 20px 40px; line-height: 1.6; }
.content, .content p, .content li, .content span, .content div, .content td, .content th, .content strong, .content em, .content b, .content i, .content figcaption,
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { color: var(--white) !important; background-color: transparent !important; }
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { font-family: var(--serif); line-height: 1.25; margin: 1.6em 0 0.5em; }
.content h1 { font-size: 1.6em; } .content h2 { font-size: 1.4em; } .content h3 { font-size: 1.2em; } .content h4 { font-size: 1.1em; }
.content a, .content a * { color: var(--gold) !important; text-decoration: underline; }
.content img { max-width: 100%; height: auto; border-radius: 12px; }
.content figure { margin: 16px 0; }
.content table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.content td, .content th { border: 1px solid var(--line); padding: 6px 10px; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.content ul, .content ol { padding-left: 1.3em; }

/* Home */
.hero { position: relative; height: 500px; overflow: hidden; background: linear-gradient(160deg, #1B2660, #0A1030 70%); }
.hero img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; }
.hero img.on { opacity: 1; }
.hero .veil { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(to bottom, rgba(10,16,48,.35) 0%, rgba(10,16,48,.10) 35%, rgba(10,16,48,.70) 60%, #0A1030 100%); }
.hero .txt { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(env(safe-area-inset-top) + 24px) 24px 24px; }
.badge { align-self: flex-start; border: 1px solid var(--gold); color: var(--gold); background: rgba(10,16,48,.65); border-radius: 50px; padding: 6px 14px; font-size: 14px; font-weight: 500; }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 44px; margin: 16px 0 8px; }
.hero .edition { color: var(--gold); font-weight: 600; margin: 0 0 12px; }
.hero .intro { margin: 0; }
.home-body { padding: 20px; }
.home-body > * + * { margin-top: 72px; }
.dates { background: var(--blue); border-radius: 12px; border-left: 4px solid var(--amber); padding: 16px; }
.dates strong { display: block; font-weight: 600; margin-bottom: 4px; }
.dates span { color: var(--muted); font-size: 14px; line-height: 20px; }
.install { text-align: center; background: rgba(229,72,77,.08); border: 1px solid #E5484D; border-radius: 12px; padding: 14px 16px; }
.install strong { display: block; font-weight: 600; margin-bottom: 4px; }
.install span { display: block; color: var(--muted); font-size: 14px; line-height: 20px; }
.install .btn { margin-top: 12px; padding: 10px 28px; }
.install .btn[hidden] { display: none; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.news-compact { margin-top: 8px; }
.news-compact > * + * { margin-top: 24px; }
.news-row { display: flex; align-items: center; background: var(--blue); border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; }
.news-row img { width: 96px; height: 96px; object-fit: cover; flex: none; }
.news-row .t { padding: 12px; }
.news-row .d, .news-card .d { color: var(--gold); font-size: 12px; margin-bottom: 4px; }
.news-row .h { font-weight: 600; line-height: 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row { text-decoration: none; color: inherit; display: flex; align-items: center; padding: 14px 0; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row svg { width: 24px; height: 24px; fill: var(--gold); flex: none; margin-right: 16px; }
.row .a { font-weight: 600; }
.row .b { color: var(--muted); font-size: 14px; }
.feature { display: flex; align-items: center; justify-content: center; border: 0; width: 100%; text-align: left; border-radius: 24px; padding: 20px; cursor: pointer;
  background: linear-gradient(90deg, var(--gold), var(--amber)); color: var(--deep); }
.feature span { flex: none; text-align: center; font-family: var(--serif); font-weight: 600; font-size: clamp(15px, 4.8vw, 20px); line-height: 26px; white-space: nowrap; }
.feature svg { width: 36px; height: 36px; fill: var(--deep); margin-left: 16px; }
.about > * + * { margin-top: 12px; }
.about p { margin: 0; }
.footer > * + * { margin-top: 12px; }
.footer p { margin: 0; }

/* News */
.news-list { padding: 12px 20px; }
.news-list > * + * { margin-top: 48px; }
.news-card { background: var(--blue); border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; display: block; }
.news-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.news-card .b { padding: 16px; }
.news-card .h { font-weight: 600; line-height: 22px; margin: 6px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .x { color: var(--muted); font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.paging { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 0; }

/* Foto */
.photo-sub { padding: 0 20px; }
.photo-sub .edi { color: var(--gold); font-weight: 600; }
.photos { padding: 8px 20px 24px; }
.photos > * + * { margin-top: 16px; }
.photos button { position: relative; display: block; width: 100%; padding: 0; padding-top: 100%; border: 0; background: var(--blue); border-radius: 18px; overflow: hidden; cursor: pointer; }
.photos img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.more { padding: 0 20px 24px; }
.viewer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; background: #000; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .close { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 12px; }
.viewer .count { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 16px); left: 0; right: 0; text-align: center; color: var(--muted); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(10,16,48,.6); border: 0; color: var(--white); font-size: 28px; width: 44px; height: 56px; border-radius: 12px; cursor: pointer; }
.viewer .prev { left: 8px; } .viewer .next { right: 8px; }

/* Schermata di benvenuto (come nell'app: un secondo e mezzo, poi dissolvenza) */
#welcome { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: #0A1030 center / cover no-repeat; display: flex; align-items: center; justify-content: center; transition: opacity .5s ease; }
#welcome.hide { opacity: 0; pointer-events: none; }
#welcome h1 { font-family: var(--serif); font-weight: 700; font-size: 38px; line-height: 44px; text-align: center; margin: 0; padding: 0 32px; text-shadow: 0 2px 12px rgba(0,0,0,.6); }

/* Etichetta celeste: guida completa */
.guide { display: flex; align-items: center; width: 100%; border-radius: 24px; padding: 20px; text-decoration: none; cursor: pointer;
  background: linear-gradient(90deg, #A8DEFF, #6DB6F0); color: var(--deep); }
.guide span { flex: 1; font-family: var(--serif); font-weight: 600; font-size: clamp(16px, 4.8vw, 20px); line-height: 26px; color: var(--deep); }
.guide svg { width: 36px; height: 36px; fill: var(--deep); margin-left: 16px; flex: none; }
/* Dove dormire */
iframe.partners { display: block; width: 100%; border: 0; height: calc(100vh - 330px); min-height: 420px; background: transparent; }

iframe.partners.auto { min-height: 0; }

/* Elenco delle opere: titolo celeste, resto bianco non in grassetto; pulsante "Portami qui" */
.content p.opera { font-weight: 400; }
.content p.opera strong { color: #8CCBFF !important; font-weight: 700; }
.content a.goto { display: inline-flex; align-items: center; margin: 8px 0 2px; padding: 6px 14px; border: 1px solid #8CCBFF; border-radius: 50px;
  font-size: 14px; line-height: 20px; text-decoration: none; }
.content a.goto, .content a.goto * { color: #8CCBFF !important; }
.content a.goto svg { width: 16px; height: 16px; fill: #8CCBFF; margin-right: 6px; flex: none; }

/* Pubblicità */
.adbox { text-align: center; }
.adlabel { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.content .adbox { margin: 32px 0; }
