/* ============================================================
   ANIME S0UL — nero + glass minimale
   Font e ritmo ereditati da s0ul_TV (Michroma / Bitter HT)
   ============================================================ */

@font-face { font-family: "Bitter HT"; src: url("../fonts/BitterHT-Regular.woff") format("woff"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Bitter HT"; src: url("../fonts/BitterHT-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; }
@font-face { font-family: "Michroma"; src: url("../fonts/Michroma-Regular.woff") format("woff"); font-weight: 400; font-style: normal; }

:root {
  /* superfici */
  --bg:        #050505;
  --texture:   radial-gradient(rgba(255,255,255,.045) .7px, transparent .7px);
  --glass:     rgba(255,255,255,.055);
  --glass-hi:  rgba(255,255,255,.09);
  --glass-brd: rgba(255,255,255,.13);
  --blur:      14px;

  /* inchiostro */
  --ink-0: #f2f2f0;
  --ink-1: #b9bdb9;
  --ink-2: #707670;

  /* tipografia */
  --f-display: "Michroma", Arial, sans-serif;
  --f-body: "Bitter HT", Georgia, serif;
  --fs-micro: 13px;
  --fs-label: 17px;
  --fs-body: 20px;
  --fs-hero: clamp(34px, 5vw, 76px);
  --ls-brand: 5px;
  --ls-label: 3px;

  /* ritmo */
  --s1: 13px; --s2: 18px; --s3: 23px; --s4: 32px; --s5: 52px;

  --radius: 4px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--bg);
  background-image: var(--texture);
  background-size: 7px 7px;
  color: var(--ink-0);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.42;
}
img { display: block; }
.card img { background: #101210 url("icons/icon-192.png") center/40% no-repeat; }
.card img[data-broken] { opacity: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- brand ---------- */
.brand {
  font-family: var(--f-display);
  letter-spacing: var(--ls-brand);
  text-transform: uppercase;
}
.brand .dim { color: var(--ink-2); }

/* ---------- topbar ---------- */
.topbar {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--s3);
  padding: calc(var(--s2) + env(safe-area-inset-top)) var(--s4) var(--s2);
  padding-left: max(var(--s4), env(safe-area-inset-left));
  padding-right: max(var(--s4), env(safe-area-inset-right));
  background: linear-gradient(rgba(5,5,5,.92), rgba(5,5,5,.75));
  border-bottom: 1px solid var(--glass-brd);
}
.topbar .brand { font-size: var(--fs-label); white-space: nowrap; }
.topbar nav { display: flex; gap: var(--s3); margin-left: auto; }
.toplink {
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--ink-1); padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid transparent;
}
.toplink:hover, .toplink:focus { color: var(--ink-0); outline: none; }
.toplink.active { color: var(--ink-0); border-color: var(--glass-brd); background: var(--glass); }

