/* Vicks — sistema di design unico.
   Sala cinema di notte: fondo inchiostro, superfici di velluto, ambra del proiettore per
   l'azione principale, rosa "dal vivo" riservato alle stanze e agli avvisi. */

:root {
  --ink: #16111f;
  --ink-2: #1b1526;
  --velvet: #211a2e;
  --seat: #352b47;
  --seat-2: #46395d;
  --paper: #f4eff9;
  --muted: #a99fbd;
  --faint: #73698a;
  --amber: #f5b544;
  --amber-2: #ffc95f;
  --amber-ink: #2b1b02;
  --live: #ff6b81;
  --ok: #5fd3a0;

  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --text: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-poster: 10px; --r-panel: 18px; --r-field: 12px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav-h: 64px;
  --tab-h: 64px;
  --shadow: 0 18px 48px -18px rgba(5, 2, 10, .8);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0; min-height: 100vh; background: var(--ink); color: var(--paper);
  font: 400 16px/1.55 var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: var(--amber); color: var(--amber-ink); }

.i { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 28px; height: 28px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── tipografia ──────────────────────────────────────────── */
h1, h2, h3, .display { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(36px, 6vw, 64px); }
h2 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 19px; font-weight: 700; letter-spacing: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.prose { max-width: 66ch; color: #d9d1e6; }

/* ── struttura ───────────────────────────────────────────── */
.shell { width: 100%; max-width: 1560px; margin: 0 auto; padding: 0 var(--gutter); }
main { padding-bottom: var(--s-8); }
.stack > * + * { margin-top: var(--s-4); }
.row-gap { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.page-head { padding-top: calc(var(--nav-h) + var(--s-6)); padding-bottom: var(--s-5); }
.page-head p { margin-top: var(--s-2); }

/* ── navigazione ─────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; gap: var(--s-5); padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(22, 17, 31, .92), rgba(22, 17, 31, 0));
  transition: background .25s var(--ease);
}
.nav.solid { background: rgba(22, 17, 31, .96); box-shadow: 0 1px 0 var(--seat); backdrop-filter: blur(12px); }
.brand { font: 800 26px/1 var(--display); letter-spacing: -.04em; color: var(--amber); }
.nav-links { display: flex; gap: var(--s-1); }
.nav-links a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.nav-links a:hover { color: var(--paper); }
.nav-links a[aria-current="page"] { color: var(--paper); background: rgba(255, 255, 255, .07); }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--paper); transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--seat); font: 700 15px var(--display); color: var(--amber); text-transform: uppercase;
}
.room-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 10px; border-radius: 999px;
  background: rgba(255, 107, 129, .14); color: var(--live); font-weight: 600; font-size: 14px;
}
.room-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.tabbar { display: none; }
@media (max-width: 760px) {
  .nav-links { display: none; }
  .tabbar {
    position: fixed; inset: auto 0 0; z-index: 50; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(22, 17, 31, .97); box-shadow: 0 -1px 0 var(--seat); backdrop-filter: blur(12px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 12px; font-weight: 500; }
  .tabbar a[aria-current="page"] { color: var(--amber); }
  main { padding-bottom: calc(var(--tab-h) + var(--s-6)); }
  .toast-zone { bottom: calc(var(--tab-h) + 16px) !important; }
}

.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px;
  background: var(--velvet); border: 1px solid var(--seat); border-radius: 14px; box-shadow: var(--shadow); z-index: 60;
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 9px; font-size: 15px; text-align: left; }
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, .06); }
.menu hr { border: 0; border-top: 1px solid var(--seat); margin: 6px 0; }
.menu .who { padding: 10px 12px 6px; font-size: 13px; color: var(--muted); }

.notice {
  position: fixed; top: var(--nav-h); left: 50%; transform: translateX(-50%); z-index: 45; width: min(720px, calc(100% - 32px));
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px;
  background: #2a2036; border: 1px solid var(--seat); color: #e4dcef; font-size: 14px; box-shadow: var(--shadow);
}
.notice .i { color: var(--amber); margin-top: 1px; }
.notice button { margin-left: auto; color: var(--muted); }

/* ── bottoni e campi ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; font-weight: 600; font-size: 15px; white-space: nowrap; transition: background .15s, transform .1s;
  background: rgba(255, 255, 255, .09); color: var(--paper);
}
.btn:hover { background: rgba(255, 255, 255, .14); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--amber); color: var(--amber-ink); }
.btn.primary:hover { background: var(--amber-2); }
.btn.live { background: var(--live); color: #2b0710; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--seat-2); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn.icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.lg { height: 52px; padding: 0 26px; font-size: 16px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 14px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--r-field); background: var(--ink-2);
  border: 1px solid var(--seat); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 12px 16px; resize: vertical; }
.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 181, 68, .18); }
.input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .06); color: #d9d1e6; font-size: 14px; font-weight: 500; transition: background .15s;
}
.chip:hover { background: rgba(255, 255, 255, .1); }
.chip[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

.switch { position: relative; display: inline-block; vertical-align: middle; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--seat-2); transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--amber-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 3px; }

.panel { background: var(--velvet); border: 1px solid var(--seat); border-radius: var(--r-panel); padding: var(--s-5); }
.panel + .panel { margin-top: var(--s-4); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .08); color: #d9d1e6; }
.badge.amber { background: rgba(245, 181, 68, .16); color: var(--amber); }
.badge.live { background: rgba(255, 107, 129, .16); color: var(--live); }
.badge.ok { background: rgba(95, 211, 160, .14); color: var(--ok); }

/* ── locandine e righe ───────────────────────────────────── */
.section { margin-top: var(--s-7); }
.section-head { display: flex; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-3); }
.section-head a { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.section-head h2 { min-width: 0; }
.section-note { margin: -4px 0 var(--s-3); color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-head a:hover { color: var(--paper); }

.rail { position: relative; }
.rail-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(132px, 15vw, 196px); gap: clamp(10px, 1.2vw, 16px);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; padding: 4px 0 8px; scroll-padding: 0 var(--gutter);
  margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter);
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-track > * { scroll-snap-align: start; }
.rail.wide .rail-track { grid-auto-columns: clamp(240px, 26vw, 340px); }
.rail-nav {
  position: absolute; top: 0; bottom: 48px; width: 48px; display: grid; place-items: center; z-index: 2;
  background: rgba(22, 17, 31, .78); opacity: 0; transition: opacity .2s; border-radius: 12px;
}
.rail:hover .rail-nav { opacity: 1; }
.rail-nav.prev { left: calc(var(--gutter) * -1 + 4px); }
.rail-nav.next { right: calc(var(--gutter) * -1 + 4px); }
@media (hover: none) { .rail-nav { display: none; } }

.card { position: relative; display: block; min-width: 0; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--r-poster); overflow: hidden; background: var(--velvet);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .05) inset;
}
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease), opacity .3s; }
.card:hover .poster img { transform: scale(1.04); }
.poster .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font: 700 16px/1.2 var(--display); color: var(--muted); }
.card-title { margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 13px; color: var(--faint); margin-top: 2px; }
.card .corner { position: absolute; top: 8px; left: 8px; }
.card .progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .55); overflow: hidden; }
.card .progress span { display: block; height: 100%; background: var(--amber); }
.card .remove {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(22, 17, 31, .8); opacity: 0; transition: opacity .15s;
}
.card:hover .remove, .card .remove:focus-visible { opacity: 1; }
@media (hover: none) { .card .remove { opacity: 1; } }

