/* ==========================================================================
   LUMA — design system
   Dark-first theme · mobile-first · CSS variables · no frameworks
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --accent: #6d5ef6;
  --accent-strong: #5a4bea;
  --accent-soft: rgba(109, 94, 246, 0.14);
  --accent-contrast: #ffffff;
  --good: #2ec4a6;
  --warn: #f5a524;
  --danger: #f4676b;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur: 0.24s;

  --sidebar-w: 244px;
  --topbar-h: 64px;
  --bottomnav-h: 66px;

  --shadow-1: 0 1px 2px rgba(6, 9, 20, 0.5);
  --shadow-2: 0 10px 30px -12px rgba(6, 9, 20, 0.55);
  --shadow-3: 0 24px 60px -24px rgba(6, 9, 20, 0.6);
}

/* Dark is the primary theme */
:root,
[data-theme="dark"] {
  --bg: #0a0c12;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, rgba(109, 94, 246, 0.16), transparent 60%);
  --surface: #11141d;
  --surface-2: #171b26;
  --surface-3: #1e2431;
  --text: #f2f4f9;
  --text-dim: #9aa4b6;
  --text-faint: #6b7486;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.05);
  --scrim: rgba(4, 6, 12, 0.72);
  --thumb-bg: #1b2130;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, rgba(109, 94, 246, 0.12), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e8ebf3;
  --text: #14161d;
  --text-dim: #59616f;
  --text-faint: #868d9b;
  --border: rgba(15, 20, 32, 0.09);
  --border-strong: rgba(15, 20, 32, 0.16);
  --hover: rgba(15, 20, 32, 0.045);
  --scrim: rgba(12, 15, 24, 0.45);
  --thumb-bg: #e6e9f1;
  --shadow-1: 0 1px 2px rgba(20, 25, 40, 0.06);
  --shadow-2: 0 12px 30px -14px rgba(20, 25, 40, 0.22);
  --shadow-3: 0 26px 60px -26px rgba(20, 25, 40, 0.28);
  color-scheme: light;
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.noscript {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: 24px; text-align: center; background: var(--bg); z-index: 999;
}

::selection { background: var(--accent); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. Icons, typography, controls ---------- */
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico--14 { width: 14px; height: 14px; }
.ico--16 { width: 16px; height: 16px; }
.ico--18 { width: 18px; height: 18px; }
.ico--28 { width: 28px; height: 28px; }
.ico--40 { width: 40px; height: 40px; stroke-width: 1.3; }
.ico--flip { transform: rotate(180deg); }

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}

kbd {
  font: 600 12px/1 var(--font); padding: 4px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-dim);
}

