:root {
  --red: #C41330;
  --red-dark: #A50F28;
  --red-border: rgba(196, 19, 48, .55);
  --bg: #F3F3F3;
  --white: #FFFFFF;
  --ink: #2B2B2E;
  --ink-soft: #4A4A4F;
  --muted: #6B6B70;
  --search: #ECE6F0;
  --nav: #F3EDF7;
  --nav-active: #E8DEF8;
  --app-w: 480px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #1E1E1E;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.app {
  position: relative;
  max-width: var(--app-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: hidden;
}
.view { min-height: 100vh; min-height: 100dvh; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(12px + var(--safe-b));
  transform: translateX(-50%);
  width: calc(min(100vw, var(--app-w)) - 28px);
  display: flex;
  justify-content: space-around;
  padding: 10px 12px 8px;
  background: var(--nav);
  border-radius: 28px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
.nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 72px;
  font-size: 11px; font-weight: 500; color: var(--ink-soft);
}
.nav__icon {
  display: grid; place-items: center;
  width: 58px; height: 30px; border-radius: 15px;
  color: #49454F;
  transition: background .2s;
}
.nav__icon svg { width: 22px; height: 22px; }
.nav__item.is-active { font-weight: 700; color: var(--ink); }
.nav__item.is-active .nav__icon { background: var(--nav-active); color: var(--red); }

/* ---------- Mini player ---------- */
.mini {
  position: fixed; z-index: 29;
  left: 50%; transform: translateX(-50%);
  bottom: calc(86px + var(--safe-b));
  width: calc(min(100vw, var(--app-w)) - 28px);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 8px;
  background: var(--red); color: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.mini.is-nonav { bottom: calc(12px + var(--safe-b)); }
.mini__open { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.mini__img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; filter: grayscale(1); }
.mini__txt { display: flex; flex-direction: column; min-width: 0; }
.mini__lbl { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.mini__title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini__btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--red); flex: none; }
.mini__btn svg { width: 16px; height: 16px; }

/* ---------- Percorso ---------- */
.percorso { padding: calc(10px + var(--safe-t)) 14px 130px; }
.handle { width: 32px; height: 4px; border-radius: 2px; background: #79747E; opacity: .6; margin: 0 auto; }
.page-head { padding: 34px 6px 14px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); }
.page-head p { margin: 4px 0 0; font-size: 13px; font-weight: 500; color: var(--ink-soft); }

.search {
  display: block; position: relative; margin: 0 0 18px;
}
.search input {
  width: 100%; height: 46px;
  padding: 0 50px 0 20px;
  border: 0; border-radius: 23px;
  background: var(--search);
  font: inherit; font-size: 14px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: #8A8590; }
.search input:focus { outline: 2px solid var(--red-border); }
.search svg { position: absolute; right: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: #49454F; pointer-events: none; }

.cards { display: flex; flex-direction: column; gap: 14px; padding: 0 2px; }
.card {
  position: relative;
  background: var(--white);
  border: 1.5px solid var(--red-border);
  border-radius: 9px;
  box-shadow: 0 3px 5px rgba(0, 0, 0, .12);
  padding: 46px 18px 14px 26px;
}
.badge {
  position: absolute; top: 14px; right: -1.5px;
  padding: 6px 16px 6px 18px;
  background: var(--red); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
  border-radius: 7px 0 0 7px;
}
.card__title { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink-soft); line-height: 1.25; }
.card__desc { margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); }
.card__actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 30px; min-width: 100px; padding: 0 14px;
  border: 1.5px solid var(--red); border-radius: 15px;
  white-space: nowrap;
  font-size: 12.5px; font-weight: 500;
}
.pill svg { width: 17px; height: 17px; }
.pill--fill { background: var(--red); color: #fff; }
.pill--line { background: #fff; color: var(--red); }
.pill.is-soon { opacity: .55; }
.empty { padding: 30px 10px; text-align: center; font-size: 14px; color: var(--muted); }

/* ---------- Ascolto (player) ---------- */
.player {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--red); color: #fff;
  padding-top: var(--safe-t);
}
.player__top { position: relative; padding: 30px 26px 0; }
.back {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-left: -10px;
  color: inherit;
}
.back svg { width: 26px; height: 26px; }
.player__step { margin: 22px 0 0; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.player__media { padding: 22px 16px 0; }
.player__img {
  width: 100%; aspect-ratio: 1.45; object-fit: cover;
  border-radius: 22px;
  filter: grayscale(1) sepia(.18) contrast(1.05);
  background: rgba(0, 0, 0, .15);
}
.credit { margin: 8px 6px 0; font-size: 10.5px; line-height: 1.35; opacity: .8; }
.credit a { text-decoration: underline; text-underline-offset: 2px; }
.player__title {
  margin: 26px 30px 0; text-align: center;
  font-size: 18px; font-weight: 700; line-height: 1.35; text-transform: uppercase;
}
.controls { display: flex; align-items: center; justify-content: center; gap: 40px; margin-top: 30px; }
.ctrl { display: grid; place-items: center; width: 52px; height: 44px; color: #fff; }
.ctrl svg { width: 36px; height: 27px; }
.play {
  display: grid; place-items: center;
  width: 70px; height: 70px; border-radius: 50%;
  background: #fff; color: var(--red);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  transition: transform .15s;
}
.play:active { transform: scale(.94); }
.play svg { width: 30px; height: 30px; }
.play .i-play { margin-left: 4px; }
.ctrl:disabled, .play:disabled { opacity: .45; cursor: default; }
.soon-note { margin: 14px 30px 0; text-align: center; font-size: 12px; font-weight: 600; opacity: .9; }

.progress { padding: 26px 16px 0; }
.progress input[type=range] {
  width: 100%; height: 18px; margin: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
  --pct: 0%;
}
.progress input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(to right, #fff var(--pct), rgba(255, 255, 255, .45) var(--pct));
}
.progress input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .45); }
.progress input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: #fff; }
.progress input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: #fff;
}
.progress input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
.progress input:disabled { cursor: default; }
.times { display: flex; justify-content: space-between; margin-top: 2px; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }

