/* SendStream: stessi colori, font e forme dell'app iPhone (Theme.swift). */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/Inter-Regular.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/Inter-Medium.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/Inter-SemiBold.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fonts/Inter-Bold.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(fonts/Inter-ExtraBold.ttf) format("truetype"); }

:root {
  --bg: #121212;
  --card: #1e1e20;
  --chip: #2a2a2c;
  --elevated: #242426;
  --field: #2e2e30;
  --text: #f4f4f6;
  --text2: #c4c4ce;
  --text3: #a1a1ad;
  --text4: #8e8e9a;
  --on-text: #09090d;
  --accent: #ff3800;
  --warn: #ff9f0a;
  --ok: #34c759;
  --hairline: rgba(255, 255, 255, .06);
  --soft: rgba(255, 255, 255, .09);
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --top-h: calc(68px + var(--safe-top));
  --gutter: max(24px, 4vw);
  --poster-w: 160px;
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--top-h);
  min-height: 100vh;
}
body.has-hero { padding-top: 0; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

.glass {
  background: rgba(58, 58, 62, .45);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
}
.muted { color: var(--text3); }

/* ---------- Barra in alto e schede ---------- */

.top {
  position: fixed; inset: 0 0 auto; z-index: 30;
  height: var(--top-h); padding: var(--safe-top) var(--gutter) 0;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
  transition: background-color .25s, border-color .25s;
  border-bottom: 1px solid transparent;
}
.top.solid {
  background: rgba(18, 18, 18, .82);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border-bottom-color: var(--hairline);
}
.top .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 22.4%; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -.045em; }
.wordmark b { color: var(--accent); font-weight: 800; }
.round {
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.round.active, .search-pill.active { background: var(--text); color: var(--on-text); }
.search-pill {
  height: 44px; padding: 0 18px; border-radius: 999px; min-width: 220px;
  display: inline-flex; align-items: center; gap: 10px; color: var(--text2); font-weight: 500;
}

.tabs {
  position: fixed; z-index: 31; top: var(--safe-top); height: 68px;
  left: calc(var(--gutter) + 210px);
  display: flex; align-items: center; gap: 4px;
}
.tabs a {
  height: 40px; padding: 0 16px; border-radius: 999px;
  display: flex; align-items: center; color: var(--text3); font-weight: 600;
  transition: color .2s, background-color .2s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); background: var(--soft); }
.tabs svg { display: none; }
body.has-back .tabs { left: calc(var(--gutter) + 266px); }

/* ---------- Hero ---------- */

.hero { position: relative; height: clamp(540px, 82vh, 920px); overflow: hidden; background: var(--bg); }
.slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility 0s .9s; }
.slide.active { opacity: 1; visibility: visible; transition: opacity .9s ease; }
.slide .bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
  -webkit-mask-image: linear-gradient(#000 50%, rgba(0, 0, 0, .72) 70%, rgba(0, 0, 0, .22) 88%, transparent);
  mask-image: linear-gradient(#000 50%, rgba(0, 0, 0, .72) 70%, rgba(0, 0, 0, .22) 88%, transparent);
}
.slide.active .bg { animation: drift 12s ease-out both; }
@keyframes drift { from { transform: scale(1.08); } to { transform: scale(1); } }
.slide::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(18, 18, 18, .9), rgba(18, 18, 18, .5) 36%, transparent 66%),
    linear-gradient(transparent 60%, rgba(18, 18, 18, .6) 85%, var(--bg));
}
.hero-body {
  position: absolute; z-index: 2; left: var(--gutter); bottom: 136px; width: min(640px, 80vw);
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
}
.slide.active .hero-body > * { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.slide.active .hero-body > :nth-child(2) { animation-delay: .08s; }
.slide.active .hero-body > :nth-child(3) { animation-delay: .14s; }
.slide.active .hero-body > :nth-child(4) { animation-delay: .2s; }
.slide.active .hero-body > :nth-child(5) { animation-delay: .26s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.hero h1, .detail h1 {
  font-size: clamp(36px, 4.6vw, 66px); font-weight: 800; letter-spacing: -.03em; line-height: 1.02;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .45);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-logo {
  display: block; max-width: min(440px, 72vw); max-height: 150px; object-fit: contain; object-position: left bottom;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .5));
}
.hero-meta { font-size: 15px; font-weight: 600; color: var(--text); white-space: pre; }
.hero-plot {
  color: var(--text2); font-size: 16px; line-height: 1.5; max-width: 560px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.badge { font-size: 13px; font-weight: 500; padding: 5px 10px; border-radius: 8px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.dots { position: absolute; z-index: 3; bottom: 92px; left: var(--gutter); display: flex; gap: 6px; }
.dots button {
  width: 6px; height: 6px; padding: 0; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .4);
  transition: width .35s, background-color .35s;
}
.dots button.on { width: 22px; background: #fff; }
.shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--card) 30%, var(--elevated) 50%, var(--card) 70%) 0 0 / 220% 100%;
  animation: shimmer 1.4s linear infinite;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- Pulsanti ---------- */