/* ---------- vetro ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .glass { background: rgba(255,255,255,.04); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: var(--s4); gap: var(--s4);
}
.login-brand { font-size: clamp(26px, 6vw, 56px); text-align: center; }
.login-sub {
  margin: 0; font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-2);
  text-align: center;
}
.login-panel { width: min(420px, 92vw); padding: var(--s4); }
.tabs { display: flex; gap: var(--s1); margin-bottom: var(--s3); }
.tab {
  flex: 1; text-align: center; padding: 10px;
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: 2px; text-transform: uppercase; color: var(--ink-2);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink-0); border-bottom-color: var(--ink-0); }
.field { display: block; margin-bottom: var(--s2); }
.field span {
  display: block; margin-bottom: 7px;
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: 2px; text-transform: uppercase; color: var(--ink-2);
}
.field input {
  width: 100%; padding: 12px 14px; color: var(--ink-0);
  background: rgba(0,0,0,.45); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  outline: none;
}
.field input:focus { border-color: rgba(255,255,255,.45); }
.btn-primary {
  width: 100%; padding: 13px;
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--bg); background: var(--ink-0); border-radius: var(--radius);
}
.btn-primary:hover, .btn-primary:focus { background: #fff; outline: none; }
.msg { margin-top: var(--s2); font-size: 16px; color: var(--ink-1); min-height: 22px; }
.msg.err { color: #ff8f8f; }

/* ---------- righe orizzontali ---------- */
.rows { padding: var(--s3) 0 var(--s5); }
.row { margin-bottom: var(--s4); }
.row-head {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: 0 var(--s4) var(--s1);
}
.row-title {
  margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--ink-1);
}
.row-scroll {
  display: flex; gap: var(--s2); overflow-x: auto; overflow-y: hidden;
  padding: var(--s1) var(--s4) var(--s2);
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.row-scroll::-webkit-scrollbar { display: none; }

/* ---------- card ---------- */
.card {
  position: relative; flex: 0 0 auto; width: 138px;
  scroll-snap-align: start; border-radius: var(--radius); overflow: hidden;
  border: 1px solid transparent; background: var(--glass);
  transition: transform .18s ease, border-color .18s ease;
}
.card img { width: 100%; height: 207px; object-fit: cover; background: #101210; }
@supports (aspect-ratio: 2/3) { .card img { height: auto; aspect-ratio: 2/3; } }
.card .card-t {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 9px 8px;
  font-size: 12.5px; line-height: 1.25; color: var(--ink-0);
  background: linear-gradient(transparent, rgba(0,0,0,.92));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-t .seen-n { display: inline-block; margin-top: 3px; }
a.card, .ep-card { display: block; }
.card:hover, .card:focus { transform: translateY(-4px); border-color: var(--glass-brd); outline: none; }
.card:hover .card-t, .card:focus .card-t { color: #fff; }
.skel { width: 138px; height: 207px; flex: 0 0 auto; border-radius: var(--radius); background: var(--glass); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- ricerca ---------- */
.search-wrap { max-width: 760px; margin: 0 auto; padding: var(--s4); }
.search-input {
  width: 100%; padding: 15px 18px; font-size: var(--fs-body); color: var(--ink-0);
  background: rgba(0,0,0,.45); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  outline: none;
}
.search-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: var(--s2); margin-top: var(--s3);
}

/* ---------- dettaglio ---------- */
.detail-hero { position: relative; min-height: 46vh; display: flex; align-items: flex-end; }
.detail-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center top;
  filter: saturate(.85);
}
.detail-fade {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(180deg, rgba(5,5,5,.35), rgba(5,5,5,.86) 62%, var(--bg));
}
.detail-inner { position: relative; padding: var(--s5) var(--s4) var(--s3); max-width: 980px; }
.eyebrow {
  margin: 0 0 var(--s1); font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-2);
}
.detail-title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: var(--fs-hero); letter-spacing: -1px; line-height: 1.08; text-transform: uppercase; }
.meta { margin-top: var(--s2); color: var(--ink-1); font-size: 17px; }
.meta b { color: var(--ink-0); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s2); }
.chip {
  padding: 5px 11px; font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-1);
  border: 1px solid var(--glass-brd); border-radius: var(--radius); background: var(--glass);
}
.plot { margin-top: var(--s3); color: var(--ink-1); max-width: 72ch; }
.back-btn {
  position: relative; z-index: 2; margin: var(--s2) var(--s4) 0;
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-1);
  padding: 9px 14px; border: 1px solid var(--glass-brd); border-radius: var(--radius);
}
.back-btn:hover, .back-btn:focus { color: var(--ink-0); background: var(--glass-hi); outline: none; }

/* episodi */
.episodes { padding: var(--s3) var(--s4) var(--s5); }
.eps-title { margin: 0 0 var(--s2); font-family: var(--f-display); font-weight: 400; font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-1); }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 9px; max-width: 900px; }
.ep {
  padding: 13px 0; text-align: center;
  font-family: var(--f-display); font-size: 14px;
  color: var(--ink-0); background: var(--glass);
  border: 1px solid var(--glass-brd); border-radius: var(--radius);
}
.ep:hover, .ep:focus { background: var(--glass-hi); border-color: rgba(255,255,255,.35); outline: none; }

/* ---------- player ---------- */
.player-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; background: #000; }
.player-layer.hidden { display: none; }
#video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-toolbar {
  position: absolute; top: calc(18px + env(safe-area-inset-top));
  left: calc(18px + env(safe-area-inset-left)); right: calc(18px + env(safe-area-inset-right));
  z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; pointer-events: none;
}
.player-back {
  position: static; min-width: 0; max-width: 100%; pointer-events: auto; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1;
  transition: opacity .3s ease;
  font-family: var(--f-display); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--ink-0); padding: 10px 16px;
  background: rgba(5,5,9,.90); border: 1px solid rgba(255,255,255,.34); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.52), 0 0 0 1px rgba(43,231,255,.08);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.player-back:hover, .player-back:focus { color: #fff; border-color: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,.6), 0 0 0 2px var(--accent); outline: 2px solid transparent; }
.cast-btn { margin-left: auto; }
.cast-short { display: none; }
.back-icon { display: block; width: 20px; height: 20px; flex: 0 0 20px; }
.back-icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.back-icon path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  padding: 12px 20px; z-index: 200; font-size: 16px; color: var(--ink-0);
  background: rgba(20,22,20,.95); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ---------- welcome / invito ---------- */
.welcome-panel { width: min(560px, 94vw); }
.steps, .policy { margin: 0 0 var(--s3); padding-left: 20px; color: var(--ink-1); font-size: 17px; }
.steps li, .policy li { margin-bottom: 9px; }
.policy b { color: var(--ink-0); }
.accept-row {
  display: flex; gap: 10px; align-items: center; margin: var(--s3) 0;
  color: var(--ink-1); cursor: pointer;
}
.accept-row input { width: 18px; height: 18px; accent-color: #f2f2f0; }

/* ---------- share modal ---------- */
.share-modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.72); padding: var(--s3);
}
.share-box { width: min(440px, 92vw); padding: var(--s4); text-align: center; }
.share-row { display: flex; gap: 9px; justify-content: center; margin-bottom: var(--s2); }
.share-btn { flex: 1; }
.share-box .search-input { margin-bottom: var(--s2); text-align: center; font-size: 15px; }
.share-close { margin-top: var(--s2); display: inline-block; }

