/* ============================================================
   YTtv — design system "cinema"
   Dark, cinematico, ispirato a Netflix / Apple TV.
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg-elev: #12121a;
  --bg-card: #16161f;
  --surface-1: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --surface-3: rgba(255, 255, 255, 0.14);
  --stroke: rgba(255, 255, 255, 0.10);
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, 0.68);
  --text-3: rgba(245, 245, 247, 0.42);
  --accent: #e50914;
  --accent-hi: #ff3b30;
  --accent-soft: rgba(229, 9, 20, 0.16);
  --ok: #30d158;
  --warn: #ffd60a;
  --shorts: #7c5cff;
  --shorts-soft: rgba(124, 92, 255, 0.18);
  --radius: 14px;
  --radius-lg: 20px;
  --topbar-h: 64px;
  --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px));
  --page-x: clamp(16px, 4vw, 56px);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 24px 70px rgba(0, 0, 0, 0.65);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(229, 9, 20, 0.09), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(124, 92, 255, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}

img { display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
input, select { font-family: inherit; }
[hidden] { display: none !important; }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Topbar ---------------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 var(--page-x);
  z-index: 60;
  background: linear-gradient(rgba(10, 10, 15, 0.86), rgba(10, 10, 15, 0.55) 70%, transparent);
  transition: background .3s ease, backdrop-filter .3s ease;
}
.topbar.scrolled {
  background: rgba(12, 12, 18, 0.82);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  box-shadow: 0 1px 0 var(--stroke);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #b0060f);
  box-shadow: 0 4px 18px rgba(229, 9, 20, 0.45);
}
.brand-mark svg { width: 20px; height: 20px; color: #fff; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: 0.4px; }
.brand-name em { font-style: normal; color: var(--accent-hi); }

.topnav { display: flex; gap: 4px; }
.topnav a {
  padding: 8px 14px; border-radius: 99px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: color .2s, background .2s;
}
.topnav a:hover { color: var(--text); background: var(--surface-1); }
.topnav a.active { color: var(--text); background: var(--surface-2); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }

.topsearch {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--stroke);
  border-radius: 99px;
  padding: 0 14px;
  height: 40px;
  width: clamp(180px, 26vw, 340px);
  transition: border-color .2s, background .2s, width .25s var(--ease-spring);
}
.topsearch:focus-within { border-color: rgba(255,255,255,.32); background: var(--surface-2); width: clamp(220px, 32vw, 420px); }
.topsearch svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.topsearch input {
  background: none; border: 0; outline: 0; color: var(--text);
  width: 100%; font-size: 14px;
}
.topsearch input::placeholder { color: var(--text-3); }
.topsearch input::-webkit-search-cancel-button { -webkit-appearance: none; }

.iconbtn {
  width: 40px; height: 40px; border-radius: 99px; border: 1px solid transparent;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface-1); color: var(--text-2);
  transition: background .2s, color .2s, transform .2s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.avatarbtn {
  width: 40px; height: 40px; border-radius: 99px; cursor: pointer; padding: 0;
  border: 2px solid var(--stroke); overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; transition: border-color .2s, transform .2s;
}
.avatarbtn:hover { border-color: rgba(255,255,255,.4); }
.avatarbtn:active { transform: scale(0.92); }
.avatarbtn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback svg { width: 20px; height: 20px; color: var(--text-2); }

.avatar-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 230px;
  background: rgba(22, 22, 31, 0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 6px; z-index: 80;
  animation: pop-in .18s var(--ease-spring);
}
.avatar-menu-head { padding: 10px 12px; border-bottom: 1px solid var(--stroke); margin-bottom: 6px; }
.avatar-menu-head .name { font-weight: 700; font-size: 14px; }
.avatar-menu-head .mail { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.avatar-menu a, .avatar-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
}
.avatar-menu a:hover, .avatar-menu button:hover { background: var(--surface-2); color: var(--text); }
.avatar-menu svg { width: 17px; height: 17px; }

/* ---------------- Layout / view ---------------- */

.view { padding: var(--topbar-h) 0 calc(var(--tabbar-h) + 40px); min-height: 100dvh; }
.page { padding: 26px var(--page-x) 0; }
/* Le animazioni d'ingresso partono solo cambiando pagina davvero (.nav-enter):
   la vista viene ridisegnata anche dopo un semplice "segna come visto", e
   rigiocare la dissolvenza dava la sensazione di un refresh completo. */