.still { aspect-ratio: 16 / 9; border-radius: var(--r-poster); overflow: hidden; background: var(--velvet); position: relative; }
.still img { width: 100%; height: 100%; object-fit: cover; }
.still .play-mark { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(22, 17, 31, .4); transition: opacity .2s; }
.card:hover .still .play-mark { opacity: 1; }
.still .play-mark span { width: 52px; height: 52px; border-radius: 50%; background: var(--amber); color: var(--amber-ink); display: grid; place-items: center; }

.grid-posters { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(128px, 14vw, 180px), 1fr)); gap: clamp(14px, 1.6vw, 22px); }

/* Top 10: numeri enormi accanto alla locandina */
.rail.ranked .rail-track { grid-auto-columns: clamp(190px, 21vw, 260px); }
.ranked-card { display: grid; grid-template-columns: 44% 1fr; align-items: end; }
.ranked-card .rank {
  font: 800 clamp(96px, 11vw, 150px)/.78 var(--display); letter-spacing: -.08em; color: var(--ink);
  -webkit-text-stroke: 2px var(--seat-2); text-align: right; margin-right: -10px; z-index: 1; user-select: none;
}
.ranked-card:hover .rank { -webkit-text-stroke-color: var(--amber); }
.ranked-card .card-title { grid-column: 2; }

