/* ============================================================
   TV — base design system
   ============================================================ */

:root {
  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Apple dark-mode system colors */
  --text-primary:   #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.62);
  --text-tertiary:  rgba(235, 235, 245, 0.38);
  --text-quaternary: rgba(235, 235, 245, 0.20);

  --bg-content: #0a0a0c;
  --bg-elevated: rgba(40, 40, 46, 0.72);
  --bg-sidebar: rgba(30, 30, 34, 0.60);

  --fill-hover: rgba(255, 255, 255, 0.06);
  --fill-selected: rgba(255, 255, 255, 0.11);
  --separator: rgba(255, 255, 255, 0.10);

  --accent: #2997ff;          /* TV app link blue */
  --accent-press: #0a84ff;
  --danger: #ff453a;

  --radius-card: 10px;
  --radius-panel: 14px;

  --sidebar-width: 224px;
  --sidebar-rail: 64px;
  --toolbar-height: 52px;

  --ease-out: cubic-bezier(0.22, 0.82, 0.24, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.44, 1);

  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 18px 44px rgba(0, 0, 0, 0.65);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-stack);
  background: #050507;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

img { display: block; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(41, 151, 255, 0.35); }

/* Thin overlay scrollbars, macOS style */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.32); background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }

/* ---------- Focus rings (Apple-style) ---------- */
:focus { outline: none; }

.focus-ring:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(10, 132, 255, 0.85);
  outline-offset: 2px;
  border-radius: 6px;
}
.card:focus-visible { outline-offset: 3px; border-radius: var(--radius-card); }

/* ---------- Typography helpers ---------- */
.t-secondary { color: var(--text-secondary); }
.t-tertiary  { color: var(--text-tertiary); }

.rail-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--text-primary);
}

.link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link:active { color: var(--accent-press); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 22px;
  border-radius: 18px;   /* pill */
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 120ms var(--ease-out), background 120ms, filter 120ms, box-shadow 160ms;
}
.btn:active { transform: scale(0.97); }

.btn-play {
  background: #fff;
  color: #000;
  min-width: 116px;
}
.btn-play:hover { background: rgba(255, 255, 255, 0.86); }
.btn-play svg { width: 13px; height: 13px; }

.btn-secondary {
  background: rgba(120, 120, 128, 0.36);
  color: var(--text-primary);
  min-width: 116px;
  backdrop-filter: blur(6px);
}
.btn-secondary:hover { background: rgba(120, 120, 128, 0.48); }

.btn-small {
  height: 28px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 14px;
  gap: 5px;
}

/* Round icon button (add-to-up-next, player chrome, etc.) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-primary);
  transition: background 130ms var(--ease-out), transform 130ms var(--ease-out);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn:active { transform: scale(0.92); }

/* Translucent circle button used on hero art */
.circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.42);
  backdrop-filter: blur(10px) saturate(150%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 130ms var(--ease-out), transform 130ms var(--ease-out);
}
.circle-btn:hover { background: rgba(140, 140, 150, 0.6); }
.circle-btn:active { transform: scale(0.93); }
.circle-btn svg { width: 17px; height: 17px; }
.circle-btn.is-on { background: #fff; color: #000; }

/* ---------- Rating badge (content rating) ---------- */
.rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 16px;
  padding: 1.5px 5px 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text-secondary);
  vertical-align: 1px;
}

/* ---------- Metadata separators ---------- */
.meta-dot::before {
  content: "·";
  margin: 0 7px;
  color: var(--text-tertiary);
}

/* ---------- Shimmer / loading ---------- */
@keyframes shimmer-sweep {
  0%   { background-position: -420px 0; }
  100% { background-position: 420px 0; }
}
.shimmer {
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.05) 34%,
    rgba(255, 255, 255, 0.11) 48%,
    rgba(255, 255, 255, 0.05) 62%
  );
  background-size: 840px 100%;
  animation: shimmer-sweep 1.25s linear infinite;
  border-radius: var(--radius-card);
}
.shimmer-text {
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(100deg,
    rgba(255,255,255,0.05) 30%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.05) 70%);
  background-size: 840px 100%;
  animation: shimmer-sweep 1.25s linear infinite;
}
.skeleton-group { margin-bottom: 42px; }
.skeleton-heading { height: 21px; width: 220px; margin-bottom: 14px; }

/* ---------- Toast ---------- */
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast {
  position: fixed;
  left: calc(var(--sidebar-width) + 26px);
  bottom: 26px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px 0 16px;
  border-radius: 22px;
  background: var(--bg-elevated);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  font-size: 13.5px;
  font-weight: 500;
  animation: toast-in 260ms var(--ease-spring);
  pointer-events: none;
}
.toast svg { width: 17px; height: 17px; color: #30d158; flex: none; }
.toast.is-leaving { transition: opacity 200ms, transform 200ms; opacity: 0; transform: translateY(10px); }

/* ---------- Context menu ---------- */
@keyframes menu-in {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.ctx-menu {
  position: fixed;
  z-index: 1000;
  min-width: 210px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(46, 46, 52, 0.86);
  backdrop-filter: blur(30px) saturate(170%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  transform-origin: top left;
  animation: menu-in 130ms var(--ease-out);
}
.ctx-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: var(--text-primary);
}
.ctx-menu .ctx-item svg { width: 15px; height: 15px; color: var(--text-secondary); }
.ctx-menu .ctx-item:hover { background: var(--accent); color: #fff; }
.ctx-menu .ctx-item:hover svg { color: #fff; }
.ctx-menu .ctx-item.is-destructive { color: #ff6961; }
.ctx-menu .ctx-item.is-destructive:hover { background: var(--danger); color: #fff; }
.ctx-menu .ctx-sep { height: 1px; margin: 5px 10px; background: rgba(255, 255, 255, 0.12); }

/* ---------- Shared view transition ---------- */
@keyframes view-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-page { animation: view-in 340ms var(--ease-out); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
