/* ═══════════════════════════════════════════════════════════════════════
   TVS Player Web — stile
   Colori dall'app Android (primary #4A9FFF, accent #26C6DA), tema scuro e chiaro.
   ═══════════════════════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
    --bg: #0b0d12;
    --bg-2: #0f1218;
    --surface: #151922;
    --surface-2: #1c2130;
    --surface-3: #252b3c;
    --line: rgba(255, 255, 255, .07);
    --line-2: rgba(255, 255, 255, .13);
    --text: #e9ecf3;
    --text-2: #a3aaba;
    --text-3: #6e7587;
    --primary: #4a9fff;
    --primary-2: #2d7be5;
    --accent: #26c6da;
    --grad: linear-gradient(135deg, #4a9fff 0%, #26c6da 100%);
    --gold: #ffc24a;
    --live: #ff3b4e;
    --ok: #34d17f;
    --danger: #ff5d6c;
    --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
    --glass: rgba(16, 19, 27, .8);
    --input: #0d1016;
    --logo-bg: rgba(255, 255, 255, .06);
    --active: rgba(74, 159, 255, .14);
    --hover: rgba(255, 255, 255, .045);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f2f4f8;
    --bg-2: #f8f9fc;
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --surface-3: #e3e7ef;
    --line: rgba(15, 23, 42, .08);
    --line-2: rgba(15, 23, 42, .14);
    --text: #121826;
    --text-2: #536074;
    --text-3: #8892a4;
    --primary: #1a73e8;
    --primary-2: #1557b0;
    --accent: #00acc1;
    --grad: linear-gradient(135deg, #1a73e8 0%, #00acc1 100%);
    --gold: #f5a300;
    --shadow: 0 12px 32px rgba(15, 23, 42, .14);
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, .08);
    --glass: rgba(255, 255, 255, .88);
    --input: #ffffff;
    --logo-bg: #f1f3f7;
    --active: rgba(26, 115, 232, .1);
    --hover: rgba(15, 23, 42, .04);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
kbd {
    font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-3); background: var(--surface-2);
}

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.error { color: var(--danger); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Pulsanti e campi ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: 10px;
    border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
    font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s, border-color .15s, filter .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(74, 159, 255, .28); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.link-btn { color: var(--primary); font-weight: 600; font-size: 13px; margin-top: 10px; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--text-2);
    transition: background .15s, color .15s; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--gold); }
.icon-btn.on .ic { fill: currentColor; }

.input, .select {
    width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--line-2); background: var(--input); color: var(--text); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.select {
    width: auto; min-width: 160px; padding-right: 34px; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}

.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 26px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { height: 32px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); transition: background .15s, color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .segmented button.active { background: var(--surface-3); }

.badge {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px;
    background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge-info { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge-accent { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }

.progress { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; background: var(--grad); }

/* ── Struttura dell'app ───────────────────────────────────────────────── */
body.tvs-app { overflow: hidden; }
body.tvs-app:not(.ready) .app { opacity: 0; }

.app {
    display: grid;
    height: 100vh; height: 100dvh;
    grid-template-columns: 84px 250px 400px minmax(0, 1fr);
    grid-template-areas: "rail cats list stage";
    transition: opacity .25s;
}
.app.is-page { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "rail page"; }
.app.is-page .cats, .app.is-page .listpane { display: none; }

/* Barra laterale */
.rail {
    grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 0 14px; background: var(--bg); border-right: 1px solid var(--line); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.rail .brand { margin-bottom: 12px; }
.brand img { width: 46px; height: 46px; object-fit: cover; border-radius: 14px; box-shadow: 0 6px 18px rgba(74,159,255,.35); }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand-name b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rail .brand-name { display: none; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 10px; }
.rail-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 0 8px; border-radius: 14px;
    color: var(--text-2); font-size: 11px; font-weight: 600; transition: color .15s, background .15s; text-align: center; line-height: 1.2;
}
.rail-nav button .ic { width: 22px; height: 22px; transition: transform .15s; }
.rail-nav button:hover { color: var(--text); background: var(--hover); }
.rail-nav button.active { color: var(--primary); background: var(--active); }
.rail-nav button.active .ic { transform: scale(1.06); }
.rail-nav button[data-view="fav"].active .ic { fill: currentColor; }
.rail-foot { margin-top: auto; }
.account-btn { display: grid; place-items: center; gap: 4px; padding: 6px; border-radius: 14px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.account-btn:hover { background: var(--hover); color: var(--text); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; object-fit: cover; }
.avatar-user { color: #fff; font-weight: 800; font-size: 13px; }
.avatar-guest { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-2); }
.avatar-guest .ic { width: 18px; height: 18px; }
.account-name { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Intestazioni dei pannelli */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 16px 12px; min-height: 64px; }
.pane-head h2 { font-size: 18px; font-weight: 750; }
.pane-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pane-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--text-3); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Categorie */
.cats { grid-area: cats; display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-right: 1px solid var(--line); }
.cat-list { list-style: none; margin: 0; padding: 0 10px 20px; overflow-y: auto; flex: 1; }
.cat {
    display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 10px;
    color: var(--text-2); text-align: left; font-weight: 500; transition: background .12s, color .12s;
}
.cat:hover { background: var(--hover); color: var(--text); }
.cat.active { background: var(--active); color: var(--text); font-weight: 650; }
.cat.active .ic { color: var(--primary); }
.cat .ic { width: 18px; height: 18px; }
.cat[data-key="__fav"] .ic { color: var(--gold); fill: currentColor; }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin: 0 5px; opacity: .9; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-sep { height: 1px; background: var(--line); margin: 8px 12px; }