/* ── hero ────────────────────────────────────────────────── */
.hero { position: relative; min-height: min(86vh, 760px); display: flex; align-items: flex-end; overflow: hidden; }
.hero-art { position: absolute; inset: 0; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.hero-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--ink) 2%, rgba(22, 17, 31, .7) 38%, rgba(22, 17, 31, .1) 70%),
              linear-gradient(to right, rgba(22, 17, 31, .85), rgba(22, 17, 31, 0) 62%);
}
.hero-body { position: relative; padding-bottom: var(--s-7); }
.hero-body > * { max-width: 760px; }
.hero-kicker { font: 600 15px var(--text); color: var(--amber); margin-bottom: var(--s-3); }
.hero-title { font: 800 clamp(44px, 7.4vw, 104px)/.9 var(--display); letter-spacing: -.035em; font-stretch: 90%; text-wrap: balance; }
.hero-meta { margin-top: var(--s-4); display: flex; gap: var(--s-3); flex-wrap: wrap; color: #d9d1e6; font-size: 15px; }
.hero-meta .star { color: var(--amber); display: inline-flex; gap: 4px; align-items: center; }
.hero-overview { margin-top: var(--s-3); max-width: 58ch; color: #d6cee3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { margin-top: var(--s-5); display: flex; gap: var(--s-3); flex-wrap: wrap; }
.hero-picks { position: absolute; right: var(--gutter); bottom: var(--s-7); display: flex; gap: 10px; }
.hero-picks button { width: 64px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; opacity: .55; transition: opacity .2s, transform .2s; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.hero-picks button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--amber); }
.hero-picks button:hover { opacity: .9; }
.hero-picks img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) { .hero-picks { display: none; } .hero { min-height: 72vh; } }