/* ---------- cast ---------- */
/* cast allineato dalla toolbar del player */

/* ---------- layout smartphone ---------- */
.bottom-nav { display: none; }

@media (max-width: 700px) {
  .topbar {
    min-height: calc(56px + env(safe-area-inset-top));
    padding: calc(var(--s2) + env(safe-area-inset-top)) var(--s3) var(--s2);
    padding-left: max(var(--s3), env(safe-area-inset-left));
    padding-right: max(var(--s3), env(safe-area-inset-right));
  }
  .topbar nav { display: none; }          /* nav spostata in basso */

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
    background: rgba(8,8,8,.92);
    border-top: 1px solid var(--glass-brd);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .bn-btn {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    font-family: var(--f-display); font-size: 8px; letter-spacing: 0;
    text-transform: uppercase; color: var(--ink-2); padding: 4px 0;
  }
  .bn-btn .ico { font-size: 17px; line-height: 1; }
  .bn-btn .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-btn.active, .bn-btn:active { color: var(--ink-0); }

  .card { width: min(44vw, 170px); }
  .skel  { width: min(44vw, 170px); height: calc(min(44vw, 170px) * 1.5); }
  .row-scroll { padding-left: var(--s3); padding-right: var(--s3); gap: 12px; }
  .row-head { padding: 0 var(--s3) var(--s1); }
  .rows { padding-bottom: 90px; }         /* spazio per la bottom nav */
  .detail-inner { padding: var(--s4) var(--s3) var(--s3); }
  .episodes { padding: var(--s3) var(--s3) 110px; }
  .search-wrap { padding-bottom: 110px; }
  .detail-title { font-size: clamp(26px, 7.5vw, 44px); }
  .plot { font-size: 17px; }
  .meta { font-size: 15px; }
  .player-toolbar {
    top: calc(10px + env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
    gap: 16px;
  }
  .player-back { min-height: 48px; padding: 10px 14px; font-size: 13px; }
  #player-back { min-width: 48px; font-size: 19px; }
  .player-label, .cast-full { display: none; }
  .cast-short { display: inline; }
  #video { height: calc(100% - 64px - env(safe-area-inset-bottom)); }
}

/* iframe player vixcloud */
#embed-frame { width: 100%; height: 100%; border: 0; background: #000; }

/* badge episodio nelle card "ultimi episodi" */
.ep-card .ep-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 4px 8px; font-family: var(--f-display); font-size: 10px;
  letter-spacing: 1.5px; color: #050505; background: rgba(242,242,240,.92);
  border-radius: 3px;
}

/* ---------- admin ---------- */
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: var(--s2); margin-bottom: 10px; flex-wrap: wrap;
}
.admin-mail { font-size: 15px; color: var(--ink-1); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-ctrl { display: flex; gap: 8px; align-items: center; }
.admin-used { font-family: var(--f-display); font-size: var(--fs-micro); color: var(--ink-2); letter-spacing: 1px; white-space: nowrap; }
.admin-ctrl input { width: 84px; padding: 8px 10px; color: var(--ink-0);
  background: rgba(0,0,0,.45); border: 1px solid var(--glass-brd); border-radius: var(--radius); outline: none; }
.admin-save { padding: 8px 12px !important; font-size: 11px !important; }

/* ---------- vista griglia ---------- */
.grid-page-wrap { padding-bottom: 110px; }
.grid-title {
  margin: var(--s2) var(--s4) var(--s2);
  font-family: var(--f-display); font-weight: 400;
  font-size: var(--fs-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--ink-1);
}
/* Griglie catalogo: due colonne deterministiche su smartphone. */
.grid-page,
.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 var(--s3);
}
.grid-page .card,
.archive-grid .card {
  min-width: 0;
  width: 100% !important;
}
.archive-grid { margin-top: var(--s3); padding: 0; }
.grid-more { display: flex; justify-content: center; padding: var(--s3); }

/* espansione righe home */
.row-expand { display: inline-flex; align-items: baseline; gap: 8px; cursor: pointer; border-radius: var(--radius); outline: none; }
.row-expand:focus .row-title, .row-expand:hover .row-title { color: var(--ink-0); }
.expand-hint {
  font-family: var(--f-display); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-2);
}

/* quick play overlay */
.card { display: block; }
.quick-play {
  position: absolute; right: 8px; bottom: 40px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  color: #050505; background: rgba(242,242,240,.92);
  font-size: 14px; line-height: 1; padding-left: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.quick-play:active { transform: scale(.92); }

/* micro-feedback touch su tutte le card */
.card:active { transform: scale(.96); transition: transform .08s ease; }

/* continue watching: barra di avanzamento sul poster */
.cw-bar {
  position: absolute; left: 0; right: 0; bottom: 34px; height: 4px;
  background: rgba(255,255,255,.22); z-index: 2;
}
.cw-bar span { display: block; height: 100%; background: var(--ink-0); }

/* azioni dettaglio */
.detail-actions { display: flex; gap: var(--s1); margin-top: var(--s3); flex-wrap: wrap; }

/* link inline (reset password) */
.linklike {
  display: block; margin: 14px auto 0;
  font-family: var(--f-display); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-2);
}
.linklike:hover, .linklike:focus { color: var(--ink-0); outline: none; }