.radio-source { padding: 0 14px 10px; }
.source-btn {
    display: flex; align-items: center; gap: 9px; width: 100%; height: 42px; padding: 0 12px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 13px; text-align: left;
}
.source-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-btn .ic { width: 17px; height: 17px; color: var(--text-2); }
.source-btn > .ic:first-child { color: var(--primary); }
.source-btn:hover { border-color: var(--line-2); }
.page-head .source-btn { width: auto; max-width: 340px; }

/* Elenco canali */
.listpane { grid-area: list; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.search { position: relative; margin: 0 14px 10px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search input {
    width: 100%; height: 42px; padding: 0 40px 0 38px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }

.chips { display: none; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; flex: none;
    transition: background .15s, color .15s, border-color .15s;
}
.chip .ic { width: 15px; height: 15px; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.auto.active { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--primary) 50%, transparent); }
.flag { font-size: 15px; line-height: 1; }

.sortbar {
    display: flex; align-items: center; gap: 10px; margin: 0 14px 10px; padding: 8px 8px 8px 12px; border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--text); font-size: 13px; font-weight: 500;
}
.sortbar span { flex: 1; }
.sortbar > .ic { color: var(--primary); width: 18px; height: 18px; }

.chlist { list-style: none; margin: 0; padding: 0 8px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.ch {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px;
    cursor: pointer; outline: none; transition: background .12s;
}
.ch:hover, .ch:focus-visible { background: var(--hover); }
.ch:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.ch.active { background: var(--active); }
.ch.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--grad); }
.ch-num { width: 26px; text-align: right; color: var(--text-3); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.ch-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; font-size: 14px; }
.ch-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch.active .ch-title { color: var(--primary); }
.ch-links { flex: none; font-size: 10.5px; font-weight: 700; color: var(--text-3); padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.ch-sub { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 18px; }
.ch-sub:empty { display: none; }
.now-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.now-bar { flex: none; width: 34px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.now-bar i { display: block; height: 100%; background: var(--primary); }
.ch-star, .ch-more { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--text-3); flex: none; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.ch-star .ic, .ch-more .ic { width: 18px; height: 18px; }
.ch:hover .ch-star, .ch:hover .ch-more, .ch:focus-within .ch-star, .ch:focus-within .ch-more, .ch-star.on { opacity: 1; }
.ch-star:hover, .ch-more:hover { background: var(--surface-2); color: var(--text); }
.ch-star.on { color: var(--gold); }
.ch-star.on .ic { fill: currentColor; }
.ch.dead .ch-title, .ch.dead .logo { opacity: .5; }
.badge-dead { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); padding: 2px 6px; border-radius: 5px; }
.grip { display: grid; place-items: center; width: 24px; color: var(--text-3); cursor: grab; flex: none; touch-action: none; }
.grip .ic { width: 18px; height: 18px; }
.sorting .ch { cursor: default; }
.sorting .ch-star, .sorting .ch-more { display: none; }
.ch-ghost { opacity: .35; }
.ch-chosen { background: var(--surface-2); box-shadow: var(--shadow); }

.eq-mini { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.eq-mini i { width: 3px; height: 4px; border-radius: 2px; background: var(--primary); }
.eq-mini.on i { animation: eq .9s ease-in-out infinite; }
.eq-mini.on i:nth-child(2) { animation-delay: -.3s; }
.eq-mini.on i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

/* Loghi */
.logo {
    position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; flex: none;
    background: var(--logo-bg); overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.logo:has(img) { background: #eef1f6; }
[data-theme="dark"] .logo:has(img) { background: #e6eaf1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.logo-initials { color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.logo-lg { width: 60px; height: 60px; border-radius: 14px; }
.logo-lg .logo { width: 100%; height: 100%; border-radius: inherit; }
.logo-lg .logo-initials { font-size: 20px; }
.logo-xl { width: 168px; height: 168px; border-radius: 34px; background: rgba(255,255,255,.94); box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.logo-xl img { padding: 18px; }
.logo-xl.logo-initials { font-size: 54px; background: var(--grad) !important; }

/* Stato vuoto */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 28px; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 18px; }
.empty p { max-width: 340px; }
.empty-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface-2); color: var(--primary); margin-bottom: 4px; }
.empty-ico .ic { width: 28px; height: 28px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 6px 0; }
.spinner-sm { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Palco: player + scheda ───────────────────────────────────────────── */
.stage { grid-area: stage; display: flex; flex-direction: column; gap: 18px; padding: 20px 24px 28px; overflow-y: auto; min-width: 0; }

.player {
    position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 18px; overflow: hidden;
    box-shadow: var(--shadow); outline: none; isolation: isolate; flex: none;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.player.is-radio video { opacity: 0; }

.p-idle {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: radial-gradient(ellipse at 50% 40%, rgba(74,159,255,.22), transparent 60%), radial-gradient(ellipse at 80% 90%, rgba(38,198,218,.14), transparent 50%), #07090d;
    color: #c5cad6; font-weight: 500; text-align: center; padding: 20px;
}
.p-idle img { width: 96px; height: 96px; object-fit: cover; border-radius: 26px; box-shadow: 0 14px 40px rgba(74,159,255,.35); }

.radio-art {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #1d3557 0%, #0a0e16 70%);
}
.radio-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; background: var(--grad); filter: blur(90px); opacity: .28; animation: glow 8s ease-in-out infinite alternate; }
@keyframes glow { from { transform: translate(-60px, -20px) scale(.9); } to { transform: translate(60px, 20px) scale(1.1); } }
.radio-logo { position: relative; }
.eq { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 38px; }
.eq i { width: 6px; height: 6px; border-radius: 3px; background: linear-gradient(to top, var(--primary), var(--accent)); opacity: .9; }
.player.playing .eq i { animation: eqbig 1.1s ease-in-out infinite; }
.player.playing .eq i:nth-child(3n) { animation-duration: .8s; }
.player.playing .eq i:nth-child(4n+1) { animation-duration: 1.3s; }
.eq i:nth-child(2) { animation-delay: -.2s; } .eq i:nth-child(3) { animation-delay: -.5s; } .eq i:nth-child(4) { animation-delay: -.1s; }
.eq i:nth-child(5) { animation-delay: -.7s; } .eq i:nth-child(6) { animation-delay: -.3s; } .eq i:nth-child(7) { animation-delay: -.9s; }
.eq i:nth-child(8) { animation-delay: -.4s; } .eq i:nth-child(9) { animation-delay: -.6s; } .eq i:nth-child(10) { animation-delay: -.15s; }
.eq i:nth-child(11) { animation-delay: -.45s; } .eq i:nth-child(12) { animation-delay: -.8s; }
@keyframes eqbig { 0%, 100% { height: 6px; } 50% { height: 38px; } }

.p-spinner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.p-spinner span { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,.18); border-top-color: #fff; animation: spin .8s linear infinite; }

.p-msg {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; width: min(440px, calc(100% - 32px));
    display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
    padding: 18px 20px; border-radius: 16px; background: rgba(12, 15, 22, .84); color: #fff; backdrop-filter: blur(10px);
    font-weight: 500; box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.p-msg-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.p-msg .btn:not(.btn-primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); color: #fff; }

.p-bigplay {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4;
    display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
    background: rgba(255,255,255,.16); backdrop-filter: blur(12px); color: #fff; border: 1px solid rgba(255,255,255,.25);
    transition: transform .15s, background .15s;
}
.p-bigplay:hover { transform: translate(-50%, -50%) scale(1.06); background: rgba(255,255,255,.24); }
.p-bigplay .ic { width: 34px; height: 34px; margin-left: 4px; }

.p-top {
    position: absolute; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 14px 16px 30px;
    background: linear-gradient(rgba(0,0,0,.65), transparent); color: #fff; opacity: 0; transition: opacity .25s; pointer-events: none;
}
.p-top-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-top-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-top-text span { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-top .icon-btn { color: #fff; pointer-events: auto; display: none; }
.p-top .icon-btn:hover { background: rgba(255,255,255,.15); }
.player:not(.is-full):not(.is-mini) .p-top { display: none; }
.player.is-full.show-ui .p-top { opacity: 1; }
.player.banner-on .p-top { opacity: 0 !important; }
.player.side-open .p-controls { right: min(380px, 85%); }

.p-controls {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 40px 14px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff;
    opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.player.show-ui .p-controls, .player.is-paused .p-controls { opacity: 1; transform: none; pointer-events: auto; }
.p-row { display: flex; align-items: center; gap: 2px; }
.p-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; transition: background .15s, color .15s; flex: none; }
.p-btn:hover { background: rgba(255,255,255,.14); }
.p-btn .ic { width: 22px; height: 22px; }
.p-btn.active { color: var(--accent); }
.p-btn[data-badge]:not([data-badge=""])::after {
    content: attr(data-badge); position: absolute; top: 2px; right: -2px; font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 6px;
    background: var(--primary); color: #fff;
}
.p-txt { width: auto; padding: 0 12px; border-radius: 20px; font-size: 12.5px; font-weight: 700; }
.p-spacer { flex: 1; }
.p-time { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .9; margin-left: 6px; white-space: nowrap; }
.live-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; margin: 0 6px; border-radius: 6px;
    font-size: 11.5px; font-weight: 800; letter-spacing: .06em; color: rgba(255,255,255,.75); background: rgba(255,255,255,.12);
}
.live-btn i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); }
.live-btn.at-live { color: #fff; background: rgba(255, 59, 78, .92); cursor: default; }
.live-btn.at-live i { background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.live-btn:not(.at-live):hover { background: rgba(255,255,255,.22); color: #fff; }
@keyframes pulse { 50% { opacity: .35; } }
.player.is-radio .live-btn.at-live { background: rgba(255,255,255,.14); }
.player:not(.has-timeline) #cBack, .player:not(.has-timeline) #cFwd { display: none; }

.p-vol { display: flex; align-items: center; }
.p-vol input { width: 0; opacity: 0; transition: width .2s, opacity .2s, margin .2s; }
.p-vol:hover input, .p-vol input:focus { width: 90px; opacity: 1; margin-right: 6px; }
input[type=range] {
    -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; cursor: pointer;
    background: linear-gradient(to right, #fff var(--val, 100%), rgba(255,255,255,.3) var(--val, 100%));
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }

.p-seek { padding: 8px 6px; cursor: pointer; }
.p-seek-track { position: relative; height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); transition: height .15s; }
.p-seek:hover .p-seek-track { height: 6px; }
.p-seek-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--grad); }
.p-seek-knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transform: scale(0); transition: transform .15s; }
.p-seek:hover .p-seek-knob { transform: scale(1); }

.p-fs-only { display: none; }
.player.is-full .p-fs-only { display: grid; }
.player.is-full { border-radius: 0; }

.p-banner {
    position: absolute; left: 24px; top: 24px; z-index: 6; display: flex; align-items: center; gap: 14px; max-width: min(560px, 80%);
    padding: 12px 18px 12px 12px; border-radius: 16px; background: rgba(12,15,22,.82); backdrop-filter: blur(12px); color: #fff;
    opacity: 0; transform: translateY(-12px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.p-banner.in { opacity: 1; transform: none; }
.player:not(.is-full) .p-banner { display: none; }
.banner-text { display: flex; flex-direction: column; min-width: 0; }
.banner-text b { font-size: 18px; }
.banner-now { opacity: .8; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.p-side {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 85%); z-index: 7; display: flex; flex-direction: column;
    background: rgba(12,15,22,.9); backdrop-filter: blur(14px); color: #fff;
    transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
    --hover: rgba(255,255,255,.08); --active: rgba(74,159,255,.25); --text-2: #a3aaba; --text-3: #8790a2; --surface-2: #252b3c; --logo-bg: rgba(255,255,255,.08); --primary: #6cb2ff;
}
.player.side-open .p-side { transform: none; }
.player:not(.is-full) .p-side { display: none; }
.p-side header { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 10px 18px; }
.p-side .icon-btn { color: #fff; }

/* Finestrella (mentre si è nelle pagine) */
.app.is-page .stage { display: none; }
.app.is-page.has-current .stage {
    display: block; position: fixed; right: 20px; bottom: 20px; width: 380px; padding: 0; z-index: 40; overflow: visible;
    animation: miniIn .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes miniIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.app.is-page .info, .app.is-page .upnext, .app.is-page .home-panel { display: none !important; }
.player.is-mini { border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.5); border: 1px solid var(--line-2); }
.player.is-mini .p-top { display: flex; opacity: 1; padding: 8px 8px 24px 12px; }
.player.is-mini .p-top .icon-btn { display: grid; width: 32px; height: 32px; }
.player.is-mini .p-top .icon-btn .ic { width: 17px; height: 17px; }
.player.is-mini .p-controls, .player.is-mini .p-msg .btn, .player.is-mini .p-banner { display: none; }
.player.is-mini .p-msg { font-size: 12px; padding: 10px; }
.player.is-mini .logo-xl { width: 76px; height: 76px; border-radius: 18px; }
.player.is-mini .logo-xl.logo-initials { font-size: 26px; }
.player.is-mini .radio-art { gap: 12px; padding-top: 20px; }
.player.is-mini .eq { height: 18px; }
.player.is-mini .p-idle { display: none; }
.player.is-mini video { cursor: pointer; }

/* Scheda del canale */
.info { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.info-head { display: flex; align-items: center; gap: 16px; }
.info-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.info-group { color: var(--text-3); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info h1 { font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.info-badges:empty { display: none; }
.info-actions { display: flex; gap: 6px; }
.info-actions .icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); }
.info-actions .icon-btn:hover { background: var(--surface-3); }
.onair:empty { display: none; }
.onair { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.onair-now, .onair-next { display: flex; align-items: center; gap: 10px; min-width: 0; }
.onair-now b { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.onair-next { color: var(--text-2); font-size: 13px; }
.onair-next span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onair-label { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.onair-now .onair-label { background: var(--live); color: #fff; }
.onair-time { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; flex: none; }

.upnext { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px 8px; }
.upnext h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 750; margin-bottom: 6px; }
.upnext ol, .guide-list { list-style: none; margin: 0; padding: 0; }
.upnext li, .guide-list li { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.upnext li:first-child { border-top: 0; }
.upnext time, .guide-list time { color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.upnext b, .guide-list b { font-weight: 650; }
.upnext p, .guide-list p { color: var(--text-2); font-size: 12.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.guide-list { max-height: 60vh; overflow-y: auto; margin-top: 12px; padding-right: 4px; }
.guide-list li.past { opacity: .5; }
.guide-list li.live { background: var(--active); border-radius: 12px; padding: 12px; border-top-color: transparent; margin: 2px 0; }
.guide-list li.live + li { border-top-color: transparent; }
.guide-list li.live .progress { margin: 8px 0 2px; }
.guide-list li p { -webkit-line-clamp: 3; }
.guide-list li.muted { display: block; color: var(--text-2); border: 0; }

.home-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px 20px; }
.home-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 750; margin-bottom: 14px; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 12px; }
.recent-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 14px; background: var(--surface-2); text-align: center; transition: background .15s, transform .15s; min-width: 0; }
.recent-tile:hover { background: var(--surface-3); transform: translateY(-2px); }
.recent-tile .logo { width: 52px; height: 52px; border-radius: 13px; }
.recent-tile span { font-size: 12.5px; font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.tip kbd { flex: none; min-width: 34px; text-align: center; }
.app.has-current .home-panel { display: none; }

/* ── Pagine ───────────────────────────────────────────────────────────── */
.app-page { display: none; grid-area: page; overflow-y: auto; min-width: 0; }
.app[data-view="guide"] #page-guide, .app[data-view="playlists"] #page-playlists, .app[data-view="apps"] #page-apps, .app[data-view="settings"] #page-settings { display: block; }
.page-inner { max-width: 1120px; margin: 0 auto; padding: 36px 36px 120px; }
.page-narrow { max-width: 820px; }
.page-wide { max-width: none; padding-bottom: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { margin-top: 6px; max-width: 620px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Playlist */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.pl-card {
    position: relative; display: flex; flex-direction: column; gap: 16px; padding: 18px; border-radius: 18px;
    background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, background .15s, box-shadow .15s; text-align: left; overflow: hidden;
}
.pl-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.pl-top { display: flex; align-items: center; gap: 14px; }
.pl-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; flex: none; box-shadow: 0 6px 16px rgba(74,159,255,.3); }
.pl-icon .ic { width: 22px; height: 22px; }
.pl-title { flex: 1; min-width: 0; }
.pl-title h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pl-stats div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.pl-stats b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pl-stats span { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.pl-foot.error { color: var(--danger); }
.pl-card.has-error .pl-icon { background: color-mix(in srgb, var(--danger) 80%, #000); box-shadow: none; }
.pl-progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pl-progress i { display: block; width: 35%; height: 100%; background: var(--grad); animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.pl-add { align-items: center; justify-content: center; gap: 6px; min-height: 200px; border: 2px dashed var(--line-2); background: transparent; color: var(--text); text-align: center; }
.pl-add:hover { border-color: var(--primary); background: var(--active); }
.pl-add-ico { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--active); color: var(--primary); margin-bottom: 6px; }
.pl-demo .pl-add-ico { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.callout { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding: 18px 20px; border-radius: 18px; background: var(--active); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.callout > .ic { width: 28px; height: 28px; color: var(--primary); }
.callout div { flex: 1; }
.callout p { color: var(--text-2); margin-top: 2px; }
.rights { margin-top: 26px; max-width: 640px; }

/* Impostazioni */
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px 14px; margin-bottom: 18px; }
.set-card h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 750; padding-bottom: 6px; }
.set-card h2 .ic { color: var(--primary); width: 19px; height: 19px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-card h2 + .set-row { border-top: 0; }
.set-text b { font-weight: 600; }
.set-text p { color: var(--text-2); font-size: 13px; margin-top: 3px; max-width: 520px; }
.set-ctl { flex: none; }
.set-block { padding: 14px 0; border-top: 1px solid var(--line); }
.set-block .set-text { margin-bottom: 12px; }
.set-buttons { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 0 6px; border-top: 1px solid var(--line); }
.set-block .set-buttons { border-top: 0; padding-bottom: 0; }
.country-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sources { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sources li { display: flex; align-items: center; gap: 10px; padding: 7px 0; min-width: 0; }
.src-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.src-dot.ok { background: var(--ok); }
.src-dot.err { background: var(--danger); }
.src-dot.busy { background: var(--primary); animation: pulse 1s infinite; }
.src-name { font-weight: 600; min-width: 140px; }
.src-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.about { display: flex; gap: 18px; align-items: flex-start; padding: 10px 0 14px; }
.about img { flex: none; }
.about p { margin-top: 6px; }

/* Guida TV a griglia */
.guide-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.guide-day { margin-left: 8px; font-weight: 600; color: var(--text-2); text-transform: capitalize; }
.epg {
    position: relative; overflow: auto; max-height: calc(100dvh - 170px); border-radius: 18px; border: 1px solid var(--line);
    background: var(--surface);
}
.epg > .empty { min-height: 300px; justify-content: center; }
.epg-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px; color: var(--text-2); }
.epg-canvas { position: relative; min-width: 100%; }
.epg-ruler { position: sticky; top: 0; z-index: 4; height: 38px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.epg-corner { position: sticky; left: 0; width: 210px; height: 38px; background: var(--surface-2); z-index: 5; border-right: 1px solid var(--line); }
.epg-tick { position: absolute; top: 0; height: 38px; line-height: 38px; padding-left: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.epg-row { position: relative; height: 66px; border-bottom: 1px solid var(--line); }
.epg-ch {
    position: sticky; left: 0; z-index: 3; display: flex; align-items: center; gap: 10px; width: 210px; height: 100%; padding: 0 12px;
    background: var(--surface); border-right: 1px solid var(--line); text-align: left; font-weight: 600; font-size: 13px;
}
.epg-ch span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.epg-ch:hover { background: var(--surface-2); }
.epg-ch .logo { width: 38px; height: 38px; border-radius: 9px; }
.epg-prog {
    position: absolute; top: 7px; bottom: 7px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
    padding: 0 10px; border-radius: 10px; background: var(--surface-2); text-align: left; overflow: hidden; white-space: nowrap;
    border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.epg-prog b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.epg-prog small { color: var(--text-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.epg-prog:hover { border-color: var(--primary); background: var(--surface-3); }
.epg-prog.live { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.epg-prog.past { opacity: .5; }
.epg-nowline { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--live); z-index: 2; pointer-events: none; }
.epg-nowline::before { content: ""; position: absolute; top: 31px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--live); }
.epg-note { padding: 12px 16px; position: sticky; left: 0; }

/* ── Finestre, menu, notifiche ────────────────────────────────────────── */
.backdrop {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
    background: rgba(4, 6, 12, .62); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s;
}
.backdrop.in { opacity: 1; }
.modal {
    width: min(500px, 100%); max-height: min(86dvh, 860px); display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.5);
    transform: translateY(12px) scale(.98); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.backdrop.in .modal { transform: none; }
.modal-wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 16px 10px 22px; }
.modal-head h2 { flex: 1; font-size: 18px; font-weight: 750; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 6px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.prose p { margin-bottom: 10px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); }
.prose li { margin-bottom: 6px; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.form-error { color: var(--danger); font-weight: 500; font-size: 13px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.notice .ic { width: 17px; height: 17px; color: var(--primary); margin-top: 1px; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border-radius: 14px; cursor: pointer;
    border: 2px dashed var(--line-2); text-align: center; font-weight: 600; transition: border-color .15s, background .15s;
}
.dropzone .ic { width: 28px; height: 28px; color: var(--primary); }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--active); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-transform: capitalize; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .ic { width: 17px; height: 17px; }
.tabs-pill { border: 0; padding: 4px; background: var(--surface-2); border-radius: 12px; gap: 4px; }
.tabs-pill .tab { flex: 1; justify-content: center; height: 36px; border: 0; border-radius: 9px; margin: 0; text-transform: none; }
.tabs-pill .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .tabs-pill .tab.active { background: var(--surface-3); }

.choose-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.choose-scroll { max-height: 52vh; overflow-y: auto; margin-top: 12px; }
.choose-list .muted { padding: 12px; }
.choose-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left; transition: background .12s; }
.choose-item:hover { background: var(--hover); }
.choose-item.active { background: var(--active); }
.choose-item > .ic { color: var(--text-2); }
.choose-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.choose-text b { font-weight: 600; }
.choose-text small { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choose-check { color: var(--primary); }

.prog-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.prog-meta div { display: flex; flex-direction: column; }
.prog-meta .muted { font-size: 13px; text-transform: capitalize; }
.prog .progress { margin-bottom: 14px; }
.prog-desc { line-height: 1.6; }
.modal-guide .modal-head .btn { flex: none; }

.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 8px 4px; border-top: 1px solid var(--line); }
.keys tr:first-child td { border-top: 0; }
.keys td:first-child { width: 130px; }

.menu {
    position: fixed; z-index: 200; min-width: 220px; max-width: 320px; max-height: 65vh; overflow-y: auto; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow);
    opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top; transition: opacity .15s, transform .15s;
}
.menu.in { opacity: 1; transform: none; }
.player .menu { position: absolute; }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; font-weight: 500; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:disabled { opacity: .55; cursor: default; }
.menu-item:disabled:hover { background: none; }
.menu-item .ic { width: 18px; height: 18px; color: var(--text-2); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-ico { width: 18px; flex: none; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--text-3); font-size: 12px; }
.menu-check { color: var(--primary) !important; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.menu-title { padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--text-3); max-width: 300px; }

.toasts {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px;
    pointer-events: none; width: max-content; max-width: calc(100vw - 24px);
}
.toast {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 16px; border-radius: 14px; pointer-events: auto;
    background: #1d2231; color: #eef1f7; box-shadow: 0 12px 34px rgba(0,0,0,.4); font-weight: 500; max-width: 560px;
    opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; border: 1px solid rgba(255,255,255,.08);
}
.toast.in { opacity: 1; transform: none; }
.toast .ic { width: 18px; height: 18px; color: var(--accent); }
.toast-ok .ic { color: var(--ok); }
.toast-err { background: #3a1820; }
.toast-err .ic { color: var(--danger); }
.toast-action { margin-left: 6px; padding: 6px 10px; border-radius: 8px; font-weight: 700; color: #7fbcff; }
.toast-action:hover { background: rgba(255,255,255,.08); }

.tabbar { display: none; }

/* ── Schermi medi: categorie come "chip" ─────────────────────────────── */
@media (max-width: 1440px) {
    .app { grid-template-columns: 84px 228px 370px minmax(0, 1fr); }
}
@media (max-width: 1220px) {
    .app { grid-template-columns: 84px 360px minmax(0, 1fr); grid-template-areas: "rail list stage"; }
    .cats { display: none; }
    .chips { display: flex; }
    .stage { padding: 18px; }
}

/* ── Telefono ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    body.tvs-app { overflow: auto; }
    .app, .app.is-page { display: flex; flex-direction: column; height: auto; min-height: 100dvh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    .rail { display: none; }
    .stage { order: -1; position: sticky; top: 0; z-index: 20; padding: 0; gap: 0; background: var(--bg); overflow: visible; }
    .app:not(.has-current) .stage { display: none; }
    .player { border-radius: 0; box-shadow: none; }
    .info { border-radius: 0; border-width: 0 0 1px; padding: 12px 16px; gap: 10px; }
    .info .logo-lg { width: 44px; height: 44px; border-radius: 11px; }
    .info h1 { font-size: 17px; }
    .info-group, .info-badges { display: none; }
    .info-actions .icon-btn { width: 38px; height: 38px; }
    .onair { padding-top: 10px; gap: 6px; }
    .onair-next { display: none; }
    .upnext { display: none !important; }
    .listpane { border: 0; }
    .listpane .pane-head { padding: 16px 16px 10px; min-height: 0; }
    .chlist { overflow: visible; padding: 0 6px 20px; }
    .ch-more { opacity: 1; }
    .search kbd { display: none; }
    .ch-star:not(.on) { display: none; }
    .app-page { overflow: visible; }
    .page-inner { padding: 22px 16px 100px; }
    .page-head h1 { font-size: 24px; }
    .page-head { margin-bottom: 18px; }
    .set-card { padding: 14px 16px 10px; }
    .set-row { flex-wrap: wrap; gap: 12px; }
    .epg { max-height: calc(100dvh - 250px); }
    .epg-ch, .epg-corner { width: 130px; }
    .epg-ch .logo { display: none; }
    .app.is-page.has-current .stage { top: auto; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 220px; background: transparent; }
    .p-vol input { display: none; }
    .p-btn { width: 36px; height: 36px; }
    .p-btn .ic { width: 20px; height: 20px; }
    #cSleep, #cBack, #cFwd, .p-time { display: none; }
    .logo-xl { width: 104px; height: 104px; border-radius: 24px; }
    .logo-xl.logo-initials { font-size: 34px; }
    .radio-art { gap: 14px; }
    .eq { height: 24px; }
    .tabbar {
        display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--glass); backdrop-filter: blur(16px);
        border-top: 1px solid var(--line);
    }
    .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0; color: var(--text-3); font-size: 10px; font-weight: 600; min-width: 0; }
    .tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabbar button .ic { width: 40px; height: 28px; padding: 4px 0; border-radius: 14px; transition: background .15s; }
    .tabbar button.active { color: var(--primary); }
    .tabbar button.active .ic { background: var(--active); }
    .tabbar button[data-view="fav"].active .ic { fill: currentColor; }
    .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
    .backdrop { align-items: end; padding: 10px; }
}

/* ── Pagine normali (Info e privacy) ──────────────────────────────────── */
body.tvs-doc { min-height: 100vh; display: flex; flex-direction: column; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); }
.doc { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 48px 24px 80px; }
.doc h1 { font-size: 34px; font-weight: 800; margin-bottom: 20px; letter-spacing: -.02em; }
.doc-content { font-size: 16px; line-height: 1.7; color: var(--text-2); }
.doc-content h2 { color: var(--text); font-size: 20px; margin: 30px 0 10px; }
.doc-content p { margin: 0 0 14px; }
.doc-foot { text-align: center; padding: 24px; color: var(--text-3); border-top: 1px solid var(--line); font-size: 13px; }

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

/* ── Le nostre app (player, /app/, articoli) ──────────────────────────── */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-bottom: 18px; }
.app-grid-big { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.app-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.app-card-img { display: block; aspect-ratio: 1024 / 500; background: var(--surface-2); overflow: hidden; }
.app-card-img > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-card-ph { width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, rgba(74,159,255,.35), transparent 65%), linear-gradient(135deg, #12223d, #0d1a2b); }
.app-card-ph img { width: 30%; max-width: 110px; border-radius: 24%; box-shadow: 0 14px 40px rgba(0,0,0,.35); }
.app-card-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.app-card-body h3 { font-size: 18px; font-weight: 800; }
.app-card-body h3 a { color: var(--text); text-decoration: none; }
.app-card-body p { color: var(--text-2); font-size: 13.5px; line-height: 1.5; flex: 1; }
.app-card-big .app-card-body h3 { font-size: 21px; }
.app-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
    background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); white-space: nowrap; }
.store-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.store-btn {
    display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px 0 12px; border-radius: 12px; text-decoration: none;
    background: #0b0d12; color: #fff; border: 1px solid rgba(255,255,255,.18); transition: transform .12s, border-color .15s, background .15s;
}
.store-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.4); background: #151922; }
.store-btn .ic { width: 24px; height: 24px; }
.store-btn span { display: flex; flex-direction: column; line-height: 1.15; }
.store-btn small { font-size: 10.5px; opacity: .75; font-weight: 500; }
.store-btn b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.store-google_play .ic { color: #34d17f; }
.store-kodi .ic { color: #17b2e7; }
.store-samsung .ic, .store-lg .ic { color: #6aa8ff; }
[data-theme="light"] .store-btn { background: #121826; }

.section-title { font-size: 20px; font-weight: 800; margin: 34px 0 14px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.news-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--text); text-decoration: none; }
.news-card:hover { border-color: var(--line-2); }
.news-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.news-card div { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.news-card time { font-size: 12px; color: var(--text-3); }
.news-card p { font-size: 13px; color: var(--text-2); }

/* Riquadro promozionale sotto il player */
.promo { position: relative; display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; padding: 4px 36px 4px 0; margin-bottom: 18px; }
.promo + h3 { border-top: 1px solid var(--line); padding-top: 16px; }
.promo-img { display: block; aspect-ratio: 1024 / 500; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.promo-img > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.promo-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.promo-kicker { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.home-panel .promo-body h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; text-transform: none; letter-spacing: -.01em; color: var(--text); margin: 0; }
.promo-body p { color: var(--text-2); font-size: 13.5px; }
.promo .store-btn { height: 42px; }
.promo-close { position: absolute; top: -4px; right: -8px; }
@media (max-width: 1100px) { .promo { grid-template-columns: 1fr; } .promo-img { max-width: 360px; } }

/* Articoli: [tvs_app] / [tvs_apps] */
.tvs-embed { margin: 26px 0; }
.tvs-embed .app-card-big { flex-direction: row; }
.tvs-embed .app-card-big .app-card-img { width: 44%; flex: none; align-self: center; margin: 16px 0 16px 16px; border-radius: 14px; }
@media (max-width: 700px) { .tvs-embed .app-card-big { flex-direction: column; } .tvs-embed .app-card-big .app-card-img { width: auto; margin: 12px 12px 0; } }

/* Pagine pubbliche */
.doc-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-nav .btn .ic { width: 16px; height: 16px; }
.doc-head .brand img { width: 42px; height: 42px; object-fit: cover; border-radius: 12px; }
.doc-wide { max-width: 1180px; }
.doc-date { display: block; color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
.doc-hero img { width: 100%; height: auto; border-radius: 18px; margin-bottom: 24px; }
.apps-hero { text-align: center; padding: 20px 0 34px; }
.apps-hero h1 { font-size: 44px; margin-bottom: 10px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.apps-hero p { color: var(--text-2); font-size: 18px; max-width: 620px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--text-2); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--primary); }
.app-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: center; margin-bottom: 30px; }
.app-detail-img { border-radius: 22px; overflow: hidden; aspect-ratio: 1024 / 500; box-shadow: var(--shadow); background: var(--surface-2); }
.app-detail-img > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-detail-text { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.app-detail-text h1 { font-size: 38px; margin: 0; }
.app-detail-lead { font-size: 17px; color: var(--text-2); line-height: 1.55; }
.app-detail-content { max-width: 760px; }
.app-detail-content li { margin-bottom: 6px; }
.app-more-title { font-size: 22px; margin: 40px 0 16px; }
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-item { display: flex; gap: 18px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.post-item:hover { border-color: var(--line-2); }
.post-thumb img { width: 180px; height: 110px; object-fit: cover; border-radius: 10px; }
.post-text { display: flex; flex-direction: column; gap: 4px; }
.post-text time { font-size: 12px; color: var(--text-3); }
.post-text span { color: var(--text-2); font-size: 14px; }
.doc-foot a { color: var(--text-2); }
@media (max-width: 860px) {
    .app-detail { grid-template-columns: 1fr; gap: 20px; }
    .app-detail-text h1, .apps-hero h1 { font-size: 30px; }
    .app-grid-big { grid-template-columns: 1fr; }
    .doc-head { padding: 14px 16px; }
    .doc-nav .btn span { display: none; }
    .doc-nav .btn { width: 40px; padding: 0; }
    .post-thumb { display: none; }
}