/* ── scheda titolo ───────────────────────────────────────── */
.detail-top { position: relative; padding-top: calc(var(--nav-h) + 12vh); }
.detail-body { position: relative; }
.detail-top .hero-art { height: 78vh; }
.detail-grid { position: relative; display: grid; grid-template-columns: 240px 1fr; gap: var(--s-6); align-items: end; }
.detail-grid .poster { box-shadow: var(--shadow); }
.detail-facts { display: flex; gap: 10px 18px; flex-wrap: wrap; margin-top: var(--s-3); color: #d9d1e6; font-size: 15px; }
.tagline { margin-top: var(--s-3); font: italic 500 18px var(--text); color: var(--amber); }
@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .poster { width: 132px; }
  .detail-top { padding-top: calc(var(--nav-h) + 20vh); }
}
.cast { display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.cast figure { margin: 0; text-align: center; }
.cast img, .cast .ph { width: 88px; height: 88px; margin: 0 auto 8px; border-radius: 50%; object-fit: cover; background: var(--seat); }
.cast figcaption { font-size: 13px; line-height: 1.3; }
.cast figcaption span { display: block; color: var(--faint); }

.episodes { display: grid; gap: 10px; }
.episode { display: grid; grid-template-columns: 200px 1fr auto; gap: var(--s-4); padding: 10px; border-radius: 14px; align-items: center; transition: background .15s; }
.episode:hover { background: rgba(255, 255, 255, .04); }
.episode .still { width: 100%; }
.episode h3 { font-size: 16px; }
.episode p { font-size: 14px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.episode .num { font: 700 14px var(--display); color: var(--faint); }
.episode.current { background: rgba(245, 181, 68, .07); box-shadow: inset 3px 0 0 var(--amber); }
@media (max-width: 640px) { .episode { grid-template-columns: 128px 1fr; } .episode .end { display: none; } }

/* ── stati vuoti, skeleton, toast ───────────────────────── */
.empty { padding: var(--s-7) var(--s-5); text-align: center; border: 1px dashed var(--seat); border-radius: var(--r-panel); }
.empty h3 { font-size: 22px; font-family: var(--display); }
.empty p { color: var(--muted); margin: 8px auto var(--s-4); max-width: 44ch; }
.skeleton { background: linear-gradient(100deg, var(--velvet) 30%, #2a2238 50%, var(--velvet) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-poster); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skeleton.poster { aspect-ratio: 2/3; }
.skeleton.line { height: 14px; margin-top: 10px; width: 70%; border-radius: 6px; }

.toast-zone { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px;
  background: var(--paper); color: var(--ink); font-weight: 500; font-size: 15px; box-shadow: var(--shadow);
  animation: toast-in .25s var(--ease);
}
.toast.error { background: var(--live); color: #2b0710; }
.toast button { margin-left: auto; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

.dialog { border: 0; padding: 0; background: transparent; color: var(--paper); max-width: min(520px, calc(100% - 32px)); width: 100%; }
.dialog::backdrop { background: rgba(10, 6, 16, .72); backdrop-filter: blur(4px); }
.dialog .panel { box-shadow: var(--shadow); }
.dialog h2 { margin-bottom: var(--s-3); }
.dialog .actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-5); flex-wrap: wrap; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .14); border-top-color: var(--amber); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--seat); }
.table td { padding: 12px; border-bottom: 1px solid rgba(53, 43, 71, .6); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

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

/* ── accesso ─────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr minmax(360px, 520px); }
.login-art { position: relative; overflow: hidden; background: var(--ink-2); }
.login-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(22,17,31,.2), var(--ink) 96%), linear-gradient(0deg, var(--ink), transparent 40%); }
.login-posters { position: absolute; inset: -8%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; transform: rotate(-8deg); opacity: .55; }
.login-posters img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; }
.login-panel { padding: clamp(32px, 7vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: var(--s-4); }
.login-panel h1 { font-size: clamp(38px, 5vw, 56px); margin-top: var(--s-6); }
.login-note { padding: 12px 14px; border-radius: 12px; background: rgba(245,181,68,.1); color: var(--amber); font-size: 15px; }
.login-error { color: var(--live); font-size: 15px; }
.login-page .notice { display: none; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-art { position: fixed; inset: 0; opacity: .5; } .login-panel { position: relative; min-height: 100vh; } }

/* ── ricerca ─────────────────────────────────────────────── */
.search-box { position: relative; margin-top: var(--s-5); max-width: 760px; }
.search-box .i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 22px; height: 22px; }
.search-box .input { height: 60px; padding-left: 54px; font-size: 19px; border-radius: 16px; }
.filters { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin-top: var(--s-4); }
.filters .row-gap { margin-left: auto; }
select.select-sm, .select-sm { height: 38px; width: auto; padding: 0 34px 0 14px; border-radius: 999px; font-size: 14px; appearance: none;
  background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a99fbd' stroke-width='2'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center; }
.fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font: 700 16px/1.2 var(--display); color: var(--muted); }
@media (max-width: 760px) { .filters .row-gap { margin-left: 0; } }

/* ── profilo ─────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: var(--s-4); margin-top: var(--s-6); }
.stats div { padding: var(--s-4) var(--s-5); border-radius: var(--r-panel); background: var(--velvet); }
.stats strong { display: block; font: 800 34px/1 var(--display); color: var(--amber); }
.stats span { color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats div { padding: 14px; } .stats strong { font-size: 26px; } }
.history { display: grid; gap: 2px; }
.history-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: 10px 8px; border-radius: 12px; }
.history-row:hover { background: rgba(255,255,255,.03); }
.history-art { width: 48px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; background: var(--seat); }
.history-art img { width: 100%; height: 100%; object-fit: cover; }
.history-text { min-width: 0; display: grid; gap: 2px; }
.history-text > a { display: block; min-width: 0; }
.history-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.history-more { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-4); padding-left: 8px; }
.bar { height: 3px; border-radius: 3px; background: var(--seat); margin-top: 6px; max-width: 320px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--amber); }
.settings { padding: 0; }
.setting { display: flex; gap: var(--s-4); align-items: center; justify-content: space-between; padding: 18px 22px; border-top: 1px solid var(--seat); cursor: pointer; }
.setting:first-child { border-top: 0; }
.setting small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ── stanze ──────────────────────────────────────────────── */
.room-start { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.room-start .panel + .panel { margin-top: 0; }
.code-input { font: 700 22px var(--display); letter-spacing: .18em; text-transform: uppercase; height: 52px; }
.room-live { display: grid; gap: var(--s-4); }
.room-live .panel + .panel { margin-top: 0; }
.room-code { font: 800 clamp(56px, 12vw, 104px)/1 var(--display); letter-spacing: .12em; color: var(--live); margin: 8px 0 20px; font-variant-numeric: tabular-nums; }
.host-now { display: flex; align-items: center; gap: var(--s-4); }
.host-now img { width: 64px; border-radius: 8px; }
.host-now div { flex: 1; min-width: 0; }
.host-now h2 { margin: 4px 0; }
.members { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.members li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.members li div { flex: 1; min-width: 0; display: grid; }
.chat-log { max-height: 280px; overflow-y: auto; display: grid; gap: 8px; margin: 12px 0; overflow-wrap: anywhere; }
.chat-log strong { color: var(--amber); font-weight: 600; margin-right: 4px; }
@media (max-width: 720px) { .room-start { grid-template-columns: 1fr; } }

/* ── TV ──────────────────────────────────────────────────── */
.tv-player { margin-bottom: var(--s-5); }
.player.inline { position: relative; inset: auto; aspect-ratio: 16 / 9; max-height: 72vh; width: 100%; border-radius: var(--r-panel); overflow: hidden; }
.player.inline [data-back] { display: none; }
.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.channel { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: var(--velvet); text-align: left; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.channel:hover { border-color: var(--seat-2); }
.channel.current { border-color: var(--live); }
.channel .logo { width: 56px; height: 40px; flex: none; border-radius: 8px; background: #fff1; display: grid; place-items: center; overflow: hidden; }
.channel .logo img { max-width: 48px; max-height: 32px; object-fit: contain; }
.channel .meta { flex: 1; min-width: 0; display: grid; }
.channel .meta strong, .channel .meta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel small { color: var(--muted); font-size: 13px; }
.tv-tools { display: flex; gap: var(--s-3); align-items: center; }

/* ── admin ───────────────────────────────────────────────── */
.admin { padding-bottom: var(--s-8); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-6); }
.admin-grid .panel + .panel { margin-top: 0; }
.admin-tabs { display: flex !important; overflow-x: auto; }
.server-state { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; }
.server-state .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.server-state.ok .dot { background: var(--ok); }
.server-state.down { color: var(--live); }
.server-state.down .dot { background: var(--live); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); margin-top: var(--s-5); }
.usage .panel + .panel { margin-top: 0; }
.usage-value { font: 800 32px var(--display); margin: 8px 0 12px; }
.usage-value small { font: 500 15px var(--text); color: var(--muted); }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.chat-log .sys { color: var(--muted); font-size: 14px; padding-left: 10px; border-left: 2px solid var(--seat-2); }

/* ── backup ──────────────────────────────────────────────── */
.backup-grid { margin-top: 0; }
.backup-card { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.backup-card .btn { margin-top: 4px; }
.backup-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(245, 181, 68, .12); color: var(--amber); }
.dropzone { width: 100%; min-height: 132px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--seat-2); border-radius: 16px; background: var(--ink-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--amber); background: rgba(245, 181, 68, .06); }
.dropzone.ready { border-style: solid; border-color: var(--ok); }
.dropzone.bad { border-color: var(--live); }
.dropzone.busy { pointer-events: none; opacity: .7; }
.progress-line { width: 100%; height: 6px; border-radius: 6px; background: var(--seat); overflow: hidden; }
.progress-line span { display: block; height: 100%; width: 0; background: var(--amber); transition: width .25s; }
.error-text { color: var(--live); }
.ok-text { color: var(--ok); }

/* scelta della sorgente nel profilo */
.setting.stacked { flex-direction: column; align-items: stretch; cursor: default; gap: 14px; }
.source-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.source-choice button { display: grid; gap: 4px; align-content: start; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--seat); transition: border-color .15s, background .15s; }
.source-choice button:hover { border-color: var(--seat-2); }
.source-choice button small { color: var(--muted); font-size: 13px; margin: 0; }
.source-choice button[aria-checked="true"] { border-color: var(--amber); background: rgba(245, 181, 68, .08); box-shadow: inset 0 0 0 1px var(--amber); }
.source-choice button[aria-checked="true"] strong { color: var(--amber); }

/* ── telefono in verticale: più respiro fra le sezioni, testi che non escono dallo schermo ── */
@media (max-width: 560px) {
  .section { margin-top: 40px; }
  .section-head { margin-bottom: 14px; flex-wrap: wrap; row-gap: 4px; }
  h2 { font-size: 22px; line-height: 1.15; }
  .rail-track { gap: 12px; padding-bottom: 12px; grid-auto-columns: 38vw; }
  .rail.wide .rail-track { grid-auto-columns: 78vw; }
  .rail.ranked .rail-track { grid-auto-columns: 58vw; }
  .ranked-card .rank { font-size: 92px; }
  .card-title { font-size: 13.5px; margin-top: 10px; }
  .card-meta { font-size: 12.5px; margin-top: 4px; }
  .hero-body { padding-bottom: 32px; }
  .stats { gap: 10px; margin-top: 24px; }
  .stats span { font-size: 13px; line-height: 1.3; display: block; margin-top: 4px; }
  .history-row { gap: 12px; padding: 12px 4px; }
  .history-text .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .history-more { flex-wrap: wrap; }
  .page-head { padding-bottom: 16px; }
}
