/* Look & feel modelled on mehulsatardekar/movie-streaming-webapp:
   Roboto, #141414 background, black sticky navbar, darkened hero with
   translucent buttons, hover-zoom sliders, landscape search results. */
:root {
  --bg: #141414;
  --nav: #0c0c0c;
  --surface: #1f1f1f;
  --surface-2: #2a2a2a;
  --border: rgba(249, 249, 249, .1);
  --text: #fff;
  --muted: #a9a9a9;
  --accent: #e5262b;
  --btn: rgba(51, 51, 51, .4);
  --gutter: clamp(16px, 4vw, 60px);
  --safe-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: #333 transparent; background: var(--bg); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
svg { fill: currentColor; }

/* ---------- Navbar ---------- */
#topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: calc(14px + env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 14px max(var(--gutter), env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent);
}
#topbar[hidden] { display: none; }
#topbar.solid { background: var(--nav); box-shadow: 0 0 14px #000; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; line-height: 1; font: 600 22px/1 Fredoka, Roboto, sans-serif; letter-spacing: .03em; }
.brand-mark { width: 34px; height: 34px; }
.brand-word { color: #fff; }
.brand-tv { color: var(--accent); margin-left: -4px; }
#tabs { display: flex; gap: 22px; font-weight: 500; }
#tabs a { color: #e5e5e5; transition: color .2s; white-space: nowrap; }
#tabs a:hover { color: #b3b3b3; }
#tabs a.active { color: #fff; font-weight: 700; }
.account { margin-left: auto; position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 4px; border: 0; cursor: pointer; font-weight: 700; color: #fff; }
.account-menu { position: absolute; right: 0; top: 46px; background: rgba(0, 0, 0, .92); border: 1px solid #333; padding: 14px; width: 250px; font-size: 13px; color: var(--muted); }
.account-menu strong { color: #fff; display: block; font-size: 15px; margin-bottom: 6px; }
.account-menu button { display: block; margin-top: 10px; width: 100%; background: none; border: 0; border-top: 1px solid #333; padding: 10px 0 0; text-align: left; cursor: pointer; color: #fff; }
.account-menu button:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 4px; padding: 9px 22px; font-weight: 500; font-size: 17px; cursor: pointer; transition: background .15s, color .15s; }
.btn svg { width: 20px; height: 20px; }
.btn-light { background: #fff; color: #000; }
.btn-light:hover { background: rgba(255, 255, 255, .75); }
.btn-dark { background: var(--btn); color: #fff; }
.btn-dark:hover, .btn-dark.on { background: #fff; color: #000; }
.btn-outline { background: none; border: 1px solid #808080; color: #808080; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; }
.btn-outline:hover { color: #fff; border-color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #f6121d; }
.pill { display: inline-block; border: 1px solid rgba(255, 255, 255, .6); padding: 0 6px; font-size: 13px; border-radius: 2px; }

/* ---------- Hero ---------- */
.hero { position: relative; height: 100vh; min-height: 30rem; max-height: 900px; display: flex; align-items: center; padding: 0 var(--gutter); overflow: hidden; background: #000; }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 20%; }
.hero-bg.blurred { filter: blur(26px); transform: scale(1.15); }
.hero .overlay { position: absolute; inset: 0; background: #000; opacity: .5; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 30%; background: linear-gradient(to top, var(--bg), transparent); }
.hero-content { position: relative; z-index: 2; max-width: 600px; margin-top: 60px; }
.hero-kicker { font-weight: 700; font-size: 14px; letter-spacing: .3em; text-transform: uppercase; color: #ddd; margin-bottom: 8px; }
.hero-kicker b { color: var(--accent); }
.hero h1 { font-size: clamp(36px, 5.5vw, 68px); line-height: 1.05; margin: 0 0 22px; font-weight: 900; letter-spacing: -.01em; text-shadow: 0 3px 24px rgba(0, 0, 0, .6); }
.hero h1.long, .title-hero h1.long { font-size: clamp(30px, 4vw, 50px); }
h1.has-logo { line-height: 0; }
.title-logo { display: block; max-width: min(520px, 80vw); max-height: 190px; width: auto; height: auto; object-fit: contain; object-position: left bottom; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .6)); }
.auth-form label a { color: #ccc; }
.hero-meta { display: flex; align-items: center; gap: 12px; font-weight: 500; margin-bottom: 14px; }
.hero p { margin: 0 0 22px; font-size: 17px; max-width: 470px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-poster { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-40%); width: 240px; box-shadow: 0 20px 60px rgba(0, 0, 0, .8); z-index: 2; }

/* ---------- Rows (sliders) ---------- */
.rows { position: relative; z-index: 3; margin-top: -16vh; padding-bottom: 60px; }
.rows.flat { margin-top: 0; padding-top: 100px; }
.rows.similar { margin-top: 0; }
.row { margin-bottom: 18px; min-height: 120px; }
.row-head { display: flex; align-items: baseline; gap: 14px; padding: 0 var(--gutter); }
.row-head h2 { font-size: 21px; margin: 0; font-weight: 500; color: #e5e5e5; }
.row-head a, .row-head button { background: none; border: 0; color: #54b9c5; cursor: pointer; font-size: 14px; padding: 0; opacity: 0; transition: opacity .2s; }
.row:hover .row-head a, .row:hover .row-head button { opacity: 1; }
.row-track-wrap { position: relative; }
.row-track { display: flex; gap: 6px; overflow-x: auto; scroll-behavior: smooth; padding: 26px var(--gutter) 30px; scrollbar-width: none; }
.row-track::-webkit-scrollbar { display: none; }
.row-arrow { position: absolute; top: 26px; bottom: 30px; width: calc(var(--gutter) - 6px); min-width: 34px; border: 0; background: rgba(20, 20, 20, .6); color: #fff; cursor: pointer; font-size: 34px; opacity: 0; transition: opacity .2s; z-index: 4; }
.row-arrow.left { left: 0; }
.row-arrow.right { right: 0; }
.row:hover .row-arrow { opacity: 1; }
.row-arrow:hover { background: rgba(20, 20, 20, .85); }

/* ---------- Cards ---------- */
.card { position: relative; flex: none; width: 170px; background: var(--surface); cursor: pointer; transition: transform .2s; border: 0; padding: 0; text-align: left; border-radius: 3px; overflow: hidden; }
.card:hover, .card:focus-visible { transform: scale(1.2); z-index: 3; box-shadow: 0 8px 24px rgba(0, 0, 0, .8); outline: none; }
.row-track .card:first-child:hover { transform-origin: left center; }
.card .art { aspect-ratio: 2 / 3; width: 100%; object-fit: cover; background: var(--surface-2); }
.card .placeholder { aspect-ratio: 2 / 3; display: flex; align-items: flex-end; padding: 12px; font-weight: 700; font-size: 15px; background: linear-gradient(160deg, #333, #181818); }
.card.wide { width: 300px; }
.card.wide .art, .card.wide .placeholder { aspect-ratio: 16 / 9; }
.card.channel { width: 210px; }
.card.channel .art { aspect-ratio: 16 / 10; object-fit: contain; padding: 18px; background: linear-gradient(145deg, #262626, #171717); }
.card.channel .placeholder { aspect-ratio: 16 / 10; }
.card .label { padding: 8px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { padding: 0 10px 10px; margin-top: -6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .badge { position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, .75); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 2px; }
.card .remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7); border: 1px solid rgba(255, 255, 255, .5); font-size: 12px; opacity: 0; transition: opacity .2s; }
.card:hover .remove { opacity: 1; }
.progress { height: 3px; background: rgba(255, 255, 255, .25); }
.progress > div { height: 100%; background: var(--accent); }

/* ---------- Grid pages (search, category, my list) ---------- */
.page { padding: 110px var(--gutter) 60px; min-height: 100vh; }
.page-title { margin: 0 0 24px; font-size: 30px; font-weight: 500; }
.page .back { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; margin-bottom: 12px; font-weight: 500; }
.page .back:hover { color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 26px 8px; }
.grid.channels { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid .card { width: auto; }
.grid .card:hover { transform: scale(1.08); }
.grid-more { display: flex; margin: 36px auto 0; }
.empty, .loading-msg { color: var(--muted); padding: 40px 0; }
.error { color: #e87c03; }
.error:empty { display: none; }

/* Search page */
.search-head { text-align: center; margin-bottom: 40px; }
.search-head h1 { font-size: 24px; font-weight: 500; margin: 0 0 18px; }
.search-box { position: relative; width: min(520px, 100%); margin: 0 auto; }
.search-box input { width: 100%; padding: 12px 16px; font: inherit; font-size: 17px; border-radius: 4px; border: 2px solid #3b6fe0; background: #fff; color: #111; outline: none; }
.suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; color: #111; border-radius: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); overflow: hidden; z-index: 5; text-align: left; }
.suggestions[hidden] { display: none; }
.suggestions button { display: flex; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; padding: 10px 16px; cursor: pointer; font-weight: 500; color: #111; text-align: left; }
.suggestions button small { color: #888; font-weight: 400; }
.suggestions button:hover, .suggestions button.hl { background: #eee; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 30px 18px; }
.result { cursor: pointer; }
button.result { display: block; width: 100%; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; }
.result .play svg { display: none; }
.result .thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); border-radius: 3px; position: relative; }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.result .thumb .poster { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(14px) brightness(.6); transform: scale(1.2); }
.result .thumb img.contain { position: relative; object-fit: contain; }
.result:hover .thumb img { transform: scale(1.06); }
.result .placeholder { width: 100%; height: 100%; display: flex; align-items: flex-end; padding: 12px; font-weight: 700; background: linear-gradient(160deg, #333, #181818); }
.result h3 { margin: 10px 0 4px; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .result-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.result .result-meta .play { margin-left: auto; color: #fff; font-weight: 500; }

/* ---------- Title (detail) page ---------- */
.title-hero { position: relative; min-height: 78vh; display: flex; align-items: flex-end; padding: 0 var(--gutter) 60px; background: #000; overflow: hidden; }
.title-hero .hero-bg { opacity: .9; }
.title-hero .overlay { position: absolute; inset: 0; background: linear-gradient(to right, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .35) 60%, rgba(0, 0, 0, .2) 100%), linear-gradient(to top, var(--bg) 0%, transparent 45%); }
.title-hero .hero-content { margin-top: 0; max-width: 680px; }
.title-hero h1 { font-size: clamp(32px, 5vw, 60px); }
.resume-note { font-size: 14px; color: #ddd; margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.resume-note .progress { width: 200px; }
.title-body { padding: 10px var(--gutter) 30px; display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.title-body p { margin: 0; font-size: 17px; color: #e5e5e5; }
.side-info { font-size: 14px; color: #777; }
.side-info div { margin-bottom: 10px; }
.side-info span { color: #ddd; }
hr.sep { margin: 10px var(--gutter) 24px; border: 0; border-top: 3px solid rgba(249, 249, 249, .1); }

/* Episodes */
.episodes { padding: 0 var(--gutter) 30px; }
.episodes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.episodes-head h2 { margin: 0; font-size: 24px; font-weight: 500; }
.episodes select { background: #242424; color: #fff; border: 1px solid #4d4d4d; border-radius: 3px; padding: 9px 14px; font: inherit; font-weight: 700; }
.episode { display: grid; grid-template-columns: 40px 180px 1fr; gap: 18px; align-items: center; padding: 18px 14px; border-bottom: 1px solid #404040; border-radius: 4px; cursor: pointer; }
button.episode { width: 100%; background: none; border: 0; border-bottom: 1px solid #404040; color: inherit; font: inherit; text-align: left; }
.episode:hover { background: #333; }
.episode.current { background: #262626; }
.episode .num { font-size: 24px; color: #d2d2d2; text-align: center; }
.episode .thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.episode .thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode .thumb .placeholder { width: 100%; height: 100%; background: linear-gradient(160deg, #333, #181818); }
.episode .thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; }
.episode h3 { margin: 0 0 6px; font-size: 16px; font-weight: 500; display: flex; justify-content: space-between; gap: 10px; }
.episode h3 small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.episode p { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Player ---------- */
.player { position: fixed; inset: 0; z-index: 40; background: #000; }
.player[hidden] { display: none; }
.player video { width: 100%; height: 100%; background: #000; display: block; }
.player-top { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 16px; padding: 20px 26px; background: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent); transition: opacity .3s; }
.player-title { font-weight: 700; font-size: 19px; }
.player-sub { color: #bbb; font-size: 15px; }
.player-controls { position: absolute; inset: auto 0 0 0; padding: 30px 26px 18px; background: linear-gradient(to top, rgba(0, 0, 0, .85), transparent); transition: opacity .3s; }
.player.idle .player-top, .player.idle .player-controls { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.ctrl { width: 46px; height: 46px; display: grid; place-items: center; background: none; border: 0; cursor: pointer; border-radius: 50%; transition: transform .15s; }
.ctrl:hover { transform: scale(1.15); }
.ctrl[hidden], .next-btn[hidden] { display: none; }
.ctrl svg { width: 30px; height: 30px; }
.ctrl-row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.time { font-size: 15px; margin-left: 10px; font-variant-numeric: tabular-nums; }
.live-badge { color: var(--accent); font-weight: 700; font-size: 14px; letter-spacing: .08em; margin-left: 8px; }
#volume { width: 90px; accent-color: #fff; }
.next-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font-weight: 500; font-size: 16px; padding: 8px 12px; }
.next-btn svg { width: 24px; height: 24px; }
.next-btn:hover { transform: scale(1.05); }
.seek { position: relative; height: 18px; margin-bottom: 8px; }
.seek[hidden] { display: none; }
.seek-track { position: absolute; left: 0; right: 0; top: 7px; height: 4px; background: rgba(255, 255, 255, .25); transition: height .1s, top .1s; }
.seek:hover .seek-track { top: 6px; height: 6px; }
.seek-buffer { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .4); width: 0; }
.seek-fill { position: absolute; inset: 0 auto 0 0; background: #fff; width: 0; }
.seek input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ctrl.active { color: var(--accent); }
.cast-info { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 12px; color: #bbb; font-size: 17px; text-align: center; pointer-events: none; }
.cast-info[hidden] { display: none; }
.cast-info svg { width: 72px; height: 72px; }
.player-notice { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100% - 32px)); background: rgba(20, 20, 20, .92); border-left: 3px solid #e87c03; padding: 12px 16px; border-radius: 4px; font-size: 15px; line-height: 1.4; }
.player-notice[hidden] { display: none; }
.player-error { position: absolute; inset: auto 0 48% 0; text-align: center; color: #e87c03; font-weight: 500; padding: 0 20px; }
.spinner { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login & profiles ---------- */
.fullscreen-page { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--bg); overflow-y: auto; }
.fullscreen-page[hidden] { display: none; }
.auth-page { background: radial-gradient(circle at 30% 20%, #3a0d0e, #000 65%); }
.auth-form { background: rgba(0, 0, 0, .75); border-radius: 4px; padding: 50px 60px 40px; width: 100%; max-width: 470px; display: flex; flex-direction: column; gap: 4px; }
.auth-form[hidden] { display: none; }
.auth-form h2 { margin: 0 0 18px; font-size: 32px; font-weight: 700; }
.auth-form .hint { color: #8c8c8c; font-size: 14px; margin: 0 0 16px; }
.auth-form label { display: flex; flex-direction: column; color: #8c8c8c; font-size: 13px; }
.auth-form label input { margin: 6px 0 12px; padding: 14px; background: #333; border: 0; border-bottom: 2px solid transparent; color: #fff; border-radius: 4px; font: inherit; }
.auth-form label input:focus { background: #454545; outline: none; border-bottom-color: #e87c03; }
.auth-form .btn { margin-top: 14px; justify-content: center; padding: 14px; font-weight: 700; }
.auth-form .btn-outline { padding: 10px; font-weight: 500; }
.auth-form .btn:disabled { opacity: .6; cursor: default; }
.auth-form .error { margin-top: 12px; }
.ok { color: #46d369; margin-top: 10px; }
.ok:empty { display: none; }

.profiles-box { text-align: center; }
.profiles-box h1 { font-size: clamp(28px, 4vw, 56px); font-weight: 500; margin: 0 0 30px; }
.profile-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 2vw; margin-bottom: 40px; }
.profile { position: relative; background: none; border: 0; cursor: pointer; color: #808080; width: clamp(90px, 10vw, 160px); }
.profile .face { aspect-ratio: 1; border-radius: 4px; display: grid; place-items: center; font-size: clamp(36px, 4vw, 64px); font-weight: 700; color: #fff; border: 3px solid transparent; transition: border-color .15s; }
.profile:hover { color: #e5e5e5; }
.profile:hover .face { border-color: #fff; }
.profile .name { display: block; margin-top: 10px; font-size: clamp(13px, 1.2vw, 18px); }
.profile .face.add { background: none; color: #808080; font-size: clamp(48px, 5vw, 80px); font-weight: 300; }
.profile:hover .face.add { background: #e5e5e5; color: #141414; }
.profile .edit { position: absolute; inset: 0 0 auto 0; aspect-ratio: 1; display: grid; place-items: center; background: rgba(0, 0, 0, .55); border-radius: 4px; color: #fff; }
.profile .edit svg { width: 34%; height: 34%; }
.profile .lock { display: block; margin: 6px auto 0; width: 16px; height: 16px; color: #808080; }

/* Profile editor */
.profile-form { width: min(640px, 100%); }
.profile-form h1 { font-size: clamp(30px, 4vw, 52px); font-weight: 500; margin: 0 0 8px; padding-bottom: 16px; border-bottom: 1px solid #333; }
.profile-form-body { display: flex; gap: 24px; padding: 24px 0; border-bottom: 1px solid #333; align-items: flex-start; }
.face.big { width: 120px; flex: none; aspect-ratio: 1; border-radius: 4px; display: grid; place-items: center; font-size: 60px; font-weight: 700; color: #fff; }
.profile-form-fields { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.profile-form-fields > input, .pin-row input { padding: 10px 14px; font: inherit; font-size: 17px; background: #666; border: 1px solid transparent; color: #fff; border-radius: 2px; outline: none; }
.profile-form-fields > input:focus, .pin-row input:focus { border-color: #fff; }
.pin-row { display: flex; flex-direction: column; gap: 6px; color: #ccc; font-size: 15px; }
.pin-row small { color: #888; }
.pin-row input { width: 140px; letter-spacing: .5em; }
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-picker button { width: 34px; height: 34px; border-radius: 4px; border: 3px solid transparent; cursor: pointer; }
.color-picker button.on { border-color: #fff; }
.profile-form .check { display: flex; align-items: center; gap: 8px; color: #ccc; }
.profile-form .check[hidden] { display: none; }
.profile-form .error { margin-top: 12px; }
.profile-form-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }

/* PIN prompt */
.pin-box { text-align: center; }
.pin-box p { color: #aaa; margin: 0 0 6px; }
.pin-box h1 { font-size: clamp(22px, 3vw, 36px); font-weight: 500; margin: 0 0 30px; }
.pin-digits { display: flex; gap: 14px; justify-content: center; margin-bottom: 20px; }
.pin-digits input { width: 64px; height: 64px; text-align: center; font-size: 30px; background: transparent; color: #fff; border: 2px solid #fff; border-radius: 4px; outline: none; -webkit-text-security: disc; }
.pin-digits input:focus { transform: scale(1.08); }
.pin-box .error { margin-bottom: 20px; }
.pin-box.shake .pin-digits { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-poster { display: none; }
  .title-body { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 760px) {
  #topbar { flex-wrap: wrap; gap: 10px 16px; background: #000; }
  #tabs { order: 3; width: 100%; gap: 16px; overflow-x: auto; font-size: 14px; }
  .card { width: 120px; }
  .card.wide { width: 230px; }
  .card.channel { width: 150px; }
  .card:hover { transform: none; }
  .row-arrow { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .rows.flat, .page { padding-top: 130px; }
  .hero { height: 75vh; }
  .episode { grid-template-columns: 120px 1fr; }
  .episode .num { display: none; }
  #volume, .time { display: none; }
  .auth-form { padding: 30px 20px; }
  .profile-form-body { flex-direction: column; align-items: center; }
}
.login-brand { position: absolute; top: calc(22px + env(safe-area-inset-top)); left: var(--gutter); font-size: 30px; }
.login-brand .brand-mark { width: 46px; height: 46px; }

/* ---------- Settings ---------- */
.settings { max-width: 820px; margin: 0 auto; }
.set-card { background: #1c1c1c; border: 1px solid #2a2a2a; border-radius: 8px; padding: 24px 28px; margin-bottom: 18px; }
.set-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.set-head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.set-sub { color: var(--muted); font-size: 14px; margin-left: auto; }
.chip { margin-left: auto; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 999px; }
.chip.on { background: rgba(70, 211, 105, .15); color: #46d369; }
.chip.off { background: rgba(255, 255, 255, .08); color: var(--muted); }
.set-desc { color: #b3b3b3; margin: 0 0 16px; font-size: 15px; }
.set-desc a { color: #fff; text-decoration: underline; }
.set-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0 0 18px; font-size: 15px; }
.set-grid dt { color: var(--muted); }
.set-grid dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.set-actions[hidden] { display: none; }
.set-actions .btn { font-size: 15px; padding: 9px 18px; }
.btn-ghost { background: none; color: #ccc; border: 1px solid #444; }
.btn-ghost:hover { border-color: #888; color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.set-form { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid #2a2a2a; padding-top: 16px; }
.set-form[hidden] { display: none; }
.set-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.set-form input { padding: 11px 13px; background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 4px; color: #fff; font: inherit; outline: none; }
.set-form input:focus { border-color: #888; }
.set-form select { padding: 10px 12px; background: #2a2a2a; border: 1px solid #3a3a3a; border-radius: 4px; color: #fff; font: inherit; min-width: 180px; }
.set-form select:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.set-form.inline { flex-direction: row; flex-wrap: wrap; border: 0; padding: 0; }
.set-form.inline input { flex: 1; min-width: 220px; }
.set-note { margin: 0; color: #777; font-size: 13px; }
.set-card .error { margin-top: 10px; }
.set-profiles { display: flex; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 18px; }
.set-profile { display: flex; align-items: center; gap: 10px; }
.set-profile .face { width: 36px; height: 36px; border-radius: 4px; display: grid; place-items: center; font-weight: 700; }
.set-profile small { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #fff; color: #111; padding: 12px 20px; border-radius: 6px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); z-index: 60; }
.toast[hidden] { display: none; }
@media (max-width: 760px) {
  .set-card { padding: 18px; }
  .set-grid { grid-template-columns: 1fr; gap: 2px; }
  .set-grid dd { margin-bottom: 10px; }
}

/* ======================================================================
   Touch and iPhone app (classes set on <html> by app.js):
   .touch = finger input, .phone = touch + small screen, .standalone = Home screen app.
   Desktop with a mouse never matches these rules.
   ====================================================================== */

/* ---------- Launch ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .35s; }
#splash img { width: 96px; height: 96px; }
/* Same spot as the launch image even when iOS shortens the viewport */
html.vp-gap #splash { padding-top: calc(100lvh - 100dvh); }
#splash.gone { opacity: 0; pointer-events: none; }

/* ---------- Touch basics ---------- */
html.touch { touch-action: manipulation; }
html.touch body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.touch input, html.touch textarea, html.touch select { -webkit-user-select: text; user-select: text; font-size: max(16px, 1em); }
html.phone, html.phone body, html.standalone, html.standalone body { overscroll-behavior-y: none; }
html.touch img { -webkit-user-drag: none; }

/* No hover effects on touch (iOS keeps :hover after a tap) */
html.touch .card:hover, html.touch .grid .card:hover { transform: none; box-shadow: none; }
html.touch .result:hover .thumb img { transform: none; }
html.touch .episode:not(.current):hover { background: none; }
html.touch .ctrl:hover, html.touch .next-btn:hover { transform: none; }
html.touch .profile:hover { color: #808080; }
html.touch .profile:hover .face { border-color: transparent; }
html.touch .btn-light:hover { background: #fff; }
html.touch .btn-dark:hover:not(.on) { background: var(--btn); color: #fff; }
html.touch .btn-outline:hover { color: #808080; border-color: #808080; }
html.touch .btn-accent:hover { background: var(--accent); }
html.touch .row-arrow { display: none; }
html.touch .row-head a, html.touch .row-head button { opacity: 1; }
html.touch .card .remove { opacity: 1; width: 30px; height: 30px; }

/* Pressed states */
html.touch .btn { transition: transform .12s, opacity .12s; }
html.touch :is(.card, .btn, .profile, .result, .episode, .icon-action, .me-other, .chips a, .hero-card-art, .news-art, .appbar-btn, .ctrl, .next-btn):active { transform: scale(.96); opacity: .75; }
html.touch :is(.me-menu > *, .suggestions button):active { background: #333; }

/* Rows: swipe with momentum, snap to the cards */
html.touch .row-track { scroll-behavior: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
html.touch .row-track > * { scroll-snap-align: start; }

/* Thumb-sized controls */
html.touch .set-actions .btn, html.touch .set-form .btn { min-height: 44px; }
html.touch .color-picker button { width: 40px; height: 40px; }
html.touch .episodes select { min-height: 40px; }

/* ---------- Phone shell: header ---------- */
html.phone { --gutter: 16px; --bar-h: 50px; --chips-h: 46px; --tab-h: 54px; --top-h: calc(env(safe-area-inset-top) + var(--bar-h)); }
html.phone #topbar { display: none; }
#appbar { position: fixed; inset: 0 0 auto 0; z-index: 20; padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent); transition: background .25s; }
#appbar.solid { background: rgba(20, 20, 20, .86); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
#appbar[hidden], html:not(.phone) #appbar { display: none; }
.appbar-row { display: flex; align-items: center; height: var(--bar-h); }
#appTitle { flex: 1; margin: 0 0 0 10px; font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#appBack:not([hidden]) + #appTitle { margin-left: 0; font-size: 18px; }
.appbar-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: #fff; padding: 0; }
.appbar-btn[hidden] { display: none; }
.appbar-btn svg { width: 26px; height: 26px; }
.chips { display: flex; align-items: center; gap: 8px; height: var(--chips-h); padding: 0 10px 8px; overflow: hidden; transition: height .25s, opacity .2s, padding .25s; }
#appbar:not(.with-chips) .chips { display: none; }
#appbar.compact .chips { height: 0; padding-bottom: 0; opacity: 0; }
.chips a { display: inline-flex; align-items: center; height: 34px; padding: 0 15px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 17px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.chips a.active { background: rgba(255, 255, 255, .2); border-color: transparent; }
.chips a[hidden], .chips:not(.filtered) .chip-x { display: none; }
.chips .chip-x { width: 34px; padding: 0; justify-content: center; }
.chip-x svg { width: 18px; height: 18px; }

/* ---------- Phone shell: bottom tab bar ---------- */
#tabbar { position: fixed; inset: auto 0 0 0; z-index: 25; display: flex; padding: 5px max(4px, env(safe-area-inset-right)) var(--safe-bottom) max(4px, env(safe-area-inset-left)); background: rgba(14, 14, 14, .92); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); border-top: 1px solid rgba(255, 255, 255, .07); }
#tabbar[hidden], html:not(.phone) #tabbar { display: none; }
#tabbar a { flex: 1; min-width: 0; height: calc(var(--tab-h) - 5px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8c8c8c; font-size: 10.5px; font-weight: 500; }
#tabbar a > span:last-child { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tabbar a.active { color: #fff; }
#tabbar svg { width: 25px; height: 25px; }
.tab-avatar { width: 25px; height: 25px; border-radius: 5px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
#tabbar a.active .tab-avatar { box-shadow: 0 0 0 2px #fff; }
html.phone #view { padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px); }
html.phone .toast { bottom: calc(var(--tab-h) + var(--safe-bottom) + 14px); width: max-content; max-width: calc(100% - 32px); }

/* ---------- Phone pages ---------- */
html.phone .page { min-height: 0; padding: calc(var(--top-h) + 8px) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
html.phone .page > .page-title, html.phone .page > .back { display: none; }
html.phone .rows.flat { padding-top: calc(var(--top-h) + var(--chips-h) + 4px); }
html.phone .page .rows.flat { padding-top: 0; }
html.phone .rows { margin-top: 0; padding-bottom: 8px; }
html.phone .row { margin-bottom: 4px; min-height: 0; }
html.phone .row-head { justify-content: space-between; padding: 0 max(16px, env(safe-area-inset-left)); }
html.phone .row-head h2 { font-size: 18px; font-weight: 700; color: #fff; }
html.phone .row-head a { font-size: 13px; color: #b3b3b3; }
html.phone .row-track { gap: 8px; padding: 10px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); scroll-padding-inline: max(16px, env(safe-area-inset-left)); }
html.phone .card { width: min(calc((100vw - 48px) / 3.25), 130px); border-radius: 5px; }
html.phone .card:not(.wide):not(.channel) .label { display: none; }
html.phone .card.wide { width: min(64vw, 300px); }
html.phone .card.channel { width: min(42vw, 190px); }
html.phone .card .badge { font-size: 10px; padding: 1px 5px; }
html.phone .grid { grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
html.phone .grid.channels { grid-template-columns: repeat(2, 1fr); }
html.phone .grid .card { width: auto; }
html.phone .empty, html.phone .loading-msg { padding: 24px 0; }

/* Hero: portrait = Netflix-style poster card on the poster's own colours */
.hero-card-art { display: none; }
@media (orientation: portrait) {
  html.phone .hero { height: auto; min-height: 0; max-height: none; flex-direction: column; justify-content: flex-start; padding: calc(var(--top-h) + var(--chips-h) + 6px) 0 10px; }
  html.phone .hero .hero-bg { filter: blur(44px) saturate(1.6); transform: scale(1.5); opacity: .8; }
  html.phone .hero .overlay { opacity: .25; }
  html.phone .hero::after { height: 40%; }
  html.phone .hero-poster, html.phone .hero .hero-kicker, html.phone .hero p, html.phone .hero-info, html.phone .hero-hint { display: none; }
  html.phone .hero .hero-content { margin: 0; width: min(calc(100vw - 48px), 400px, calc(62svh * 2 / 3)); max-width: none; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center; padding: 0 14px 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .1); pointer-events: none; }
  html.phone .hero .hero-content > * { pointer-events: auto; }
  html.phone .hero .hero-content > :is(h1, .hero-meta) { pointer-events: none; }
  html.phone .hero-card-art { display: block; position: absolute; inset: 0; z-index: -1; }
  html.phone .hero-card-art .art, html.phone .hero-card-art .placeholder { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
  html.phone .hero .hero-content::after { content: ""; position: absolute; inset: 45% 0 0 0; z-index: -1; background: linear-gradient(to top, rgba(0, 0, 0, .9), transparent); pointer-events: none; }
  html.phone .hero h1 { font-size: 30px; margin: 0 0 8px; }
  /* Posters already carry their title: on the card only a TMDB logo is shown */
  html.phone .hero h1:not(.has-logo) { display: none; }
  html.phone .hero h1.long { font-size: 24px; }
  html.phone .hero .title-logo { max-width: 85%; max-height: 96px; margin: 0 auto; object-position: center bottom; }
  html.phone .hero .hero-meta { justify-content: center; font-size: 13px; margin-bottom: 12px; }
  html.phone .hero .hero-actions { width: 100%; flex-wrap: nowrap; gap: 8px; }
  html.phone .hero .hero-actions .btn { flex: 1; justify-content: center; height: 42px; padding: 0 8px; font-size: 16px; font-weight: 700; white-space: nowrap; }
  html.phone .hero [data-play] { background: #fff; color: #000; }
  html.phone .hero .hero-actions .btn-dark:not([data-play]) { background: rgba(70, 70, 70, .85); }
}
@media (orientation: landscape) {
  html.phone .hero { height: 100svh; min-height: 0; padding-left: max(var(--gutter), env(safe-area-inset-left)); }
  html.phone .hero .hero-content { margin-top: calc(var(--top-h) + var(--chips-h)); max-width: 55%; }
  html.phone .hero h1 { font-size: 34px; margin-bottom: 12px; }
  html.phone .hero .title-logo { max-height: 110px; }
  html.phone .hero p { font-size: 14px; -webkit-line-clamp: 2; margin-bottom: 14px; }
  html.phone .rows { margin-top: -12vh; }
  html.phone .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  html.phone .grid.channels { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  /* Compact tab bar, icon beside the label, as iOS does in landscape */
  html.phone { --tab-h: 44px; --bar-h: 44px; }
  html.phone #tabbar a { flex-direction: row; gap: 6px; font-size: 12px; }
  html.phone #tabbar svg, html.phone .tab-avatar { width: 21px; height: 21px; }
}

/* Search: iOS search field, results as a list */
html.phone .search-head { margin-bottom: 14px; }
html.phone .search-head h1 { display: none; }
html.phone .search-box { width: 100%; }
html.phone .search-box input { -webkit-appearance: none; appearance: none; background: #2b2b2b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M10 3a7 7 0 0 1 5.6 11.2l5.1 5.1-1.4 1.4-5.1-5.1A7 7 0 1 1 10 3Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z'/%3E%3C/svg%3E") no-repeat 12px center / 20px; color: #fff; border: 0; border-radius: 10px; padding: 11px 14px 11px 40px; }
html.phone .suggestions { background: #222; color: #fff; }
html.phone .suggestions button { color: #fff; min-height: 46px; align-items: center; }
html.phone .suggestions button.hl { background: #333; }
html.phone .results { grid-template-columns: 1fr; gap: 6px; }
html.phone .result { position: relative; display: grid; grid-template-columns: 42% 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding-right: 56px; background: #1b1b1b; border-radius: 6px; overflow: hidden; }
html.phone .result .thumb { grid-row: 1 / 3; border-radius: 0; }
html.phone .result h3 { margin: 0 0 2px; font-size: 15px; align-self: end; }
html.phone .result .result-meta { font-size: 12px; gap: 6px; align-self: start; }
html.phone .result .result-meta .pill { font-size: 11px; }
html.phone .result .play { position: absolute; right: 12px; top: 50%; width: 36px; height: 36px; margin-top: -18px; display: grid; place-items: center; border: 1.5px solid #fff; border-radius: 50%; }
html.phone .result .play svg { display: block; width: 15px; height: 15px; margin-left: 2px; }
html.phone .result .play > span { display: none; }

/* Novità */
.news-list { display: flex; flex-direction: column; gap: 30px; max-width: 720px; }
.news-item { display: grid; grid-template-columns: 44px 1fr; gap: 10px; }
.news-date { text-align: center; color: #aaa; font-size: 12px; font-weight: 700; text-transform: uppercase; padding-top: 2px; }
.news-date b { display: block; font-size: 28px; line-height: 1; color: #fff; }
.news-art { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.news-art img { width: 100%; height: 100%; object-fit: cover; }
.news-art .poster { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(14px) brightness(.6); transform: scale(1.2); }
.news-art img.contain { position: relative; object-fit: contain; }
.news-art .placeholder { width: 100%; height: 100%; display: flex; align-items: flex-end; padding: 12px; font-weight: 700; background: linear-gradient(160deg, #333, #181818); }
.news-item h3 { margin: 12px 0 4px; font-size: 19px; font-weight: 700; }
.news-meta { color: var(--muted); font-size: 13px; }
.news-actions { display: flex; gap: 4px; margin-top: 10px; }
.icon-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 72px; min-height: 48px; padding: 4px; background: none; border: 0; color: #ddd; font-size: 11px; cursor: pointer; }
.icon-action svg { width: 24px; height: 24px; }

/* Il mio Sandors */
.me-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 18px; }
.me-head .face { width: 80px; height: 80px; border-radius: 8px; display: grid; place-items: center; font-size: 40px; font-weight: 700; }
.me-name { font-size: 22px; font-weight: 700; }
.me-switch { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 20px; }
.me-other { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.me-other .face { width: 50px; height: 50px; border-radius: 6px; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #fff; }
.me-other .lock { margin: 0; width: 14px; height: 14px; }
.me .rows { margin: 0 calc(-1 * var(--gutter)); }
.me .rows.flat { padding-top: 0; }
.me-menu { max-width: 640px; margin: 16px auto 0; background: #1c1c1c; border-radius: 10px; overflow: hidden; }
.me-menu > * { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 16px; background: none; border: 0; border-bottom: 1px solid #2a2a2a; color: #fff; font: inherit; text-align: left; cursor: pointer; }
.me-menu > :last-child { border-bottom: 0; }
.me-menu svg { width: 22px; height: 22px; color: #b3b3b3; }

/* ---------- Title sheet (phone) ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); transform: translate3d(0, 100%, 0); transition: transform .42s cubic-bezier(.32, .72, 0, 1); will-change: transform; backface-visibility: hidden; box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); }
.sheet[hidden] { display: none; }
.sheet.open { transform: translate3d(0, 0, 0); }
.sheet.dragging { transition: none; }
.sheet-body { height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--safe-bottom) + 24px); }
.sheet-loading { position: relative; height: 70vh; }
/* Keeps the status bar readable over the scrolled content */
.sheet::before { content: ""; position: absolute; z-index: 2; inset: 0 0 auto 0; height: env(safe-area-inset-top); background: linear-gradient(var(--bg) 55%, rgba(20, 20, 20, 0)); pointer-events: none; }
.sheet-close { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top) + 8px); right: max(10px, env(safe-area-inset-right)); width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: #fff; }
.sheet-close::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: rgba(30, 30, 30, .75); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sheet-close svg { position: relative; width: 20px; height: 20px; }
.sheet .title-hero { display: block; min-height: 0; padding: 0; overflow: visible; background: var(--bg); }
.sheet .title-hero .hero-bg { position: relative; inset: auto; aspect-ratio: 16 / 9; max-height: 60svh; width: 100%; opacity: 1; }
.sheet .title-hero .hero-bg::after { content: ""; position: absolute; inset: 55% 0 0 0; background: linear-gradient(to top, var(--bg), transparent); }
.sheet .title-hero .hero-bg.blurred { filter: blur(18px); transform: none; }
.sheet .title-hero .overlay { display: none; }
.sheet .title-hero .hero-content { position: relative; margin-top: -20px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); max-width: none; }
.sheet .hero-kicker { font-size: 12px; margin-bottom: 4px; }
.sheet .title-hero h1 { font-size: 26px; margin: 0 0 10px; }
.sheet .title-hero h1.long { font-size: 22px; }
.sheet .title-logo { max-width: 72%; max-height: 90px; }
.sheet .hero-meta { flex-wrap: wrap; gap: 8px; font-size: 14px; color: #bbb; margin-bottom: 12px; }
.sheet .hero-actions { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.sheet .hero-actions .btn { width: 100%; justify-content: center; height: 44px; padding: 0 12px; font-size: 16px; font-weight: 700; }
.sheet .hero-actions .btn-dark { background: #2b2b2b; }
.sheet .hero-actions .btn-dark.on { background: #2b2b2b; color: #fff; }
.sheet .resume-note { font-size: 13px; margin-top: 12px; }
.sheet .resume-note .progress { flex: none; width: 110px; }
.sheet .title-body { grid-template-columns: 1fr; gap: 10px; padding: 16px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.sheet .title-body p { font-size: 15px; }
.sheet .side-info { font-size: 13px; }
.sheet .side-info div { margin-bottom: 4px; }
.sheet hr.sep { margin: 12px 16px 16px; border-top-width: 1px; }
.sheet .episodes { padding: 0 max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.sheet .episodes-head h2 { font-size: 19px; font-weight: 700; }
.sheet .rows.similar { margin-top: 0; }
html.phone .episode { grid-template-columns: 128px 1fr; gap: 8px 12px; padding: 12px 0; border-radius: 0; }
html.phone .episode .num { display: none; }
html.phone .episode > div:last-child { display: contents; }
html.phone .episode h3 { flex-direction: column; gap: 2px; margin: 0; font-size: 15px; align-self: center; }
html.phone .episode p { grid-column: 1 / -1; font-size: 13px; }
html.phone .episode.current { background: none; }

/* ---------- Sign-in, profiles, PIN ---------- */
html.phone .auth-page { flex-direction: column; justify-content: flex-start; align-items: stretch; background: radial-gradient(circle at 50% 0%, #3a0d0e, #000 70%); }
html.phone .login-brand { position: static; align-self: center; margin: 24px 0 28px; font-size: 26px; }
html.phone .login-brand .brand-mark { width: 40px; height: 40px; }
html.phone .auth-form { background: none; padding: 0 8px 24px; max-width: 480px; margin: 0 auto; }
html.phone .auth-form h2 { font-size: 28px; }
html.phone .auth-form label input { padding: 16px 14px; }
html.phone .auth-form .btn { min-height: 52px; font-size: 17px; }
html.phone .profiles-box h1 { font-size: 24px; margin-bottom: 28px; }
html.phone .profile-list { display: grid; grid-template-columns: repeat(2, 116px); gap: 26px 30px; justify-content: center; align-items: start; margin-bottom: 36px; }
html.phone .profile { width: 116px; }
html.phone .profile .face { font-size: 48px; border-radius: 8px; }
html.phone .profile .name { font-size: 15px; color: #ccc; }
html.phone .profile .face.add { background: #1c1c1c; }
html.phone .profiles-box .btn { min-height: 44px; }
@media (orientation: landscape) {
  html.phone .profile-list { grid-template-columns: repeat(4, 96px); gap: 18px 24px; margin-bottom: 20px; }
  html.phone .profile { width: 96px; }
  html.phone .profiles-box h1 { margin-bottom: 16px; }
}
html.phone .profile-form h1 { font-size: 26px; }
html.phone .profile-form-fields > input, html.phone .pin-row input { padding: 13px 14px; }
html.phone .profile-form-actions .btn { flex: 1 1 100%; justify-content: center; min-height: 48px; }
html.phone #profileEditor { align-items: flex-start; }

.pin-pad { display: none; }
html.touch .pin-box h1 { font-size: 22px; margin-bottom: 8px; }
html.touch .pin-digits { gap: 22px; margin: 22px 0 14px; }
html.touch .pin-digits input { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 2px solid #fff; font-size: 0; color: transparent; caret-color: transparent; pointer-events: none; transition: background .1s; }
html.touch .pin-digits input.filled { background: #fff; }
html.touch .pin-digits input:focus { transform: none; }
html.touch .pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; justify-content: center; margin: 12px auto 22px; }
html.touch .pin-pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .13); color: #fff; font-size: 32px; font-weight: 400; transition: background .1s; }
html.touch .pin-pad button:active { background: rgba(255, 255, 255, .4); }
html.touch .pin-pad [data-key="del"] { background: none; }
html.touch .pin-pad [data-key="del"] svg { width: 30px; height: 30px; }
@media (orientation: landscape) and (max-height: 500px) {
  html.touch .pin-pad { grid-template-columns: repeat(6, 54px); gap: 10px 14px; }
  html.touch .pin-pad button { width: 54px; height: 54px; font-size: 24px; }
  html.touch .pin-pad > span { display: none; }
}

/* ---------- Player on touch ---------- */
html.touch .player { touch-action: none; -webkit-user-select: none; user-select: none; }
.player-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .3s; pointer-events: none; }
html.touch .player:not(.idle) .player-scrim { opacity: 1; }
html.touch .player-top { padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); gap: 8px; }
html.touch .player-controls { padding: 20px max(16px, env(safe-area-inset-right)) calc(8px + var(--safe-bottom)) max(16px, env(safe-area-inset-left)); }
html.phone .player-title { font-size: 16px; }
html.phone .player-sub { font-size: 13px; }
/* Big play/pause and ±10 s in the middle (fixed = centred on the player) */
html.touch #ppBtn { position: fixed; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; }
html.touch #ppBtn svg { width: 56px; height: 56px; }
html.touch #back10, html.touch #fwd10 { position: fixed; top: 50%; width: 64px; height: 64px; margin-top: -32px; }
html.touch #back10 { left: calc(50% - 32px - 120px); }
html.touch #fwd10 { left: calc(50% - 32px + 120px); }
html.touch #back10 svg, html.touch #fwd10 svg { width: 42px; height: 42px; }
html.touch #back10[hidden], html.touch #fwd10[hidden] { display: none; }
#playerSpinner:not([hidden]) ~ .player-controls #ppBtn { visibility: hidden; }
html.touch #volume { display: none; }
html.phone #muteBtn { display: none; }
html.touch .time { display: inline; margin-left: 0; font-size: 13px; }
html.touch .ctrl-row { gap: 4px; min-height: 46px; }
html.touch .next-btn { min-height: 44px; font-size: 15px; }
/* Seek bar: tall hit area, red bar with a knob */
html.touch .seek { height: 34px; margin-bottom: 0; touch-action: none; }
html.touch .seek-track { top: 15px; }
html.touch .seek.dragging .seek-track { top: 14px; height: 6px; }
html.touch .seek-fill { background: var(--accent); }
html.touch .seek input { pointer-events: none; }
.seek-knob { display: none; position: absolute; right: -8px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--accent); transition: transform .1s; }
html.touch .seek-knob { display: block; }
html.touch .seek.dragging .seek-knob { transform: scale(1.4); }
/* Double-tap feedback */
.skip-hint { position: absolute; top: 0; bottom: 0; width: 36%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; background: rgba(255, 255, 255, .1); }
.skip-hint.left { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; }
.skip-hint.right { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%; }
.skip-hint svg { width: 34px; height: 34px; }
.skip-hint.show { animation: skip-hint .7s ease-out; }
@keyframes skip-hint { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
html.touch .player-notice { bottom: calc(110px + var(--safe-bottom)); }


/* Home-screen app on a phone: app shell with its own page scroller */
html.vp-gap { --safe-bottom: 0px; }
html.standalone.phone body { position: fixed; inset: 0; overflow: hidden; background: #000; }
html.standalone.phone body.shell { background: #0f0f0f; }
html.standalone.phone body.shell.sheet-up { background: var(--bg); }
html.standalone.phone body:has(.fullscreen-page:not([hidden]), #player:not([hidden])) { background: #000; }
html.standalone.phone #view { position: absolute; inset: 0; overflow: hidden auto; overscroll-behavior: none; -webkit-overflow-scrolling: touch; }
html.standalone.phone #tabbar { background: #0f0f0f; }
html.phone :is(#profilePicker, #profileEditor, #pinPrompt) { background: #000; }

/* ---------- Audio & subtitle menu (player) ---------- */
.tracks-panel { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, var(--safe-bottom)) max(24px, env(safe-area-inset-left)); background: rgba(0, 0, 0, .88); overflow-y: auto; }
.tracks-panel[hidden], .tracks-cols section[hidden] { display: none; }
.tracks-cols { display: flex; gap: 56px; max-width: 100%; }
.tracks-cols section { min-width: 220px; }
.tracks-cols h3 { margin: 0 0 12px; padding-left: 12px; font-size: 22px; font-weight: 700; }
.track { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; background: none; border: 0; border-radius: 6px; color: #b3b3b3; font-size: 17px; text-align: left; cursor: pointer; }
.track svg { width: 22px; height: 22px; flex: none; visibility: hidden; }
.track.on { color: #fff; font-weight: 700; }
.track.on svg { visibility: visible; }
.track:focus-visible, .tracks-done:focus-visible, .ctrl:focus-visible, .next-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.track:focus-visible { background: rgba(255, 255, 255, .12); color: #fff; }
@media (hover: hover) { .track:hover { background: rgba(255, 255, 255, .12); color: #fff; } }
.tracks-done { min-width: 140px; justify-content: center; }
.player.panel-open :is(.player-top, .player-controls, .player-scrim) { opacity: 0; pointer-events: none; }
@media (orientation: portrait) {
  html.phone .tracks-cols { flex-direction: column; gap: 22px; width: 100%; }
}

/* ---------- Motion on iPhone: only transform and opacity (GPU), never layout ---------- */
.sheet-shade { position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .42s cubic-bezier(.32, .72, 0, 1); }
html:not(.phone) .sheet-shade { display: none; }
body.sheet-up .sheet-shade { opacity: 1; }
html.phone #view.view-enter > * { animation: view-enter .24s ease-out both; }
html.phone #view.view-push > * { animation: view-push .32s cubic-bezier(.32, .72, 0, 1) both; }
@keyframes view-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes view-push { from { opacity: .4; transform: translate3d(28%, 0, 0); } to { opacity: 1; transform: none; } }
/* Pressed states ease in and out instead of jumping */
html.touch :is(.result, .episode, .profile, .icon-action, .me-other, .chips a, .hero-card-art, .news-art, .appbar-btn, .ctrl, .next-btn, #tabbar a) { transition: transform .16s ease, opacity .16s ease; }
html.touch #tabbar a:active { transform: scale(.9); }
/* Posters fade in instead of popping */
html.touch img.art { opacity: 0; transition: opacity .3s ease; }
html.touch img.art.ready { opacity: 1; }
/* Composited layers for the parts that move while scrolling */
html.phone :is(#appbar, #tabbar) { transform: translateZ(0); }
html.phone .row-track { transform: translateZ(0); }
.player-top, .player-controls, .player-scrim { will-change: opacity; }
@media (prefers-reduced-motion: reduce) {
  html.phone #view.view-enter > *, html.phone #view.view-push > * { animation: none; }
  .sheet, .sheet-shade { transition-duration: .01s; }
}