.preview {
  flex: 1;
  margin: 36px 16px 0;
  padding: 24px 24px calc(28px + var(--safe-b));
  background: #fff; color: var(--ink);
  border-radius: 14px 14px 0 0;
}
.preview h2 { margin: 0; font-size: 19px; font-weight: 600; color: var(--ink-soft); }
.preview__body {
  position: relative; margin-top: 12px;
  font-size: 16px; line-height: 1.5; letter-spacing: .01em; color: var(--muted);
}
.preview__body p { margin: 0 0 14px; }
.preview:not(.is-open) .preview__body { max-height: 7.5em; overflow: hidden; }
.preview:not(.is-open) .preview__body::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff);
}
.textlink {
  margin-top: 10px;
  font-size: 13px; font-weight: 700; color: var(--red);
  text-decoration: underline; text-underline-offset: 3px;
}
.step-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #eee; }
.step-nav a { font-size: 13px; font-weight: 600; color: var(--red); max-width: 48%; }
.step-nav a span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.step-nav .next { text-align: right; margin-left: auto; }

/* ---------- Leggi ---------- */
.read { min-height: 100vh; min-height: 100dvh; background: #fff; padding-bottom: calc(96px + var(--safe-b)); }
.read__bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #f0f0f0;
}
.read__bar .back { color: var(--red); }
.read__bar span { font-size: 13px; font-weight: 700; color: var(--red); letter-spacing: .02em; }
.read__inner { padding: 18px 24px 0; }
.read__img { width: 100%; aspect-ratio: 1.45; object-fit: cover; border-radius: 18px; filter: grayscale(1) sepia(.12); }
.read .credit { color: var(--muted); opacity: 1; }
.read h1 { margin: 22px 0 0; font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.read__sub { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .02em; }
.read__text { margin-top: 18px; font-size: 16.5px; line-height: 1.65; color: #3E3E44; }
.read__text p { margin: 0 0 16px; }
.read__cta {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--safe-b));
  width: calc(min(100vw, var(--app-w)) - 32px);
}
.read__cta .pill { width: 100%; height: 50px; border-radius: 25px; font-size: 15px; font-weight: 600; box-shadow: 0 6px 16px rgba(196, 19, 48, .3); }
.read__cta .pill svg { width: 20px; height: 20px; }

