/* ── LiveTube · Twitch layout, shadcn/ui polish ──────────────────── */

:root {
  /* shadcn zinc dark tokens */
  --background: #09090b;
  --foreground: #fafafa;
  --card: #101012;
  --card-elevated: #18181b;
  --popover: #18181b;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --subtle-foreground: #71717a;
  --border: #27272a;
  --input: #27272a;
  --ring: #d4d4d8;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --destructive: #ef4444;

  /* brand */
  --purple: #9147ff;
  --purple-hover: #7c3aed;
  --purple-soft: rgba(145, 71, 255, 0.14);
  --live: #ef4444;

  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-lg: calc(var(--radius) + 4px);
  --nav-h: 56px;
  --sidebar-w: 256px;
  --chat-w: 340px;
  --font: "Geist Sans", "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.65);
}

/* shadcn zinc light theme */
html[data-theme="light"] {
  --background: #fafafa;
  --foreground: #09090b;
  --card: #ffffff;
  --card-elevated: #f4f4f5;
  --popover: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #52525b;
  --subtle-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #18181b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #dc2626;
  --purple: #7c3aed;
  --purple-hover: #6d28d9;
  --purple-soft: rgba(124, 58, 237, 0.12);
  --live: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.18);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-color: var(--background);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }
html[data-theme="light"] * { scrollbar-color: #d4d4d8 transparent; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(ellipse 70% 40% at 50% -10%, var(--glow-1, rgba(145, 71, 255, 0.06)), transparent),
    radial-gradient(ellipse 50% 30% at 90% 110%, var(--glow-2, rgba(145, 71, 255, 0.04)), transparent);
  transition: background-color .2s ease, color .2s ease;
}

html[data-theme="light"] body {
  --glow-1: rgba(124, 58, 237, 0.05);
  --glow-2: rgba(124, 58, 237, 0.03);
}

::selection { background: var(--purple-soft); }

/* shadcn focus ring */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button { font-family: inherit; cursor: pointer; }

/* custom scrollbars (native feel) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 999px;
  border: 3px solid var(--background);
}
::-webkit-scrollbar-thumb:hover { background: #52525b; }
* { scrollbar-width: thin; scrollbar-color: #3f3f46 transparent; }

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

/* ── Top nav ─────────────────────────────────────────────────────── */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-burger {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-burger:hover { background: var(--accent); color: var(--foreground); }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--foreground);
  flex-shrink: 0;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--purple);
  color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px rgba(145, 71, 255, 0.4);
}

.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }

.search {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--foreground);
  font-size: 13.5px;
  font-family: inherit;
}
.search input::placeholder { color: var(--subtle-foreground); }

.search-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 100%;
  background: var(--muted);
  border: none;
  border-left: 1px solid var(--input);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.search-btn:hover { color: var(--foreground); background: #3f3f46; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-icon-btn:hover { background: var(--accent); color: var(--foreground); }

/* CSS tooltip (native feel) */
.nav-icon-btn[data-tip]:hover::after,
.nav-burger[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  animation: fadeSlide .15s ease;
  z-index: 110;
}

/* theme icons: only the active scheme's icon shows */
.theme-icon { display: none; }
html[data-theme="light"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: block; }
html[data-theme="system"] .theme-icon-system { display: block; }

/* shadcn dropdown-menu */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlide .15s ease;
  z-index: 120;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--foreground);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background .1s ease;
}
.dropdown-item:hover { background: var(--accent); }
.dropdown-item[aria-checked="true"] { background: var(--purple-soft); color: var(--purple); }

.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Shell: sidebar + content ────────────────────────────────────── */

.shell {
  display: flex;
  padding-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}

.sidebar {
  position: fixed;
  top: var(--nav-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--background);
  border-right: 1px solid var(--border);
  transition: margin-left .2s cubic-bezier(.4, 0, .2, 1);
  z-index: 90;
}

body.sidebar-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

.sidebar-head {
  padding: 16px 16px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle-foreground);
  flex-shrink: 0;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  color: var(--foreground);
  transition: background .1s ease;
}

.sidebar-item:hover { background: var(--accent); }
.sidebar-item.active {
  background: var(--muted);
  box-shadow: inset 2px 0 0 var(--purple);
}
.sidebar-item.active .side-name { color: var(--foreground); font-weight: 600; }

.side-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.side-avatar .live-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  border: 2px solid var(--background);
}

.side-main { min-width: 0; flex: 1; }

.side-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-cat {
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.side-right .live-dot { width: 7px; height: 7px; background: var(--live); animation: none; }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--subtle-foreground);
  flex-shrink: 0;
}

.content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left .2s cubic-bezier(.4, 0, .2, 1);
}

body.sidebar-collapsed .content { margin-left: 0; }

/* ── Stage row: player + chat ────────────────────────────────────── */

.stage-row {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}

.stage { flex: 1; min-width: 0; }

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(145, 71, 255, 0.07), transparent),
    var(--card);
}

.player-empty-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--purple);
  background: var(--card-elevated);
  box-shadow: var(--shadow-sm);
}

.player-empty-title { margin: 0; font-size: 15px; font-weight: 600; }
.player-empty-sub { margin: 0; font-size: 12.5px; color: var(--muted-foreground); max-width: 380px; }

/* ── Channel info bar ────────────────────────────────────────────── */

.chan-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 2px 0;
  animation: fadeSlide .25s ease;
}

.chan-avatar-wrap { position: relative; flex-shrink: 0; }

.chan-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  border: 2px solid transparent;
}