/* tracking */
.ep.watched { color: var(--ink-2); border-style: dashed; }
.st-select {
  padding: 10px 12px; color: var(--ink-0);
  background: rgba(0,0,0,.45); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  font-family: var(--f-display); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  outline: none;
}
.st-select:focus { border-color: rgba(255,255,255,.4); }
.st-mini { width: calc(100% - 16px); margin: 8px; padding: 7px !important; font-size: 10px; }
.st-chip { cursor: pointer; }
.seen-n { color: var(--ink-2); font-weight: 400; }
.st-card { position: relative; }

/* guida */
.guide-wrap { max-width: 720px; margin: 0 auto; padding: var(--s3) var(--s3) 110px; }
.guide-box { padding: var(--s3); margin-bottom: var(--s3); }
.guide-box .policy li { margin-bottom: 9px; }


/* ---------- archivio responsive ---------- */
.archive-wrap {
  width: 100%; max-width: 1440px; margin: 0 auto;
  padding: var(--s4);
  padding-bottom: 110px;
}

/* ---------- layout desktop reale ---------- */
@media (min-width: 701px) and (hover: hover) {
  body:not(.tv-mode) .bottom-nav { display: none !important; }
  body:not(.tv-mode) .topbar { min-height: 72px; }
  body:not(.tv-mode) .rows,
  body:not(.tv-mode) .grid-page-wrap {
    width: 100%; max-width: 1440px; margin-left: auto; margin-right: auto;
  }
  body:not(.tv-mode) .grid-page-wrap { padding-bottom: var(--s5); }
  body:not(.tv-mode) .search-wrap { max-width: 1200px; }
  body:not(.tv-mode) .archive-wrap { padding-bottom: var(--s5); }
  body:not(.tv-mode) .grid-page,
  body:not(.tv-mode) .archive-grid,
  body:not(.tv-mode) .search-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--s2);
  }
  body:not(.tv-mode) .grid-page .card,
  body:not(.tv-mode) .archive-grid .card,
  body:not(.tv-mode) .search-grid .card { width: 100% !important; min-width: 0; }
  body:not(.tv-mode) .row-scroll .card { width: 180px; }
}

/* tv-mode */
body.tv-mode { font-size: 24px; }
body.tv-mode .bottom-nav { display: none !important; }
body.tv-mode .card:focus,
body.tv-mode .ep:focus,
body.tv-mode button:focus,
body.tv-mode a:focus { outline: 3px solid rgba(255,255,255,.85); outline-offset: 3px; }
body.tv-mode .card { width: 220px; }
body.tv-mode .grid-page { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------- profilo / account ---------- */
.account-wrap { padding-bottom: 130px; max-width: 560px; }
.acc-card { padding: var(--s4); text-align: center; }
.acc-mail {
  margin: 6px 0 var(--s3);
  font-family: var(--f-display); font-weight: 400; font-size: 17px;
  letter-spacing: 1px; color: var(--ink-0); word-break: break-all;
}
.acc-num {
  font-family: var(--f-display); font-size: 52px; line-height: 1;
  color: var(--ink-0); letter-spacing: -1px;
}
.acc-num .acc-sep { color: var(--ink-2); font-size: 32px; margin: 0 6px; }
#q-cap { font-size: 32px; color: var(--ink-1); }
.acc-lbl {
  margin-top: 6px; font-family: var(--f-display); font-size: 10px;
  letter-spacing: 3px; text-transform: uppercase; color: var(--ink-2);
}
.acc-bar {
  margin: var(--s2) auto 0; max-width: 320px; height: 5px;
  background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden;
}
.acc-bar span { display: block; height: 100%; background: var(--ink-0); transition: width .4s; }
.acc-reset { margin-top: var(--s2); font-size: 14px; color: var(--ink-1); }
.acc-reset b { font-family: var(--f-display); font-weight: 400; letter-spacing: 1px; color: var(--ink-0); }
.acc-actions { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s3); justify-content: center; }
.acc-logout { margin-top: var(--s3); background: #2a1214; color: #ff9c9c; }
.acc-logout:hover, .acc-logout:focus { background: #3a1618; color: #ffb4b4; }

/* ---------- splash ---------- */
#splash {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background-color: #050505;
  background-image: radial-gradient(rgba(255,255,255,.045) .7px, transparent .7px);
  background-size: 7px 7px;
  transition: opacity .45s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; padding: 0 24px; }
.splash-brand {
  font-family: "Michroma", Arial, sans-serif;
  font-size: clamp(30px, 8vw, 58px); letter-spacing: var(--ls-brand);
  color: var(--ink-0); animation: splashPulse 1.15s ease-in-out infinite;
}
.splash-tip {
  margin-top: 26px; font-style: italic;
  font-family: "Bitter HT", Georgia, serif; font-size: 16px;
  color: var(--ink-2); max-width: 34ch; margin-left: auto; margin-right: auto;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: .82; }
  50%      { transform: scale(1.055); opacity: 1; }
}