.nav-enter .page { animation: fade-up .35s var(--ease-spring); }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.page-sub { color: var(--text-2); margin: 6px 0 0; font-size: 15px; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 19px; font-weight: 750; letter-spacing: -0.2px;
  margin: 0 var(--page-x) 12px;
}
.section-title .count {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  background: var(--surface-2); padding: 3px 9px; border-radius: 99px;
}
.section-title .see-all { margin-left: auto; font-size: 13px; color: var(--text-2); font-weight: 600; }
.section-title .see-all:hover { color: var(--text); }
.section-title svg { width: 20px; height: 20px; color: var(--accent-hi); }
.section-title.is-shorts svg { color: var(--shorts); }

/* ---------------- Hero (billboard) ---------------- */

.hero {
  position: relative;
  margin: calc(var(--topbar-h) * -1) 0 34px;
  min-height: clamp(420px, 62vh, 640px);
  display: flex; align-items: flex-end;
  isolation: isolate;
}
.hero-bg { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.nav-enter .hero-bg img { animation: hero-zoom 14s ease-out both; }
@keyframes hero-zoom { from { transform: scale(1.08); } to { transform: scale(1); } }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 2%, rgba(10,10,15,0.65) 38%, rgba(10,10,15,0.15) 70%, rgba(10,10,15,0.45)),
    linear-gradient(to right, rgba(10,10,15,0.88), rgba(10,10,15,0.25) 55%, transparent);
}
.hero-content { padding: 0 var(--page-x) clamp(28px, 5vh, 52px); max-width: 720px; }
.nav-enter .hero-content { animation: fade-up .5s var(--ease-spring); }
.hero-channel { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 14px;
  background: rgba(0,0,0,0.4); border: 1px solid var(--stroke); padding: 6px 14px 6px 6px; border-radius: 99px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; font-weight: 700; }
.hero-channel img { width: 26px; height: 26px; border-radius: 99px; }
.hero-title {
  font-size: clamp(26px, 4.6vw, 46px); font-weight: 850; letter-spacing: -1px;
  line-height: 1.08; margin: 0 0 12px;
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-meta { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 14px; font-weight: 600; margin-bottom: 22px; flex-wrap: wrap; }
.hero-meta .new-badge { color: var(--ok); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Buttons / chips ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 22px; border-radius: 12px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 750; letter-spacing: 0.1px;
  transition: transform .15s var(--ease-spring), background .2s, opacity .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: rgba(255,255,255,0.85); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 24px rgba(229,9,20,0.35); }
.btn-accent:hover { background: var(--accent-hi); }
.btn-soft { background: rgba(80, 80, 95, 0.55); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn-soft:hover { background: rgba(105, 105, 120, 0.6); }
.btn-ghost { background: var(--surface-1); color: var(--text); border: 1px solid var(--stroke); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(255, 69, 58, 0.16); color: #ff6961; border: 1px solid rgba(255,69,58,0.35); }
.btn-danger:hover { background: rgba(255, 69, 58, 0.26); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-google { background: #fff; color: #1f1f1f; }
.btn-google:hover { background: #ececec; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 calc(var(--page-x) * 0) 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 16px; border-radius: 99px; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--stroke); color: var(--text-2);
  font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px;
  transition: all .2s;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: #fff; color: #000; border-color: #fff; }
.chip .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }

/* ---------------- Rows (carousel) ---------------- */

.row { margin-bottom: 34px; position: relative; }
.row-scroller {
  display: grid; grid-auto-flow: column; gap: 14px;
  grid-auto-columns: clamp(240px, 24vw, 330px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 6px var(--page-x) 14px;
  scrollbar-width: none;
}
.row-scroller::-webkit-scrollbar { display: none; }
.row-scroller > * { scroll-snap-align: start; }
.row-scroller.shorts-row { grid-auto-columns: clamp(140px, 15vw, 190px); }
.row-scroller.channels-row { grid-auto-columns: clamp(150px, 16vw, 200px); }

.row-arrow {
  position: absolute; top: 0; bottom: 14px; width: 52px; z-index: 5;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: linear-gradient(to right, rgba(10,10,15,0.9), transparent);
  color: #fff; opacity: 0; transition: opacity .25s;
}
.row-arrow.right { right: 0; background: linear-gradient(to left, rgba(10,10,15,0.9), transparent); }
.row-arrow.left { left: 0; }
.row:hover .row-arrow { opacity: 1; }
.row-arrow svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.8)); }
@media (hover: none) { .row-arrow { display: none; } }

/* ---------------- Video card ---------------- */

.vcard { cursor: pointer; position: relative; }
.vcard-thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 2px 14px rgba(0,0,0,0.35);
  transition: transform .3s var(--ease-spring), box-shadow .3s;
}
.vcard:hover .vcard-thumb { transform: scale(1.045) translateY(-3px); box-shadow: var(--shadow-card); }
.vcard-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-spring); }
.vcard-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent 45%);
  opacity: 0; transition: opacity .25s;
}
.vcard:hover .vcard-thumb::after { opacity: 1; }

