/* Shared primitives used across /host, /tv and /remote. */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* faint radial glow so the black canvas has depth, like the reference */
  background:
    radial-gradient(1200px 700px at 18% -10%, rgba(124, 58, 237, 0.14), transparent 60%),
    radial-gradient(1000px 650px at 100% 0%, rgba(34, 211, 238, 0.08), transparent 55%),
    var(--bg);
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
img { display: block; max-width: 100%; }

/* --- Brand mark ---------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 14px; user-select: none; }
.brand .mic { width: 46px; height: 46px; filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.55)); }
.brand .word { line-height: 0.92; font-weight: 800; letter-spacing: 0.01em; }
.brand .word .l1 { color: var(--ink); font-size: 22px; display: block; }
.brand .word .l2 {
  font-size: 22px; display: block;
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --- Panels & labels ----------------------------------------------------- */
.panel {
  background:
    linear-gradient(180deg, rgba(168, 85, 247, 0.05), rgba(13, 14, 26, 0) 40%),
    var(--panel);
  border: 1px solid rgba(124, 58, 237, 0.55);
  border-radius: var(--r-panel);
  box-shadow: var(--glow-violet-soft);
}

.section-label {
  font-size: var(--label-size);
  font-weight: 700;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--cyan);
}
.section-label.violet { color: var(--violet); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--touch);
  padding: 0 16px;
  border-radius: var(--r-row);
  border: 1px solid rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.08);
  color: var(--ink);
  font-size: 14px; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: rgba(168, 85, 247, 0.18); }
.btn:active { transform: translateY(1px); }

/* Add button, as in the reference: violet outline pill with a + */
.btn-add {
  min-height: 40px; padding: 0 14px;
  border-radius: var(--r-row);
  border: 1px solid var(--violet);
  background: rgba(168, 85, 247, 0.12);
  color: #E9D5FF;
  font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.btn-add:hover { background: rgba(168, 85, 247, 0.24); box-shadow: 0 0 16px -4px rgba(168, 85, 247, 0.6); }
.btn-add .plus { font-size: 17px; line-height: 1; margin-right: 2px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch);
  border-radius: var(--r-row);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-size: 18px;
}
.icon-btn:hover { border-color: rgba(168, 85, 247, 0.6); background: rgba(168, 85, 247, 0.1); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* --- Search result rows -------------------------------------------------- */
.result {
  display: flex; align-items: center; gap: 12px;
  padding: 8px;
  border-radius: var(--r-row);
  border: 1px solid transparent;
}
.result:hover { background: var(--row-hover); border-color: rgba(124, 58, 237, 0.35); }
.result .thumb {
  width: 76px; height: 43px; flex: 0 0 auto;   /* 16:9 — show the full YouTube thumbnail */
  border-radius: 6px; object-fit: cover; background: #1a1c30;
  border: 1px solid rgba(255,255,255,0.06);
}
.result .meta { min-width: 0; flex: 1 1 auto; }
.result .meta .title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.result .meta .sub {
  font-size: 13px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Search field -------------------------------------------------------- */
.search {
  display: flex; align-items: center; gap: 10px;
  height: var(--touch);
  padding: 0 14px;
  border-radius: var(--r-row);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.search:focus-within { border-color: rgba(168, 85, 247, 0.7); box-shadow: var(--glow-violet-soft); }
.search svg { flex: 0 0 auto; opacity: 0.7; }
.search input {
  flex: 1 1 auto; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 15px;
}
.search input::placeholder { color: var(--ink-faint); }

/* --- Source tabs --------------------------------------------------------- */
.tabs { display: flex; gap: 10px; }
.tab {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--touch);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--ink-dim);
  font-size: 14px; font-weight: 600;
}
.tab[aria-selected="true"] {
  color: var(--ink);
  border-color: rgba(124, 58, 237, 0.8);
  background: rgba(124, 58, 237, 0.16);
  box-shadow: var(--glow-violet-soft);
}
.tab .yt { color: #FF0033; }

/* --- QR join card -------------------------------------------------------- */
.qr-card { display: flex; align-items: center; gap: 16px; }
.qr-card .join-text .lead { color: var(--ink); font-weight: 600; font-size: 15px; }
.qr-card .join-text .cyan { color: var(--cyan); font-size: 14px; }
.qr-card .join-text .url { color: var(--ink); font-size: 15px; font-weight: 600; word-break: break-all; }
.qr-card img.qr { width: 96px; height: 96px; border-radius: 8px; background: #fff; padding: 6px; }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: rgba(13, 14, 26, 0.96);
  border: 1px solid rgba(168, 85, 247, 0.7);
  box-shadow: var(--glow-violet);
  color: var(--ink);
  padding: 12px 20px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(34, 197, 94, 0.7); box-shadow: 0 0 22px -4px rgba(34,197,94,0.5); }
.toast.err { border-color: rgba(239, 68, 68, 0.7); box-shadow: 0 0 22px -4px rgba(239,68,68,0.5); }

/* --- Scrollbars ---------------------------------------------------------- */
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(124,58,237,0.5) transparent; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.45); border-radius: 8px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* Avatars: photo fills the shape (whatever radius the context sets), else a letter */
.avatar { overflow: hidden; }
.avatar.has-photo { padding: 0; background: #1a1c30; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* Circular photo cropper */
.cropper-backdrop { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(5,6,15,0.82); backdrop-filter: blur(4px); }
.cropper { width: min(340px, 94vw); background: var(--panel); border: 1px solid rgba(168,85,247,0.6); border-radius: 14px; box-shadow: var(--glow-violet); padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.cropper-title { font-size: 14px; font-weight: 600; color: var(--ink-dim); align-self: center; }
.cropper-stage { position: relative; width: 280px; height: 280px; max-width: 78vw; max-height: 78vw; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; cursor: grab; }
.cropper-stage:active { cursor: grabbing; }
.cropper-img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
.cropper-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(168,85,247,0.9); box-shadow: 0 0 0 9999px rgba(5,6,15,0.55); pointer-events: none; }
.cropper-zoom { width: 100%; accent-color: var(--violet); }
.cropper-actions { display: flex; gap: 10px; align-self: stretch; justify-content: flex-end; }

.muted { color: var(--ink-dim); }
.empty { color: var(--ink-faint); font-size: 14px; padding: 18px 6px; text-align: center; }
[hidden] { display: none !important; }