.pill {
  height: 50px; padding: 0 26px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: transform .15s, background-color .2s;
}
.pill:active { transform: scale(.96); }
.pill svg { width: 18px; height: 18px; }
.pill.white { background: #fff; color: #000; }
.pill.white:hover { background: #e6e6ea; }
.pill.glass:hover { background: rgba(80, 80, 86, .55); }
.pill.wide { width: 100%; }

/* ---------- Righe ---------- */

.rows { padding-bottom: 48px; }
.has-hero .rows { position: relative; z-index: 3; margin-top: -40px; }
.row { margin-bottom: 30px; }
.row-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 var(--gutter); margin-bottom: 8px;
}
.row-head h2 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.more { font-size: 14px; font-weight: 600; color: var(--text3); padding: 8px 0; }
.more:hover { color: var(--text); }
.row-wrap { position: relative; }
.row-scroll {
  display: flex; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 8px var(--gutter) 10px; scroll-padding: 0 var(--gutter); scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll > .card { scroll-snap-align: start; }
.row-nav {
  position: absolute; z-index: 2; top: 8px; bottom: 10px; width: var(--gutter); min-width: 44px;
  border: 0; padding: 0; color: var(--text); opacity: 0; transition: opacity .2s;
  display: flex; align-items: center; justify-content: center;
}
.row-nav svg { width: 30px; height: 30px; stroke-width: 2.5; }
.row-nav.prev { left: 0; background: linear-gradient(90deg, rgba(18, 18, 18, .95), transparent); }
.row-nav.next { right: 0; background: linear-gradient(270deg, rgba(18, 18, 18, .95), transparent); }
@media (hover: hover) { .row-wrap:hover .row-nav { opacity: 1; } }

/* ---------- Card ---------- */

.card { flex: none; width: var(--poster-w); display: block; }
.frame {
  position: relative; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; background: var(--card);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}
.frame::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--hairline);
}
@media (hover: hover) { .card:hover .frame { transform: scale(1.04); box-shadow: 0 14px 34px rgba(0, 0, 0, .55); } }
.card:focus-visible { outline: none; }
.card:focus-visible .frame { outline: 3px solid var(--text); outline-offset: 3px; transform: scale(1.04); }
.art { position: absolute; inset: 0; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ph {
  position: absolute; inset: 0; padding: 12px; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 13px; font-weight: 600; color: var(--text4); overflow: hidden;
}
.card .name {
  margin-top: 8px; font-size: 13px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sub { font-size: 12px; color: var(--text4); margin-top: 2px; }
.progress { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 9px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.card.wide { width: 280px; }
.card.wide .frame { aspect-ratio: 16 / 9; border-radius: 18px; }
.card.wide .name { font-size: 15px; font-weight: 700; -webkit-line-clamp: 1; }
.shade { position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0, 0, 0, .5)); }

.card.channel { width: 190px; }
.card.channel .frame { aspect-ratio: 16 / 9; border-radius: 14px; background: var(--elevated); }
.card.channel .name { -webkit-line-clamp: 1; }
.art.logo img { object-fit: contain; padding: 14% 18%; }

.grid { display: grid; gap: 24px 14px; grid-template-columns: repeat(auto-fill, minmax(var(--poster-w), 1fr)); }
.grid .card { width: auto; }
.grid.live { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* ---------- Pagine ---------- */

.page { padding: 20px var(--gutter) 48px; }
.page.narrow { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 8px 0 20px; }
.page-head h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text4); }
.section { font-size: 20px; font-weight: 700; margin: 30px 0 8px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px var(--gutter) 18px;
}
.chips::-webkit-scrollbar { display: none; }
.page .chips { margin: 0 calc(-1 * var(--gutter)); }
.chip {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; background: var(--chip); color: var(--text2);
  font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .2s, color .2s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--on-text); }