/* ============================================================
   ANIME S0UL v2.3 — Neon Signal / S0ul Noir / Manga Paper
   Override isolati: il player e gli hook funzionali restano invariati.
   ============================================================ */
@font-face { font-family: "Bangers"; src: url("../fonts/Bangers-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("../fonts/ComicNeue-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("../fonts/ComicNeue-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

html[data-theme] {
  --bg: #06060a;
  --texture: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px);
  --glass: #10111a;
  --glass-hi: #171927;
  --glass-brd: #2a2d3b;
  --ink-0: #f7f7fa;
  --ink-1: #a2a5b6;
  --ink-2: #85899d;
  --accent: #ff2e63;
  --accent2: #2be7ff;
  --signal: #c9ff3d;
  --radius: 6px;
  --f-display-theme: "Michroma", Arial, sans-serif;
  --f-body-theme: "Bitter HT", Georgia, serif;
}
html[data-theme="noir"] {
  --bg: #050505; --glass: #101110; --glass-hi: #181a18; --glass-brd: #2a2d2a;
  --ink-0: #f2f2f0; --ink-1: #b9bdb9; --ink-2: #858b85;
  --accent: #f2f2f0; --accent2: #aeb4ae; --signal: #d7ddd7;
}
html[data-accent="cyan"] { --accent: #2be7ff; }
html[data-accent="lime"] { --accent: #c9ff3d; }
html[data-theme="manga"] {
  --bg: #f4f0e6; --glass: #fffdf7; --glass-hi: #eee7da; --glass-brd: #17130f;
  --ink-0: #17130f; --ink-1: #554b42; --ink-2: #74685d;
  --accent: #d7193f; --accent2: #2d727a; --signal: #728d21;
  --radius: 2px; --f-display-theme: "Bangers", Impact, sans-serif;
  --f-body-theme: "Comic Neue", "Bitter HT", serif;
}
html[data-theme] body {
  color: var(--ink-0); font-family: var(--f-body-theme);
  background-color: var(--bg);
  background-image: var(--texture);
  background-size: 100% 28px;
}
html[data-theme="manga"] body {
  background-image:
    radial-gradient(circle at 18% 20%, rgba(23,19,15,.055) 0 .7px, transparent .9px),
    repeating-linear-gradient(6deg, transparent 0 28px, rgba(90,72,55,.035) 29px, transparent 30px);
  background-size: 9px 9px, 100% 52px;
}
html[data-theme] .brand,
html[data-theme] .toplink,
html[data-theme] .row-title,
html[data-theme] .grid-title,
html[data-theme] .eps-title,
html[data-theme] .eyebrow,
html[data-theme] .btn-primary,
html[data-theme] .back-btn,
html[data-theme] .chip { font-family: var(--f-display-theme); }
html[data-theme] .brand .dim { color: var(--accent); }

/* topbar desktop */
html[data-theme] .topbar {
  min-height: 72px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: 14px;
  gap: 18px; background: rgba(6,6,10,.94); border-bottom-color: var(--glass-brd);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
html[data-theme="manga"] .topbar { background: rgba(244,240,230,.96); border-bottom: 2px solid var(--ink-0); }
html[data-theme] .topbar .brand { font-size: 18px; letter-spacing: 2px; }
html[data-theme] .topbar nav { gap: 3px; align-items: center; }
html[data-theme] .toplink {
  position: relative; display: inline-flex; min-height: 42px; align-items: center; justify-content: center;
  padding: 8px 11px; font-size: 11px; letter-spacing: .8px; border: 0; color: var(--ink-2);
}
html[data-theme] .toplink::after {
  content: ""; position: absolute; left: 20%; right: 20%; bottom: 1px; height: 2px;
  background: transparent;
}
html[data-theme] .toplink.active { background: transparent; color: var(--ink-0); }
html[data-theme] .toplink.active::after { background: var(--accent); }
html[data-theme] .toplink:hover, html[data-theme] .toplink:focus-visible { color: var(--ink-0); outline: none; }
html[data-theme="manga"] .toplink { font-size: 16px; letter-spacing: .25px; }

/* hero reale, popolato dai dati featured */
.home-hero { display: none; position: relative; width: min(1440px, 100%); height: 430px; margin: 0 auto; overflow: hidden; background: var(--glass); border-bottom: 1px solid var(--glass-brd); }
.home-hero.ready { display: block; }
.home-hero-art { position: absolute; top: 0; right: 0; bottom: 0; left: auto; width: 62%; height: 100%; object-fit: cover; object-position: center 28%; }
.home-hero-shade { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--bg) 0%, var(--bg) 39%, rgba(6,6,10,.82) 53%, rgba(6,6,10,.12) 78%), linear-gradient(0deg, var(--bg), transparent 42%); }
.home-hero-copy { position: relative; z-index: 1; width: min(620px, 58%); padding: 64px 34px 38px; }
.featured-pill, .hero-primary {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center;
  font-family: var(--f-display-theme); text-transform: uppercase; letter-spacing: 1px;
}
.featured-pill { min-height: 30px; padding: 6px 16px; border-radius: 999px; font-size: 10px; color: #fff; background: var(--accent); }
.home-hero h1 { margin: 18px 0 12px; max-width: 16ch; font-size: clamp(38px, 5vw, 64px); line-height: 1.02; text-transform: uppercase; }
.home-hero p { max-width: 48ch; margin: 0 0 24px; color: var(--ink-1); font-size: 17px; }
.hero-primary { min-width: 142px; padding: 10px 20px; border-radius: var(--radius); font-size: 11px; color: #fff; background: var(--accent); }
html[data-theme="manga"] .home-hero { margin-top: 14px; width: min(1390px, calc(100% - 32px)); border: 2px solid var(--ink-0); }
html[data-theme="manga"] .home-hero-shade { background: linear-gradient(90deg, var(--bg) 0%, var(--bg) 40%, rgba(244,240,230,.9) 57%, rgba(244,240,230,.05) 82%), linear-gradient(0deg, var(--bg), transparent 38%); }
html[data-theme="manga"] .home-hero h1 { font-family: "Bangers", Impact, sans-serif; letter-spacing: 1px; }
html[data-theme="manga"] .hero-primary { color: #fff; }
html[data-theme="manga"][data-ink="on"] .home-hero-art,
html[data-theme="manga"][data-ink="on"] .card img { filter: grayscale(1) sepia(.12) contrast(1.22) brightness(1.04); }

/* sezioni e card */
html[data-theme] .rows { padding-top: 28px; }
html[data-theme] .row { margin-bottom: 38px; }
html[data-theme] .row-head { align-items: center; justify-content: space-between; }
html[data-theme] .row-title { color: var(--ink-0); font-size: 17px; letter-spacing: 1.2px; }
html[data-theme] .expand-hint { color: var(--ink-2); }
html[data-theme] .row-scroll { gap: 14px; }
html[data-theme] .card {
  width: 168px; overflow: hidden; background: var(--glass); border: 1px solid var(--glass-brd);
  box-shadow: none; border-radius: var(--radius);
}
html[data-theme] .card img { width: 100%; height: 252px; aspect-ratio: 2 / 3; object-fit: cover; background-color: var(--glass-hi); }
html[data-theme] .card .card-t {
  position: relative; left: auto; right: auto; bottom: auto; display: -webkit-box;
  height: 58px; padding: 9px 10px; background: var(--glass); color: var(--ink-0);
  font-size: 14px; line-height: 1.28; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
html[data-theme] .card:hover, html[data-theme] .card:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
html[data-theme] .ep-card .ep-badge {
  display: inline-flex; min-width: 64px; height: 28px; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 999px; color: #fff; background: var(--accent); font-size: 9px;
}
html[data-theme] .quick-play { bottom: 68px; color: #fff; background: var(--accent); }
html[data-theme] .cw-bar { bottom: 58px; background: rgba(128,132,150,.35); }
html[data-theme] .cw-bar span, html[data-theme] .acc-bar span { background: var(--accent); }
html[data-theme] .skel { width: 168px; height: 310px; background: var(--glass); }
html[data-theme="manga"] .card { border-width: 2px; }
html[data-theme="manga"] .card .card-t { font-family: "Comic Neue", serif; font-weight: 700; }
html[data-theme="manga"] .row-title, html[data-theme="manga"] .grid-title, html[data-theme="manga"] .eps-title { font-size: 23px; letter-spacing: .5px; }

/* controlli */
html[data-theme] .glass,
html[data-theme] .field input,
html[data-theme] .search-input,
html[data-theme] .st-select,
html[data-theme] .ep { background: var(--glass); border-color: var(--glass-brd); }
html[data-theme] .btn-primary { color: #fff; background: var(--accent); }
html[data-theme="noir"] .btn-primary { color: var(--bg); }
html[data-theme] .btn-primary:hover, html[data-theme] .btn-primary:focus-visible { filter: brightness(1.08); outline: 2px solid var(--ink-0); outline-offset: 2px; }
html[data-theme] .back-btn:hover, html[data-theme] .back-btn:focus-visible,
html[data-theme] .ep:hover, html[data-theme] .ep:focus-visible { color: var(--ink-0); border-color: var(--accent); outline: none; }
html[data-theme] .ep.watched { color: var(--accent2); border-color: var(--accent2); }

/* profilo e selettore temi */
html[data-theme] .account-wrap { max-width: 1180px; }
html[data-theme] .acc-card { max-width: 560px; margin-left: auto; margin-right: auto; }
.appearance-card { margin-top: 22px; padding: 24px; }
.appearance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.appearance-head h2 { margin: 2px 0 0; font-size: 28px; }
.sync-state { font-family: var(--f-display-theme); color: var(--accent2); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.theme-option { min-height: 92px; display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; border: 1px solid var(--glass-brd); border-radius: var(--radius); background: var(--glass); }
.theme-option.active { border: 2px solid var(--accent); }
.theme-option span:last-child { min-width: 0; }
.theme-option b, .theme-option small { display: block; }
.theme-option b { font-family: var(--f-display-theme); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
.theme-option small { margin-top: 6px; color: var(--ink-2); font-size: 12px; }
.theme-swatch { flex: 0 0 48px; width: 48px; height: 56px; border-radius: 4px; border: 1px solid var(--glass-brd); }
.theme-option.noir .theme-swatch { background: #050505; box-shadow: inset 0 0 0 8px #f2f2f0; }
.theme-option.neon .theme-swatch { background: #10111a; box-shadow: inset 0 0 0 8px #ff2e63; }
.theme-option.manga { color: #17130f; background: #f4f0e6; }
.theme-option.manga .theme-swatch { background: #17130f; box-shadow: inset 0 0 0 8px #f4f0e6; }
.theme-option.manga b { font-family: "Bangers", Impact, sans-serif; font-size: 16px; }
.pref-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.pref-grid label > span { display: block; margin-bottom: 7px; font-family: var(--f-display-theme); font-size: 9px; color: var(--ink-2); letter-spacing: 1px; text-transform: uppercase; }
.pref-grid select { width: 100%; min-height: 46px; padding: 8px 11px; color: var(--ink-0); background: var(--glass); border: 1px solid var(--glass-brd); border-radius: var(--radius); font-family: var(--f-display-theme); font-size: 10px; }
.ink-option { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; }
.ink-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.ink-option b, .ink-option small { display: block; }
.ink-option b { font-size: 15px; }
.ink-option small { color: var(--ink-2); font-size: 12px; }
.ink-option.disabled { opacity: .45; cursor: default; }

/* bottom navigation */
@media (max-width: 700px) {
  html[data-theme] .topbar { min-height: calc(66px + env(safe-area-inset-top)); padding-top: calc(15px + env(safe-area-inset-top)); }
  html[data-theme] .topbar .brand { font-size: 18px; }
  html[data-theme] .bottom-nav {
    min-height: calc(72px + env(safe-area-inset-bottom)); padding: 7px 2px calc(7px + env(safe-area-inset-bottom));
    background: rgba(6,6,10,.96); border-top-color: var(--glass-brd);
  }
  html[data-theme="manga"] .bottom-nav { background: rgba(244,240,230,.97); border-top: 2px solid var(--ink-0); }
  html[data-theme] .bn-btn { min-height: 54px; justify-content: center; gap: 5px; color: var(--ink-2); font-size: 9px; }
  html[data-theme] .bn-btn .ico { display: flex; height: 20px; align-items: center; justify-content: center; font-size: 18px; }
  html[data-theme] .bn-btn.active { color: var(--accent); }
  html[data-theme="manga"] .bn-btn { font-family: "Bangers", Impact, sans-serif; font-size: 11px; }
  .home-hero { height: 382px; }
  .home-hero-art { width: 64%; object-position: center 24%; }
  .home-hero-shade { background: linear-gradient(90deg, var(--bg) 0%, rgba(6,6,10,.96) 33%, rgba(6,6,10,.28) 78%), linear-gradient(0deg, var(--bg), transparent 45%); }
  .home-hero-copy { width: 100%; padding: 76px 16px 28px; }
  .home-hero h1 { max-width: 9ch; font-size: 38px; }
  .home-hero p { max-width: 26ch; font-size: 15px; }
  html[data-theme="manga"] .home-hero { width: calc(100% - 24px); }
  html[data-theme="manga"] .home-hero-shade { background: linear-gradient(90deg, var(--bg) 0%, rgba(244,240,230,.97) 38%, rgba(244,240,230,.22) 78%), linear-gradient(0deg, var(--bg), transparent 42%); }
  html[data-theme] .row-scroll .card { width: min(44vw, 171px); }
  html[data-theme] .card img { height: auto; aspect-ratio: 2 / 3; }
  html[data-theme] .card .card-t { height: 58px; font-size: 14px; }
  html[data-theme] .skel { width: min(44vw, 171px); height: calc(min(44vw, 171px) * 1.5 + 58px); }
  .appearance-card { padding: 18px 14px; }
  .theme-options, .pref-grid { grid-template-columns: 1fr; }
  .theme-option { min-height: 76px; }
}

@media (min-width: 701px) and (hover: hover) {
  html[data-theme] body:not(.tv-mode) .row-scroll .card { width: 190px; }
  html[data-theme] body:not(.tv-mode) .card img { height: 285px; }
  html[data-theme] body:not(.tv-mode) .skel { width: 190px; height: 343px; }
}

html[data-density="compact"] .row { margin-bottom: 26px; }
html[data-density="compact"] .row-scroll { gap: 10px; }
html[data-density="compact"] .card .card-t { height: 52px; padding-top: 7px; }
html[data-density="compact"] .cw-bar { bottom: 52px; }
html[data-density="compact"] .quick-play { bottom: 62px; }
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }

@supports not (aspect-ratio: 2 / 3) {
  @media (max-width: 700px) { html[data-theme] .card img { height: calc(min(44vw, 171px) * 1.5); } }
}

/* Controlli legacy con stile inline: override mirato, senza toccare display/z-index. */
html[data-theme] #ar-type,
html[data-theme] #ar-year,
html[data-theme] #ar-status,
html[data-theme] #ar-order,
html[data-theme] #tv-code {
  color: var(--ink-0) !important;
  background: var(--glass) !important;
  border-color: var(--glass-brd) !important;
}
@media (max-width: 700px) {
  html[data-theme] .bn-btn { font-size: 10px; }
  html[data-theme="manga"] .bn-btn { font-size: 11px; }
}


/* ---------- installazione PWA dal Profilo ---------- */
.install-app-btn { border-color: var(--accent); color: var(--ink-0); }
.install-app-btn .install-ico { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; color: var(--accent); font-size: 20px; }
.install-app-btn.installed { opacity: .7; border-color: var(--glass-brd); cursor: default; }
.install-app-btn.installed .install-ico { color: var(--accent2); }
.pwa-install-modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.76); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pwa-install-sheet { position: relative; width: 100%; max-width: 520px; padding: 30px; border: 1px solid var(--glass-brd); }
.pwa-install-close {
  position: absolute; top: 12px; right: 12px; width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-1); background: transparent; border: 1px solid var(--glass-brd); border-radius: 50%; font-size: 16px;
}
.pwa-install-close:hover, .pwa-install-close:focus-visible { color: var(--ink-0); border-color: var(--accent); outline: none; }
.pwa-install-mark {
  display: inline-flex; min-width: 62px; height: 32px; align-items: center; justify-content: center;
  margin-bottom: 18px; color: #fff; background: var(--accent); border-radius: var(--radius);
  font-family: var(--f-display-theme); font-size: 11px; letter-spacing: 1px;
}
.pwa-install-sheet h2 { margin: 5px 0 20px; font-size: 30px; }
.pwa-install-steps { margin: 0; padding-left: 23px; color: var(--ink-0); }
.pwa-install-steps li { margin-bottom: 13px; padding-left: 4px; line-height: 1.45; }
.share-glyph { display: inline-block; padding: 1px 5px; color: var(--accent); border: 1px solid var(--glass-brd); border-radius: 4px; font-weight: 700; }
.pwa-install-note { margin: 20px 0; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.pwa-install-ok { margin-top: 4px; }
html[data-theme="manga"] .pwa-install-sheet { border-width: 2px; box-shadow: 8px 8px 0 rgba(23,19,15,.28); }
html[data-theme="manga"] .pwa-install-sheet h2 { font-family: "Bangers", Impact, sans-serif; font-size: 36px; letter-spacing: .5px; }
@media (max-width: 700px) {
  .pwa-install-modal { align-items: flex-end; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .pwa-install-sheet { padding: 26px 20px 22px; border-radius: 12px 12px 4px 4px; }
  .pwa-install-sheet h2 { padding-right: 42px; font-size: 27px; }
}

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.install-app-btn:focus, .pwa-install-close:focus, .pwa-install-ok:focus { outline: 3px solid var(--ink-0); outline-offset: 3px; }

.card img[data-broken] { opacity:1; }

/* Player touch landscape: lascia la barra nativa lontana dal bordo Home. */
@media (max-height: 700px) {
  .player-toolbar { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); }
  .player-back { min-height: 48px; padding: 9px 14px; font-size: 13px; }
  #player-back { min-width: 48px; font-size: 19px; }
  .player-label, .cast-full { display: none; }
  .cast-short { display: inline; }
  #video {
    --player-landscape-pad: 5px;
    position: absolute; left: 0; top: var(--player-landscape-pad);
    height: calc(100% - var(--player-landscape-pad) - var(--player-landscape-pad));
  }
}

/* Invito: tono giocoso, istruzione Guida sempre evidente. */
.welcome-invite { text-align: center; }
.invite-kicker {
  margin: 0 0 8px; color: var(--accent); font-family: var(--f-display);
  font-size: clamp(20px, 4vw, 34px); letter-spacing: .07em; text-transform: uppercase;
  text-shadow: 2px 0 rgba(43,231,255,.28), -2px 0 rgba(255,46,99,.22);
}
.invite-callout {
  display: flex; flex-direction: column; gap: 5px; margin: 0 0 var(--s3); padding: 14px 16px;
  text-align: left; color: var(--ink-1); background: var(--glass); border: 1px solid var(--glass-brd);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.invite-callout b { color: var(--ink-0); font-family: var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.invite-callout span { font-size: 15px; line-height: 1.45; }