.vcard .dur {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(0,0,0,0.78); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 7px; border-radius: 6px; letter-spacing: 0.3px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.vcard .live-badge { position: absolute; left: 8px; bottom: 8px; z-index: 2; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }

.vcard .play-hint {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.vcard:hover .play-hint { opacity: 1; }
.vcard .play-hint span {
  width: 54px; height: 54px; border-radius: 99px; display: grid; place-items: center;
  background: rgba(255,255,255,0.92); color: #000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transform: scale(.8); transition: transform .25s var(--ease-spring);
}
.vcard:hover .play-hint span { transform: scale(1); }
.vcard .play-hint svg { width: 26px; height: 26px; margin-left: 3px; }

.vcard .progressbar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: 3; background: rgba(255,255,255,0.22); }
.vcard .progressbar i { display: block; height: 100%; background: var(--accent); border-radius: 0 99px 99px 0; }

.vcard .watched-tag {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,0.72); color: var(--ok); font-size: 11px; font-weight: 800;
  padding: 4px 9px; border-radius: 99px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.vcard .watched-tag svg { width: 13px; height: 13px; }
.vcard.is-watched .vcard-thumb img { filter: grayscale(0.5) brightness(0.62); }

.vcard-body { display: flex; gap: 10px; padding: 10px 4px 0; }
.vcard-body .ch-avatar { width: 34px; height: 34px; border-radius: 99px; flex: none; margin-top: 2px; background: var(--surface-2); }
.vcard-title {
  font-size: 14px; font-weight: 650; line-height: 1.32; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vcard-meta { color: var(--text-3); font-size: 12.5px; margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.vcard-meta .ch-name { color: var(--text-2); font-weight: 600; }
.vcard-meta .ch-name:hover { color: var(--text); }

.vcard-actions {
  position: absolute; right: 8px; top: 8px; z-index: 4; display: flex; gap: 6px;
  opacity: 0; transform: translateY(-4px); transition: all .2s;
}
.vcard:hover .vcard-actions, .vcard:focus-within .vcard-actions { opacity: 1; transform: none; }
@media (hover: none) { .vcard-actions { opacity: 1; transform: none; } }
.qbtn {
  width: 32px; height: 32px; border-radius: 99px; border: 0; cursor: pointer;
  background: rgba(0,0,0,0.72); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s, transform .15s;
}
.qbtn:hover { background: rgba(40,40,50,0.9); }
.qbtn:active { transform: scale(0.88); }
.qbtn svg { width: 16px; height: 16px; }
.qbtn.on { background: var(--ok); color: #04310f; }
.qbtn.on-wl { background: var(--warn); color: #4a3b00; }

/* ---------------- Short card ---------------- */

.scard { cursor: pointer; position: relative; }
.scard-thumb {
  position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(160deg, #191925, #101018);
  box-shadow: 0 2px 14px rgba(0,0,0,0.4);
  transition: transform .3s var(--ease-spring), box-shadow .3s;
}
.scard:hover .scard-thumb { transform: scale(1.05) translateY(-4px); box-shadow: var(--shadow-card); }
.scard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scard-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent 42%);
}
.scard .s-badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--shorts); color: #fff; font-size: 10.5px; font-weight: 800;
  padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .4px;
  box-shadow: 0 4px 14px rgba(124,92,255,.4);
}
.scard .s-badge svg { width: 11px; height: 11px; }
.scard.is-watched .scard-thumb img { filter: grayscale(0.5) brightness(0.55); }
.scard .watched-tag { position: absolute; right: 8px; top: 8px; z-index: 2; background: rgba(0,0,0,0.72); color: var(--ok); border-radius: 99px; padding: 5px; display: grid; place-items: center; }
.scard .watched-tag svg { width: 13px; height: 13px; }
.scard-info { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.scard-title {
  font-size: 12.5px; font-weight: 700; line-height: 1.3; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.scard-meta { font-size: 11px; color: rgba(255,255,255,0.75); display: flex; gap: 6px; align-items: center; }
.scard-meta img { width: 16px; height: 16px; border-radius: 99px; }

/* ---------------- Grids ---------------- */

.vgrid {
  display: grid; gap: 22px 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.sgrid {
  display: grid; gap: 16px 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.chgrid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ---------------- Channel card ---------------- */

.chcard {
  background: linear-gradient(150deg, var(--surface-1), rgba(255,255,255,0.02));
  border: 1px solid var(--stroke); border-radius: var(--radius-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .25s var(--ease-spring), border-color .2s, background .2s;
}
.chcard:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.22); }
.chcard-top { display: flex; align-items: center; gap: 13px; cursor: pointer; }
.chcard-top img { width: 56px; height: 56px; border-radius: 99px; border: 2px solid var(--stroke); background: var(--surface-2); }
.chcard-name { font-size: 15.5px; font-weight: 750; margin: 0; line-height: 1.2; }
.chcard-handle { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.chcard-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.chcard-stats span {
  font-size: 11.5px; font-weight: 700; color: var(--text-2);
  background: var(--surface-1); border: 1px solid var(--stroke);
  padding: 4px 10px; border-radius: 99px;
}
.chcard-stats .unseen { color: #fff; background: var(--accent); border-color: transparent; }
.chcard-actions { display: flex; gap: 8px; margin-top: auto; }

.chip-channel {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 10px; border-radius: var(--radius-lg); cursor: pointer; text-align: center;
  background: var(--surface-1); border: 1px solid var(--stroke);
  transition: transform .25s var(--ease-spring), background .2s;
}
.chip-channel:hover { transform: translateY(-3px); background: var(--surface-2); }
.chip-channel img { width: 74px; height: 74px; border-radius: 99px; border: 2px solid var(--stroke); background: var(--surface-2); }
.chip-channel b { font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip-channel .sub { font-size: 11.5px; color: var(--text-3); }
.chip-channel .pill { font-size: 10.5px; font-weight: 800; background: var(--accent); border-radius: 99px; padding: 2px 8px; }

/* ---------------- Channel detail ---------------- */

.ch-hero { position: relative; margin-top: -26px; padding: 40px var(--page-x) 26px; overflow: hidden; }
.ch-hero-banner { position: absolute; inset: 0; z-index: -1; }
.ch-hero-banner img { width: 100%; height: 100%; object-fit: cover; filter: blur(30px) brightness(0.35) saturate(1.4); transform: scale(1.2); }
.ch-hero-inner { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ch-hero-inner > img { width: 96px; height: 96px; border-radius: 99px; border: 3px solid rgba(255,255,255,0.25); box-shadow: var(--shadow-card); }
.ch-hero h1 { margin: 0 0 4px; font-size: clamp(24px, 3.6vw, 34px); font-weight: 850; letter-spacing: -0.6px; }
.ch-hero .meta { color: var(--text-2); font-size: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.ch-hero .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Add channel / search ---------------- */

.addbox {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface-1); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 8px 8px 8px 18px; margin-bottom: 8px;
  transition: border-color .2s;
}
.addbox:focus-within { border-color: rgba(255,255,255,0.35); }
.addbox svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.addbox input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font-size: 15px; min-width: 0; }
.addbox input::placeholder { color: var(--text-3); }

.hint { color: var(--text-3); font-size: 12.5px; margin: 8px 4px 22px; }

.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-1); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 12px 14px;
  transition: background .2s, transform .2s var(--ease-spring);
}
.result-item:hover { background: var(--surface-2); }
.result-item img { width: 52px; height: 52px; border-radius: 99px; background: var(--surface-2); flex: none; }
.result-item .info { min-width: 0; flex: 1; }
.result-item .info b { display: block; font-size: 15px; }
.result-item .info span { color: var(--text-3); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Search page ---------------- */

.search-hero { max-width: 760px; margin: 0 auto; }
.search-hero .addbox { padding: 10px 10px 10px 20px; border-radius: 20px; background: var(--surface-2); }
.search-hero .addbox input { font-size: 17px; height: 40px; }
.search-section { margin-top: 30px; }
.search-section h3 { font-size: 16px; font-weight: 750; color: var(--text-2); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.search-section h3 svg { width: 17px; height: 17px; }

/* ---------------- Empty states ---------------- */

.empty {
  text-align: center; padding: 70px 20px; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.empty .art {
  width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--stroke);
}
.empty .art svg { width: 42px; height: 42px; color: var(--text-3); }
.empty h3 { margin: 0; color: var(--text); font-size: 20px; font-weight: 800; }
.empty p { margin: 0; max-width: 420px; font-size: 14px; }

/* ---------------- Skeletons ---------------- */

.skel { position: relative; overflow: hidden; background: var(--surface-1); border-radius: var(--radius); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.07) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-thumb { aspect-ratio: 16/9; }
.skel-short { aspect-ratio: 9/16; }
.skel-line { height: 13px; border-radius: 6px; margin-top: 10px; }
.skel-line.w60 { width: 60%; }

/* ---------------- Player (film) ---------------- */

.player-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 5, 9, 0.7);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; overscroll-behavior: contain;
  animation: fade .25s ease;
  padding: clamp(0px, 4vh, 40px) 0;
}
@keyframes fade { from { opacity: 0; } }
.player-sheet {
  width: min(1060px, 100%); margin: 0 auto;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-pop);
  border: 1px solid var(--stroke);
  animation: sheet-in .35s var(--ease-spring);
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }
.player-stage { position: relative; aspect-ratio: 16/9; background: #000; }
.player-stage iframe, .player-stage > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-close {
  position: fixed; top: 18px; right: 18px; z-index: 110;
  width: 44px; height: 44px; border-radius: 99px; border: 0; cursor: pointer;
  background: rgba(20,20,28,0.8); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .2s, transform .15s;
}
.player-close:hover { background: rgba(50,50,60,0.9); }
.player-close:active { transform: scale(.9); }
.player-close svg { width: 20px; height: 20px; }

.player-info { padding: 20px clamp(16px, 3vw, 28px) 26px; }
.player-title { font-size: clamp(18px, 2.4vw, 24px); font-weight: 800; letter-spacing: -0.3px; margin: 0 0 6px; line-height: 1.25; }
.player-meta { color: var(--text-3); font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.player-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.player-ch { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--surface-1); border: 1px solid var(--stroke); transition: background .2s; }
.player-ch:hover { background: var(--surface-2); }
.player-ch img { width: 34px; height: 34px; border-radius: 99px; }
.player-ch b { font-size: 13.5px; }
.player-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.player-next { padding: 0 clamp(16px, 3vw, 28px) 26px; }
.player-next h4 { font-size: 14px; font-weight: 800; color: var(--text-2); margin: 0 0 12px; text-transform: uppercase; letter-spacing: 1px; }
.player-next .row-scroller { padding-left: 0; padding-right: 0; grid-auto-columns: clamp(200px, 22vw, 250px); }

/* ---------------- Shorts player (verticale, immersivo) ---------------- */

.shorts-overlay {
  position: fixed; inset: 0; z-index: 120; background: #000;
  animation: fade .25s ease; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.shorts-backdrop { position: absolute; inset: 0; overflow: hidden; }
.shorts-backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(60px) brightness(0.28) saturate(1.5); transform: scale(1.3); transition: opacity .4s; }
.shorts-stage-wrap { position: relative; height: 100dvh; display: flex; align-items: center; justify-content: center; gap: 18px; }
.shorts-frame {
  position: relative; height: min(94dvh, 900px); aspect-ratio: 9/16;
  background: #0c0c12; border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.8);
  transition: transform .3s var(--ease-spring);
}
.shorts-frame iframe, .shorts-frame > div:first-child { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.shorts-frame.swipe-up { animation: swipe-up .3s var(--ease-spring); }
.shorts-frame.swipe-down { animation: swipe-down .3s var(--ease-spring); }
@keyframes swipe-up { from { transform: translateY(60px); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes swipe-down { from { transform: translateY(-60px); opacity: 0.3; } to { transform: none; opacity: 1; } }

.shorts-overlay .scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.72), transparent); z-index: 2;
}
.shorts-caption { position: absolute; left: 14px; right: 64px; bottom: 14px; z-index: 3; }
.shorts-caption .ch { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; cursor: pointer; }
.shorts-caption .ch img { width: 32px; height: 32px; border-radius: 99px; border: 2px solid rgba(255,255,255,0.4); }
.shorts-caption .ch b { font-size: 13.5px; font-weight: 750; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.shorts-caption .title { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.shorts-caption .meta { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 5px; }

.shorts-rail {
  position: absolute; right: 10px; bottom: 18px; z-index: 4;
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.shorts-rail .railbtn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; cursor: pointer; color: #fff;
}
.shorts-rail .railbtn > span:first-child {
  width: 46px; height: 46px; border-radius: 99px; display: grid; place-items: center;
  background: rgba(255,255,255,0.14); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.shorts-rail .railbtn:hover > span:first-child { background: rgba(255,255,255,0.26); }
.shorts-rail .railbtn:active > span:first-child { transform: scale(.88); }
.shorts-rail .railbtn.on > span:first-child { background: var(--ok); color: #04310f; }
.shorts-rail .railbtn.on-wl > span:first-child { background: var(--warn); color: #4a3b00; }
.shorts-rail .railbtn svg { width: 21px; height: 21px; }
.shorts-rail .railbtn small { font-size: 10.5px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.8); }

.shorts-nav {
  display: flex; flex-direction: column; gap: 14px; z-index: 5;
}
.shorts-nav button {
  width: 52px; height: 52px; border-radius: 99px; border: 1px solid var(--stroke); cursor: pointer;
  background: rgba(255,255,255,0.08); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.shorts-nav button:hover { background: rgba(255,255,255,0.2); }
.shorts-nav button:active { transform: scale(.9); }
.shorts-nav button[disabled] { opacity: 0.3; pointer-events: none; }
.shorts-nav svg { width: 24px; height: 24px; }
.shorts-close { position: fixed; top: 16px; right: 16px; z-index: 130; }
.shorts-counter {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 125;
  font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.45); padding: 5px 14px; border-radius: 99px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
@media (max-width: 720px) {
  .shorts-frame { height: 100dvh; aspect-ratio: auto; width: 100vw; border-radius: 0; }
  .shorts-nav { display: none; }
  .shorts-caption { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .shorts-rail { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------- Profile ---------------- */

.profile-hero {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: linear-gradient(140deg, var(--surface-2), rgba(255,255,255,0.02));
  border: 1px solid var(--stroke); border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 32px); margin-bottom: 26px;
}
.profile-hero img.pic { width: 88px; height: 88px; border-radius: 99px; border: 3px solid rgba(255,255,255,0.25); }
.profile-hero .pic-fallback { width: 88px; height: 88px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--stroke); }
.profile-hero .pic-fallback svg { width: 40px; height: 40px; color: var(--text-3); }
.profile-hero h2 { margin: 0 0 4px; font-size: 24px; font-weight: 850; }
.profile-hero .mail { color: var(--text-2); font-size: 14px; }
.profile-hero .syncline { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--surface-1); border: 1px solid var(--stroke); color: var(--text-2); }
.profile-hero .syncline .led { width: 8px; height: 8px; border-radius: 99px; background: var(--text-3); }
.profile-hero .syncline.on { color: var(--ok); }
.profile-hero .syncline.on .led { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.profile-hero .actions { margin-left: auto; display: flex; flex-direction: column; gap: 8px; }

.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 30px; }
.stat-card {
  background: var(--surface-1); border: 1px solid var(--stroke); border-radius: var(--radius-lg);
  padding: 18px; text-align: left;
}
.stat-card .num { font-size: clamp(24px, 3vw, 32px); font-weight: 850; letter-spacing: -1px; }
.stat-card .lbl { color: var(--text-3); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }
.stat-card.accent .num { color: var(--accent-hi); }
.stat-card.shorts .num { color: var(--shorts); }
.stat-card.ok .num { color: var(--ok); }

.profile-hero .syncline.err { color: #ff6961; }
.profile-hero .syncline.err .led { background: #ff6961; box-shadow: 0 0 10px #ff6961; }

/* avviso cloud (errore di sync) */
.cloud-alert {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 69, 58, 0.10); border: 1px solid rgba(255, 69, 58, 0.35);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 22px;
}
.cloud-alert > svg { width: 22px; height: 22px; color: #ff6961; flex: none; }
.cloud-alert b { font-size: 14.5px; }
.cloud-alert p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.cloud-alert > div { flex: 1; min-width: 0; }
.cloud-alert .btn { flex: none; }

/* ---------------- Statistiche ---------------- */

.stat-block { margin-bottom: 34px; }
.stat-two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .stat-two { grid-template-columns: 1fr; } }

.chart-bars {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
  align-items: end; height: 180px;
  background: var(--surface-1); border: 1px solid var(--stroke);
  border-radius: var(--radius-lg); padding: 16px 14px 10px;
}
.chart-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar-fill { width: min(70%, 26px); border-radius: 6px 6px 3px 3px; transition: height .5s var(--ease-spring); min-height: 0; }
.chart-bar-x { font-size: 10.5px; color: var(--text-3); font-weight: 700; }

.split-card, .hour-chart, .top-ch-list, .activity-feed {
  background: var(--surface-1); border: 1px solid var(--stroke); border-radius: var(--radius-lg);
}
.split-card { padding: 20px; }
.split-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.split-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; width: 92px; flex: none; }
.split-label svg { width: 15px; height: 15px; }
.split-track { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.split-track i { display: block; height: 100%; border-radius: 99px; transition: width .5s var(--ease-spring); }
.split-row b { width: 40px; text-align: right; font-size: 15px; font-weight: 800; }
.split-foot { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12.5px; padding-top: 6px; border-top: 1px solid var(--stroke); }

.hour-chart { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 132px; padding: 16px 14px 8px; }
.hour-bar { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; position: relative; }
.hour-fill { width: 100%; max-width: 12px; background: linear-gradient(180deg, var(--shorts), rgba(124,92,255,.5)); border-radius: 4px 4px 2px 2px; transition: height .5s var(--ease-spring); }
.hour-bar span { position: absolute; bottom: -16px; font-size: 9.5px; color: var(--text-3); font-weight: 700; }
.hour-chart { margin-bottom: 12px; }

.top-ch-list { padding: 8px; display: flex; flex-direction: column; }
.top-ch { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; transition: background .15s; }
.top-ch:hover { background: var(--surface-2); }
.top-ch img { width: 42px; height: 42px; border-radius: 99px; flex: none; background: var(--surface-2); }
.top-ch-info { flex: 1; min-width: 0; }
.top-ch-info b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }
.top-ch-track { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.top-ch-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); border-radius: 99px; transition: width .5s var(--ease-spring); }
.top-ch-val { text-align: right; font-size: 14px; font-weight: 800; flex: none; }
.top-ch-val small { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); }

.activity-feed { padding: 6px 8px; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.activity-item.clickable { cursor: pointer; }
.activity-item.clickable:hover { background: var(--surface-2); }
.activity-dot { width: 9px; height: 9px; border-radius: 99px; flex: none; background: var(--text-3); }
.activity-dot.play { background: var(--accent); }
.activity-dot.open { background: var(--ok); }
.activity-dot.search { background: var(--warn); }
.activity-dot.channel_add { background: var(--shorts); }
.activity-dot.channel_remove { background: #ff6961; }
.activity-text { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-text b { color: var(--text); font-weight: 650; }
.activity-time { color: var(--text-3); font-size: 12px; flex: none; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; align-items: center; gap: 14px; padding: 10px;
  border-radius: var(--radius); background: var(--surface-1); border: 1px solid transparent;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.history-item:hover { background: var(--surface-2); border-color: var(--stroke); }
.history-item .th { position: relative; width: 120px; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; flex: none; background: var(--bg-card); }
.history-item .th.vertical { width: 52px; aspect-ratio: 9/16; }
.history-item .th img { width: 100%; height: 100%; object-fit: cover; }
.history-item .info { min-width: 0; flex: 1; }
.history-item .info b { display: block; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-item .info span { color: var(--text-3); font-size: 12px; }

/* ---------------- Settings ---------------- */

.settings-grid { display: grid; gap: 18px; max-width: 860px; }
.setting-card {
  background: var(--surface-1); border: 1px solid var(--stroke);
  border-radius: var(--radius-lg); padding: 22px;
}
.setting-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.setting-card h3 svg { width: 19px; height: 19px; color: var(--text-2); }
.setting-card > p { color: var(--text-2); font-size: 13.5px; margin: 0 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .6px; }
.field input[type="text"], .field input[type="password"], .field input[type="number"], .field select, .field textarea {
  width: 100%; height: 44px; border-radius: 11px; padding: 0 14px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--stroke); color: var(--text);
  font-size: 14px; outline: 0; transition: border-color .2s;
}
.field textarea { height: auto; padding: 12px 14px; resize: vertical; font-family: ui-monospace, monospace; font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255,255,255,0.4); }
.field .note { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--stroke); }
.switch-row:first-of-type { border-top: 0; }
.switch-row .sw-label b { display: block; font-size: 14.5px; }
.switch-row .sw-label span { color: var(--text-3); font-size: 12.5px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3);
  transition: background .25s;
}
.switch i::after {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 99px;
  background: #fff; top: 3px; left: 3px; transition: transform .25s var(--ease-spring);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }

/* elenco playlist nell'editor filtri */
.pl-list { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow-y: auto; padding: 2px; }
.pl-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 10px; background: rgba(0,0,0,0.25); border: 1px solid var(--stroke);
  cursor: pointer; font-size: 13.5px; transition: background .15s, border-color .15s;
  /* annulla lo stile delle label dei form (.field label) */
  text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; font-weight: 500;
}
.pl-row:hover { background: var(--surface-2); }
.pl-row:has(input:checked) { border-color: rgba(229, 9, 20, 0.55); background: var(--accent-soft); }
.pl-row input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; margin: 0; }
.pl-row b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row .cnt { margin-left: auto; color: var(--text-3); font-size: 12px; flex: none; }

.badge-ok { color: var(--ok); font-weight: 800; font-size: 12.5px; }
.badge-warn { color: var(--warn); font-weight: 800; font-size: 12.5px; }
.badge-err { color: #ff6961; font-weight: 800; font-size: 12.5px; }

/* ---------------- Toast ---------------- */

#toast-root { position: fixed; bottom: calc(var(--tabbar-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: rgba(24, 24, 34, 0.92); border: 1px solid var(--stroke);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: var(--text); padding: 12px 18px; border-radius: 14px;
  font-size: 13.5px; font-weight: 650; box-shadow: var(--shadow-pop);
  animation: toast-in .3s var(--ease-spring);
  max-width: 92vw;
}
.toast.out { animation: toast-out .3s ease forwards; }
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: #ff6961; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ---------------- Modal (conferme) ---------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  background: rgba(5,5,9,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade .2s ease; padding: 20px;
}
.modal-card {
  width: min(420px, 100%); background: var(--bg-elev); border: 1px solid var(--stroke);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-pop);
  animation: sheet-in .3s var(--ease-spring);
}
.modal-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.modal-card p { margin: 0 0 20px; color: var(--text-2); font-size: 14px; }
.modal-card .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- Tabbar (mobile) ---------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: none; align-items: stretch; justify-content: space-around;
  height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(12, 12, 18, 0.88);
  backdrop-filter: saturate(160%) blur(22px); -webkit-backdrop-filter: saturate(160%) blur(22px);
  border-top: 1px solid var(--stroke);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 700;
  transition: color .2s;
}
.tabbar a svg { width: 23px; height: 23px; transition: transform .2s var(--ease-spring); }
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { transform: translateY(-1px) scale(1.08); color: var(--accent-hi); }
.tabbar a[data-nav="shorts"].active svg { color: var(--shorts); }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .topnav { display: none; }
  .tabbar { display: flex; }
  .topsearch { display: none; }
  .row-scroller { grid-auto-columns: clamp(220px, 62vw, 300px); }
  .row-scroller.shorts-row { grid-auto-columns: clamp(130px, 34vw, 170px); }
  .row-scroller.channels-row { grid-auto-columns: clamp(130px, 36vw, 170px); }
  .hero { min-height: clamp(380px, 58vh, 560px); }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .profile-hero .actions { margin-left: 0; width: 100%; flex-direction: row; }
}
@media (max-width: 560px) {
  :root { --page-x: 16px; }
  .vgrid { grid-template-columns: 1fr; gap: 20px; }
  .sgrid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px 8px; }
  .chgrid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; }
  .player-overlay { padding: 0; align-items: stretch; }
  .player-sheet { border-radius: 0; border: 0; min-height: 100dvh; }
  .ch-hero-inner > img { width: 72px; height: 72px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .history-item .th { width: 96px; }
  .brand-name { display: none; }
}

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