.text-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
}
.text-link:hover { text-decoration: underline; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  font-weight: 650; font-size: 14.5px; white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn .ico { width: 18px; height: 18px; }

.btn--primary {
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: 0 10px 24px -12px var(--accent);
}
.btn--primary:hover { background: var(--accent-strong); transform: translateY(-1px); }

.btn--soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn--soft:hover { background: var(--surface-3); }

.btn--ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn--ghost:hover { color: var(--text); border-color: var(--border-strong); }

.btn--lg { height: 52px; padding: 0 26px; font-size: 15.5px; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn--danger { background: rgba(244, 103, 107, 0.12); color: var(--danger); border: 1px solid rgba(244, 103, 107, 0.3); }
.btn--danger:hover { background: rgba(244, 103, 107, 0.2); }

.btn--block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  color: var(--text-dim);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--sm .ico { width: 16px; height: 16px; }

/* inputs */
.input {
  width: 100%; height: 50px; padding: 0 18px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-md); color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input--lg { height: 58px; font-size: 17px; border-radius: var(--r-lg); }

/* chips */
.chips { display: flex; gap: 9px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 15px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--dur) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .ico { width: 15px; height: 15px; }

/* avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, hsl(var(--av-h, 250) 70% 55%), hsl(calc(var(--av-h, 250) + 45) 70% 45%));
  overflow: hidden; flex: none; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; font-size: 12px; }
.avatar--lg { width: 72px; height: 72px; font-size: 26px; }
.avatar--xl { width: 96px; height: 96px; font-size: 34px; }
.avatar--btn { cursor: pointer; border: 2px solid transparent; transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.avatar--btn:hover { transform: scale(1.06); border-color: var(--accent); }

/* ---------- 4. Shell: sidebar / topbar / bottomnav / view ---------- */
.app { min-height: 100dvh; }

.sidebar {
  display: none;
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  padding: 22px 16px; z-index: 40;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  flex-direction: column; gap: 8px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; padding: 4px 8px; border-radius: var(--r-sm); }
.brand__mark { width: 34px; height: 34px; display: block; }
.brand__mark svg { width: 100%; height: 100%; display: block; }
.brand__mark rect { fill: var(--accent); }
.brand__mark path { fill: #fff; }
.brand__name { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.brand--lg { gap: 14px; }
.brand--lg .brand__mark { width: 52px; height: 52px; }
.brand--lg .brand__name { font-size: 34px; }
.brand--sm { padding: 0; }
.brand--sm .brand__mark { width: 30px; height: 30px; }
.brand--sm .brand__name { font-size: 18px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 22px; flex: 1; overflow-y: auto; }
.side-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); padding: 16px 12px 7px;
}
.side-nav a {
  display: flex; align-items: center; gap: 13px;
  height: 46px; padding: 0 13px; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 600; color: var(--text-dim);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.side-nav a:hover { background: var(--hover); color: var(--text); transform: translateX(2px); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-nav a .ico { width: 20px; height: 20px; }
.side-tag {
  margin-left: auto; font-style: normal; font-size: 10px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
}

.side-foot { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.side-note { font-size: 11.5px; color: var(--text-faint); padding: 0 6px; }

.theme-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim);
  transition: border-color var(--dur) var(--ease);
}
.theme-row:hover { border-color: var(--border-strong); }
.theme-row .ico { width: 17px; height: 17px; }
.theme-row__track {
  flex: 1; height: 22px; border-radius: var(--r-pill);
  background: var(--surface-3); position: relative; transition: background var(--dur) var(--ease);
}
.theme-row__knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); transition: transform var(--dur) var(--ease-pop);
}
[data-theme="dark"] .theme-row__knob { transform: translateX(0); }
[data-theme="light"] .theme-row__knob { transform: translateX(calc(100% * 3 + 22px - 16px + 6px)); }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 35;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar__search { display: none; position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.topbar__search-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); pointer-events: none; }
.topbar__search-input {
  width: 100%; height: 44px; padding: 0 16px 0 44px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--r-pill);
  font-size: 14.5px; transition: all var(--dur) var(--ease);
}
.topbar__search-input::placeholder { color: var(--text-faint); }
.topbar__search-input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.topbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar .brand--sm { margin-right: auto; }

.theme-ico-sun { display: none; }
[data-theme="light"] .theme-ico-sun { display: block; }
[data-theme="light"] .theme-ico-moon { display: none; }

/* view */
.view { min-height: calc(100dvh - var(--topbar-h)); padding: 18px 14px calc(var(--bottomnav-h) + 26px); }
.view--scroll { overflow-y: auto; }
.view--flush { padding: 0; overflow: hidden; height: calc(100dvh - var(--topbar-h)); min-height: 0; }
.view:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-title { font-size: clamp(22px, 3.6vw, 30px); font-weight: 800; letter-spacing: -0.03em; }
.page-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 3px; }

/* bottom nav */
.bottomnav {
  position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom));
  height: var(--bottomnav-h); z-index: 45;
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-faint); font-size: 10.5px; font-weight: 650;
  transition: color var(--dur) var(--ease);
  position: relative;
}
.bn-ico {
  display: grid; place-items: center; width: 44px; height: 30px; border-radius: var(--r-pill);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease-pop);
}
.bn-item .ico { width: 21px; height: 21px; }
.bn-item:hover { color: var(--text-dim); }
.bn-item[aria-current="page"] { color: var(--accent); }
.bn-item[aria-current="page"] .bn-ico { background: var(--accent-soft); transform: translateY(-1px); }
.bn-item:active .bn-ico { transform: scale(0.9); }