.chan-avatar.is-live { border-color: var(--live); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

.chan-avatar-wrap .live-pill {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--live);
  border-radius: calc(var(--radius-sm) + 1px);
  padding: 3px 8px;
  line-height: 1.3;
  white-space: nowrap;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.chan-main { min-width: 0; flex: 1; }

.chan-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.chan-title {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chan-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--muted);
  border-radius: 999px;
  padding: 3px 10px;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-purple { color: var(--purple); background: var(--purple-soft); }

.badge-viewers {
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.badge-viewers .live-dot { width: 7px; height: 7px; background: var(--live); animation: none; }

.chan-actions { flex-shrink: 0; }

/* shadcn button: primary */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-foreground);
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, opacity .12s ease;
}
.btn-primary:hover { background: #e4e4e7; }

/* ── Chat panel ──────────────────────────────────────────────────── */

.chat-panel {
  display: flex;
  flex-direction: column;
  width: var(--chat-w);
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: calc(100vh - var(--nav-h) - 32px);
  max-height: 760px;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  box-shadow: var(--shadow-sm);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--card-elevated);
}

.chat-head-title { letter-spacing: -0.01em; }

.chat-name-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chat-name-edit:hover { background: var(--accent); color: var(--foreground); border-color: #3f3f46; }

.chat-name-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.chat-body { flex: 1; overflow-y: auto; padding: 10px 12px; }

.chat-empty {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--subtle-foreground);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 9px;
  margin-bottom: 3px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  animation: fadeSlide .18s ease;
}
.chat-msg:hover { background: var(--accent); }

.chat-msg-mine { border-left-color: var(--purple); background: var(--purple-soft); }
.chat-msg-mine:hover { background: var(--purple-soft); }

.chat-msg-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.chat-msg-name { font-size: 12px; font-weight: 700; }
.chat-msg-time { font-size: 10px; color: var(--subtle-foreground); }

.chat-msg-text {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-msg-sys {
  align-items: center;
  text-align: center;
  font-size: 11px;
  color: var(--subtle-foreground);
  background: var(--card-elevated);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.chat-msg-sys:hover { background: var(--card-elevated); }

.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--card-elevated);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-form input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }

.chat-send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  background: var(--purple);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  transition: background .12s ease, transform .1s ease;
}
.chat-send:hover { background: var(--purple-hover); }
.chat-send:active { transform: scale(0.94); }

/* ── Discover grid ───────────────────────────────────────────────── */

.discover { padding: 8px 16px 40px; }

.discover-head { margin-bottom: 14px; }

.discover-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.discover-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted-foreground); }

/* shadcn Tabs */
.tabs {
  display: inline-flex;
  gap: 4px;
  margin-top: 10px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tab {
  height: 28px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.tab:hover { color: var(--foreground); }
.tab-active {
  color: var(--foreground);
  background: var(--card-elevated);
  box-shadow: var(--shadow-sm);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: var(--foreground);
  transition: transform .12s ease;
  animation: fadeSlide .3s ease backwards;
}

.card:hover { transform: translateY(-2px); }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.card:hover .card-thumb {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple-soft), var(--shadow-md);
}
.card.active .card-thumb { border-color: var(--purple); }

.card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease, opacity .3s ease;
}

.card:hover .card-thumb img { transform: scale(1.04); }

.card-initial { font-size: 28px; font-weight: 700; color: #3f3f46; }

.card-badges {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px;
}

.card-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--live);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.card-viewers-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--foreground);
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.card-viewers-tag .live-dot { width: 7px; height: 7px; background: var(--live); animation: none; }

.card-offline-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--foreground);
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.card-body {
  display: flex;
  gap: 10px;
  padding: 10px 2px 0;
  align-items: flex-start;
}

.card-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.card-main { min-width: 0; }

.card-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-cat {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* skeleton shimmer */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--card-elevated);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05) 50%, transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Footer / toast ──────────────────────────────────────────────── */

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: var(--sidebar-w);
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--subtle-foreground);
}

body.sidebar-collapsed .foot { margin-left: 0; }

.foot-sep { color: var(--border); }

.admin-link { color: var(--muted-foreground); }
.admin-link:hover { color: var(--foreground); }

.grid-empty { grid-column: 1 / -1; font-size: 13px; color: var(--muted-foreground); padding: 16px 0; }

/* shadcn toast: bottom-right, slide in */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.21, 1.02, .73, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* channel-switch fade */
.player-frame.switching iframe { animation: playerFade .45s ease; }

@keyframes playerFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Immersive theater: player fills the viewport, chat overlays ─── */

body.theater .topnav { transform: translateY(-100%); transition: transform .2s ease; }

body.theater .shell { padding-top: 0; }

body.theater .stage-row {
  padding: 0;
  gap: 0;
  height: 100vh;
}

body.theater .player-frame {
  border: none;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
  height: 100vh;
}

body.theater .player-frame iframe { height: 100vh; }

body.theater .chan-info {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 150;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlide .25s ease;
}

body.theater .discover,
body.theater .foot { display: none; }

body.theater .chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 160;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-right: none;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.theater .sidebar { display: none; }
body.theater .content { margin-left: 0; }

/* ── Theater mode ────────────────────────────────────────────────── */

body.theater .sidebar,
body.theater .chat-panel { display: none; }
body.theater .content,
body.theater .foot { margin-left: 0; }
body.theater .stage-row { padding: 16px 16px 0; }

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .chat-panel { display: none; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .content, .foot { margin-left: 0; }
}

@media (max-width: 640px) {
  .topnav { gap: 6px; padding: 0 8px; }
  .brand-name { display: none; }
  .search { max-width: none; }
  .stage-row { padding: 10px; gap: 10px; }
  .discover { padding: 4px 10px 28px; }
  .chan-info { flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; }
}
