/* JammerVIO Remote — design system (v0.6 "sharp" pass).
   Self-hosted variable fonts (no runtime CDN): Space Grotesk for display,
   Inter for text. Deep-black surfaces, one violet→fuchsia gradient accent,
   soft layered shadows, 160–240ms motion, shimmer skeletons. */

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/Inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/fonts/SpaceGrotesk-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #08080d;
  --panel: #13131c;
  --panel-2: #1a1a26;
  --field: #0e0e16;
  --line: #22222f;
  --line-bright: #303042;
  --fg: #f4f4f8;
  --muted: #9c9cb2;
  --accent: #7c4dff;
  --accent-soft: rgba(124, 77, 255, 0.16);
  --accent2: #d500f9;
  --grad: linear-gradient(135deg, #7c4dff, #d500f9);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --r-s: 10px; --r-m: 14px; --r-l: 18px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 28px -14px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 8px 22px -10px rgba(124, 77, 255, 0.55);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--fg);
  font: 400 16px/1.5 var(--font-text);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(124, 77, 255, 0.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.app { min-height: 100dvh; display: flex; flex-direction: column; }

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

/* Centered card screens: sign-in and the TV approval flow. */
.center-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 28px 24px;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: card-in 240ms var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--grad);
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.mark svg { width: 20px; height: 20px; display: block; }
.brand b {
  font: 700 19px/1 var(--font-display); letter-spacing: -0.01em;
}
h1 {
  font: 700 22px/1.2 var(--font-display); letter-spacing: -0.02em;
  margin: 0 0 6px;
}
p.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.code {
  font: 600 26px/1 ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.3em; text-align: center; padding: 15px 10px 15px 18px;
  background: var(--field); border: 1px solid var(--line);
  border-radius: var(--r-m); margin-bottom: 20px;
  text-shadow: 0 0 24px rgba(124, 77, 255, 0.35);
}

label {
  display: block; font: 600 11px/1 var(--font-text); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 7px;
}
input {
  width: 100%; padding: 13px 14px; margin-bottom: 14px; font: 400 16px var(--font-text);
  color: var(--fg); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--r-s);
  transition: border-color 160ms, box-shadow 160ms;
}
input::placeholder { color: #5b5b70; }
input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button {
  width: 100%; padding: 14px; font: 600 16px var(--font-text); color: #fff;
  background: var(--grad); border: 0; border-radius: var(--r-s);
  cursor: pointer; box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 120ms var(--ease), filter 160ms, box-shadow 160ms;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.975); filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
.msg {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--r-s);
  font-size: 14px; display: none;
}
.msg.show { display: block; animation: rise 160ms var(--ease) both; }
.msg.ok  { background: rgba(52, 211, 153, 0.09); border: 1px solid rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.msg.err { background: rgba(248, 113, 113, 0.09); border: 1px solid rgba(248, 113, 113, 0.35); color: #fecaca; }
.foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.6; }
.link {
  display: block; margin-top: 16px; text-align: center;
  color: #c4b5fd; text-decoration: none; font: 600 14px var(--font-text);
}
.link:active { opacity: 0.7; }
.hidden { display: none !important; }

/* App chrome */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: rgba(8, 8, 13, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar .brand { margin: 0; }
.topbar .mark { width: 30px; height: 30px; border-radius: 9px; box-shadow: var(--shadow-glow); }
.topbar .mark svg { width: 15px; height: 15px; }
.topbar .brand b { font-size: 16px; }
.topbar .who {
  margin-left: auto; color: var(--muted); font: 600 12px var(--font-text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding: 20px 16px 100px;
  animation: rise 200ms var(--ease) both;
}
.hgroup h1 { font-size: 26px; margin: 0 0 4px; }
.hgroup p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  animation: rise 220ms var(--ease) both;
}
.tile h2 {
  font: 700 15px/1.3 var(--font-display); letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.tile p { margin: 0 0 6px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tile p:last-child { margin-bottom: 0; }
.tile .ghost { margin-top: 12px; }
.tile.stat {
  display: block; text-decoration: none; color: inherit;
  transition: border-color 160ms;
}
.tile.stat:active { border-color: var(--accent); }
.ghost {
  padding: 12px; font: 600 15px var(--font-text); color: var(--fg);
  background: transparent; border: 1px solid var(--line-bright); border-radius: var(--r-s);
  box-shadow: none;
}
.ghost:hover { background: var(--panel-2); }
.ghost:active { background: var(--panel-2); }
.meta {
  color: #5b5b70; font: 500 11px var(--font-text); letter-spacing: 0.06em;
  text-align: center; margin-top: 20px; text-transform: uppercase;
}

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  border-top: 1px solid var(--line);
  background: rgba(10, 10, 16, 0.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 5;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center; padding: 11px 0 10px; position: relative;
  color: var(--muted); text-decoration: none;
  font: 600 11px var(--font-text); letter-spacing: 0.04em; text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a.active { color: var(--fg); }
.tabbar a.active::before {
  content: ''; position: absolute; top: 0; width: 18px; height: 2px;
  border-radius: 0 0 2px 2px; background: var(--grad);
}

/* Chips (profiles, sort, filter) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; font: 600 13px var(--font-text); color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--c, transparent); border-radius: 999px;
  cursor: pointer; box-shadow: none;
  transition: color 160ms, border-color 160ms, background 160ms;
  -webkit-tap-highlight-color: transparent;
}
.chip.on {
  color: var(--fg); background: var(--accent-soft);
  border-color: rgba(124, 77, 255, 0.55);
}
.chip .lock {
  font: 600 9px var(--font-text); letter-spacing: 0.08em; color: var(--muted);
  border: 1px solid var(--line-bright); border-radius: 6px; padding: 1px 5px;
}
.search {
  width: 100%; padding: 12px 14px; margin-bottom: 14px;
  font: 400 16px var(--font-text); color: var(--fg);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-m);
}
.search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Poster grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cell {
  position: relative; padding: 0; margin: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden;
  cursor: pointer; min-height: 150px; display: flex; align-items: stretch;
  box-shadow: var(--shadow-1); min-width: 0;
  transition: transform 140ms var(--ease), border-color 140ms;
  -webkit-tap-highlight-color: transparent;
}
.cell:active { transform: scale(0.965); border-color: var(--accent); }
.cell img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--panel-2); }
.cell .ph {
  flex: 1; display: grid; place-items: center; padding: 10px;
  font: 600 12px var(--font-text); color: var(--muted); text-align: center;
  overflow: hidden;
}
.cell .badge {
  position: absolute; top: 6px; left: 6px; font: 600 10px var(--font-text);
  letter-spacing: 0.03em; padding: 3px 7px; border-radius: 7px; color: #fff;
  background: rgba(10, 10, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cell .badge.watched { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.4); }
.cell .bar {
  position: absolute; left: 0; right: 0; bottom: 27px; height: 3px;
  background: rgba(0, 0, 0, 0.55); display: block;
}
.cell .bar span { display: block; height: 100%; background: var(--grad); }
.cell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 5px;
  font: 600 11px var(--font-text); color: #fff;
  background: linear-gradient(transparent, rgba(5, 5, 9, 0.92));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.empty {
  color: var(--muted); font-size: 14px; padding: 28px 8px; text-align: center;
  line-height: 1.6;
}

/* Continue-watching rail */
.rail {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.railcell {
  position: relative; flex: none; width: 112px; min-height: 168px; padding: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-m); overflow: hidden; cursor: pointer;
  display: flex; align-items: stretch; scroll-snap-align: start;
  box-shadow: var(--shadow-1); transition: transform 140ms var(--ease), border-color 140ms;
  -webkit-tap-highlight-color: transparent;
}
.railcell:active { transform: scale(0.965); border-color: var(--accent); }
.railcell img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--panel-2); }
.railcell .ph {
  flex: 1; display: grid; place-items: center; padding: 8px;
  font: 600 11px var(--font-text); color: var(--muted); text-align: center; overflow: hidden;
}
.railcell .bar { position: absolute; left: 0; right: 0; bottom: 23px; height: 3px; background: rgba(0, 0, 0, 0.55); display: block; }
.railcell .bar span { display: block; height: 100%; background: var(--grad); }
.railcell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px;
  font: 600 10px var(--font-text); color: #fff;
  background: linear-gradient(transparent, rgba(5, 5, 9, 0.92));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}

/* Item detail sheet */
.sheet {
  position: fixed; inset: 0; z-index: 10; background: rgba(4, 4, 8, 0.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in 160ms ease-out both;
}
.sheet-card {
  width: 100%; max-width: 560px; max-height: 86dvh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-bright);
  border-radius: 20px 20px 0 0; padding: 26px 18px 30px; position: relative;
  box-shadow: 0 -18px 50px -12px rgba(0, 0, 0, 0.8);
  animation: sheet-up 260ms var(--ease) both;
}
.sheet-card::before {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 4px; border-radius: 2px; background: var(--line-bright);
}
.sheet-card .close {
  position: absolute; top: 18px; right: 14px; width: 34px; height: 34px;
  padding: 0; font-size: 14px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line-bright); border-radius: 999px; box-shadow: none;
}
.sheet-card .close:active { color: var(--fg); }
.sheet-head { display: flex; gap: 14px; align-items: flex-start; }
.sheet-head img {
  width: 94px; border-radius: var(--r-m); flex: none;
  box-shadow: var(--shadow-1);
}
.sheet-head h2 { font: 700 20px/1.25 var(--font-display); letter-spacing: -0.01em; margin: 0 0 5px; }
.sheet-head .sub { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.sheet-head .okline { margin: 7px 0 0; color: #a7f3d0; font-size: 13px; }
.sheet-card .desc { color: var(--muted); font-size: 14px; line-height: 1.6; }
.sheet-card h3 {
  font: 700 12px var(--font-text); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 8px;
}
.sheet-card .step { color: var(--fg); font-size: 14px; margin: 0 0 5px; }
.muted { color: var(--muted); }

/* Play box + controls */
.playbox { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.playbox #choose { width: auto; margin-top: 10px; padding: 10px 16px; font-size: 13px; }
.tvlist { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tvopt {
  text-align: left; padding: 12px 14px; font: 600 14px var(--font-text);
  color: var(--fg); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: none;
  transition: border-color 160ms;
}
.tvopt.on { border-color: var(--accent); background: var(--accent-soft); }
.tvopt .muted { font: 500 12px var(--font-text); }
.tvopt .muted.now { color: #a7f3d0; font-weight: 600; }
.note { display: none; margin: 12px 0 0; font-size: 13px; line-height: 1.5; }
.note.show { display: block; animation: rise 160ms var(--ease) both; }
.note.ok { color: #a7f3d0; }
.note.err { color: #fecaca; }
.ctrlrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ctrlrow .ghost { flex: 1; min-width: 100px; margin-top: 0; padding: 11px 8px; font-size: 13px; }
.tile .step#tvnote { margin-top: 8px; }
.muted.now { color: #a7f3d0; font-weight: 600; }

/* Profiles + PIN management */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pinrow {
  display: flex; align-items: center; gap: 10px; padding: 13px 0;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.pinrow .pname { flex: 1; font: 600 15px var(--font-text); }
.pinrow .pstate { color: var(--muted); font-size: 13px; }
.mini {
  width: auto; padding: 8px 13px; font: 600 12px var(--font-text);
  color: var(--fg); background: var(--panel-2);
  border: 1px solid var(--line-bright); border-radius: 999px; box-shadow: none;
}
.mini:active { border-color: var(--accent); }
.pinform { padding: 4px 0 12px; border-top: 1px solid var(--line); }
.pinform label { margin-top: 10px; }
.pinform .apply { margin-top: 8px; margin-right: 8px; width: auto; padding: 10px 18px; }
.pinform .cancel { margin-top: 8px; width: auto; padding: 10px 18px; }

/* Devices */
.devrow {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 0;
  border-top: 1px solid var(--line);
}
.devrow:first-child { border-top: 0; }
.devrow .dot { margin-top: 6px; }
.devrow .dot[style*='#22c55e'] { box-shadow: 0 0 10px rgba(52, 211, 153, 0.6); }
.devrow .devmain { flex: 1; min-width: 0; line-height: 1.5; }
.devrow .devmain b { font: 700 15px var(--font-display); letter-spacing: -0.01em; }
.devrow .pstate { display: inline; font-size: 13px; color: var(--muted); }
.oktext { color: #a7f3d0; }
.warntext { color: #fde68a; }

/* Playlists. */
.plcard .mini-rail { overflow: hidden; margin-top: 4px; }
.mini-rail img { width: 52px; height: 78px; object-fit: cover; border-radius: 6px; flex: none; }
.mini-rail .ph {
  width: 52px; height: 78px; border-radius: 6px; background: var(--panel-2);
  display: grid; place-items: center; font: 600 10px var(--font-text);
  color: var(--muted); overflow: hidden; padding: 4px; text-align: center;
}
.newpl { display: flex; gap: 8px; align-items: center; }
.newpl input { flex: 1; margin-bottom: 0; }
.newpl button { width: auto; padding: 12px 16px; font-size: 14px; white-space: nowrap; }
.plhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plhead h2 { flex: 1; margin: 0; min-width: 120px; }
.plrow {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-top: 1px solid var(--line);
}
.plrow:first-child { border-top: 0; }
.plrow .thumb {
  width: 40px; height: 60px; border-radius: 6px; object-fit: cover; flex: none;
  background: var(--panel-2); display: block;
}
.plrow .thumb.ph {
  display: grid; place-items: center; font: 700 16px var(--font-display);
  color: var(--muted);
}
.plrow .devmain { flex: 1; min-width: 0; line-height: 1.4; }
.plrow .devmain b { font: 600 14px var(--font-text); }
.plrow .mini { padding: 7px 11px; }

/* Retry / skeletons */
.retry { width: auto; padding: 11px 18px; }
.sk { display: grid; gap: 12px; }
.sk-block {
  height: 84px; border-radius: var(--r-m); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk.sk-posters { grid-template-columns: repeat(3, 1fr); }
.sk.sk-posters .sk-block { height: 150px; border-radius: var(--r-m); }

/* Motion */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up {
  from { transform: translateY(60px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