/* ---------- 5. Onboarding ---------- */
.onboarding {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 24px;
  background: var(--bg); overflow: hidden;
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.onboarding.is-visible { opacity: 1; }
.onboarding.is-leaving { opacity: 0; transform: scale(1.04); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }

.onboarding__orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; pointer-events: none; }
.onboarding__orb--a { width: 460px; height: 460px; background: var(--accent); top: -140px; left: -120px; animation: drift 16s ease-in-out infinite alternate; }
.onboarding__orb--b { width: 380px; height: 380px; background: #22d3ee; bottom: -130px; right: -110px; opacity: 0.3; animation: drift 19s ease-in-out infinite alternate-reverse; }

.onboard-card {
  position: relative; width: min(520px, 100%); text-align: left;
  padding: clamp(28px, 5vw, 46px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  animation: rise 0.7s var(--ease) both;
}
.onboard-title { font-size: clamp(30px, 7vw, 44px); line-height: 1.08; font-weight: 800; letter-spacing: -0.035em; margin: 16px 0 10px; }
.onboard-sub { color: var(--text-dim); font-size: 15px; margin-bottom: 26px; }
.onboard-form { display: flex; flex-direction: column; gap: 12px; }
.onboard-hint { margin-top: 16px; font-size: 13px; color: var(--text-faint); }

/* ---------- 6. Setup screen ---------- */
.setup {
  position: fixed; inset: 0; z-index: 85;
  overflow-y: auto; padding: 28px 16px;
  display: grid; place-items: center;
  background: var(--bg);
}
.setup__card {
  width: min(620px, 100%); padding: clamp(26px, 4.5vw, 42px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  animation: rise 0.6s var(--ease) both;
}
.setup__badge {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center; margin-bottom: 18px;
  background: var(--accent-soft); color: var(--accent);
}
.setup__title { font-size: clamp(24px, 4.6vw, 32px); font-weight: 800; letter-spacing: -0.03em; margin: 10px 0 10px; line-height: 1.15; }
.setup__sub { color: var(--text-dim); font-size: 14.5px; margin-bottom: 24px; }

.steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.steps li { display: flex; gap: 13px; align-items: flex-start; }
.steps__n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800;
}
.steps strong { display: block; font-size: 14.5px; font-weight: 700; }
.steps span { font-size: 13px; color: var(--text-dim); }
.steps code { font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); }

.code-block {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 14px 18px; margin-bottom: 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.code-block code { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--good); word-break: break-all; }

.setup__form { display: flex; flex-direction: column; gap: 10px; }
.setup__foot { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0 20px; }
.setup__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.setup__note { margin-top: 16px; font-size: 12.5px; color: var(--text-faint); }

/* ---------- 7. States, skeletons, toasts ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: clamp(40px, 9vw, 80px) 20px;
  animation: rise 0.5s var(--ease) both;
}
.state__icon {
  width: 84px; height: 84px; border-radius: 28px;
  display: grid; place-items: center; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint);
}
.state__icon .ico { width: 38px; height: 38px; stroke-width: 1.4; }
.state__icon--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.state__icon--danger { background: rgba(244, 103, 107, 0.12); border-color: rgba(244, 103, 107, 0.25); color: var(--danger); }
.state__title { font-size: clamp(19px, 3.4vw, 23px); font-weight: 750; letter-spacing: -0.02em; }
.state__text { max-width: 460px; color: var(--text-dim); font-size: 14.5px; }
.state__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.state__code {
  margin-top: 4px; font-size: 12.5px; color: var(--text-faint);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--r-pill); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* skeletons */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--hover), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
.skel-card { display: flex; flex-direction: column; gap: 10px; }
.skel-thumb { aspect-ratio: 16 / 9; width: 100%; border-radius: var(--r-md); }
.skel-line { height: 12px; width: 100%; border-radius: 6px; }
.skel-line--short { width: 55%; }
.skel-line--mid { width: 78%; }
.skel-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.skel-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.skel-row .skel-thumb { width: 168px; aspect-ratio: 16/9; flex: none; border-radius: var(--r-sm); }
.skel-row .skel-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.loading-center { display: grid; place-items: center; gap: 14px; padding: 70px 20px; color: var(--text-dim); font-size: 14px; }