.toolbar { display: flex; gap: 10px; margin-bottom: 22px; }
.field {
  flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 14px; border: 0;
  display: flex; align-items: center; gap: 10px; background: var(--field); color: var(--text3);
}
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.field input::placeholder { color: var(--text4); }
.field:focus-within { box-shadow: 0 0 0 2px var(--text3); }
.field.big { height: 58px; border-radius: 18px; margin-bottom: 14px; }
.field.big input { font-size: 18px; font-weight: 500; }
.select { flex: none; width: auto; color: var(--text); appearance: none; -webkit-appearance: none; padding-right: 20px; }

.search .chips { padding-bottom: 22px; }
.search .row-head, .search .row-scroll { padding-left: 0; padding-right: 0; }
.search .row-scroll { margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter) 10px; }

/* ---------- Schede ---------- */

.detail { position: relative; min-height: min(86vh, 900px); display: flex; flex-direction: column; justify-content: flex-end; }
.detail-bg { position: absolute; inset: 0; overflow: hidden; }
.detail-bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
  -webkit-mask-image: linear-gradient(#000 45%, rgba(0, 0, 0, .6) 70%, transparent);
  mask-image: linear-gradient(#000 45%, rgba(0, 0, 0, .6) 70%, transparent);
  animation: drift 14s ease-out both;
}
.detail-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(18, 18, 18, .92), rgba(18, 18, 18, .55) 45%, rgba(18, 18, 18, .15));
}
.detail-body {
  position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 40px;
  padding: calc(var(--top-h) + 120px) var(--gutter) 28px;
}
.detail-poster { width: 230px; flex: none; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.detail-text { max-width: 760px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.plot { color: var(--text2); font-size: 16px; line-height: 1.55; }
.credits { display: grid; gap: 10px; font-size: 14px; color: var(--text2); }
.credits:empty { display: none; }
.credits span { display: block; font-size: 12px; font-weight: 600; color: var(--text4); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.note { color: var(--warn); background: rgba(255, 159, 10, .1); padding: 10px 14px; border-radius: 12px; font-size: 14px; }

.episodes-page { padding-top: 8px; }
.episodes { display: flex; flex-direction: column; gap: 12px; }
.episode {
  display: flex; align-items: center; gap: 18px; width: 100%; padding: 12px; border: 0; border-radius: 18px;
  background: var(--card); text-align: left; transition: background-color .2s;
}
.episode:hover { background: var(--elevated); }
.episode .frame { width: 230px; flex: none; aspect-ratio: 16 / 9; border-radius: 12px; }
.ep-text { min-width: 0; }
.ep-title { font-size: 16px; font-weight: 700; }
.ep-plot {
  margin-top: 6px; font-size: 14px; color: var(--text3); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Account e accesso ---------- */

.panel { background: var(--card); border-radius: 18px; padding: 2px 18px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text3); }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }
.kv b.ok { color: var(--ok); }
.page.narrow .hero-actions { margin-top: 24px; }

.login { max-width: 440px; margin: 6vh auto; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo { width: 96px; height: 96px; border-radius: 22.4%; margin: 0 auto 6px; box-shadow: 0 18px 50px rgba(0, 0, 0, .7); }
.login .wordmark { font-size: 36px; }
.login .field { flex: none; height: 54px; }

/* ---------- Stati ---------- */

.center { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 16px; text-align: center; }
.message h3 { font-size: 20px; font-weight: 700; }
.message .big { font-size: 40px; }
.message .icon svg { width: 44px; height: 44px; color: var(--text4); }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--soft); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Player ---------- */

#player { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; }
.player-bar {
  position: absolute; z-index: 2; inset: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 24px; background: linear-gradient(rgba(0, 0, 0, .7), transparent);
  pointer-events: none;
}
.player-bar > * { pointer-events: auto; }
#player-title { flex: 1; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#video { flex: 1; width: 100%; min-height: 0; background: #000; }
#player-msg {
  position: absolute; z-index: 2; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: rgba(30, 30, 32, .85);
  color: var(--text2); font-size: 14px; text-align: center; display: flex; align-items: center; gap: 12px;
}
#player-msg:empty { display: none; }

/* ---------- Schermi larghi ---------- */

@media (min-width: 1600px) { :root { --poster-w: 180px; } }

/* ---------- Telefono ---------- */

@media (max-width: 760px) {
  :root { --gutter: 20px; --poster-w: 124px; --top-h: calc(60px + var(--safe-top)); }
  body { padding-bottom: calc(72px + var(--safe-bottom)); }
  .top { gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  .wordmark { font-size: 19px; }
  .search-pill { min-width: 0; width: 44px; padding: 0; justify-content: center; }
  .search-pill span { display: none; }

  .tabs {
    top: auto; bottom: 0; left: 0; right: 0; height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom); gap: 0; justify-content: space-around;
    background: rgba(18, 18, 18, .88);
    -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
    border-top: 1px solid var(--hairline);
  }
  body.has-back .tabs { left: 0; }
  .tabs a { flex: 1; height: 100%; flex-direction: column; justify-content: center; gap: 3px; padding: 0; font-size: 11px; border-radius: 0; }
  .tabs a.active { background: none; color: var(--accent); }
  .tabs svg { display: block; width: 24px; height: 24px; }

  .hero { height: max(560px, 80vh); }
  .slide::after { background: linear-gradient(rgba(0, 0, 0, .35), transparent 22%, transparent 55%, rgba(18, 18, 18, .55) 80%, var(--bg)); }
  .hero-body { left: 20px; right: 20px; width: auto; bottom: 46px; align-items: center; text-align: center; gap: 12px; }
  .hero h1 { font-size: 34px; }
  .hero-logo { max-width: 270px; max-height: 110px; object-position: center bottom; }
  .hero-plot { display: none; }
  .hero-meta { font-size: 14px; white-space: normal; }
  .hero-actions { justify-content: center; }
  .pill { height: 48px; padding: 0 22px; font-size: 15px; }
  .dots { left: 50%; bottom: 18px; transform: translateX(-50%); }
  .has-hero .rows { margin-top: 0; }
  .row-head h2 { font-size: 19px; }
  .card.wide { width: 250px; }
  .card.channel { width: 150px; }
  .grid { gap: 18px 10px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .grid.live { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .detail { min-height: 0; }
  .detail-bg { bottom: auto; height: 62vh; }
  .detail-bg::after { background: linear-gradient(rgba(0, 0, 0, .35), transparent 30%); }
  .detail-body { flex-direction: column; align-items: center; text-align: center; gap: 18px; padding-top: calc(var(--top-h) + 24vh); }
  .detail-poster { width: 150px; }
  .detail-text { align-items: center; }
  .detail h1 { font-size: 30px; }
  .hero-meta { text-align: center; }
  .credits { text-align: left; width: 100%; }
  .episode { align-items: flex-start; gap: 12px; padding: 10px; }
  .episode .frame { width: 132px; }
  .page-head h1 { font-size: 30px; }
  .toolbar { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- TV LG webOS ---------- */

html.tv { zoom: 1.3; }
.tv :focus { outline: 3px solid #fff; outline-offset: 3px; }
.tv .card:focus { outline: none; }
.tv .card:focus .frame { transform: scale(1.07); box-shadow: 0 0 0 3px #fff, 0 16px 40px rgba(0, 0, 0, .6); }
.tv .pill:focus, .tv .chip:focus { outline: none; box-shadow: 0 0 0 3px #fff; transform: scale(1.05); }
.tv .chip:focus { background: var(--text); color: var(--on-text); }
.tv .row-nav { display: none; }
