/* BunkerPlex - aspetto. Nero e verde scuro: un fondo, un inchiostro, un accento.
   Niente sfocature, sfumature decorative o ombre: su TV e chiavette economiche
   sono cio' che piu' rallenta. Le uniche sfumature sono i veli scuri sopra le
   immagini, che servono a leggere il testo.
   Dove ci si trova si vede sempre allo stesso modo: l'elemento selezionato
   diventa chiaro (o prende un bordo chiaro, sulle locandine). */
:root {
  --bg: #060a07;
  --surface: #0e1510;
  --surface2: #17211a;
  --ink: #f2f5f2;
  --ink2: #9fada3;
  --ink3: #77857b;
  --accent: #1a7f45;
  --accent-text: #4cbf7f;
  --warn: #e0a030;
  --accent-ink: #ffffff;
  --ok: #4cbf7f;
  --rail: 4.6rem;
  --pad: 3rem;
  --r: .4rem;
  --poster: 10.5rem;
  --stage: 54vh;
}

* { box-sizing: border-box; }

html {
  font-size: 13px;
  font-size: clamp(13px, 1.05vw, 30px);
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
/* Sulla TV si guarda da lontano: tutto un po' piu' grande */
html.tv { font-size: 14px; font-size: clamp(14px, 1.5vw, 40px); }
html.bigposters { --poster: 13.5rem; }
/* Sulla TV sei locandine per riga e due righe intere a schermo */
html.tv { --poster: 7.6rem; }
html.tv.bigposters { --poster: 10rem; }
html.tv .hero .cover { width: 11rem; }
html.tv .overview.full { -webkit-line-clamp: 4; }

body { margin: 0; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
.f { outline: none; -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 0; height: 0; }
.ic { width: 1em; height: 1em; flex: none; fill: currentColor; vertical-align: -.12em; }
.ic.line { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Menu laterale ---------- */
#rail {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: var(--rail); padding: 1.2rem .7rem 1rem;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  transition: width .16s ease-out;
}
#rail:hover, #rail:focus-within { width: 17rem; background: var(--surface); }
body.playing #rail, body.playing #clock { display: none; }
.brand { display: flex; align-items: center; height: 3rem; margin-bottom: 1rem; padding-left: .6rem; white-space: nowrap; }
.brand svg { width: 2rem; height: 2rem; flex: none; }
.brand span { margin-left: .9rem; font-size: 1.35rem; font-weight: 400; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.railitem {
  position: relative; display: flex; align-items: center; flex: none;
  height: 3rem; margin-bottom: .25rem; padding-left: .6rem; border-radius: var(--r);
  color: var(--ink2); font-weight: 600; white-space: nowrap;
}
.railitem svg { width: 2rem; height: 2rem; flex: none; padding: .3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.railitem .avatar {
  width: 2rem; height: 2rem; flex: none; border-radius: var(--r); font-style: normal;
  display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
  background: var(--surface2); color: var(--ink);
}
.railitem span, .brand span, .raillabel span { opacity: 0; }
.railitem span { margin-left: .9rem; overflow: hidden; text-overflow: ellipsis; padding-right: .8rem; }
#rail:hover span, #rail:focus-within span { opacity: 1; }
/* La voce in cui ti trovi si riconosce anche a menu chiuso: fondo pieno,
   icona verde e, per le raccolte, il quadratino con le iniziali in verde */
.railitem.on { color: var(--ink); background: var(--surface2); }
.railitem.on::before { content: ""; position: absolute; left: -.7rem; top: .6rem; bottom: .6rem; width: .25rem; border-radius: 0 .2rem .2rem 0; background: var(--accent); }
.railitem.on svg { color: var(--accent-text); }
.railitem.on .avatar { background: var(--accent); color: var(--accent-ink); }
.railitem:hover { color: var(--ink); }
.railitem:focus { background: var(--ink); color: var(--bg); }
.railitem:focus svg { color: inherit; }
.railitem:focus .avatar { background: var(--bg); color: var(--ink); }
.railitem.add { color: var(--ink3); }
.raillabel { height: 2rem; margin-top: .6rem; padding-left: .7rem; display: flex; align-items: center; color: var(--ink3); font-size: .85rem; font-weight: 600; white-space: nowrap; }
#navlibs { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.spacer { flex: 1; min-height: .5rem; }

#view { margin-left: var(--rail); min-height: 100vh; padding-bottom: 5rem; }
body.playing #view { margin-left: 0; }
.page { padding-top: 3rem; }

#clock { display: none; position: fixed; top: 1.3rem; right: var(--pad); z-index: 20; padding: .2rem .6rem; border-radius: var(--r); background: #060a07b3; color: var(--ink); font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
html.tv #clock { display: block; }
.hint { display: none; color: var(--ink3); font-size: .88rem; }
html.tv .hint { display: block; }

/* ---------- Home: anteprima in alto, file di locandine sotto ---------- */
.stage { position: fixed; top: 0; left: var(--rail); right: 0; height: var(--stage); overflow: hidden; background: var(--bg); }
.stage .bg { position: absolute; top: 0; right: 0; width: 70%; height: 100%; background: var(--bg) center 20% / cover no-repeat; opacity: 0; transition: opacity .35s linear; }
.stage .bg.on { opacity: 1; }
.stage .shade {
  position: absolute; top: 0; left: 0; right: 0; bottom: -2px;
  background:
    linear-gradient(90deg, #060a07 30%, #060a07d9 44%, #060a0700 78%),
    linear-gradient(0deg, #060a07 4%, #060a0700 38%);
}
.stage .info { position: absolute; left: var(--pad); bottom: 1.6rem; width: 48%; max-width: 46rem; }
.stage h1 { font-size: 2.7rem; line-height: 1.06; font-weight: 800; letter-spacing: -.025em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stage .meta { margin-top: .6rem; }
.stage .overview { -webkit-line-clamp: 3; max-width: 38rem; margin-top: .5rem; line-height: 1.45; }
html.tv .stage .overview { -webkit-line-clamp: 2; }
.stage .hint { margin-top: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows { position: fixed; top: var(--stage); bottom: 0; left: var(--rail); right: 0; overflow-x: hidden; overflow-y: auto; padding: 0 0 46vh; }
.rows .section { margin: 0; }
.rows .section h2 { height: 5vh; margin: 0; display: flex; align-items: center; }
.rows .row { padding-top: 1.6vh; padding-bottom: 2.4vh; }
.rows .card.poster { width: 19vh; }
.rows .card.wide { width: 38vh; }
.rows .cap { padding-top: 1vh; }
/* Sulla TV i titoli stanno gia' nell'anteprima: sotto restano solo le immagini, piu' grandi */
html.tv .rows .cap { display: none; }
html.tv .rows .card.poster { width: 21vh; }
html.tv .rows .card.wide { width: 46vh; }

/* ---------- Testi comuni ---------- */
.tagline { color: var(--ink2); margin-top: .5rem; font-size: 1.05rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; color: var(--ink2); font-size: 1rem; font-weight: 500; margin-top: .8rem; }
.meta > * { margin-right: 1rem; margin-bottom: .3rem; }
.meta .lead { color: var(--ink); font-weight: 700; }
.meta .star { color: var(--ink); font-weight: 700; }
.tag { border-radius: .25rem; padding: 0 .4rem; font-size: .8rem; font-weight: 700; background: var(--surface2); color: var(--ink); }
.overview { margin-top: .9rem; font-size: 1.05rem; line-height: 1.55; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.overview.full { -webkit-line-clamp: 7; }
.okdot { color: var(--ok); } .nodot { color: var(--warn); }

/* ---------- Scheda film / serie / saga ---------- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: flex-end; padding: 6rem var(--pad) 3rem; }
.hero.short { min-height: 30rem; padding-bottom: 1.4rem; }
.hero .bg { position: absolute; top: 0; left: calc(-1 * var(--rail)); right: 0; height: 100vh; max-height: 100%; background: var(--bg) center 20% / cover no-repeat; }
.hero .bg::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(90deg, #060a07 6%, #060a07e0 36%, #060a0766 68%, #060a0733 100%),
    linear-gradient(0deg, #060a07 2%, #060a0700 55%);
}
.hero .in { position: relative; display: flex; align-items: flex-end; width: 100%; }
.hero .cover { width: 14rem; flex: none; margin-right: 2.6rem; border-radius: var(--r); overflow: hidden; }
.hero .txt { max-width: 50rem; min-width: 0; }
.hero h1 { font-size: 3.2rem; line-height: 1.05; font-weight: 800; letter-spacing: -.025em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.credits { margin-top: 1.1rem; font-size: .98rem; line-height: 2.1; color: var(--ink2); }
.credits b { color: var(--ink); font-weight: 600; margin-right: .7rem; }
.fine { margin-top: 1rem; color: var(--ink3); font-size: .85rem; }
.chip { display: inline-block; padding: 0 .75rem; margin: 0 .4rem .4rem 0; border-radius: var(--r); background: var(--surface2); color: var(--ink); line-height: 1.9; }
.chip:hover { background: #223026; }
.chip:focus { background: var(--ink); color: var(--bg); }
.actions { display: flex; flex-wrap: wrap; margin-top: 1.5rem; }
.btn {
  display: inline-flex; align-items: center; padding: .75rem 1.5rem; margin: 0 .7rem .6rem 0;
  border-radius: var(--r); background: #ffffff24; font-weight: 700; font-size: 1.02rem; white-space: nowrap;
  transition: transform .12s ease-out;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:hover { background: #ffffff38; }
.btn.primary:hover { background: #1f8d4e; }
.btn:focus, .btn.primary:focus, .btn.danger:focus { background: var(--ink); color: var(--bg); transform: scale(1.05); }
.btn .ic { margin-right: .55rem; }
.btn.on { color: var(--ok); }
.btn.on:focus { color: var(--bg); }

/* ---------- File e griglie di locandine ---------- */
.section { margin-top: 2rem; }
.section h2 { font-size: 1.2rem; font-weight: 700; padding: 0 var(--pad); margin-bottom: .2rem; }
.section h2 small { color: var(--ink3); font-weight: 500; font-size: .9rem; margin-left: .8rem; }
.row { position: relative; display: flex; overflow-x: auto; padding: 1rem var(--pad) 1.2rem; }
.row::after { content: ""; flex: none; width: 60vw; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--poster), 1fr)); grid-gap: 1.9rem 1.3rem; gap: 1.9rem 1.3rem; padding: 1.4rem var(--pad) 2rem; }
.grid .card { margin: 0; width: auto; }
.more-note { padding: 0 var(--pad) 2rem; color: var(--ink3); }

.card { flex: none; display: block; margin-right: 1.3rem; text-align: left; transition: transform .14s ease-out; }
.card.poster { width: var(--poster); }
.card.wide { width: 20rem; }
.art { position: relative; border-radius: var(--r); overflow: hidden; background: hsl(var(--h, 220), 22%, 20%); }
.poster .art, .cover .art { padding-top: 150%; }
.wide .art { padding-top: 56.25%; }
.art img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.art .ph { position: absolute; left: 0; right: 0; bottom: 0; padding: .8rem; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.art .bar { position: absolute; left: 0; right: 0; bottom: 0; height: .3rem; background: #060a07b3; }
.art .bar i { display: block; height: 100%; background: var(--accent); }
.art .badge { position: absolute; top: .4rem; right: .4rem; min-width: 1.5rem; height: 1.5rem; padding: 0 .4rem; border-radius: .25rem; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .8rem; display: flex; align-items: center; justify-content: center; }
.art .badge.seen { background: #060a07d9; color: var(--ok); }
.art .q { position: absolute; top: .4rem; left: .4rem; padding: 0 .4rem; border-radius: .25rem; background: #060a07d9; font-size: .72rem; font-weight: 700; line-height: 1.5rem; }
.art .playico { position: absolute; top: 50%; left: 50%; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem; border-radius: 50%; background: #060a07cc; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; opacity: 0; }
.card:focus .playico, .card:hover .playico { opacity: 1; }
.art .more { position: absolute; right: .4rem; bottom: .7rem; width: 2rem; height: 2rem; border-radius: 50%; background: #060a07d9; color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; cursor: pointer; opacity: 0; }
.card:hover .more { opacity: 1; }
html.tv .art .more { display: none; }
.art .more:hover { background: var(--ink); color: var(--bg); }
.cap { padding: .6rem .1rem 0; }
.cap b { display: block; font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap small { display: block; color: var(--ink2); font-size: .85rem; margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover { transform: scale(1.03); }
.card:focus { transform: scale(1.07); z-index: 2; position: relative; }
.card:focus .art { box-shadow: 0 0 0 .22rem var(--ink); }

/* ---------- Pagina raccolta e filtri ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: baseline; padding: 0 var(--pad); }
.toolbar h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.025em; margin-right: 1.2rem; }
.toolbar .count { color: var(--ink2); font-weight: 500; margin-right: 1.6rem; }
.toolbar .hint { flex: 1 1 100%; margin-top: .3rem; }
/* Intestazione della raccolta: lo stesso quadratino del menu, il nome e un riassunto */
.libhead { align-items: center; flex-wrap: nowrap; }
.libhead > .avatar {
  width: 3.8rem; height: 3.8rem; flex: none; margin-right: 1.2rem; border-radius: .7rem; font-style: normal;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 800; letter-spacing: .02em;
  background: var(--accent); color: var(--accent-ink);
}
.libhead > .avatar.friend { border-radius: 50%; background: var(--surface2); color: var(--ink); }
.libtitle { min-width: 0; flex: 1 1 auto; }
.libhead h1 { margin-right: 0; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.libmeta { margin-top: .3rem; color: var(--ink2); font-weight: 500; }
.libmeta .sep { font-style: normal; margin: 0 .5rem; color: var(--ink3); }
.libmeta b { color: var(--accent-text); font-weight: 600; }
.libmeta .warn { color: var(--warn); }
.libtitle .hint { margin-top: .3rem; }
.filters { display: flex; flex-wrap: wrap; align-items: center; padding: 1rem var(--pad) 0; }
.filter {
  display: inline-flex; align-items: center; padding: .5rem 1rem; margin: 0 .55rem .55rem 0;
  border-radius: var(--r); background: var(--surface); font-size: .95rem; font-weight: 600;
  transition: transform .12s ease-out;
}
.filter span { color: var(--ink2); margin-right: .45rem; font-weight: 500; }
.filter:hover { background: var(--surface2); }
.filter.active { background: var(--surface2); }
.filter.active b { color: var(--accent-text); }
.filter:focus { background: var(--ink); color: var(--bg); transform: scale(1.05); }
.filter:focus span, .filter:focus b { color: var(--bg); }
.empty { padding: 2.5rem var(--pad); color: var(--ink2); font-size: 1.1rem; line-height: 1.7; max-width: 54rem; }
.empty h2 { color: var(--ink); font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-bottom: .9rem; }
.empty p { margin-bottom: .8rem; }
.empty b, .empty code { color: var(--ink); }
.empty.center { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Finestra di scelta ---------- */
#modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50; background: #030504d9; display: flex; align-items: center; justify-content: center; }
#modal[hidden] { display: none; }
.sheet { width: 31rem; max-width: 92vw; max-height: 84vh; display: flex; flex-direction: column; background: var(--surface); border-radius: .7rem; }
.sheet h3 { padding: 1.4rem 1.7rem .9rem; font-size: 1.25rem; line-height: 1.35; }
.sheet .opts { overflow-y: auto; padding: 0 .7rem .9rem; }
.opt { display: flex; align-items: center; width: 100%; text-align: left; padding: .8rem 1rem; border-radius: var(--r); font-size: 1.05rem; }
.opt small { margin-left: auto; padding-left: 1rem; color: var(--ink2); }
.opt .mark { width: 1.5rem; flex: none; color: var(--accent-text); }
.opt.sel { font-weight: 700; }
.opt:hover { background: var(--surface2); }
.opt:focus { background: var(--ink); color: var(--bg); }
.opt:focus small, .opt:focus .mark { color: var(--bg); }
.letters { display: flex; flex-wrap: wrap; padding: 0 1.2rem 1.2rem; }
.letter { width: 3.2rem; height: 3.2rem; margin: 0 .35rem .35rem 0; border-radius: var(--r); background: var(--surface2); font-size: 1.2rem; font-weight: 700; }
.letter[disabled] { color: var(--ink3); background: none; cursor: default; }
.letter:focus { background: var(--ink); color: var(--bg); }

/* ---------- Episodi (come su Netflix) ---------- */
/* Intestazione: «Episodi», il menu della stagione e quanti ne restano; sotto, una riga per
   episodio con numero grande, miniatura, titolo e durata, trama. Righe divise da un filo;
   l'episodio da vedere adesso ha il fondo un po' piu' chiaro. */
.eplist { padding: 1.6rem var(--pad) 0; max-width: 84rem; }
.ephead { display: flex; flex-wrap: wrap; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--surface2); }
.ephead h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.015em; margin-right: 1.4rem; }
.seasonpick {
  display: inline-flex; align-items: center; padding: .55rem .9rem .55rem 1.1rem; margin-right: 1.2rem;
  border-radius: var(--r); border: 1px solid var(--ink3); background: var(--surface); font-size: 1.05rem; font-weight: 700;
}
.seasonpick .ic { width: 1.2em; height: 1.2em; margin-left: .8rem; }
.seasonpick:hover { background: var(--surface2); border-color: var(--ink2); }
.seasonpick:focus { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.epcount { color: var(--ink2); font-weight: 500; }
.ephead .btn { margin: 0 0 0 auto; }
.btn.small { padding: .5rem 1rem; font-size: .92rem; }
.eps { padding: 0; }
.eprow { display: flex; align-items: center; border-bottom: 1px solid var(--surface2); border-radius: var(--r); }
.eprow.cur { background: var(--surface2); border-bottom-color: transparent; }
.eprow:hover { background: var(--surface); }
.eprow.cur:hover { background: #1d2a21; }
.ep {
  flex: 1; min-width: 0; text-align: left; padding: 1.4rem 0 1.4rem 0; border-radius: var(--r);
  display: grid; grid-template-columns: 4.6rem 14rem 1fr; grid-template-rows: auto 1fr;
  grid-template-areas: "num art head" "num art desc"; align-items: start;
}
.ep .num { grid-area: num; align-self: center; text-align: center; color: var(--ink2); font-size: 1.8rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.ep .art { grid-area: art; padding-top: 56.25%; margin-right: 1.4rem; }
.ep .playico { width: 2.6rem; height: 2.6rem; margin: -1.3rem 0 0 -1.3rem; font-size: 1.1rem; border: 2px solid var(--ink); }
.ep .head { grid-area: head; display: flex; align-items: baseline; min-width: 0; padding-top: .2rem; }
.ep h3 { flex: 1; min-width: 0; font-size: 1.12rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep h3 .n { display: none; }
.ep .dur { flex: none; margin-left: 1rem; color: var(--ink2); font-size: .95rem; font-weight: 500; }
.ep .dur.left { color: var(--accent-text); }
.ep p { grid-area: desc; margin-top: .45rem; color: var(--ink2); font-size: .95rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep:hover .playico { opacity: 1; }
/* Con frecce e telecomando: la miniatura prende il bordo chiaro, come le locandine */
.ep:focus .art { box-shadow: 0 0 0 .22rem var(--ink); }
.ep:focus .playico { opacity: 1; }
.ep:focus .num, .ep:focus h3 { color: var(--ink); }
.eprow:focus-within { background: var(--surface2); }
.seenbtn {
  width: 2.6rem; height: 2.6rem; flex: none; margin: 0 1rem 0 1.4rem; border-radius: 50%;
  border: 2px solid var(--ink3); color: var(--ink3); font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
}
.seenbtn:hover { border-color: var(--ink); color: var(--ink); }
.seenbtn.on { border-color: var(--ok); color: var(--ok); }
.seenbtn:focus { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.ep .dur.gone { color: var(--warn); }
.ep .dur .ic { margin-right: .35rem; }
.eprow.off .art img { opacity: .35; }

/* Mentre la pagina scorre con rotella o dito, niente effetti al passaggio del mouse (vedi app.js) */
body.scrolling #view { pointer-events: none; }

/* ---------- Video su un disco scollegato ---------- */
.card.off .art img { opacity: .35; }
.art .q.offb { display: flex; align-items: center; color: var(--warn); }
.art .q.offb .ic { margin-right: .3rem; }
.offnote { display: flex; align-items: flex-start; margin-top: 1.1rem; padding: .8rem 1rem; max-width: 46rem; border-radius: var(--r); background: #e0a0301f; color: var(--ink2); line-height: 1.45; }
.offnote > .ic { width: 1.5rem; height: 1.5rem; margin: .1rem .8rem 0 0; color: var(--warn); }
.offnote b { display: block; color: var(--warn); }
.offnote code, .missing code { color: var(--ink); font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: .92em; word-break: break-all; }
.missing { padding: 0 1.7rem 1rem; color: var(--ink2); line-height: 1.5; }
.missing code { display: block; margin-top: .5rem; padding: .6rem .8rem; border-radius: var(--r); background: var(--bg); }

/* ---------- Cerca / Impostazioni / moduli ---------- */
.field { display: block; width: 100%; padding: .85rem 1.2rem; border-radius: var(--r); background: var(--surface); border: 2px solid var(--surface2); font-size: 1.15rem; outline: none; }
.field::placeholder { color: var(--ink3); }
.field:focus { border-color: var(--ink); background: var(--surface2); }
.searchbox { padding: 0 var(--pad); max-width: 52rem; }
.searchbox .field { font-size: 1.5rem; padding: 1rem 1.4rem; }
.browse { padding: 1.6rem var(--pad) 0; max-width: 62rem; }
.browse h2 { font-size: 1.2rem; margin-bottom: .8rem; }
.panel { margin: 1.4rem var(--pad) 0; padding: 1.6rem 1.8rem; max-width: 60rem; background: var(--surface); border-radius: .7rem; }
.panel h2 { font-size: 1.3rem; margin-bottom: .9rem; }
.panel p { color: var(--ink2); line-height: 1.6; margin-bottom: .8rem; }
.panel p b, .panel p code { color: var(--ink); }
.stats { display: flex; flex-wrap: wrap; margin-bottom: .6rem; }
.stat { margin-right: 2.8rem; margin-bottom: .6rem; }
.stat b { display: block; font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink2); font-size: .9rem; }
.inline { display: flex; align-items: center; }
.inline .field { flex: 1; margin-right: .8rem; }
.inline .btn { margin: 0; }
.result { display: flex; align-items: center; width: 100%; text-align: left; padding: .7rem; margin-bottom: .5rem; border-radius: var(--r); background: var(--surface2); }
.result img, .result .noimg { width: 4.2rem; height: 6.3rem; flex: none; object-fit: cover; border-radius: .25rem; margin-right: 1.1rem; background: var(--bg); }
.result p { margin: .25rem 0 0; font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result:hover { background: #223026; }
.result:focus { background: var(--ink); color: var(--bg); }
.result:focus p { color: #3a4a40; }
.result.dir { padding: .8rem 1rem; font-size: 1.05rem; }
.dirico { width: 2rem; flex: none; color: var(--ink2); font-size: 1.1rem; }
.result.dir:focus .dirico { color: var(--bg); }
/* Amici: le loro raccolte nel menu, e il segno di una richiesta da approvare */
.railitem.friend .avatar { border-radius: 50%; }
.railitem.friend.off { opacity: .55; }
.railitem.alert svg { color: var(--accent, #4cbf7f); stroke: var(--accent, #4cbf7f); }
.railitem.alert::after { content: ''; position: absolute; left: 2.1rem; top: .55rem; width: .6rem; height: .6rem; border-radius: 50%; background: #e5484d; }
.setting { display: flex; align-items: center; width: 100%; text-align: left; padding: .8rem 1rem; margin-bottom: .5rem; border-radius: var(--r); background: var(--surface2); font-weight: 600; }
.setting small { margin-left: auto; padding-left: 1rem; color: var(--ink2); font-size: 1rem; font-weight: 500; }
.setting:hover { background: #223026; }
.setting:focus { background: var(--ink); color: var(--bg); }
.setting:focus small { color: var(--bg); }

/* Raccolte nelle Impostazioni */
.lib { margin-bottom: 1rem; padding: 1.1rem 1.2rem .5rem; border-radius: var(--r); background: var(--surface2); }
.lib .head { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.lib .avatar { width: 2.6rem; height: 2.6rem; flex: none; margin-right: 1rem; border-radius: var(--r); display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; background: var(--bg); }
.lib .name { flex: 1; min-width: 8rem; margin-right: 1rem; }
.lib .name b { display: block; font-size: 1.25rem; }
.lib .name small { color: var(--ink2); font-size: .9rem; }
.lib .btn { margin: .2rem 0 .2rem .5rem; padding: .5rem 1rem; font-size: .92rem; }
.folder { display: flex; align-items: center; padding: .6rem 0 .6rem .2rem; border-top: 1px solid #ffffff14; }
.folder .where { flex: 1; min-width: 0; margin-right: 1rem; }
.folder .where b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .where small { display: block; color: var(--ink2); margin-top: .15rem; font-size: .88rem; }
.folder .btn { margin: 0; flex: none; padding: .45rem .95rem; font-size: .9rem; }

/* ---------- Player (browser) ----------
   Il protagonista e' la barra del tempo: spessa, con la parte gia' caricata, le
   tacche di sigla e titoli di coda e l'anteprima del minuto sotto il puntatore.
   Tutto il resto e' icone bianche su un velo scuro, che spariscono mentre si guarda. */
.player {
  --p-ink: #ffffff; --p-ink2: #c9d2cc; --p-track: #ffffff2e; --p-buf: #ffffff47; --p-fill: var(--accent-text);
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 40; background: #000; color: var(--p-ink); overflow: hidden;
}
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .top, .player .bottom { position: absolute; left: 0; right: 0; padding: 1.5rem 2.4rem; transition: opacity .25s, transform .25s; }
.player .top { top: 0; display: flex; align-items: flex-start; padding-bottom: 4.5rem; background: linear-gradient(#000b, #0000); }
.player .bottom { bottom: 0; padding-top: 5.5rem; padding-bottom: 1.1rem; background: linear-gradient(0deg, #000e, #0008 55%, #0000); }
.player.idle .top, .player.idle .bottom, .player.idle .pmid { opacity: 0; pointer-events: none; }
.player.idle .top { transform: translateY(-.6rem); }
.player.idle .bottom { transform: translateY(.6rem); }
.player.idle { cursor: none; }

.ptitle { min-width: 0; margin-left: .7rem; padding-top: .25rem; }
.ptitle b { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptitle span { display: flex; align-items: center; gap: .55rem; margin-top: .15rem; color: var(--p-ink2); font-size: 1rem; white-space: nowrap; }
.ptitle span em { min-width: 0; font-style: normal; overflow: hidden; text-overflow: ellipsis; }
/* Qualita' accanto all'anno: come il badge delle copertine, ma in linea col testo */
.ptitle .pq { flex: none; padding: .1em .45em; border: 1px solid currentColor; border-radius: .3em; font-style: normal; font-size: .78em; font-weight: 700; letter-spacing: .03em; line-height: 1.2; opacity: .9; }
.pends { margin-left: auto; padding: .7rem 0 0 1.5rem; color: var(--p-ink2); font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Bottoni: icone senza fondo, il fondo compare sotto il puntatore */
.pbtn {
  position: relative; flex: none; width: 3rem; height: 3rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--p-ink); background: none;
  transition: background .12s, transform .12s, box-shadow .12s;
}
.pbtn:hover { background: #ffffff1f; }
.pbtn:active { transform: scale(.9); }
.pbtn:focus { outline: none; }
.pbtn:focus-visible { box-shadow: 0 0 0 .16rem #fff; }
.pbtn.main { width: 3.3rem; height: 3.3rem; margin-right: .35rem; background: #fff; color: #000; font-size: 1.35rem; }
.pbtn.main:hover { background: #fff; transform: scale(1.06); }
.pbtn.wide { width: auto; padding: 0 1.1rem 0 .85rem; border-radius: 99rem; font-size: .95rem; font-weight: 700; }
.pbtn.wide .ic { font-size: 1.15rem; margin-right: .5rem; }
.pbtn.on { color: var(--p-fill); }
.pbtn.on::after { content: ""; position: absolute; left: 32%; right: 32%; bottom: .42rem; height: .16rem; border-radius: 1rem; background: var(--p-fill); }
/* Salti: il numero dei secondi dentro la freccia */
.sk { position: relative; display: inline-flex; }
.sk b { position: absolute; left: 0; right: 0; top: 57%; transform: translateY(-50%); font-size: .4em; font-weight: 800; line-height: 1; text-align: center; letter-spacing: -.02em; }

/* Etichetta con nome e tasto, sopra il bottone (sotto, nella barra in alto) */
.player [data-tip]::before {
  content: attr(data-tip); position: absolute; z-index: 3; bottom: calc(100% + .55rem); left: 50%;
  padding: .38rem .65rem; border-radius: .35rem; background: var(--ink); color: #000;
  font-size: .8rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  opacity: 0; transform: translate(var(--tx, -50%), var(--ty, .25rem)); transition: opacity .12s, transform .12s; pointer-events: none;
}
.player [data-tip]:hover::before, .player [data-tip]:focus-visible::before, .player.nav [data-tip]:focus::before { opacity: 1; --ty: 0; }
.player .ctl > [data-tip]:first-child::before, .player .top [data-tip]::before { left: 0; --tx: 0; }
.player .ctl > [data-tip]:last-child::before { left: auto; right: 0; --tx: 0; }
.player .top [data-tip]::before { bottom: auto; top: calc(100% + .55rem); --ty: -.25rem; }
.player .top [data-tip]:hover::before, .player .top [data-tip]:focus-visible::before { --ty: 0; }

/* Barra del tempo */
.pbar { display: flex; align-items: center; }
.ptime { flex: none; min-width: 3.6rem; font-size: .95rem; font-variant-numeric: tabular-nums; color: var(--p-ink); }
.ptime.end { text-align: right; color: var(--p-ink2); border-radius: .3rem; }
.ptime.end:hover { color: var(--p-ink); }
.ptime.end:focus-visible { outline: .14rem solid #fff; outline-offset: .2rem; }
.ptrack { position: relative; flex: 1; height: 2.4rem; margin: 0 1rem; cursor: pointer; touch-action: none; }
.ptrack .seek { position: absolute; top: 0; left: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: none; }
.ptrack .seek::-webkit-slider-thumb { -webkit-appearance: none; width: 2px; height: 2.4rem; }
.ptrack .seek::-moz-range-thumb { width: 2px; height: 2.4rem; border: 0; }
.ptrack .rail { position: absolute; left: 0; right: 0; top: 50%; height: .34rem; margin-top: -.17rem; border-radius: 99rem; background: var(--p-track); overflow: hidden; transition: transform .15s; }
.ptrack .rail i { position: absolute; top: 0; bottom: 0; left: 0; }
.ptrack .buf { background: var(--p-buf); }
.ptrack .fill { background: var(--p-fill); }
.ptrack .rail .cut { width: .22rem; margin-left: -.11rem; background: #000; }
.ptrack .knob { position: absolute; top: 50%; width: 1.1rem; height: 1.1rem; margin: -.55rem 0 0 -.55rem; border-radius: 50%; background: #fff; transform: scale(.55); transition: transform .15s; pointer-events: none; }
.ptrack:hover .rail, .ptrack.hover .rail, .player.drag .rail { transform: scaleY(1.65); }
.ptrack:hover .knob, .ptrack.hover .knob, .player.drag .knob, .seek:focus-visible ~ .knob { transform: none; }
.seek:focus-visible ~ .rail { box-shadow: 0 0 0 .14rem #fff; }
.ptip {
  position: absolute; bottom: 100%; margin-bottom: .15rem; transform: translateX(-50%);
  padding: .3rem .6rem; border-radius: .35rem; background: var(--ink); color: #000;
  font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: center;
  opacity: 0; transition: opacity .1s; pointer-events: none;
}
.ptip small { display: block; font-size: .72rem; font-weight: 600; color: #35503f; }
.ptrack.hover .ptip { opacity: 1; }

.player .ctl { display: flex; align-items: center; margin-top: .3rem; }
.player .ctl > * + * { margin-left: .2rem; }
.player .grow { flex: 1; }
.pvol { display: flex; align-items: center; }
.vol {
  --v: 100%; -webkit-appearance: none; appearance: none; width: 0; height: .28rem; margin: 0; border-radius: 99rem; opacity: 0;
  background: linear-gradient(90deg, #fff var(--v), #ffffff40 var(--v)); cursor: pointer; outline: none;
  transition: width .18s, opacity .18s, margin .18s;
}
.pvol:hover .vol, .pvol:focus-within .vol { width: 5.5rem; margin: 0 .6rem 0 .2rem; opacity: 1; }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: .85rem; height: .85rem; border-radius: 50%; background: #fff; }
.vol::-moz-range-thumb { width: .85rem; height: .85rem; border: 0; border-radius: 50%; background: #fff; }
.vol:focus-visible { box-shadow: 0 0 0 .14rem #fff; }
.prate { padding: .2rem .5rem; border: 1px solid #ffffff66; border-radius: .3rem; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.prate[hidden] { display: none; }

/* TV: salti e volume col telecomando, quindi niente bottoni per quelli */
html.tv .player .pc { display: none; }
.player .phint { display: none; margin-left: 1rem; color: var(--p-ink2); font-size: .9rem; }
html.tv .player .phint { display: inline; }
/* Bottone scelto col telecomando: ben visibile anche da lontano */
.player.nav .pbtn:focus { background: var(--ink); color: #000; box-shadow: 0 0 0 .25rem var(--accent); transform: scale(1.1); }

/* Al centro: rotella di caricamento, segnale dei comandi, salti */
.pspin { position: absolute; top: 50%; left: 50%; width: 3.6rem; height: 3.6rem; margin: -1.8rem 0 0 -1.8rem; border-radius: 50%; border: .26rem solid #ffffff2b; border-top-color: var(--p-fill); opacity: 0; pointer-events: none; transition: opacity .2s; }
.player.busy .pspin { opacity: 1; animation: spin .8s linear infinite; }
.player .note { position: absolute; top: calc(50% + 3rem); left: 0; right: 0; padding: 0 2rem; text-align: center; color: #fff; font-size: 1.1rem; text-shadow: 0 1px 6px #000; pointer-events: none; }
.pflash { position: absolute; top: 50%; left: 50%; width: 5.2rem; height: 5.2rem; margin: -2.6rem 0 0 -2.6rem; border-radius: 50%; background: #0009; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 2rem; opacity: 0; pointer-events: none; }
.pflash b { margin-top: .15rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.pflash.show { animation: pflash .6s ease-out; }
@keyframes pflash { 0% { opacity: 1; transform: scale(.8); } 35% { opacity: 1; } 100% { opacity: 0; transform: scale(1.3); } }
.skipfx { position: absolute; top: 50%; display: flex; align-items: center; padding: .7rem 1.3rem; border-radius: 99rem;
  background: #000a; color: #fff; font-size: 1.5rem; opacity: 0; transform: translateY(-50%); transition: opacity .15s; pointer-events: none; }
.skipfx b { margin: 0 .55rem; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.skipfx.left { left: 9%; }
.skipfx.right { right: 9%; }
.skipfx.show { opacity: 1; }
/* Sul telefono Play e salti stanno al centro dello schermo */
.pmid { position: absolute; top: 50%; left: 50%; display: none; align-items: center; transform: translate(-50%, -50%); transition: opacity .25s; }
.pmid .pbtn { width: 3.8rem; height: 3.8rem; margin: 0 1.4rem; font-size: 2rem; background: #0007; }
.pmid .pbtn.main { width: 5rem; height: 5rem; font-size: 2rem; background: #0007; color: #fff; }
.player.busy .pmid .main { visibility: hidden; }

/* «Salta intro» e la scheda dei titoli di coda: restano anche a comandi nascosti */
.pskip, .pcard { position: absolute; right: 2.4rem; bottom: 9.6rem; z-index: 2; transition: transform .25s; animation: rise .3s cubic-bezier(.2, .8, .2, 1); }
.player.idle .pskip, .player.idle .pcard { transform: translateY(7rem); }
.pskip { padding: .85rem 1.6rem; border-radius: 99rem; background: #fff; color: #000; font-size: 1.05rem; font-weight: 700; }
.pskip:hover { background: var(--ink); }
.pskip:focus { outline: none; }
.pskip:focus-visible { box-shadow: 0 0 0 .25rem var(--accent); }
.pskip[hidden], .pcard[hidden] { display: none; }
.pcard { width: 28rem; max-width: calc(100vw - 2rem); padding: 1.1rem 1.1rem 1rem; border-radius: .8rem; background: var(--surface); border: 1px solid #ffffff17; }
.pcard small { display: block; color: var(--ink2); font-size: .85rem; }
.pcard > b { display: block; margin: .2rem 0 .9rem; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-b { display: flex; }
.pcb { position: relative; flex: 1; overflow: hidden; padding: .75rem .8rem; border-radius: .5rem; background: var(--surface2); font-size: .92rem; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.pcb + .pcb { margin-left: .6rem; }
.pcb.go { background: #fff; color: #000; }
.pcb.go i { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: var(--p-fill); transform: scaleX(0); transform-origin: 0 50%; }
.pcard.auto .pcb.go i { transition: transform 1s linear; }
.pcb span { position: relative; }
.pcb:focus { outline: none; box-shadow: 0 0 0 .2rem #fff; }
.pcb:not(.go):focus { background: var(--ink); color: #000; }

.player.subs-s video::cue { font-size: 3.2vh; }
.player.subs-l video::cue { font-size: 6.5vh; }
.player.subs-xl video::cue { font-size: 8.5vh; }

/* Col dito: niente etichette al passaggio, comandi principali al centro */
@media (hover: none) and (pointer: coarse) {
  html:not(.tv) .player .pmid { display: flex; }
  html:not(.tv) .player .ctl [data-p=toggle], html:not(.tv) .player .ctl [data-p=back],
  html:not(.tv) .player .ctl [data-p=fwd], html:not(.tv) .player .pvol { display: none; }
  html:not(.tv) .player [data-tip]::before { display: none; }
  html:not(.tv) .player .ptrack .knob { transform: none; }
}

#toast { position: fixed; left: 50%; bottom: 2.5rem; transform: translate(-50%, 2rem); z-index: 60; max-width: 90vw; padding: .8rem 1.4rem; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: 700; opacity: 0; transition: opacity .16s, transform .16s; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Apertura ----------
   Circa 1,4 s piu' l'uscita: alone verde, il marchio entra con un rimbalzo e il
   triangolo si accende, le lettere salgono una dopo l'altra, un riflesso passa sul
   marchio, una linea si allunga sotto il nome; poi tutto si allarga e sfuma nella Home.
   Solo opacita' e trasformazioni; mai sui dispositivi lenti (lo script in index.html). */
#intro { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; transition: opacity .38s linear; }
#intro.out { opacity: 0; pointer-events: none; }
.intro-glow {
  position: absolute; top: 50%; left: 50%; width: 84vmin; height: 84vmin; margin: -42vmin 0 0 -42vmin; border-radius: 50%;
  background: radial-gradient(closest-side, #1a7f4573, #1a7f4529 55%, #1a7f4500);
  animation: intro-glow 1.3s cubic-bezier(.2, .7, .3, 1) both;
}
#intro.out .intro-glow { animation: intro-glow-out .4s cubic-bezier(.4, 0, 1, 1) both; }
.intro-box { position: relative; display: flex; flex-direction: column; align-items: center; transition: transform .4s cubic-bezier(.4, 0, .2, 1); }
#intro.out .intro-box { transform: scale(1.1); }
.intro-word { display: flex; align-items: center; font-size: 5rem; font-weight: 400; letter-spacing: -.03em; line-height: 1.1; }
.intro-word b { font-weight: 800; }
.intro-badge {
  position: relative; display: block; flex: none; width: 1em; height: 1em; margin-right: .28em; border-radius: 22%; overflow: hidden;
  animation: intro-mark .6s cubic-bezier(.2, .9, .3, 1.35) both;
}
.intro-badge svg { display: block; width: 100%; height: 100%; }
.intro-play { transform-origin: 34px 32px; animation: intro-play .45s .28s cubic-bezier(.2, .9, .3, 1.5) both; }
/* Il riflesso: una striscia chiara che attraversa il marchio (tagliata dai suoi bordi) */
.intro-badge::after {
  content: ""; position: absolute; top: -15%; bottom: -15%; left: 0; width: 42%;
  background: linear-gradient(90deg, #ffffff00, #ffffff8c, #ffffff00);
  animation: intro-sheen .5s .88s cubic-bezier(.4, 0, .2, 1) both;
}
.intro-name { display: block; white-space: nowrap; }
.intro-name i { display: inline-block; font-style: normal; animation: intro-letter .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.22s + var(--i) * .035s); }
.intro-line {
  display: block; width: 100%; height: .18rem; margin-top: 1.5rem; border-radius: .2rem;
  background: linear-gradient(90deg, #4cbf7f00, var(--accent-text), #4cbf7f00);
  animation: intro-line 1s .32s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes intro-glow { 0% { opacity: 0; transform: scale(.5); } 45% { opacity: 1; } 100% { opacity: .8; transform: scale(1.06); } }
@keyframes intro-glow-out { from { opacity: .8; transform: scale(1.06); } to { opacity: 0; transform: scale(1.7); } }
@keyframes intro-mark { 0% { opacity: 0; transform: scale(.3) rotate(-14deg); } 55% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes intro-play { from { opacity: 0; transform: scale(.2) translateX(-6px); } }
@keyframes intro-sheen { from { transform: translateX(-160%) skewX(-20deg); } to { transform: translateX(320%) skewX(-20deg); } }
@keyframes intro-letter { from { opacity: 0; transform: translateY(.38em); } }
@keyframes intro-line { 0% { opacity: 1; transform: scaleX(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: scaleX(1); } }

/* ---------- Con il mouse o il dito: niente elemento "selezionato" ---------- */
/* La selezione chiara serve a chi usa frecce e telecomando; col mouse basta il passaggio sopra. */
body:not(.kb) .btn:focus { background: #ffffff24; color: inherit; transform: none; }
body:not(.kb) .btn.primary:focus { background: var(--accent); color: var(--accent-ink); }
body:not(.kb) .btn.on:focus { color: var(--ok); }
body:not(.kb) .card:focus { transform: none; }
body:not(.kb) .card:focus .art { box-shadow: none; }
body:not(.kb) .card:hover { transform: scale(1.03); }
body:not(.kb) .filter:focus { background: var(--surface); color: inherit; transform: none; }
body:not(.kb) .filter.active:focus { background: var(--surface2); }
body:not(.kb) .filter:focus span { color: var(--ink2); }
body:not(.kb) .filter:focus b { color: inherit; }
body:not(.kb) .filter.active:focus b { color: var(--accent-text); }
body:not(.kb) .chip:focus { background: var(--surface2); color: var(--ink); }
body:not(.kb) .ep:focus .art { box-shadow: none; }
body:not(.kb) .ep:focus .num { color: var(--ink2); }
body:not(.kb) .ep:focus h3 { color: inherit; }
body:not(.kb) .ep:focus:not(:hover) .playico { opacity: 0; }
body:not(.kb) .eprow:focus-within { background: none; }
body:not(.kb) .eprow.cur:focus-within { background: var(--surface2); }
body:not(.kb) .eprow:hover { background: var(--surface); }
body:not(.kb) .seenbtn:focus { background: none; border-color: var(--ink3); color: var(--ink3); }
body:not(.kb) .seenbtn.on:focus { border-color: var(--ok); color: var(--ok); }
body:not(.kb) .seasonpick:focus { background: var(--surface); color: inherit; border-color: var(--ink3); }
body:not(.kb) .railitem:focus { background: none; color: var(--ink2); }
body:not(.kb) .railitem.on:focus { color: var(--ink); background: var(--surface2); }
body:not(.kb) .railitem:focus .avatar { background: var(--surface2); }
body:not(.kb) .railitem.on:focus svg { color: var(--accent-text); }
body:not(.kb) .railitem.on:focus .avatar { background: var(--accent); color: var(--accent-ink); }
body:not(.kb) .opt:focus { background: none; color: inherit; }
body:not(.kb) .opt:focus small { color: var(--ink2); }
body:not(.kb) .opt:focus .mark { color: var(--accent-text); }
body:not(.kb) .opt:hover { background: var(--surface2); }
body:not(.kb) .result:focus, body:not(.kb) .setting:focus { background: var(--surface2); color: inherit; }
body:not(.kb) .result:focus p { color: var(--ink2); }
body:not(.kb) .setting:focus small { color: var(--ink2); }
body:not(.kb) .letter:focus { background: var(--surface2); color: inherit; }

/* ---------- Telefono ---------- */
@media (max-width: 720px) {
  :root { --pad: 1.1rem; --rail: 0rem; --poster: 6.6rem; --stage: 46vh; }
  html, html.tv { font-size: 15px; }
  #rail, #rail:hover, #rail:focus-within { top: auto; right: 0; bottom: 0; width: auto; height: 4.2rem; padding: .3rem .4rem; flex-direction: row; align-items: stretch; overflow-x: auto; background: var(--surface); }
  .brand, .raillabel, .spacer { display: none; }
  #navlibs { flex-direction: row; overflow: visible; flex: none; }
  .railitem { flex-direction: column; justify-content: center; height: auto; min-width: 4.4rem; margin: 0 .1rem 0 0; padding: 0 .4rem; }
  .railitem svg, .railitem .avatar { width: 1.7rem; height: 1.7rem; padding: .15rem; font-size: .7rem; }
  .railitem span, #rail:hover .railitem span { opacity: 1; margin: .15rem 0 0; padding: 0; font-size: .72rem; font-weight: 500; max-width: 5.4rem; }
  .railitem.on::before { left: .8rem; right: .8rem; top: 0; bottom: auto; width: auto; height: .2rem; border-radius: 0 0 .2rem .2rem; }
  #view { padding-bottom: 6.5rem; }
  .stage .info { width: auto; right: var(--pad); bottom: 1rem; }
  .stage .bg { width: 100%; }
  .stage .shade { background: linear-gradient(0deg, #060a07 8%, #060a07d9 46%, #060a0733 100%); }
  .stage h1, .hero h1 { font-size: 2rem; }
  .stage .overview { -webkit-line-clamp: 2; }
  .rows { bottom: 4.2rem; }
  .rows .card.poster { width: 16vh; }
  .rows .card.wide { width: 30vh; }
  .hero { padding-top: 4rem; }
  .hero .cover { display: none; }
  .toolbar h1 { font-size: 2rem; }
  .libhead > .avatar { width: 2.9rem; height: 2.9rem; margin-right: .9rem; font-size: 1rem; }
  .libmeta { font-size: .9rem; }
  .grid { grid-gap: 1.2rem .8rem; gap: 1.2rem .8rem; }
  /* Episodi sul telefono, come nell'app: miniatura e titolo affiancati, trama sotto */
  .ep { grid-template-columns: 9.5rem 1fr; grid-template-areas: "art head" "desc desc"; padding: 1rem 0 1rem .2rem; }
  .ep .num { display: none; }
  .ep .art { margin-right: .9rem; }
  .ep .head { flex-direction: column; align-self: center; padding: 0; }
  .ep h3 { flex: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 1rem; }
  .ep h3 .n { display: inline; }
  .ep .dur { margin: .25rem 0 0; font-size: .88rem; }
  .ep p { margin-top: .7rem; font-size: .9rem; }
  .ep .playico { opacity: 1; }
  .eprow { align-items: flex-start; }
  .seenbtn { width: 2.3rem; height: 2.3rem; margin: 2.2rem .2rem 0 .6rem; font-size: 1rem; }
  .ephead h2 { font-size: 1.3rem; }
  .ephead .btn { margin: .8rem 0 0; }
  .lib .btn { margin-left: 0; margin-right: .5rem; }
  .panel { padding: 1.2rem; }
  .inline { flex-wrap: wrap; }
  .inline .field { flex: 1 1 100%; margin: 0 0 .6rem; }
  .player .top { padding: 1rem 1rem 3.5rem; }
  .player .bottom { padding: 4rem 1rem .6rem; }
  .ptitle b { font-size: 1.15rem; }
  .ptitle span { font-size: .9rem; }
  .pends { padding-top: .5rem; font-size: .85rem; }
  .ptime { min-width: 0; font-size: .85rem; }
  .ptrack { margin: 0 .8rem; }
  .pbtn.wide { width: 3rem; padding: 0; border-radius: 50%; }
  .pbtn.wide .ic { margin: 0; }
  .pbtn.wide span { display: none; }
  .pvol { display: none; }
  .pskip, .pcard { right: 1rem; bottom: 7.6rem; }
  .pcard { width: calc(100vw - 2rem); }
  .pmid .pbtn { margin: 0 .9rem; }
  .intro-word { font-size: 3rem; }
  #toast { bottom: 5rem; }
}

/* ---------- Animazioni ridotte: dispositivi lenti o scelta dell'utente ---------- */
html.lite *, html.lite *::before, html.lite *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Cast con le foto ---------- */
.hero.more { min-height: 76vh; }
.people { margin-top: 1.6rem; }
.people .row { padding-top: 1.2rem; }
.person { flex: none; display: block; width: 8.4rem; margin-right: 1.2rem; text-align: center; transition: transform .16s cubic-bezier(.2, .9, .3, 1.2); }
.face { position: relative; display: block; width: 7rem; height: 7rem; margin: 0 auto .7rem; border-radius: 50%; overflow: hidden; background: var(--surface2); }
.face i { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 1.6rem; font-weight: 700; color: var(--ink2); }
.face img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; z-index: 1; }
.person b { display: block; font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; margin-top: .15rem; color: var(--ink2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person:hover .face { box-shadow: 0 0 0 .18rem var(--ink2); }
body.kb .person:focus { transform: scale(1.08); }
body.kb .person:focus .face { box-shadow: 0 0 0 .22rem var(--ink); }
@media (max-width: 720px) { .person { width: 6.4rem; } .face { width: 5.4rem; height: 5.4rem; } }

/* ---------- Animazioni ---------- */
/* Solo opacita' e spostamenti (li disegna la scheda grafica, non pesano sul processore).
   Con le animazioni ridotte spariscono tutte: vedi html.lite qui sotto. */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(1.4rem); } }
@keyframes slide { from { opacity: 0; transform: translateX(-1.2rem); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes drift { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes grow { from { transform: scaleX(0); } }

/* Pagina nuova: il contenuto sale, le file e le locandine arrivano una dopo l'altra.
   Corte e quasi senza attese: la pagina deve sembrare pronta appena si preme OK. */
#view.enter .page, #view.enter .hero .txt, #view.enter .hero .cover, #view.enter .eplist, #view.enter .people { animation: rise .22s cubic-bezier(.2, .8, .2, 1) backwards; }
#view.enter .hero .cover { animation-delay: .03s; }
#view.enter .hero .bg { animation: fade .3s linear backwards; }
#view.enter .rows .section { animation: rise .24s cubic-bezier(.2, .8, .2, 1) backwards; }
#view.enter .rows .section:nth-child(2) { animation-delay: .03s; }
#view.enter .rows .section:nth-child(n+3) { animation-delay: .06s; }
#view.enter .grid .card:nth-child(-n+24) { animation: rise .22s cubic-bezier(.2, .8, .2, 1) backwards; }
#view.enter .grid .card:nth-child(6n+3), #view.enter .grid .card:nth-child(6n+4) { animation-delay: .02s; }
#view.enter .grid .card:nth-child(6n+5), #view.enter .grid .card:nth-child(6n+6) { animation-delay: .04s; }
#view.enter .actions .btn { animation: rise .22s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: .04s; }
#view.enter .actions .btn:nth-child(n+2) { animation-delay: .06s; }
#view.enter .person { animation: pop .22s cubic-bezier(.2, .8, .2, 1) backwards; }
#view.enter .person:nth-child(2n) { animation-delay: .03s; }

/* Sagome grigie mentre la pagina arriva (prima volta o rete lenta) */
.skel { display: block; background: var(--surface2); animation: skel 1.2s ease-in-out infinite alternate; }
.art.skel { padding-top: 150%; }
i.skel.title { width: 18rem; max-width: 70%; height: 2.4rem; border-radius: var(--r); }
i.skel.line { width: 28rem; max-width: 80%; height: 1rem; margin-top: .8rem; border-radius: .3rem; }
i.skel.short { width: 14rem; }
.section h2 i.skel.line { width: 10rem; margin: 0; }
@keyframes skel { from { opacity: .55; } to { opacity: 1; } }

/* Home: il testo dell'anteprima scivola dentro a ogni cambio, lo sfondo si assesta piano */
.stage .info.in > * { animation: slide .34s cubic-bezier(.2, .8, .2, 1) backwards; }
.stage .info.in > *:nth-child(2) { animation-delay: .05s; }
.stage .info.in > *:nth-child(n+3) { animation-delay: .1s; }
.stage .bg.on { animation: drift 9s cubic-bezier(.2, .6, .3, 1) both; }
.hero .bg { transform-origin: 70% 30%; }

/* Selezione: la locandina "scatta" in avanti, i pulsanti rispondono alla pressione */
.card { transition: transform .18s cubic-bezier(.2, .9, .3, 1.25); }
.art .bar i { transform-origin: 0 50%; }
#view.enter .art .bar i { animation: grow .4s .1s cubic-bezier(.2, .8, .2, 1) backwards; }
.btn:active, .filter:active, .chip:active, .opt:active, .setting:active, .result:active, .letter:active { transform: scale(.96); }
.railitem span { transition: opacity .16s linear, transform .2s cubic-bezier(.2, .8, .2, 1); transform: translateX(-.5rem); }
#rail:hover .railitem span, #rail:focus-within .railitem span { transform: none; }
.railitem.on::before { animation: pop .25s ease-out; }

/* Finestre di scelta e avvisi */
#modal { animation: fade .16s linear; }
.sheet { animation: pop .2s cubic-bezier(.2, .9, .3, 1.15); }
.opt { animation: rise .26s cubic-bezier(.2, .8, .2, 1) backwards; }
.opt:nth-child(2) { animation-delay: .03s; } .opt:nth-child(3) { animation-delay: .06s; }
.opt:nth-child(4) { animation-delay: .09s; } .opt:nth-child(n+5) { animation-delay: .12s; }

/* Locandine e foto in dissolvenza quando l'immagine e' arrivata, invece di comparire
   di colpo a meta' disegno. html.imgfade c'e' solo senza animazioni ridotte; la classe
   .imgok la mette app.js all'evento load (subito, se l'immagine era gia' pronta).
   Non .in: c'e' gia' .hero .in, che renderebbe la locandina della scheda "relative". */
html.imgfade .art img, html.imgfade .face img { opacity: 0; transition: opacity .3s linear; }
html.imgfade .art img.imgok, html.imgfade .face img.imgok { opacity: 1; }

/* Telecomando: sulla locandina scelta passa un riflesso di luce. Il pezzo in piu' esiste
   solo sulla locandina col fuoco (uno alla volta) e parte dopo un attimo, cosi'
   scorrendo veloce con le frecce non si accende su ogni locandina. */
body.kb .card:focus .art::after {
  content: ""; position: absolute; top: -10%; bottom: -10%; left: 0; width: 40%; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, #ffffff00, #ffffff40, #ffffff00);
  animation: sheen .7s .16s cubic-bezier(.45, .05, .35, 1) both;
}
@keyframes sheen { from { transform: translateX(-170%) skewX(-18deg); } to { transform: translateX(330%) skewX(-18deg); } }

/* «La mia lista» e «Visto»: la conferma fa un piccolo scatto (classe .popped da app.js) */
.btn.popped, .seenbtn.popped { animation: press .36s cubic-bezier(.2, .9, .3, 1.4); }
.btn.popped .ic, .seenbtn.popped .ic { animation: tick .42s cubic-bezier(.2, .9, .3, 1.6); }
@keyframes press { 0% { transform: scale(.9); } 55% { transform: scale(1.1); } }
@keyframes tick { 0% { opacity: 0; transform: scale(.2) rotate(-30deg); } 60% { opacity: 1; transform: scale(1.3); } }

/* Impostazioni: il menu dell'area resta fermo, entrano solo titolo, righe e pannelli,
   uno dopo l'altro (pochi elementi, attese brevissime) */
#view.enter .page.settings { animation: none; }
#view.enter .smain > *, #view.enter .soverview > *, #view.enter .slist .srow:nth-child(-n+14) { animation: rise .24s cubic-bezier(.2, .8, .2, 1) backwards; }
#view.enter .soverview > .slist { animation: none; }
#view.enter .smain > :nth-child(n+3), #view.enter .soverview > :nth-child(n+3) { animation-delay: .03s; }
#view.enter .smain > :nth-child(n+4), #view.enter .soverview > :nth-child(n+5) { animation-delay: .06s; }
#view.enter .smain > :nth-child(n+5) { animation-delay: .09s; }
#view.enter .slist .srow:nth-child(n+3) { animation-delay: .02s; }
#view.enter .slist .srow:nth-child(n+5) { animation-delay: .04s; }
#view.enter .slist .srow:nth-child(n+7) { animation-delay: .06s; }
#view.enter .slist .srow:nth-child(n+9) { animation-delay: .08s; }


@media (max-width: 720px) { .railitem span, #rail:hover .railitem span { transform: none; } }
html.lite *, html.lite *::before, html.lite *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Accesso con l'account: niente menu finche' non si e' entrati */
body.locked #rail { display: none; }
body.locked #view { margin-left: 0; }
.panel.login { max-width: 34rem; margin: 9vh auto 0; }
.panel.login h1 { font-size: 1.9rem; margin-bottom: 1rem; letter-spacing: -.01em; }
.profiles { display: flex; flex-wrap: wrap; gap: .8rem; }
.profile { display: flex; flex-direction: column; align-items: center; width: 8.5rem; padding: 1rem .6rem; border-radius: var(--r); background: var(--surface2); font-weight: 600; }
.profile .avatar { width: 4.2rem; height: 4.2rem; margin-bottom: .6rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 1.5rem; font-weight: 700; background: var(--bg); }
.profile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile:focus { background: var(--ink); color: var(--bg); }
.profile.on { box-shadow: inset 0 0 0 2px var(--ink); }
@media (max-width: 720px) { .panel.login { margin: 2rem 1rem 0; } }
.panel.login.wide { max-width: 44rem; }

/* Modalita' offline */
.offbox { margin: 0 0 1.4rem; padding: 1rem 1.2rem; border-radius: var(--r); background: var(--surface2); border-left: 4px solid #d9a441; }
.offbox h2 { margin-bottom: .5rem; }
#offpill { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; padding: .45rem .9rem; border-radius: 999px; background: #3a2f12; color: #f3d48a; font-size: .9rem; font-weight: 600; pointer-events: none; }
#offpill[hidden] { display: none; }

/* ---------- Persone: ognuno ha un volto fisso (iniziale su una tinta tenue tutta sua) ---------- */
.uface {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2rem; height: 2rem; border-radius: 50%; font-style: normal; font-weight: 700; font-size: .95rem;
  background: hsl(var(--h) 26% 21%); color: hsl(var(--h) 62% 80%);
}
.uface.mid { width: 2.7rem; height: 2.7rem; font-size: 1.15rem; }
.uface.big { width: 4.6rem; height: 4.6rem; font-size: 2rem; }
.railitem .uface { width: 2rem; height: 2rem; font-size: .9rem; }
.railitem:focus .uface, .snav:focus .uface { background: var(--bg); color: var(--ink); }
.profile .uface { margin-bottom: .6rem; }
.profile:focus .uface { background: var(--bg); color: var(--ink); }

/* ---------- Impostazioni: panoramica ---------- */
.settings .stitle { font-size: 2rem; font-weight: 700; letter-spacing: -.015em; margin-bottom: .45rem; }
.settings .ssub { color: var(--ink2); font-size: 1.05rem; line-height: 1.5; margin-bottom: 1.6rem; max-width: 46rem; }
.settings .ssub.warn { color: var(--warn); }
.soverview { padding: 0 var(--pad); max-width: calc(60rem + 2 * var(--pad)); }
/* Versioni di server e app, sotto il titolo */
.versions { display: flex; flex-wrap: wrap; gap: .7rem; margin: -.4rem 0 1.4rem; }
.vchip { display: flex; flex-direction: column; gap: .1rem; min-width: 11rem; padding: .7rem 1rem; border-radius: .7rem;
  background: var(--surface); border-left: 3px solid var(--ok); }
.vchip.warn { border-left-color: var(--warn); }
.vchip small { color: var(--ink2); font-size: .85rem; }
.vchip b { font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; }
.vchip span { color: var(--ink2); font-size: .85rem; }
.vchip.warn span { color: var(--warn); }
/* Le versioni aprono Aggiornamenti: tutto il riquadro e' un pulsante (una pressione col telecomando) */
a.versions { color: inherit; text-decoration: none; align-items: stretch; }
.versions .vgo { display: flex; align-items: center; gap: .3rem; padding: 0 .4rem; color: var(--ink2); font-size: .9rem; font-weight: 600; }
a.versions:hover .vchip { background: var(--surface2); }
a.versions:focus .vchip { background: var(--ink); color: var(--bg); }
a.versions:focus .vchip small, a.versions:focus .vchip span { color: var(--bg); }
a.versions:focus .vgo { color: var(--ink); }
a.versions:focus .vgo .chev { stroke: var(--ink); }
.slist { background: var(--surface); border-radius: .7rem; padding: .35rem; }
.srow { display: flex; align-items: center; gap: 1rem; min-height: 4.5rem; padding: .7rem 1rem; border-radius: var(--r); }
.srow + .srow { border-top: 1px solid #ffffff0d; }
.srow:hover { background: var(--surface2); }
.srow:focus { background: var(--ink); color: var(--bg); }
.srow:focus + .srow, .srow:hover + .srow { border-top-color: transparent; }
.stext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stext b { font-size: 1.12rem; font-weight: 600; }
.stext small { color: var(--ink2); font-size: .92rem; margin-top: .15rem; }
.sval { flex: none; display: flex; align-items: center; gap: .5rem; color: var(--ink2); font-size: .98rem; text-align: right; }
.sval.ok::before, .sval.warn::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); }
.sval.warn { color: var(--warn); }
.sval.warn::before { background: var(--warn); }
.chev { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: var(--ink3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.srow:focus .stext small, .srow:focus .sval { color: var(--bg); }
.srow:focus .sval::before { background: var(--bg); }
.srow:focus .chev { stroke: var(--bg); }
.srow:focus .uface { background: var(--bg); color: var(--ink); }

/* ---------- Impostazioni: una vista per area, con l'elenco delle aree a sinistra ---------- */
.sgrid { display: grid; grid-template-columns: 15rem minmax(0, 52rem); gap: 2.6rem; padding: 0 var(--pad); }
.scol { display: flex; flex-direction: column; position: sticky; top: 3rem; align-self: start; }
/* L'area aperta: fondo pieno, barretta verde a sinistra e icona verde, come nel menu */
.snav { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 2.9rem; margin-bottom: .15rem; padding: .35rem .8rem; border-radius: var(--r); color: var(--ink2); font-weight: 600; white-space: nowrap; }
.snav span { overflow: hidden; text-overflow: ellipsis; }
.sic { width: 1.35rem; height: 1.35rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--ink3); }
.snav .uface { width: 1.6rem; height: 1.6rem; font-size: .78rem; }
.snav.home { margin-bottom: .7rem; }
.snav.on { background: var(--surface2); color: var(--ink); }
.snav.on::before { content: ""; position: absolute; left: 0; top: .55rem; bottom: .55rem; width: .22rem; border-radius: 0 .2rem .2rem 0; background: var(--accent); }
.snav.on .sic { color: var(--accent-text); }
.snav:hover { color: var(--ink); background: var(--surface); }
.snav:hover .sic { color: var(--ink2); }
.snav.on:hover { background: var(--surface2); }
.snav.on:hover .sic { color: var(--accent-text); }
.snav:focus { background: var(--ink); color: var(--bg); }
.snav:focus .sic { color: var(--bg); }
.snav:focus::before { background: var(--bg); }
body:not(.kb) .snav:focus { background: none; color: var(--ink2); }
body:not(.kb) .snav:focus .sic { color: var(--ink3); }
body:not(.kb) .snav:focus .uface { background: var(--surface2); color: var(--ink); }
body:not(.kb) .snav.on:focus { background: var(--surface2); color: var(--ink); }
body:not(.kb) .snav.on:focus .sic { color: var(--accent-text); }
body:not(.kb) .snav.on:focus::before { background: var(--accent); }
.sup { display: none; }
.smain .panel { margin: 0 0 1.2rem; max-width: none; }
.flabel { display: block; margin-bottom: .45rem; font-weight: 600; font-size: .95rem; }
.joined { display: flex; }
.joined .field { flex: 1; min-width: 0; border-radius: var(--r) 0 0 var(--r); }
.joined .btn { margin: 0; border-radius: 0 var(--r) var(--r) 0; }
.link { color: var(--accent-text); font-weight: 600; border-radius: 3px; }
.link:focus { background: var(--ink); color: var(--bg); }

/* Account: chi sei, com'e' il collegamento, cosa ti segue */
.panel.who { display: flex; align-items: center; gap: 1.4rem; }
.whotext h2 { font-size: 1.7rem; margin-bottom: .2rem; }
.panel .whotext p { margin-bottom: .25rem; }
.panel .whotext p.sync { display: flex; align-items: center; gap: .5rem; margin: .3rem 0 0; font-weight: 600; color: var(--ok); }
.sync::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.panel .whotext p.sync.warn { color: var(--warn); }
.panel .whotext p.sync.local { color: var(--ink2); }
.kv { display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; margin: 0; }
.kv dt, .kv dd { margin: 0; padding: .8rem 0; border-top: 1px solid #ffffff0f; }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; }
.kv dt { color: var(--ink2); }
.kv dd { text-align: right; }
.panel p.kvnote { margin: .7rem 0 0; color: var(--ink2); font-size: .92rem; }

/* Persone (solo amministratore) */
.panel.accts { padding: .5rem 1.2rem; }
.acct { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding: .95rem .2rem; }
.acct + .acct { border-top: 1px solid #ffffff0f; }
.ptext { flex: 1; min-width: 14rem; }
.ptext b { font-size: 1.12rem; margin-right: .55rem; }
.ptext small { display: block; margin-top: .25rem; color: var(--ink2); }
.pill { display: inline-block; flex: none; margin-right: .35rem; padding: 0 .6rem; border-radius: 999px; background: var(--surface2); color: var(--ink2); font-size: .82rem; font-weight: 600; line-height: 1.7; white-space: nowrap; vertical-align: .1em; }
.pill.warn { background: #3a2f12; color: #f3d48a; }
.pacts { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill.admin { background: #1d3550; color: #9fcbff; }
.acct.off .ptext b, .acct.off .uface { opacity: .5; }
.acct .aedit { flex-basis: 100%; margin-top: .2rem; }

/* Plancia: le schede in cima */
.atabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.2rem; }
.atab { padding: .55rem 1.1rem; border: 0; border-radius: 999px; background: var(--surface); color: var(--ink2); font: inherit; font-weight: 600; cursor: pointer; }
.atab.on { background: var(--ink); color: var(--bg); }
@media (max-width: 600px) { .atabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .atab { flex: none; } }
.pacts .btn { margin: 0; padding: .5rem 1rem; font-size: .92rem; }

/* Nome e password provvisoria da comunicare */
.sheet.secret { padding-bottom: 1.5rem; }
.secretbody { display: flex; align-items: center; gap: 1.3rem; padding: 0 1.7rem; }
.secretbody dl { margin: 0; }
.secretbody dt { color: var(--ink2); font-size: .9rem; }
.secretbody dd { margin: 0 0 .6rem; font-size: 1.3rem; font-weight: 700; }
.secretbody dd.pw { margin-bottom: 0; font-size: 1.55rem; letter-spacing: .02em; }
.secretnote { padding: .9rem 1.7rem 0; color: var(--ink2); line-height: 1.5; }
.sheet.secret .actions { padding: 0 1.7rem; margin-top: 1.1rem; }
.num { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  /* Schermo stretto: le aree diventano una fila di schede che scorre, sempre in vista.
     Non sulla TV: in rem ha lo spazio della 1280x720 e la colonna delle aree regge,
     mentre a 960x540 la fila finirebbe sotto i pulsanti in alto a destra */
  html:not(.tv) .sgrid { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  html:not(.tv) .scol { position: relative; top: auto; flex-direction: row; gap: .4rem; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) .2rem; scroll-padding: 0 var(--pad); }
  html:not(.tv) .snav, html:not(.tv) .snav.home { flex: none; min-height: 2.6rem; margin: 0; padding: .3rem .95rem .3rem .75rem; border-radius: 999px; background: var(--surface); gap: .5rem; }
  html:not(.tv) .snav.on { background: var(--accent); color: var(--accent-ink); }
  html:not(.tv) .snav.on::before { display: none; }
  html:not(.tv) .snav.on .sic, html:not(.tv) .snav.on:hover .sic { color: var(--accent-ink); }
  html:not(.tv) .snav.on:hover { background: var(--accent); }
  html:not(.tv) body:not(.kb) .snav:focus { background: var(--surface); }
  html:not(.tv) body:not(.kb) .snav.on:focus { background: var(--accent); color: var(--accent-ink); }
  html:not(.tv) body:not(.kb) .snav.on:focus .sic { color: var(--accent-ink); }
  html:not(.tv) .sic { width: 1.15rem; height: 1.15rem; }
  html:not(.tv) .snav .uface { width: 1.4rem; height: 1.4rem; font-size: .7rem; }
}
@media (max-width: 720px) {
  .srow { gap: .8rem; padding: .7rem .6rem; }
  .srow .sval { max-width: 42%; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dd { text-align: left; padding-top: 0; border-top: 0; }
  .panel.who { gap: 1rem; }
  .uface.big { width: 3.6rem; height: 3.6rem; font-size: 1.6rem; }
  .secretbody { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 720px) { .railitem.me { display: none; } }

/* ---------- Attivita': operazioni in corso e notifiche, in alto a destra ---------- */
#activity { position: fixed; top: .75rem; right: var(--pad); z-index: 40; display: flex; gap: .5rem; }
#activity[hidden], body.playing #activity, body.locked #activity { display: none; }
html.tv #activity { right: calc(var(--pad) + 5.4rem); top: 1.05rem; }
.actbtn {
  position: relative; display: flex; align-items: center; gap: .55rem; height: 2.5rem; min-width: 2.5rem;
  padding: 0 .75rem; border-radius: 999px; background: var(--surface2); color: var(--ink); font-weight: 600; font-size: .95rem;
  justify-content: center;
}
.actbtn .ic { width: 1.25rem; height: 1.25rem; }
.actbtn:hover { background: #223026; }
.actbtn:focus { background: var(--ink); color: var(--bg); }
.actbtn.busy { padding: 0 1rem 0 .8rem; }
.acttext { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actcount {
  position: absolute; top: -.3rem; right: -.3rem; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem;
  display: flex; align-items: center; justify-content: center; border-radius: 999px;
  background: var(--warn); color: #1b1405; font-size: .78rem; font-weight: 800;
}
.spin { width: 1rem; height: 1rem; flex: none; border-radius: 50%; border: 2px solid #ffffff2e; border-top-color: var(--accent-text); animation: spin .8s linear infinite; }
.actbtn:focus .spin { border-color: #0000002e; border-top-color: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }

#modal.corner { align-items: flex-start; justify-content: flex-end; padding: 3.7rem var(--pad) 0; background: #03050466; }
html.tv #modal.corner { padding-right: calc(var(--pad) + 5.4rem); }
.actsheet { width: 27rem; padding-bottom: .7rem; }
.actsheet h3 { padding-bottom: .5rem; }
.actgroup h4 { margin: .4rem 1.7rem .3rem; color: var(--ink2); font-size: .9rem; font-weight: 600; }
.actrow { display: flex; align-items: flex-start; gap: .8rem; width: calc(100% - 1.4rem); margin: 0 .7rem; padding: .75rem 1rem; border-radius: var(--r); text-align: left; }
.actrow .spin { margin-top: .2rem; }
.actrow .chev { margin-top: .1rem; }
.actrow:hover { background: var(--surface2); }
.actrow:focus { background: var(--ink); color: var(--bg); }
.actrow:focus .acttxt small, .actrow:focus .chev { color: var(--bg); stroke: var(--bg); }
.actrow:focus .ndot { background: var(--bg); }
.acttxt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acttxt b { font-weight: 600; font-variant-numeric: tabular-nums; }
.acttxt small { margin-top: .15rem; color: var(--ink2); overflow-wrap: anywhere; }
.ndot { width: .55rem; height: .55rem; margin-top: .5rem; flex: none; border-radius: 50%; background: var(--warn); }
.actempty { padding: .2rem 1.7rem .8rem; color: var(--ink2); }
/* Amici accanto alla campanella: chi e' online, con le sue raccolte */
.actbtn[hidden] { display: none; }
.frcount { font-variant-numeric: tabular-nums; color: var(--accent-text); }
.actbtn:focus .frcount { color: var(--bg); }
.frwho { display: flex; align-items: center; gap: .55rem; margin: .5rem 1.7rem .2rem; font-weight: 600; }
.frwho small { margin-left: auto; color: var(--ink2); font-weight: 400; font-size: .85rem; }
.odot { width: .55rem; height: .55rem; flex: none; border-radius: 50%; background: var(--accent-text); }
.odot.off { background: var(--ink2); opacity: .6; }
.frnow.off .actrow { opacity: .7; }
.frnow .actrow .avatar { width: 2.2rem; height: 2.2rem; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: .8rem; background: var(--bg); color: var(--ink); }

/* Barra di avanzamento (lettura dei titoli): la vera percentuale, o in movimento se non si sa */
.actbar { display: block; height: .3rem; margin-top: .55rem; border-radius: 999px; background: #ffffff1f; overflow: hidden; }
.actbar i { display: block; height: 100%; border-radius: inherit; background: var(--accent-text); transition: width .4s ease-out; }
.actbar.indet i { width: 35%; animation: slidebar 1.3s ease-in-out infinite; }
@keyframes slidebar { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.actrow:focus .actbar { background: #0000001f; }
.actrow:focus .actbar i { background: var(--bg); }
#scanmsg .actbar { max-width: 30rem; }
.scanline { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* QR per scaricare l'app */
.apkqr { display: flex; align-items: center; gap: 1.8rem; }
.qrtile { width: 11.5rem; height: 11.5rem; flex: none; padding: .5rem; border-radius: var(--r); background: #f2f5f2; }
.qrtile svg { display: block; width: 100%; height: 100%; }
.apktext { min-width: 0; }
.panel p.apkurl { color: var(--ink); font-weight: 600; word-break: break-all; }
.panel p.paircode { color: var(--ink); font-size: 2.4rem; font-weight: 700; letter-spacing: .18em; margin: .4rem 0 .6rem; }

/* Indirizzi e cartelle su altri PC */
.kv dt small, .kv dd small { display: block; margin-top: .15rem; color: var(--ink2); font-size: .85rem; font-weight: 400; }
.soverview .panel { margin: 1.2rem 0 0; max-width: none; }
.folder.elsewhere .where b { color: var(--ink2); }

@media (max-width: 720px) {
  #activity { top: .55rem; right: .8rem; }
  .acttext { display: none; }
  .actbtn.busy { padding: 0 .75rem; }
  #modal.corner { padding: 3.4rem .6rem 0; }
  .actsheet { width: 100%; }
  .apkqr { flex-direction: column; align-items: flex-start; gap: 1rem; }
}
.panel ul.news { margin: .4rem 0 1rem; padding-left: 1.2rem; line-height: 1.7; color: var(--ink); }
.panel ol.steps { margin: .2rem 0 1rem; padding-left: 1.3rem; line-height: 1.7; color: var(--ink2); }
.panel ol.steps b { color: var(--ink); word-break: break-all; }

/* ---------- App sulla schermata Home: niente rimbalzo né lampi al tocco ---------- */
@media (display-mode: standalone) {
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
}

/* Installa sulla TV dal PC */
#tvpanel .actions { flex-wrap: wrap; align-items: center; gap: .6rem; }
#tvpanel .field.tvaddr { flex: 1 1 16rem; max-width: 22rem; }
#tvpanel .kv { margin-top: .4rem; }
#tvpanel .kv dt small { display: block; color: var(--ink3, var(--ink2)); font-size: .85rem; }
.tvguide { margin-top: 1.2rem; color: var(--ink2); }
.tvguide summary { cursor: pointer; color: var(--ink); padding: .3rem 0; }
.tvguide ol.steps { margin-top: .7rem; }
.tvpair { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 .6rem; }
.tvpair .field { flex: 1 1 10rem; max-width: 16rem; }

.tvsteps { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin: .4rem 0 1rem; padding: 0; color: var(--ink3); font-size: .92rem; }
.tvsteps li { display: flex; align-items: center; gap: .45rem; }
.tvsteps li span { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid currentColor; font-size: .8rem; }
.tvsteps li.done { color: var(--ok); }
.tvsteps li.now { color: var(--ink); font-weight: 600; }
.tvsteps li.now span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tvsteps li.now.fail { color: var(--warn); }
.tvsteps li.now.fail span { background: var(--warn); border-color: var(--warn); }
.tvnow { padding: .9rem 1.1rem; border-radius: .5rem; background: #ffffff0a; line-height: 1.55; margin-bottom: .6rem; }
.tvnow.wait { border-left: 3px solid var(--warn); }
.tvnow.busy { border-left: 3px solid var(--ink2); }
.tvnow.ok { border-left: 3px solid var(--ok); }
.tvnow.err { border-left: 3px solid var(--warn); color: var(--ink); }
.tvnow .actions { margin-top: .7rem; }
.tvlogtitle { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: 1.2rem 0 .5rem; }
.panel .tvlogtitle h3 { font-size: 1rem; margin: 0; color: var(--ink2); }
.tvlog { max-height: 20rem; overflow-y: auto; padding: .7rem .9rem; border-radius: .5rem; background: #00000033; font-size: .9rem; line-height: 1.5; }
.tvlog div { display: flex; gap: .7rem; color: var(--ink2); }
.tvlog time { color: var(--ink3); flex: none; min-width: 4.3rem; }
.tvlog span { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.tvlog .ok { color: var(--ok); } .tvlog .wait { color: var(--warn); } .tvlog .err { color: var(--warn); font-weight: 600; }
.tvlog .dbg { color: var(--ink3); font-family: ui-monospace, Consolas, monospace; font-size: .78rem; }
.tvlog .sep { color: var(--ink); font-weight: 600; border-top: 1px solid #ffffff1f; margin-top: .5rem; padding-top: .4rem; }
.tvlog .sep:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.tvlog .spin { animation: tvblink 1.2s ease-in-out infinite; }
@keyframes tvblink { 50% { opacity: .3; } }

/* «Guarda su»: barra-telecomando in basso mentre una TV trasmette */
#castbar {
  --p-ink: var(--ink); --p-fill: var(--accent-text);
  position: fixed; z-index: 45; left: calc(var(--rail) + 1rem); right: 1rem; bottom: 1rem;
  max-width: 56rem; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info ctl" "line line";
  align-items: center; gap: .35rem 1rem; padding: .7rem 1rem .6rem;
  border-radius: .8rem; background: var(--surface2); box-shadow: 0 .6rem 2.2rem #000a; border: 1px solid #ffffff14;
}
#castbar[hidden] { display: none; }
body.casting .rows { padding-bottom: calc(46vh + 7rem); }
#castbar .cinfo { grid-area: info; display: flex; align-items: center; gap: .8rem; min-width: 0; }
#castbar .cinfo img { flex: none; width: 2.6rem; height: 3.9rem; object-fit: cover; border-radius: .3rem; }
#castbar .cicon { flex: none; font-size: 1.8rem; color: var(--accent-text); }
#castbar .ctxt { min-width: 0; }
#castbar .ctxt b { display: block; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#castbar .ctxt span { display: block; color: var(--ink2); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#castbar .cctl { grid-area: ctl; display: flex; align-items: center; gap: .15rem; }
#castbar .pbtn { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
#castbar .pbtn.main { width: 2.9rem; height: 2.9rem; margin: 0 .2rem; font-size: 1.15rem; }
#castbar .cline { grid-area: line; display: flex; align-items: center; gap: .8rem; }
#castbar .cseek { flex: 1; min-width: 0; accent-color: var(--accent-text); }
#castbar .ctime { flex: none; color: var(--ink2); font-size: .85rem; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  #castbar { left: .5rem; right: .5rem; bottom: 4.7rem; padding: .55rem .7rem .45rem; gap: .2rem .5rem; }
  #castbar .cinfo img { width: 2.1rem; height: 3.1rem; }
  #castbar .pbtn { width: 2.3rem; height: 2.3rem; }
  #castbar .cctl .pbtn:not(.main):not([data-cast="stop"]) { display: none; }
}

/* ---------- Impostazioni: niente filetti né barrette, più leggibili ---------- */
.settings .stitle { font-size: 2.4rem; font-weight: 800; letter-spacing: -.025em; }
.vchip { border-left: 0; }
.vchip b { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.vchip span { display: flex; align-items: center; gap: .45rem; color: var(--ok); font-weight: 600; }
.vchip span::before { content: ""; width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: currentColor; }
.vchip.warn span { color: var(--warn); }
.srow + .srow { border-top: 0; }
.srow .sic { width: 1.5rem; height: 1.5rem; color: var(--ink3); }
.srow:focus .sic { color: var(--bg); }
.srow.lead .uface { width: 3.4rem; height: 3.4rem; font-size: 1.45rem; }
.srow.lead .stext b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.kv dt, .kv dd { border-top: 0; padding: .75rem .9rem; }
.kv dt:nth-of-type(odd), .kv dd:nth-of-type(odd) { background: #ffffff07; }
.kv dt { border-radius: var(--r) 0 0 var(--r); }
.kv dd { border-radius: 0 var(--r) var(--r) 0; }
.folder { border-top: 0; margin-top: .4rem; padding: .65rem .8rem; border-radius: var(--r); background: var(--surface); }
.lib { padding-bottom: .9rem; }
.setting small { color: var(--ink); background: #ffffff12; padding: .2rem .75rem; border-radius: 999px; }
.setting:focus small { background: #060a071f; color: var(--bg); }
body:not(.kb) .setting:focus small { color: var(--ink); background: #ffffff12; }
@media (max-width: 720px) {
  .kv dt { border-radius: var(--r) var(--r) 0 0; padding-bottom: .2rem; }
  .kv dd { border-radius: 0 0 var(--r) var(--r); padding-top: 0; }
}
/* ---------- TV: in rem lo spazio è sempre lo stesso (1rem = 1,5vw) ---------- */
@media (min-width: 721px) {
  html.tv .sgrid { grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; }
  /* Panoramica: due colonne di righe, l'account in testa su tutta la larghezza */
  html.tv .slist { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .6rem; }
  html.tv .srow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic txt chev" "ic val chev"; column-gap: 1rem; row-gap: .25rem; min-height: 5.2rem; padding: .9rem 1.1rem; }
  html.tv .srow > .sic, html.tv .srow > .uface { grid-area: ic; }
  html.tv .srow > .stext { grid-area: txt; }
  html.tv .srow > .sval { grid-area: val; justify-content: flex-start; text-align: left; }
  html.tv .srow > .chev { grid-area: chev; }
  html.tv .srow.lead { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "ic txt val chev"; background: var(--surface2); }
  html.tv .srow.lead:focus { background: var(--ink); }
  html.tv .srow.lead > .sval { justify-content: flex-end; }
  html.tv .stext b { font-size: 1.2rem; }
  html.tv .stext small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.tv .setting { padding: 1rem 1.2rem; font-size: 1.08rem; }
  html.tv .smain .panel { padding: 1.7rem 2rem; }
  html.tv .panel h2 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.015em; }
}

/* ---------- Telefono e tablet: tocco, spazi sicuri, leggibilita' ---------- */
/* Niente doppio tocco per ingrandire sui comandi: il tocco risponde subito */
a, button, .f { touch-action: manipulation; }

/* Col mouse o col dito l'elemento col fuoco non diventa bianco (solo con frecce e telecomando) */
body:not(.kb) .srow:focus { background: none; color: inherit; }
body:not(.kb) .srow:focus:hover { background: var(--surface2); }
body:not(.kb) .srow.lead:focus { background: inherit; }
body:not(.kb) .srow:focus .stext small, body:not(.kb) .srow:focus .sval { color: var(--ink2); }
body:not(.kb) .srow:focus .sval.warn { color: var(--warn); }
body:not(.kb) .srow:focus .sval.ok::before { background: var(--ok); }
body:not(.kb) .srow:focus .sval.warn::before { background: var(--warn); }
body:not(.kb) .srow:focus .chev { stroke: var(--ink3); }
body:not(.kb) .srow:focus .sic { color: var(--ink3); }
body:not(.kb) .srow:focus .uface { background: hsl(var(--h) 26% 21%); color: hsl(var(--h) 62% 80%); }
body:not(.kb) .actrow:focus { background: none; color: inherit; }
body:not(.kb) .actrow:focus .acttxt small { color: var(--ink2); }
body:not(.kb) .actrow:focus .chev { stroke: var(--ink3); }
body:not(.kb) .actrow:focus .ndot { background: var(--warn); }
body:not(.kb) .actrow:focus .actbar { background: #ffffff1f; }
body:not(.kb) .actrow:focus .actbar i { background: var(--accent-text); }
body:not(.kb) .actrow:hover { background: var(--surface2); }
body:not(.kb) .actbtn:focus { background: var(--surface2); color: var(--ink); }
body:not(.kb) .actbtn:focus .frcount { color: var(--accent-text); }
body:not(.kb) .profile:focus { background: var(--surface2); color: inherit; }
body:not(.kb) .profile:focus .uface { background: hsl(var(--h) 26% 21%); color: hsl(var(--h) 62% 80%); }
body:not(.kb) a.versions:focus .vchip { background: var(--surface); color: inherit; }
body:not(.kb) a.versions:focus .vchip small { color: var(--ink2); }
body:not(.kb) a.versions:focus .vchip span { color: var(--ok); }
body:not(.kb) a.versions:focus .vchip.warn span { color: var(--warn); }
body:not(.kb) .link:focus { background: none; color: var(--accent-text); }

/* Avvisi: larghi quanto il testo (non stretti a meta' schermo); il segnale offline
   resta sotto le finestre di scelta */
#toast { width: max-content; max-width: min(90vw, 34rem); text-align: center; }
#offpill { z-index: 44; }

/* Un valore lungo (es. lo stato dell'account) non schiaccia il nome della riga */
.sval { flex: 0 1 auto; min-width: 0; max-width: 45%; }
html.tv .srow > .sval { max-width: none; }

/* Col dito il "passaggio sopra" resta appiccicato dopo il tocco: niente ingrandimenti,
   una piccola pressione al tocco, e il menu delle azioni (⋯) sempre in vista
   (su iPhone la pressione lunga non apre il menu) */
@media (hover: none) and (pointer: coarse) {
  html:not(.tv) body:not(.kb) .card:hover { transform: none; }
  html:not(.tv) body:not(.kb) .card:active { transform: scale(.97); }
  html:not(.tv) .card .playico { display: none; }
  html:not(.tv) .art .more { opacity: 1; width: 2.2rem; height: 2.2rem; right: .35rem; bottom: .65rem; }
  html:not(.tv) .card.wide .art .more { bottom: .6rem; }
  html:not(.tv) .ep .playico { display: flex; }
  html:not(.tv) .person:hover .face { box-shadow: none; }
  html:not(.tv) .srow:hover, html:not(.tv) .setting:hover, html:not(.tv) .result:hover { background: inherit; }
  html:not(.tv) .srow:active, html:not(.tv) .setting:active, html:not(.tv) .result:active, html:not(.tv) .actrow:active { background: var(--surface2); }
}

/* Tablet (e telefono in orizzontale): caratteri piu' grandi, menu a sinistra sempre
   uguale con l'etichetta sotto l'icona, senza aprirsi a ogni tocco */
@media (hover: none) and (pointer: coarse) and (min-width: 721px) {
  html:not(.tv) { font-size: clamp(15px, 1.4vw, 18px); --rail: 5.4rem; }
  html:not(.tv) #rail, html:not(.tv) #rail:hover, html:not(.tv) #rail:focus-within {
    width: var(--rail); padding: .8rem .3rem calc(.8rem + env(safe-area-inset-bottom)); background: var(--bg); overflow-y: auto;
  }
  html:not(.tv) .brand { justify-content: center; height: 2.6rem; margin-bottom: .6rem; padding: 0; }
  html:not(.tv) .brand span { display: none; }
  html:not(.tv) .raillabel { height: .6rem; margin: .3rem .6rem .5rem; border-top: 1px solid var(--surface2); }
  html:not(.tv) .raillabel span { display: none; }
  html:not(.tv) #navlibs { flex: none; overflow: visible; }
  html:not(.tv) .railitem { flex-direction: column; justify-content: center; height: auto; min-height: 3.7rem; margin-bottom: .2rem; padding: .35rem .1rem; }
  html:not(.tv) .railitem svg, html:not(.tv) .railitem .avatar, html:not(.tv) .railitem .uface { width: 1.8rem; height: 1.8rem; }
  html:not(.tv) .railitem svg { padding: .2rem; }
  html:not(.tv) .railitem span, html:not(.tv) #rail:hover .railitem span, html:not(.tv) #rail:focus-within .railitem span {
    opacity: 1; transform: none; max-width: 100%; margin: .2rem 0 0; padding: 0; font-size: .68rem; font-weight: 600; text-align: center;
  }
  html:not(.tv) .railitem.on::before { left: -.4rem; }
  html:not(.tv) .railitem.alert::after { left: calc(50% + .35rem); top: .35rem; }
  html:not(.tv) .card:focus { transform: none; }
  html:not(.tv) .btn { padding: .8rem 1.4rem; }
  html:not(.tv) .filter { padding: .6rem 1rem; }
}
@media (hover: none) and (pointer: coarse) and (min-width: 721px) and (max-height: 560px) {
  html:not(.tv) .brand { display: none; }
  html:not(.tv) .railitem { min-height: 3.2rem; }
}

/* Schermo in verticale (tablet): l'anteprima della Home e le schede usano tutta la larghezza */
@media (orientation: portrait) and (min-width: 721px) {
  html:not(.tv) .stage .bg { width: 100%; }
  html:not(.tv) .stage .shade { background: linear-gradient(0deg, #060a07 6%, #060a07d9 40%, #060a0733 100%); }
  html:not(.tv) .stage .info { width: auto; right: var(--pad); max-width: 40rem; }
  html:not(.tv) .hero .bg { height: 70vh; }
  html:not(.tv) .hero .bg::after { background: linear-gradient(0deg, #060a07 4%, #060a07cc 40%, #060a0740 100%); }
  html:not(.tv) .hero { min-height: 0; padding-top: 38vh; }
  html:not(.tv) .hero .cover { width: 11rem; margin-right: 1.8rem; }
  html:not(.tv) .rows .card.poster { width: min(19vh, 22vw); }
  html:not(.tv) .rows .card.wide { width: min(38vh, 40vw); }
}

/* Telefono: barra in basso a schede uguali, rispettando la barra di sistema dell'iPhone;
   le Impostazioni vanno in alto a destra accanto alla campanella */
@media (max-width: 720px) {
  #rail, #rail:hover, #rail:focus-within { height: calc(4.2rem + env(safe-area-inset-bottom)); padding-bottom: calc(.3rem + env(safe-area-inset-bottom)); }
  #navlibs { display: contents; }
  .railitem { flex: 1 0 3.9rem; min-width: 3.9rem; margin: 0; padding: 0 .15rem; }
  .railitem span, #rail:hover .railitem span { max-width: 100%; text-align: center; font-weight: 600; }
  .railitem:active { background: var(--surface2); }
  .railitem.add { display: none; }
  .railitem.on { background: none; color: var(--accent-text); }
  .railitem.on svg { color: var(--accent-text); }
  .railitem.on::before { left: 30%; right: 30%; }
  body:not(.kb) .railitem.on:focus { background: none; color: var(--accent-text); }
  #rail .railitem[data-key="nav-settings"] {
    position: fixed; top: .55rem; right: .8rem; z-index: 41; flex: none; width: 2.5rem; min-width: 0; height: 2.5rem; padding: 0;
    border-radius: 999px; background: var(--surface2); color: var(--ink);
  }
  #rail .railitem[data-key="nav-settings"] svg { width: 1.6rem; height: 1.6rem; padding: .1rem; }
  #rail .railitem[data-key="nav-settings"] span, #rail .railitem[data-key="nav-settings"]::before { display: none; }
  #rail .railitem[data-key="nav-settings"].on { background: var(--accent); color: var(--accent-ink); }
  #rail .railitem[data-key="nav-settings"].on svg { color: inherit; }
  #activity { right: 3.8rem; }
  #modal.corner { padding-top: 3.4rem; }
  .rows { bottom: calc(4.2rem + env(safe-area-inset-bottom)); }
  #view { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
  #offpill { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(4.8rem + env(safe-area-inset-bottom)); white-space: nowrap; font-size: .82rem; }
  #castbar { bottom: calc(4.7rem + env(safe-area-inset-bottom)); }

  /* Filtri della raccolta su una sola riga che scorre col dito */
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; scroll-padding: 0 var(--pad); }
  .filters::after { content: ""; flex: none; width: 1px; }
  .filter { flex: none; margin-bottom: 0; }

  /* Impostazioni: il valore va sotto il nome invece di schiacciarlo */
  .srow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic txt chev" "ic val chev"; column-gap: .85rem; row-gap: .2rem; min-height: 4rem; }
  .srow > .sic, .srow > .uface { grid-area: ic; }
  .srow > .stext { grid-area: txt; }
  .srow > .sval { grid-area: val; max-width: none; justify-content: flex-start; text-align: left; font-size: .9rem; }
  .srow > .chev { grid-area: chev; }
  .settings .stitle { font-size: 2rem; }
  .vchip { min-width: 0; flex: 1 1 8rem; }

  /* Finestre di scelta: salgono dal basso, a tutta larghezza, a portata di pollice */
  body:not(.playing) #modal:not(.corner) { align-items: flex-end; }
  body:not(.playing) #modal:not(.corner) .sheet {
    width: 100%; max-width: none; max-height: 88vh; border-radius: 1rem 1rem 0 0;
    padding-bottom: env(safe-area-inset-bottom); animation: sheetup .24s cubic-bezier(.2, .8, .2, 1);
  }
  body:not(.playing) #modal:not(.corner) .sheet::before { content: ""; display: block; flex: none; width: 2.6rem; height: .3rem; margin: .6rem auto 0; border-radius: 999px; background: var(--ink3); opacity: .6; }
  .opt { padding: .95rem 1rem; }
  /* Pulsanti dal testo lungo: vanno a capo invece di allargare la pagina */
  .btn { max-width: 100%; white-space: normal; text-align: left; }
  #view { overflow-x: clip; }
}
@keyframes sheetup { from { transform: translateY(100%); } }
html.lite .sheet { animation: none !important; }

/* ---- Accesso: login, scelta del server, collegamento della TV ---- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; padding: 2rem 1rem;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, #1a7f4530, transparent 70%), var(--bg); }
.authcard { width: 100%; max-width: 26rem; margin: auto; display: flex; flex-direction: column; animation: authin .35s ease-out; }
.authcard.wide { max-width: 34rem; }
@keyframes authin { from { opacity: 0; transform: translateY(.6rem); } }
.authbrand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 2.2rem; font-size: 1.6rem; letter-spacing: -.02em; }
.authbrand svg { width: 2.4rem; height: 2.4rem; }
.authbrand b { font-weight: 800; }
.authcard h1, .tvlink h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; text-align: center; margin: 0 0 .4rem; }
.authsub { text-align: center; color: var(--ink2); margin: 0 0 1.8rem; }
.authsub b { color: var(--ink); }
.authcard > p { color: var(--ink2); line-height: 1.55; text-align: center; margin: 0 0 1.4rem; }
.authcard > p b { color: var(--ink); }
.authcard .field { margin-bottom: .8rem; font-size: 1.08rem; padding: .95rem 1.1rem; border-radius: .6rem; }
.btn.block { display: flex; justify-content: center; width: 100%; margin: .4rem 0 0; padding: .95rem 1.5rem; border-radius: .6rem; font-size: 1.08rem; }
.btn.block:focus { transform: none; box-shadow: 0 0 0 3px var(--ink); }
.authlink { display: block; align-self: center; margin-top: 1.1rem; padding: .3rem .6rem; border-radius: var(--r); color: var(--ink2); font-weight: 600; font-size: .95rem; text-align: center; }
.authlink:hover { color: var(--ink); }
.authlink:focus { background: var(--ink); color: var(--bg); }
.author { display: flex; align-items: center; gap: .9rem; margin: 1.6rem 0 1.2rem; color: var(--ink3); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.author::before, .author::after { content: ""; flex: 1; height: 1px; background: var(--surface2); }
.gbtn { display: flex; align-items: center; justify-content: center; gap: .75rem; width: 100%; padding: .9rem 1.2rem; border-radius: .6rem;
  background: #ffffff; color: #1f1f1f; font-weight: 600; font-size: 1.05rem; transition: transform .12s ease-out; }
.gbtn svg { width: 1.3rem; height: 1.3rem; flex: none; }
.gbtn:hover { background: #f1f3f4; }
.gbtn:focus { box-shadow: 0 0 0 3px var(--accent-text); }
.authico { align-self: center; width: 4rem; height: 4rem; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; margin-bottom: 1.2rem; }
.authico svg { width: 2rem; height: 2rem; fill: none; stroke: var(--accent-text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.authwait { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: .6rem; background: var(--surface); color: var(--ink2); line-height: 1.45; }
.authwait b { color: var(--ink); }
.authwait .spinner { width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%; border: .2rem solid var(--surface2); border-top-color: var(--accent-text); animation: authspin 1s linear infinite; }
@keyframes authspin { to { transform: rotate(360deg); } }
.authnote { color: var(--ink3); font-size: .9rem; text-align: center; margin-top: 1rem; }

.srvlist { display: flex; flex-direction: column; gap: .7rem; }
.srv { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 1rem 1.1rem; border-radius: .8rem; background: var(--surface); border: 2px solid transparent; text-align: left; transition: transform .12s ease-out, background .12s; }
.srv:hover { background: var(--surface2); }
.srv:focus { background: var(--ink); color: var(--bg); transform: scale(1.02); }
.srv.on { border-color: var(--accent); }
.srv.off { opacity: .5; }
.srvico { width: 3rem; height: 3rem; flex: none; border-radius: .7rem; background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.srvico svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.srv:focus .srvico { background: var(--bg); }
.srvtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.srvtxt b { font-size: 1.1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srvtxt small { color: var(--ink2); margin-top: .15rem; font-size: .9rem; }
.srv:focus .srvtxt small { color: var(--bg); opacity: .75; }
.srvdot { width: .65rem; height: .65rem; flex: none; border-radius: 50%; background: var(--ink3); }
.srvdot.live { background: var(--ok); box-shadow: 0 0 0 .25rem #4cbf7f26; }
.srv.add { background: transparent; border: 2px dashed var(--surface2); }
.srv.add .srvico svg { stroke: var(--accent-text); }
.srv.add:focus { background: var(--ink); border-color: var(--ink); }
.srvadd { display: flex; gap: .6rem; }
.srvadd .field { margin: 0; flex: 1; min-width: 0; }
.srvadd .btn { margin: 0; border-radius: .6rem; }
.srvreq { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; margin-bottom: .9rem; border-radius: .8rem; background: #1a7f4522; color: var(--ink2); }
.srvreq span { flex: 1; }
.srvreq b { color: var(--ink); }
.srvreq .btn { margin: 0; }
.railitem.srvswitch span { font-weight: 700; }

/* TV: QR da una parte, codice dall'altra */
.tvlink { width: 100%; max-width: 62rem; margin: auto; display: flex; flex-direction: column; align-items: center; animation: authin .35s ease-out; }
.tvlink .authsub { margin-bottom: 2.4rem; }
.tvcols { display: flex; align-items: stretch; justify-content: center; width: 100%; gap: 0; }
.tvcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; border-radius: 1rem; background: var(--surface); }
.tvcol b { font-size: 1.25rem; margin-top: 1.2rem; }
.tvcol small { color: var(--ink2); line-height: 1.5; margin-top: .4rem; max-width: 22rem; }
.tvcol small b { color: var(--ink); font-size: inherit; margin: 0; }
.qrtile.big { width: 14rem; height: 14rem; padding: .7rem; border-radius: .8rem; }
.tvor { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 1.6rem; color: var(--ink3); text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; }
.tvor::before, .tvor::after { content: ""; flex: 1; width: 1px; background: var(--surface2); margin: .6rem 0; }
.tvstep { margin: 0 0 1.4rem !important; font-size: 1rem; }
.tvcode { display: flex; align-items: center; gap: .6rem; font-size: 3.6rem; font-weight: 800; letter-spacing: .14em; color: var(--ink); line-height: 1; padding: 1.1rem 1.6rem; border-radius: .8rem; background: var(--bg); border: 2px solid var(--surface2); }
.tvcode i { width: .25rem; }
.tvmore { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 2rem; }
.tvmore .btn svg { width: 1.1rem; height: 1.1rem; margin-right: .5rem; }
@media (max-width: 720px) {
  .tvcols { flex-direction: column; }
  .tvor { flex-direction: row; padding: 1rem 0; }
  .tvor::before, .tvor::after { width: auto; height: 1px; flex: 1; margin: 0 .8rem; }
  .tvcode { font-size: 2.4rem; }
  .authbrand { margin-bottom: 1.6rem; }
}
html.tv .tvlink .authbrand { margin-bottom: 1.2rem; }
html.tv .tvlink .authsub { margin-bottom: 1.6rem; }
body.guest #rail .add { display: none; }
.whopick { justify-content: center; gap: 1.2rem; margin-bottom: .6rem; }
.whopick .profile { background: transparent; width: 9rem; }
.whopick .profile:focus { background: var(--ink); color: var(--bg); transform: scale(1.06); }
.authrow { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; }
.authrow .authlink { margin-top: 1.4rem; }
.gqr { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--ink2); }
.gqr p { margin: 1rem 0 .8rem; line-height: 1.5; }
.gqr p b { color: var(--ink); }
.tvcode.small { font-size: 2rem; padding: .7rem 1.2rem; }
/* Notifiche (Impostazioni → Notifiche) */
.steps { margin: .4rem 0 1rem; padding-left: 1.3rem; color: var(--ink2); }
.steps li { margin: .25rem 0; }
.nlist dt small { display: block; color: var(--ink2); font-weight: 400; font-size: .85rem; }
@media (max-width: 640px) { .nkinds, .nlist { grid-template-columns: 1fr; } .nkinds dd, .nlist dd { border-top: 0; padding-top: 0; } }