/* toasts */
.toasts {
  position: fixed; left: 50%; bottom: calc(var(--bottomnav-h) + 26px);
  transform: translateX(-50%); z-index: 95;
  display: flex; flex-direction: column; gap: 9px; align-items: center;
  width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 13px 17px;
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  box-shadow: var(--shadow-3); font-size: 14px; font-weight: 600;
  animation: toast-in 0.4s var(--ease-pop) both;
}
.toast.is-leaving { animation: toast-out 0.3s var(--ease) both; }
.toast .ico { width: 18px; height: 18px; color: var(--accent); }
.toast--ok .ico { color: var(--good); }
.toast--err .ico { color: var(--danger); }

/* ---------- 8. Video cards & feed ---------- */
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.section-title { font-size: 17.5px; font-weight: 750; letter-spacing: -0.02em; }

.feed-grid {
  display: grid; gap: 20px 16px;
  grid-template-columns: 1fr;
}

.card {
  position: relative; display: flex; flex-direction: column; gap: 11px;
  cursor: pointer; border-radius: var(--r-lg);
  transition: transform var(--dur) var(--ease);
}
.card:hover { transform: translateY(-3px); }
.card:active { transform: translateY(-1px) scale(0.995); }

.card__thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--thumb-bg); border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.card__thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
}
.card:hover .card__thumb img { transform: scale(1.05); }

.card__dur {
  position: absolute; right: 8px; bottom: 8px;
  padding: 3px 7px; border-radius: 7px;
  background: rgba(6, 8, 14, 0.82); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.card__live {
  position: absolute; left: 8px; top: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 7px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.card__live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }

.card__hover-acts {
  position: absolute; inset: auto 8px 8px auto; display: flex; gap: 6px;
  opacity: 0; transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover .card__hover-acts,
.card:focus-within .card__hover-acts { opacity: 1; transform: translateY(0); }
.card__hover-acts .icon-btn {
  width: 34px; height: 34px; background: rgba(6, 8, 14, 0.78); color: #fff;
  backdrop-filter: blur(6px);
}
.card__hover-acts .icon-btn:hover { background: var(--accent); }
.card__hover-acts .icon-btn.is-on { background: var(--accent); }
@media (hover: none) { .card__hover-acts { display: none; } }

.card__body { display: flex; gap: 11px; align-items: flex-start; padding: 0 3px; }
.card__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card__title {
  font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__channel { font-size: 13.5px; color: var(--text-dim); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__stats { font-size: 13px; color: var(--text-faint); }
.card__stats span + span::before { content: " · "; }

.thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--surface-2), var(--surface-3));
  color: var(--text-faint);
}
.thumb-fallback .ico { width: 34px; height: 34px; opacity: 0.7; }

/* hero card (first item) */
.card--hero { grid-column: 1 / -1; }
.card--hero .card__thumb { border-radius: var(--r-lg); }
.card--hero .card__title { font-size: clamp(17px, 2.4vw, 21px); -webkit-line-clamp: 2; }
.card--hero .card__channel { font-size: 14px; }
.card--hero .card__channel::after { content: " · Featured"; color: var(--accent); font-weight: 700; }

/* Desktop: the featured card becomes a horizontal spotlight, never a wall-sized image */
@media (min-width: 900px) {
  .card--hero {
    flex-direction: row; align-items: center; gap: 24px;
    background: var(--surface); border: 1px solid var(--border);
    padding: 16px; border-radius: var(--r-xl);
  }
  .card--hero:hover { border-color: var(--border-strong); }
  .card--hero .card__thumb { flex: 0 1 56%; max-width: 660px; border-radius: var(--r-md); }
  .card--hero .card__body {
    flex: 1 1 44%; flex-direction: column; align-items: flex-start;
    gap: 13px; padding: 8px 14px;
  }
  .card--hero .card__title { font-size: clamp(20px, 1.9vw, 27px); -webkit-line-clamp: 3; }
  .card--hero .card__channel { font-size: 15px; }
  .card--hero .card__stats { font-size: 14.5px; }
  .card--hero .avatar { width: 46px; height: 46px; font-size: 17px; }
}

/* horizontal strip */
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 76vw);
  gap: 14px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip > * { scroll-snap-align: start; }