/* ---------- Scansione ---------- */
.scan {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--red);
}
.scan__head { padding: calc(56px + var(--safe-t)) 28px 54px; color: #fff; }
.scan__head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.scan__head p { margin: 4px 0 0; font-size: 13px; font-weight: 500; }
.scan__band { background: var(--bg); padding: 40px 0; }
.frame {
  position: relative;
  width: min(82%, 340px); aspect-ratio: 1; margin: 0 auto;
  background: #fff;
}
.frame::before, .frame::after {
  content: ""; position: absolute; width: 50px; height: 50px; z-index: 2;
  border: 0 solid var(--red); pointer-events: none;
}
/* Cornici a "L" rosse come nel design */
.frame::before { top: -12px; left: -12px; border-top-width: 7px; border-left-width: 7px; width: calc(100% + 24px); height: 26%; border-right-width: 7px; }
.frame::after  { bottom: -12px; left: -12px; border-bottom-width: 7px; border-left-width: 7px; width: calc(100% + 24px); height: 26%; border-right-width: 7px; }
.frame video, .frame .frame__ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame__ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px; text-align: center; }
.frame__qr { width: 62%; opacity: .14; }
.frame__ph .pill { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 44px; border-radius: 22px; font-size: 14px; font-weight: 600; padding: 0 20px; box-shadow: 0 4px 12px rgba(196, 19, 48, .3); }
.frame__msg { position: absolute; left: 14px; right: 14px; bottom: 16px; font-size: 12px; font-weight: 500; color: var(--muted); }
.scanline {
  position: absolute; left: 6%; right: 6%; height: 2px; top: 10%;
  background: var(--red); box-shadow: 0 0 10px var(--red);
  animation: scan 2.2s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes scan { to { top: 90%; } }
.scan__foot { flex: 1; padding: 22px 28px calc(110px + var(--safe-b)); color: #fff; }
.scan__foot p { margin: 0 0 10px; font-size: 12px; font-weight: 500; opacity: .9; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .7);
  font-size: 14px; font-weight: 700; color: #fff;
}
.chip:active { background: #fff; color: var(--red); }

/* ---------- Scopri ---------- */
.scopri { padding-bottom: calc(120px + var(--safe-b)); }
.scopri__head { background: var(--red); color: #fff; padding: calc(56px + var(--safe-t)) 28px 34px; }
.scopri__head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.scopri__head p { margin: 4px 0 0; font-size: 13px; font-weight: 500; }
.scopri__body { padding: 20px 16px 0; }
.box {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
  margin-bottom: 16px;
}
.box h2 { margin: 0 0 10px; font-size: 17px; font-weight: 600; color: var(--ink-soft); }
.box p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.hero { margin: -20px -20px 16px; }
.hero img { width: 100%; aspect-ratio: 1.6; object-fit: cover; object-position: center 60%; border-radius: 12px 12px 0 0; }
.credits { list-style: none; margin: 0; padding: 0; }
.credits li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid #f0f0f0; }
.credits li:first-child { border-top: 0; padding-top: 2px; }
.credits img { width: 52px; height: 52px; flex: none; object-fit: cover; border-radius: 8px; filter: grayscale(1); }
.credits b { display: block; font-size: 11px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .02em; }
.credits strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.credits span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); word-break: break-word; }
.credits a { color: var(--red); text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 481px) {
  .app { box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
}
@media (prefers-reduced-motion: reduce) {
  .scanline { animation: none; top: 50%; }
}