/* ---------- 9. Search ---------- */
.search-wrap { position: relative; max-width: 760px; }
.search-bar {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-pill); padding: 0 8px 0 20px; height: 56px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-bar > .ico { color: var(--text-faint); flex: none; }
.search-bar input {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 16px;
}
.search-bar input::placeholder { color: var(--text-faint); }
.search-bar .btn { height: 40px; padding: 0 18px; }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-3);
  padding: 7px; overflow: hidden;
  animation: rise 0.22s var(--ease) both;
}
.suggest__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 13px; border-radius: var(--r-sm);
  font-size: 14.5px; text-align: left; color: var(--text-dim);
}
.suggest__item:hover, .suggest__item.is-active { background: var(--hover); color: var(--text); }
.suggest__item .ico { width: 17px; height: 17px; color: var(--text-faint); flex: none; }
.suggest__item b { color: var(--text); font-weight: 700; }
.suggest__tag { margin-left: auto; font-size: 11px; color: var(--text-faint); }

.recent-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 4px; }
.results-count { font-size: 13.5px; color: var(--text-faint); }

/* list-style search results */
.result-list { display: flex; flex-direction: column; }
.result {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--dur) var(--ease);
  border-radius: var(--r-sm);
}
.result:last-child { border-bottom: 0; }
.result:hover .result__thumb img { transform: scale(1.04); }
.result__thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--r-md);
  overflow: hidden; background: var(--thumb-bg); border: 1px solid var(--border); flex: none;
}
.result__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.result__title { font-size: 16.5px; font-weight: 700; line-height: 1.35; letter-spacing: -0.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result__channel { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); margin-top: 7px; }
.result__stats { font-size: 13px; color: var(--text-faint); margin-top: 3px; }
.result__desc { display: none; font-size: 13.5px; color: var(--text-faint); margin-top: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 10. Watch page ---------- */
.watch { display: flex; flex-direction: column; gap: 24px; max-width: 1500px; margin: 0 auto; }
.watch__main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.player-frame {
  position: relative; aspect-ratio: 16/9; width: 100%;
  background: #000; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-2);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* file:// helper shown instead of the player (YouTube Error 153) */
.player-frame--local { aspect-ratio: auto; min-height: 340px; background: var(--surface); display: flex; }
.local-fix {
  margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: clamp(22px, 4vw, 40px); max-width: 580px;
}
.local-fix__ico {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(245, 165, 36, 0.14); color: var(--warn);
}
.local-fix h3 { font-size: clamp(17px, 2.4vw, 21px); font-weight: 750; letter-spacing: -0.02em; }
.local-fix p { font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.local-fix p strong { color: var(--text); }
.local-fix code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px;
}
.local-fix__cmds { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 2px; }
.cmd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 10px 9px 14px; text-align: left;
}
.cmd-row code { background: none; border: 0; padding: 0; font-size: 13px; color: var(--text); white-space: nowrap; overflow-x: auto; }
.cmd-row__copy {
  flex: none; display: inline-flex; align-items: center; gap: 6px; font: inherit;
  font-size: 12.5px; font-weight: 650; color: var(--text);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
}
.cmd-row__copy:hover { background: var(--accent-soft); border-color: var(--accent); }
.local-fix__after { font-size: 13.5px; }
.local-fix__after a { color: var(--accent); font-weight: 650; }
.local-fix .btn { margin-top: 6px; }

/* persistent file:// tip banner */
.file-banner {
  position: fixed; right: 16px; bottom: 16px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  max-width: min(470px, calc(100vw - 32px));
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 11px 10px 11px 14px;
  box-shadow: var(--shadow-3); animation: banner-in 0.4s var(--ease-pop);
}
.file-banner__ico { flex: none; display: grid; place-items: center; color: var(--warn); }
.file-banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-banner__body strong { font-size: 13.5px; }
.file-banner__body span { font-size: 12.5px; color: var(--text-dim); }
.file-banner__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 5px;
}
.file-banner .icon-btn { flex: none; width: 34px; height: 34px; }
@keyframes banner-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 600px) {
  .file-banner { left: 10px; right: 10px; bottom: calc(var(--bottomnav-h) + 10px); max-width: none; justify-content: space-between; }
  .local-fix { gap: 8px; }
  .cmd-row code { font-size: 12px; }
}
.player-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
  background: #000; color: #fff;
}

.watch__title { font-size: clamp(19px, 3vw, 24px); font-weight: 750; letter-spacing: -0.025em; line-height: 1.3; }

.channel-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 4px 0;
}
.channel-row__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.channel-row__name { font-size: 15.5px; font-weight: 700; }
.channel-row__subs { font-size: 13px; color: var(--text-faint); }
.channel-row__actions { display: flex; gap: 9px; margin-left: auto; flex-wrap: wrap; }

.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 17px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 14px; font-weight: 650; color: var(--text);
  transition: all var(--dur) var(--ease);
}
.pill-btn:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); }
.pill-btn:active { transform: scale(0.96); }
.pill-btn .ico { width: 18px; height: 18px; }
.pill-btn.is-on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.pill-btn.is-on .ico { fill: currentColor; }
.pill-btn__count { font-variant-numeric: tabular-nums; }

.actions__group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.actions__group .pill-btn { height: 36px; background: transparent; border: 0; padding: 0 15px; }
.actions__group .pill-btn:hover { background: var(--hover); }
.actions__group .pill-btn.is-on { background: var(--accent); color: #fff; }

.desc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px;
  font-size: 14.5px; color: var(--text-dim); cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.desc:hover { border-color: var(--border-strong); }
.desc__head { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; font-size: 14px; }
.desc__body { white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.desc.is-open .desc__body { -webkit-line-clamp: unset; display: block; }
.desc__more { display: inline-block; margin-top: 8px; font-weight: 700; color: var(--text); font-size: 13.5px; }

.comments { display: flex; flex-direction: column; gap: 4px; }
.comments__head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.comments__count { font-size: 16px; font-weight: 750; }
.comment { display: flex; gap: 12px; padding: 12px 0; }
.comment__body { min-width: 0; }
.comment__meta { font-size: 13px; color: var(--text-faint); display: flex; gap: 8px; flex-wrap: wrap; }
.comment__meta strong { color: var(--text); font-weight: 700; font-size: 13.5px; }
.comment__text { font-size: 14.5px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.comment__likes { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-faint); margin-top: 7px; }
.comment__likes .ico { width: 14px; height: 14px; }

.related { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.related-item { display: flex; gap: 11px; cursor: pointer; border-radius: var(--r-sm); padding: 4px; margin: -4px;
  transition: background var(--dur) var(--ease); }
.related-item:hover { background: var(--hover); }
.related-item__thumb { position: relative; width: 168px; flex: none; aspect-ratio: 16/9; border-radius: var(--r-sm);
  overflow: hidden; background: var(--thumb-bg); border: 1px solid var(--border); }
.related-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-item__title { font-size: 14px; font-weight: 650; line-height: 1.35; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-item__meta { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }
.related__mobile-title { display: block; }

/* ---------- 11. Shorts ---------- */
.shorts {
  position: relative; height: 100%;
  display: flex; justify-content: center;
  background: #05060a;
}
.shorts__feed {
  height: 100%; width: 100%; max-width: 480px;
  overflow-y: auto; scroll-snap-type: y mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.shorts__feed::-webkit-scrollbar { display: none; }

.short {
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  background: #05060a; overflow: hidden;
}
.short__media { position: absolute; inset: 0; background: #000 center / cover no-repeat; }
.short__media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.short__media .thumb-fallback { background: #0b0d14; }

.short__shade {
  position: absolute; inset: auto 0 0; height: 46%;
  background: linear-gradient(to top, rgba(3, 4, 8, 0.92), rgba(3, 4, 8, 0.55) 42%, transparent);
  pointer-events: none;
}
.short__top {
  position: absolute; top: 0; left: 0; right: 0; padding: 16px 16px 26px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(3, 4, 8, 0.7), transparent);
  z-index: 3;
}
.short__top h2 { color: #fff; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.short__top .ico { color: var(--accent); }
.short__nav { display: flex; gap: 6px; }
.short__nav .icon-btn { color: #fff; background: rgba(255,255,255,0.12); width: 40px; height: 40px; }
.short__nav .icon-btn .ico { width: 20px; height: 20px; }
.short__nav .icon-btn:hover { background: rgba(255,255,255,0.22); }

.short__info {
  position: absolute; left: 0; right: 64px; bottom: 0; z-index: 3;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 11px; color: #fff;
}
.short__channel { display: flex; align-items: center; gap: 10px; }
.short__channel-name { font-size: 14.5px; font-weight: 750; }
.short__follow {
  height: 30px; padding: 0 13px; border-radius: var(--r-pill);
  background: #fff; color: #10121a; font-size: 12.5px; font-weight: 750;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.short__follow:hover { transform: scale(1.05); }
.short__follow.is-on { background: rgba(255,255,255,0.2); color: #fff; }
.short__title { font-size: 14.5px; font-weight: 600; line-height: 1.4; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.short__stats { font-size: 12.5px; color: rgba(255,255,255,0.68); }

.short__rail {
  position: absolute; right: 8px; bottom: 16px; z-index: 3;
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: #fff; font-size: 11.5px; font-weight: 700;
}
.rail-btn__ico {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(8px);
  transition: transform var(--dur) var(--ease-pop), background var(--dur) var(--ease);
}
.rail-btn:hover .rail-btn__ico { background: rgba(255, 255, 255, 0.26); transform: scale(1.08); }
.rail-btn:active .rail-btn__ico { transform: scale(0.9); }
.rail-btn.is-on .rail-btn__ico { background: var(--accent); }
.rail-btn.is-on .ico { fill: currentColor; }
.rail-btn .ico { width: 21px; height: 21px; }
.rail-btn span:last-child { text-shadow: 0 1px 6px rgba(0,0,0,0.6); font-variant-numeric: tabular-nums; }

.short__tap {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  background: transparent;
}
.short__tap-ico {
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(6, 8, 14, 0.55); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transform: scale(0.8); transition: opacity 0.25s var(--ease), transform 0.25s var(--ease-pop);
  pointer-events: none;
}
.short.is-paused .short__tap-ico { opacity: 1; transform: scale(1); }
.short__progress { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; border-radius: 3px;
  background: rgba(255,255,255,0.22); z-index: 4; overflow: hidden; display: none; }

.shorts__hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 650;
  background: rgba(6,8,14,0.6); padding: 9px 16px; border-radius: var(--r-pill);
  pointer-events: none; z-index: 5; animation: fade-out 2.6s var(--ease) forwards;
}

/* ---------- 12. Library ---------- */
.tabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px; border-radius: var(--r-pill); width: fit-content; margin-bottom: 20px; }
.tab {
  height: 38px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 650; color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--dur) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.tab__count { font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; gap: 13px; align-items: center; padding: 13px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: opacity var(--dur) var(--ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover .list-row__thumb img { transform: scale(1.05); }
.list-row__thumb { position: relative; width: 138px; flex: none; aspect-ratio: 16/9; border-radius: var(--r-sm);
  overflow: hidden; background: var(--thumb-bg); border: 1px solid var(--border); }
.list-row__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.list-row__body { min-width: 0; flex: 1; }
.list-row__title { font-size: 14.5px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-row__meta { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.list-row__acts { display: flex; gap: 4px; flex: none; }

.group-label { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-faint); margin: 22px 0 4px; }

/* ---------- 13. Profile ---------- */
.profile { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
.profile__head {
  display: flex; flex-direction: column; gap: 18px; align-items: flex-start;
  padding: clamp(22px, 4vw, 34px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  position: relative; overflow: hidden;
}
.profile__head::after {
  content: ""; position: absolute; top: -80px; right: -60px; width: 260px; height: 260px;
  background: var(--accent); opacity: 0.1; border-radius: 50%; filter: blur(50px); pointer-events: none;
}
.profile__ident { display: flex; gap: 18px; align-items: center; min-width: 0; }
.profile__name { font-size: clamp(24px, 4.6vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.profile__badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
  font-size: 12px; font-weight: 700; color: var(--good);
  background: rgba(46, 196, 166, 0.12); padding: 4px 11px; border-radius: var(--r-pill); }
.profile__edit { display: flex; gap: 9px; width: 100%; max-width: 420px; }
.profile__actions { display: flex; gap: 9px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  padding: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 3px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat__ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.stat__ico .ico { width: 18px; height: 18px; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 12.5px; color: var(--text-faint); font-weight: 600; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 4px; gap: 3px; }
.seg__btn { height: 36px; padding: 0 16px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 650;
  color: var(--text-dim); display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--dur) var(--ease); }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg__btn .ico { width: 15px; height: 15px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: clamp(18px, 3vw, 26px); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel__title { font-size: 16.5px; font-weight: 750; letter-spacing: -0.02em; }

/* ---------- 14. Comments sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(3px);
  animation: fade-in 0.3s var(--ease) both; }
.sheet__panel {
  position: relative; width: min(560px, 100%); max-height: 82dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 26px 26px 0 0; box-shadow: var(--shadow-3);
  animation: sheet-up 0.38s var(--ease) both;
}
.sheet__grab { width: 42px; height: 4.5px; border-radius: 4px; background: var(--border-strong);
  margin: 10px auto 2px; flex: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 12px 22px; border-bottom: 1px solid var(--border); flex: none; }
.sheet__head h2 { font-size: 17px; font-weight: 750; }
.sheet__body { overflow-y: auto; padding: 8px 22px 26px; overscroll-behavior: contain; }

/* ---------- 15. Utilities ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.gap-8 { gap: 8px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.empty-note { font-size: 14px; color: var(--text-faint); padding: 14px 0; }

/* ---------- 16. Keyframes ---------- */
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { 0%, 60% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.12); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes pop { 0% { transform: scale(0.82); } 60% { transform: scale(1.14); } 100% { transform: scale(1); } }
.is-pop { animation: pop 0.4s var(--ease-pop); }

/* ---------- 17. Responsive ---------- */
@media (min-width: 600px) {
  .feed-grid { grid-template-columns: repeat(2, 1fr); }
  .result { flex-direction: row; align-items: flex-start; }
  .result__thumb { width: 240px; }
  .result__desc { display: -webkit-box; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .onboard-form { flex-direction: row; align-items: stretch; }
  .onboard-form .input { flex: 1; }
  .setup__form { flex-direction: row; }
  .setup__form .input { flex: 1; }
  .strip { grid-auto-columns: minmax(260px, 32vw); }
}

@media (min-width: 900px) {
  .feed-grid { grid-template-columns: repeat(3, 1fr); }
  .related__mobile-title { display: block; }
  .watch { flex-direction: row; align-items: flex-start; gap: 30px; }
  .watch__main { flex: 1 1 auto; }
  .related { width: 380px; flex: none; position: sticky; top: calc(var(--topbar-h) + 18px); }
  .related-item__thumb { width: 158px; }
}

@media (min-width: 1080px) {
  .sidebar { display: flex; }
  .topbar { margin-left: var(--sidebar-w); padding: 0 26px; }
  .view { margin-left: var(--sidebar-w); padding: 26px 30px 60px; }
  .view--flush { padding: 0; height: calc(100dvh - var(--topbar-h)); }
  .bottomnav { display: none; }
  .topbar__search { display: block; }
  .topbar__search-btn { display: none; }
  .topbar .brand--sm { display: none; }
  .toasts { bottom: 30px; }
  .feed-grid { grid-template-columns: repeat(3, 1fr); gap: 26px 20px; }
  .card__title { font-size: 15.5px; }
  .strip { grid-auto-columns: minmax(280px, 23vw); }
  .shorts__feed { max-width: 440px; border-radius: var(--r-xl); box-shadow: var(--shadow-3); }
  .short { border-radius: var(--r-xl); }
  .sheet { align-items: center; }
  .sheet__panel { border-radius: 26px; max-height: 78dvh; animation: rise 0.32s var(--ease) both; }
  .sheet__grab { display: none; }
}

@media (min-width: 1440px) {
  .feed-grid { grid-template-columns: repeat(4, 1fr); }
  .related { width: 420px; }
}

@media (max-width: 420px) {
  .related-item__thumb, .list-row__thumb { width: 128px; }
  .search-bar { height: 52px; padding-left: 16px; }
  .search-bar .btn { padding: 0 14px; }
}

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