@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* Accent colors — overridden server-side by buildCssVars() in layout <head> */
    --accent: #e87722;
    --accent-rgb: 232, 119, 34;
    --accent-light: #f0a050;
    --accent-light-rgb: 240, 160, 80;
    --accent-dark: #cc6200;
    --accent-dark-rgb: 204, 98, 0;
    --accent-gold: #f0c040;
    --accent-gold-rgb: 240, 192, 64;
    /* Light mode surface palette */
    --bg: #ffffff;
    --card: #f5f5f5;
    --deep: #f5f5f5;
    --border: rgba(0, 0, 0, 0.08);
    --border-soft: rgba(0, 0, 0, 0.05);
    --text-primary: #1a1a2e;
    --text-secondary: #525252;
    --text-muted: rgba(0, 0, 0, 0.45);
    --btn-ghost: rgba(0, 0, 0, 0.04);
    --btn-ghost-hover: rgba(0, 0, 0, 0.08);
    --scrollbar-thumb: rgba(0, 0, 0, 0.1);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.2);
    --sheet-bg: #f5f5fa;
    --sheet-border: rgba(0, 0, 0, 0.1);
    --sheet-handle: rgba(0, 0, 0, 0.15);
    --auth-card-bg: #ffffff;
    --auth-card-shadow:
      0 8px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
  }

  /* Dark mode surface palette — applied when <html class="dark"> */
  .dark {
    --bg: #1a1a2e;
    --card: #16213e;
    --deep: #0f3460;
    --border: rgba(255, 255, 255, 0.08);
    --border-soft: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #a0a0a0;
    --btn-ghost: rgba(255, 255, 255, 0.04);
    --btn-ghost-hover: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
    --sheet-bg: #0e0e0e;
    --sheet-border: rgba(255, 255, 255, 0.07);
    --sheet-handle: rgba(255, 255, 255, 0.14);
    --auth-card-bg: rgba(22, 33, 62, 0.88);
    --auth-card-shadow:
      0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(var(--accent-rgb), 0.08);
  }

  html,
  body {
    background: var(--bg);
    color: var(--text-primary);
    font-family:
      var(--font-inter),
      Inter,
      system-ui,
      -apple-system,
      sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Prevent horizontal scroll on all pages */
    overflow-x: hidden;
    max-width: 100vw;
    /* Stop the browser/WebView's native pull-to-refresh and rubber-band
       bounce document-wide — without this, a fast vertical swipe (e.g. in
       the Shorts/Reels feed) can trigger it before a child element's own
       touch-action/overscroll-behavior rules take effect. */
    overscroll-behavior-y: none;
  }

  /* ── Global scrollbar — slim, dark, unobtrusive ──────────────────────────
     Replaces the default browser scrollbar on every element.
     Windows/Chrome users especially see the ugly default; this fixes it.  */
  * {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
  }
  *::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
  *::-webkit-scrollbar-track {
    background: transparent;
  }
  *::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 99px;
  }
  *::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
  }
  *::-webkit-scrollbar-corner {
    background: transparent;
  }

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

@layer utilities {
  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }

  /* Explicit thin scrollbar — slightly more visible than the global default,
     used on panels / lists that benefit from a visible scroll indicator.    */
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-hover) transparent;
  }
  .scrollbar-thin::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
  .scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
  }
  .scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-hover);
    border-radius: 99px;
  }
  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    filter: brightness(1.3);
  }

  .line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .aspect-16-9 {
    aspect-ratio: 16 / 9;
  }
}

/* ─── Banner carousel progress bar ──────────────────────────────────────── */

@keyframes banner-prog {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

/* ─── Music section detail page ─────────────────────────────────────────── */

@keyframes msd-head-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes msd-row-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Content detail page ────────────────────────────────────────────────── */

@keyframes cd-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cd-row-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Payment modal ──────────────────────────────────────────────────────── */

@keyframes pay-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pay-scale {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes pay-success {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── Wallet page ────────────────────────────────────────────────────────── */

@keyframes wallet-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wallet-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wallet-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* ─── Upload page ────────────────────────────────────────────────────────── */

@keyframes upload-page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes upload-row-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes upload-success {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── Notification page ──────────────────────────────────────────────────── */

@keyframes notif-head-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes notif-row-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Search page ────────────────────────────────────────────────────────── */

@keyframes srch-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes srch-card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes srch-eq {
  from {
    transform: scaleY(0.25);
  }
  to {
    transform: scaleY(1);
  }
}

/* ─── Subscription/Plans page ───────────────────────────────────────────── */

@keyframes plan-rise {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes plan-glow {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

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

@keyframes feature-check-in {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ─── Rent page ──────────────────────────────────────────────────────────── */

@keyframes rent-section-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gold-shimmer {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(var(--accent-gold-rgb), 0);
  }
  50% {
    box-shadow: 0 0 12px rgba(var(--accent-gold-rgb), 0.55);
  }
}

/* ─── Subscriptions page ─────────────────────────────────────────────────── */

@keyframes sub-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sub-card-out {
  from {
    opacity: 1;
    transform: scale(1);
    max-height: 280px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: scale(0.92);
    max-height: 0;
    margin-bottom: 0;
  }
}

/* ─── Feed page ──────────────────────────────────────────────────────────── */

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.45);
  }
  65% {
    transform: scale(0.88);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes feed-card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Hero Banner Carousel ───────────────────────────────────────────────── */

@keyframes hero-zoom-in {
  from {
    transform: scale(1) translate(0%, 0%);
  }
  to {
    transform: scale(1.07) translate(-1.5%, -0.8%);
  }
}

@keyframes hero-content-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Liked page ─────────────────────────────────────────────────────────── */

@keyframes liked-card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heart-beat-once {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.35);
  }
  55% {
    transform: scale(0.92);
  }
  75% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes heart-glow-pulse {
  0%,
  100% {
    box-shadow: 0 0 0px rgba(var(--accent-rgb), 0);
  }
  50% {
    box-shadow: 0 0 32px rgba(var(--accent-rgb), 0.35);
  }
}

/* ─── Music page ─────────────────────────────────────────────────────────── */

.music-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}
@media (max-width: 1180px) {
  .music-body {
    grid-template-columns: 220px minmax(0, 1fr) 280px;
  }
}
@media (max-width: 980px) {
  .music-body {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .music-right {
    display: none;
  }
}
@media (max-width: 720px) {
  .music-body {
    grid-template-columns: 1fr;
  }
  .music-left {
    display: none;
  }
}

/* Left panel */
.music-left {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px - 96px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  scrollbar-width: none;
}
.music-left h4 {
  margin: 0;
  padding: 0 18px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}
.music-left-section {
  display: flex;
  flex-direction: column;
}
.music-left-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 16px 18px 6px;
}
.music-left-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 12px;
}
.music-left-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  margin: 0 8px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition:
    background 160ms ease,
    color 160ms ease;
}
.music-left-item:hover {
  background: var(--card);
  color: var(--text-primary);
}
.music-left-item.active {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.music-left-icon {
  width: 16px;
  display: inline-flex;
  flex-shrink: 0;
}
.music-left-label {
  flex: 1;
  min-width: 0;
}
.music-left-count {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}
.music-left-arrow {
  transition: transform 200ms ease;
}
.music-left-item.expanded .music-left-arrow {
  transform: rotate(90deg);
}
.music-left-sub {
  display: flex;
  flex-direction: column;
  padding: 2px 0 6px 50px;
}
.music-left-sub button {
  text-align: left;
  font-size: 10px;
  color: var(--text-muted);
  padding: 5px 0;
  cursor: pointer;
  transition: color 140ms ease;
}
.music-left-sub button:hover {
  color: var(--text-primary);
}
.music-feat {
  margin: 20px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.music-feat-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
}
.music-feat-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.45));
}
.music-feat-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.music-feat-tracks {
  color: #999;
  font-size: 11px;
  margin-top: 2px;
}
.music-feat-btn {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  height: 34px;
  border-radius: 8px;
  width: 100%;
  transition: filter 160ms ease;
}
.music-feat-btn:hover {
  filter: brightness(1.08);
}

/* Center panel */
.music-center {
  padding: 32px 36px 40px;
  min-width: 0;
}
@media (max-width: 720px) {
  .music-center {
    padding: 24px 16px 32px;
  }
}

.music-now-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.music-now-art {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1a4e, #0f3460);
  box-shadow:
    0 0 60px rgba(var(--accent-rgb), 0.2),
    0 16px 40px rgba(0, 0, 0, 0.55);
}
.music-now-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.35));
}
.music-now-meta {
  margin-top: 20px;
  text-align: center;
}
.music-now-title {
  color: #fff;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.music-now-sub {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fff;
  flex-wrap: wrap;
  justify-content: center;
}
.music-now-tick {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.music-now-album {
  color: #999;
  font-size: 11px;
  font-style: italic;
}
.music-now-actions {
  margin-top: 10px;
  display: flex;
  gap: 20px;
  align-items: center;
}
.music-now-actions button {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms ease;
}
.music-now-actions button:hover {
  transform: scale(1.12);
}

/* Progress bar */
.music-pb-row {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 12px;
  align-items: center;
}
.music-pb-time {
  font-size: 11px;
  color: #999;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.music-pb-bar {
  position: relative;
  height: 4px;
  background: var(--deep);
  border-radius: 2px;
  cursor: pointer;
  transition: height 160ms ease;
}
.music-pb-bar:hover {
  height: 6px;
}
.music-pb-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  position: relative;
}
.music-pb-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  display: block;
}

/* Main controls */
.music-pc-main {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}
.music-pc-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition:
    transform 160ms ease,
    color 160ms ease;
}
.music-pc-btn.muted {
  color: #999;
}
.music-pc-btn:hover {
  transform: scale(1.1);
}
.music-pc-btn.is-active {
  color: var(--accent);
}
.music-pc-play {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.3);
  transition: transform 160ms ease;
}
.music-pc-play:hover {
  transform: scale(1.06);
}
.music-pc-play::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: music-pulse-ring 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes music-pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}
.music-pc-secondary {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.music-pc-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 180px;
}
.music-pc-vol-bar {
  flex: 1;
  height: 4px;
  background: var(--deep);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  max-width: 120px;
}
.music-pc-vol-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.music-pc-right {
  display: flex;
  gap: 12px;
}
.music-pc-icon {
  cursor: pointer;
  color: #999;
  transition: color 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.music-pc-icon:hover {
  color: var(--accent);
}
.music-pc-icon.is-on {
  color: var(--accent);
}

/* Queue */
.music-queue {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.music-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.music-queue-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
.music-queue-clear {
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
}
.music-queue-clear:hover {
  text-decoration: underline;
}
.music-queue-label {
  font-size: 10px;
  color: var(--accent);
  margin-top: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.music-queue-label.muted {
  color: #999;
  margin-top: 16px;
}
.music-queue-row {
  display: grid;
  grid-template-columns: 16px 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  border-left: 3px solid transparent;
  transition: background 140ms ease;
}
.music-queue-row:hover {
  background: var(--card);
}
.music-queue-row.is-playing {
  background: var(--card);
  border-left-color: var(--accent);
  padding-left: 7px;
}
.music-queue-num {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.music-queue-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #0f3460;
  position: relative;
}
.music-queue-meta {
  min-width: 0;
}
.music-queue-name {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-queue-row.is-playing .music-queue-name {
  color: var(--accent);
}
.music-queue-artist {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.music-queue-dur {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Right panel */
.music-right {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px - 96px);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  /* Outer shell — inner .music-rp-body handles its own scroll */
  scrollbar-width: none;
}
.music-right::-webkit-scrollbar {
  display: none;
}
.music-rp-tabs {
  display: flex;
  gap: 24px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.music-rp-tab {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition:
    color 160ms ease,
    border-color 160ms ease;
}
.music-rp-tab.active {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  border-bottom-color: var(--accent);
}
.music-rp-tab:not(.active):hover {
  color: var(--text-secondary);
}
.music-rp-body {
  flex: 1;
  padding: 20px 18px;
  overflow-y: auto;
}

/* Lyrics */
.music-lyr {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.music-lyr-line {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.45;
  transition:
    color 300ms ease,
    font-size 300ms ease;
}
.music-lyr-line.past {
  color: #555;
}
.music-lyr-line.future {
  color: #888;
}
.music-lyr-line.current {
  color: var(--accent);
  font-size: 17px;
  font-weight: 500;
}
.music-lyr-foot {
  color: #555;
  font-size: 10px;
  text-align: center;
  margin-top: 24px;
}

/* Artist tab */
.music-art-banner {
  position: relative;
  height: 140px;
  background: #16213e;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  margin: -20px -18px 0;
}
.music-art-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}
.music-art-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(26, 26, 46, 0) 0%,
    rgba(26, 26, 46, 0.6) 100%
  );
}
.music-art-name {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
}
.music-art-listeners {
  color: #999;
  font-size: 11px;
  margin-top: 3px;
}
.music-art-bio {
  color: #ccc;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.music-art-more {
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
}
.music-art-popular {
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  margin: 16px 0 8px;
}
.music-art-btn {
  width: 100%;
  height: 34px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 14px;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease;
}
.music-art-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Related grid */
.music-rel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.music-rel-card {
  cursor: pointer;
}
.music-rel-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #16213e;
  border-radius: 4px;
  overflow: hidden;
}
.music-rel-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}
.music-rel-card:hover .music-rel-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.music-rel-name {
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-rel-artist {
  color: #999;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Reels page ─────────────────────────────────────────────────────────── */

.reels-stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
}
.reels-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
}

.reels-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}
@media (max-width: 999px) {
  .reels-stage {
    padding: 10px 6px;
  }
}

/* Desktop: a left-to-right row — meta column, video, action rail (plus an
   isolated nav arrow further right) — matching YouTube Shorts desktop.
   Mobile: true full-bleed video (original TikTok-style app behavior) with
   caption + actions overlaid ON the video — see the mobile override below
   and the .reels-dark-overlay / .reels-mobile-actions rules further down.
   dvh math subtracts header (56px) + bottom nav (56px, mobile only) +
   notch safe area. */
.reels-reel-col {
  /* Also bound by width: leaves ~760px for the sidebar + meta column +
     action rail before the video is allowed to claim the rest, so it
     doesn't hog space the side columns need at narrower desktop widths.
     Floored at 380px — below that the video reads as too small to be
     usable, and .reels-actions (a fixed-height icon list) would end up
     taller than the video anyway, which is the real switch-to-mobile-
     layout signal (see the min-width: 1000px breakpoint below). */
  --reel-h: max(
    380px,
    min(calc(100dvh - 150px), 820px, calc((100vw - 760px) * 16 / 9))
  );
  --meta-h: 0px;
  --unit-gap: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  height: calc(var(--reel-h) + var(--unit-gap) + var(--meta-h));
  max-height: 100%;
}
@media (max-width: 999px) {
  .reels-reel-col {
    width: 100%;
    /* No icon rail beside the video on mobile — it's full-bleed — so this
       is just the available viewport height, no width-bound needed. */
    --reel-h: calc(100dvh - 56px - 56px - env(safe-area-inset-bottom, 0px));
    --meta-h: 0px;
    --unit-gap: 0px;
    gap: 0;
  }
}
@media (min-width: 1000px) {
  /* Grid instead of flex here: .reels-meta-col (left) and .reels-side-
     actions (right) are NOT the same width, so centering the row as one
     flex block shifts the video off true center. A `1fr auto 1fr` grid
     gives the video (auto, middle column) a genuinely centered position —
     the two side columns absorb the leftover space symmetrically no
     matter how wide their own content is. */
  .reels-reel-col {
    /* Must be an explicit width, not shrink-to-fit — `1fr` tracks only
       distribute/shrink correctly when the grid container itself has a
       definite size to divide up. Without this, the grid sizes to its
       content's natural (unshrunk) width and overflows .reels-stage at
       narrower desktop widths (~1024px and below). */
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    /* Force the single row to exactly the video's height instead of
       auto-sizing to content — .reels-actions is a fixed-height icon
       list that can be taller than a short video, and without this it
       would stretch the whole row (and both side columns with it),
       stranding the video at the top with dead space below it. */
    grid-template-rows: 100%;
    gap: 0;
  }
  .reels-meta-col {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    /* minmax(0,1fr) above lets this column shrink below 320px when the
       viewport is too narrow to fit meta + video + actions at full size —
       width:100% (capped by max-width) lets the column's actual content
       follow that shrunk size instead of overflowing it. */
    min-width: 0;
  }
  .reels-viewport {
    grid-column: 2;
    grid-row: 1;
  }
  .reels-side-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 28px;
    padding-left: 28px;
    min-width: 0;
    /* .reels-actions' icon list can be taller than the row (see
       grid-template-rows above) — let it overflow visibly rather than
       stretching/clipping the row that the centered video depends on. */
    overflow: visible;
  }
}

/* Left column — creator/title/sound, bottom-aligned beside the video.
   Desktop only; mobile overlays caption info directly on the video instead
   (see .reels-unit .reels-meta below) — there's no room for a side column
   on a phone screen. */
.reels-meta-col {
  display: none;
}
@media (min-width: 1000px) {
  .reels-meta-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-self: stretch;
    /* Fills whatever its grid column has room for, up to 320px — shrinks
       gracefully (captions/handles already truncate) instead of
       overflowing at narrower desktop widths. */
    width: 100%;
    max-width: 320px;
    gap: 8px;
    padding-bottom: 12px;
  }
}

/* Clips the sliding video track only — the icon rail / nav arrows are
   siblings outside this element so they stay put during a swipe. */
.reels-viewport {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: calc(var(--reel-h) * 9 / 16);
  max-width: 420px;
}
@media (max-width: 999px) {
  .reels-viewport {
    width: 100%;
    max-width: 100%;
  }
}

/* One virtualized card: video box stacked above its meta block. Three of
   these are mounted at once (prev/current/next), positioned via inline
   `top` + a shared `y` drag offset — see ReelsPage.tsx. */
.reels-unit {
  position: absolute;
  left: 0;
  right: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--unit-gap);
}

/* Flat, borderless on desktop — blends into the page like YouTube Shorts
   desktop rather than sitting in a rounded card. Full-bleed on mobile (the
   var overrides above make --reel-h fill the whole available height). */
.reels-reel {
  position: relative;
  height: var(--reel-h);
  width: 100%;
  flex-shrink: 0;
  background: var(--deep);
  overflow: hidden;
  cursor: pointer;
}

/* Dark vignette over the video — mobile only, matches the original app's
   full-bleed player chrome so overlaid white text stays legible. */
.reels-dark-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.22) 0%,
    transparent 30%,
    transparent 60%,
    rgba(0, 0, 0, 0.18) 100%
  );
  pointer-events: none;
  z-index: 1;
}
@media (max-width: 999px) {
  .reels-dark-overlay {
    display: block;
  }
}

.reels-mute-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 150ms ease;
  z-index: 5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.reels-reel:hover .reels-mute-btn {
  opacity: 1;
}
.reels-mute-btn:active {
  transform: scale(0.88);
}
/* Always show mute on touch devices (no hover state) */
@media (pointer: coarse) {
  .reels-mute-btn {
    opacity: 1;
  }
}

.reels-bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.35);
  pointer-events: none;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.6);
  animation: reels-bigplay-pop 200ms ease-out both;
}
@keyframes reels-bigplay-pop {
  from {
    transform: translate(-50%, -50%) scale(0.75);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* Below-video meta — YouTube Shorts desktop style: plain flowing text under
   the video instead of a dark gradient overlaid on top of it. */
.reels-meta {
  width: 100%;
  height: var(--meta-h);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reels-creator-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.reels-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.reels-handle {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.reels-connect-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 0 16px;
  height: 28px;
  border-radius: 20px;
  margin-left: auto;
  letter-spacing: 0.02em;
  transition:
    filter 160ms ease,
    transform 120ms ease;
  flex-shrink: 0;
}
.reels-connect-btn:hover {
  filter: brightness(1.1);
}
.reels-connect-btn:active {
  transform: scale(0.93);
}

.reels-caption {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reels-sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
}
/* Hidden by default (desktop) — the @media block below shows it on mobile.
   Must stay ABOVE that block: two equal-specificity rules for the same
   selector are resolved by source order, so declaring this after the
   override would always win and hide the action bar on mobile too. */
.reels-mobile-actions {
  display: none;
}
@media (max-width: 999px) {
  .reels-meta-col .reels-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .reels-meta-col .reels-handle {
    font-size: 12px;
  }
  .reels-meta-col .reels-caption {
    font-size: 12px;
  }
  .reels-meta-col .reels-connect-btn {
    height: 24px;
    font-size: 10px;
    padding: 0 12px;
  }

  /* ── Mobile: caption overlaid directly on the video (original app
     behavior) instead of the desktop's plain flowing left column. Scoped
     to .reels-unit .reels-meta so .reels-meta-col above is untouched. ── */
  .reels-unit .reels-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44%;
    max-height: 340px;
    min-height: 200px;
    padding: 0 72px 20px 16px;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.92) 0%,
      rgba(0, 0, 0, 0.68) 38%,
      rgba(0, 0, 0, 0.28) 65%,
      transparent 100%
    );
    justify-content: flex-end;
    z-index: 2;
  }
  .reels-unit .reels-meta .reels-avatar {
    width: 46px;
    height: 46px;
    font-size: 17px;
    border: 2.5px solid #fff;
    box-shadow:
      0 0 0 2px var(--accent),
      0 4px 16px rgba(0, 0, 0, 0.5);
  }
  .reels-unit .reels-meta .reels-handle {
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  }
  .reels-unit .reels-meta .reels-caption {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13.5px;
    font-weight: 500;
    white-space: normal;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  }
  .reels-unit .reels-meta .reels-sound {
    color: #fff;
    background: transparent;
    border: none;
    padding: 0;
  }
  .reels-unit .reels-meta .reels-sound-text {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  }

  /* ── Mobile action panel overlaid on the video (original app behavior,
     Flutter Stack match) — replaces the desktop .reels-actions rail. ── */
  .reels-mobile-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    right: 10px;
    /* sit comfortably above the progress bar (8px) */
    bottom: 20px;
    z-index: 10;
    gap: 14px;
  }
  .rma-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .rma-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
      transform 150ms ease,
      background 150ms ease;
    box-shadow:
      0 2px 12px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
  .rma-btn:active {
    transform: scale(0.84);
    background: rgba(0, 0, 0, 0.65);
  }
  .rma-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow:
      0 0 0 2px var(--accent),
      0 4px 16px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    transition: transform 150ms ease;
  }
  .rma-avatar:active {
    transform: scale(0.84);
  }
  .rma-count,
  .rma-label {
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-shadow:
      0 1px 6px rgba(0, 0, 0, 0.9),
      0 0 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    line-height: 1;
    letter-spacing: 0.01em;
  }
}
.reels-sound-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.reels-sound-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.reels-sound:hover .reels-sound-text {
  animation: reels-marquee 12s linear infinite;
}
@keyframes reels-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-30%);
  }
}

.reels-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 4;
  cursor: pointer;
}
/* Taller invisible hit area for easier scrubbing */
.reels-progress::before {
  content: "";
  position: absolute;
  inset: -12px 0 0 0;
}
@media (max-width: 999px) {
  .reels-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
  }
  /* Larger touch target on mobile */
  .reels-progress::before {
    inset: -16px 0 0 0;
  }
}
/* Downloaded-ahead range, rendered behind the playback fill */
.reels-progress-buffered {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.35);
  transition: width 0.25s ease-out;
  border-radius: 0 2px 2px 0;
}
.reels-progress-fill {
  height: 100%;
  background: linear-gradient(
    to right,
    var(--accent),
    color-mix(in srgb, var(--accent) 70%, #fff)
  );
  transition: width 0.08s linear;
  border-radius: 0 2px 2px 0;
  position: relative;
}
/* Playhead dot at the tip */
.reels-progress-fill::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 150ms ease;
}
.reels-progress:hover .reels-progress-fill::after {
  opacity: 1;
}

/* Right action bar — a fixed toolbar beside the video at every breakpoint;
   it reflects the current reel but never slides with the swipe transition. */
.reels-actions {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  align-self: center;
}
@media (max-width: 999px) {
  /* Replaced by .reels-mobile-actions overlaid on the video (original
     app behavior) — there's no room for a side rail on a phone screen. */
  .reels-actions {
    display: none;
  }
}
.reels-action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.reels-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.reels-action-stack:hover .reels-action-icon {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
}
.reels-action-count {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.reels-action-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.reels-vinyl {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    var(--accent) 0 7px,
    #0d0d1a 7px 13px,
    #1a0a2e 13px 19px,
    #0d0d1a 19px 21px
  );
  animation: reels-spin 6s linear infinite;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.12),
    0 3px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
@keyframes reels-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Nav buttons — desktop only (touch users rely on swipe instead). Floats as
   an isolated control near the stage's right edge, independent of the
   video/icon-rail width, matching YouTube Shorts desktop. */
/* Part of the same centered flex row as .reels-meta-col/.reels-viewport/
   .reels-actions (not pinned to the page edge) — that way the whole group
   stays one balanced, centered unit at any window width, instead of
   leaving a lopsided gap on wide screens. */
.reels-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: center;
}
.reels-nav-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}
.reels-nav-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}
.reels-nav-btn:active {
  transform: scale(0.92);
}
.reels-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.reels-nav-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
  transform: none;
}
/* ── Must come AFTER base .reels-nav so cascade order wins on mobile ── */
@media (max-width: 999px) {
  .reels-nav {
    display: none;
  }
}

/* ─── Watch page ─────────────────────────────────────────────────────────── */

.watch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  padding: 20px;
  max-width: 1600px;
}
@media (max-width: 1180px) {
  .watch-grid {
    grid-template-columns: 1fr;
  }
}

/* Player */
.watch-player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0f3460;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.watch-player-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.15) 0%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.6) 100%
  );
  pointer-events: none;
}
.watch-hd-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 3px;
}
.watch-bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  transition: transform 200ms ease;
  padding-left: 4px;
}
.watch-bigplay:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

/* Progress bar */
.watch-progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: height 160ms ease;
}
.watch-progress-bar:hover {
  height: 6px;
}
.watch-progress-fill {
  height: 100%;
  background: var(--accent);
  position: relative;
}
.watch-progress-handle {
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}
.watch-progress-marker {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
}
.watch-progress-tip {
  position: absolute;
  bottom: 18px;
  transform: translateX(-50%);
  background: #0f3460;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Controls */
.watch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}
.watch-ctl-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 140ms ease;
}
.watch-ctl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.watch-vol {
  display: flex;
  align-items: center;
  gap: 8px;
}
.watch-vol-track {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  cursor: pointer;
}
.watch-vol-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent);
  border-radius: 2px;
}
.watch-vol-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}
.watch-time {
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0 6px;
}

/* Title */
.watch-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 16px 0 0;
  letter-spacing: -0.01em;
}

/* Channel row */
.watch-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.watch-channel-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.watch-channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a2a4e;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.watch-channel-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.watch-channel-tick {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.watch-channel-subs {
  color: var(--text-muted);
  font-size: 11px;
}
.watch-btn-connect {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  height: 28px;
  padding: 0 14px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  transition:
    background 160ms ease,
    color 160ms ease;
  white-space: nowrap;
}
.watch-btn-connect:hover {
  background: var(--accent);
  color: #fff;
}

/* Action buttons */
.watch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.watch-pill-group {
  display: flex;
  align-items: stretch;
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  height: 32px;
}
.watch-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  transition: background 160ms ease;
}
.watch-pill-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.watch-pill-btn.active {
  background: var(--accent);
  color: #fff;
}
.watch-pill-divider {
  width: 1px;
  background: var(--border);
}
.watch-action-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  transition: background 160ms ease;
  white-space: nowrap;
}
.watch-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.watch-action-circle {
  width: 32px;
  padding: 0;
  justify-content: center;
}

/* Description */
.watch-desc {
  background: var(--card);
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  border: 1px solid var(--border);
}
.watch-desc-meta {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}
.watch-desc-text {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 8px;
}
.watch-desc-toggle {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  display: inline-block;
}
.watch-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.watch-tag {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Chapters */
.watch-chapters {
  background: var(--card);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.watch-chapters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.watch-chapters-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
.watch-chapters-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.watch-chapter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background 140ms ease;
  cursor: pointer;
}
.watch-chapter:hover {
  background: rgba(255, 255, 255, 0.04);
}
.watch-chapter.active {
  background: #1a2547;
  border-left-color: var(--accent);
}
.watch-chapter-time {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  min-width: 56px;
  font-variant-numeric: tabular-nums;
}
.watch-chapter-thumb {
  position: relative;
  width: 80px;
  height: 45px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #0f3460;
}
.watch-chapter-title {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
  flex: 1;
}

/* Comments */
.watch-comments {
  margin-top: 28px;
}
.watch-comments-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.watch-comments-title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}
.watch-comments-count {
  color: var(--text-muted);
  font-size: 12px;
}
.watch-sort-btn {
  margin-left: auto;
  background: var(--card);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.watch-add-comment {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
}
.watch-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.watch-comment-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  padding: 6px 2px;
  outline: 0;
  font-family: inherit;
  transition: border-color 160ms ease;
}
.watch-comment-input::placeholder {
  color: #555;
}
.watch-comment-input:focus {
  border-bottom-color: var(--accent);
}
.watch-comment-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}
.watch-btn-text {
  background: transparent;
  color: #999;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
}
.watch-btn-text:hover {
  color: #fff;
}
.watch-btn-primary {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  transition: filter 160ms ease;
}
.watch-btn-primary:hover {
  filter: brightness(1.08);
}
.watch-comment {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.watch-comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.watch-comment-name {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}
.watch-comment-time {
  color: var(--text-muted);
  font-size: 10px;
}
.watch-comment-text {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 4px;
}
.watch-comment-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.watch-comment-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #888;
  font-size: 11px;
  transition: color 140ms ease;
  cursor: pointer;
}
.watch-comment-act:hover {
  color: var(--accent);
}
.watch-comment-replies {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  cursor: pointer;
}
.watch-show-more {
  width: 100%;
  margin-top: 22px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  transition:
    background 160ms ease,
    color 160ms ease;
}
.watch-show-more:hover {
  background: var(--accent);
  color: #fff;
}

/* Right sidebar */
.watch-side-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.watch-autoplay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 4px;
}
.watch-autoplay-label {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
.watch-toggle {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #333;
  position: relative;
  transition: background 200ms ease;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
}
.watch-toggle.on {
  background: var(--accent);
}
.watch-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.watch-toggle.on .watch-toggle-knob {
  transform: translateX(16px);
}

/* Recommended card */
.watch-rec-card {
  display: flex;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease;
}
.watch-rec-card:hover {
  background: var(--card);
}
.watch-rec-thumb {
  position: relative;
  width: 160px;
  height: 90px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #16213e;
}
.watch-duration {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: monospace;
}
.watch-rec-meta {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}
.watch-rec-title {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.005em;
}
.watch-rec-creator {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watch-rec-stats {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 1px;
}

/* Mini reels */
.watch-mini-reels-label {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 14px 4px 8px;
}
.watch-mini-reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.watch-mini-reel {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 4px;
  overflow: hidden;
  background: #16213e;
  cursor: pointer;
  transition: transform 180ms ease;
}
.watch-mini-reel:hover {
  transform: translateY(-2px);
}
.watch-reel-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(var(--accent-rgb), 0.85);
  color: #fff;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 4px;
  border-radius: 2px;
}
.watch-reel-likes {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* ─── Profile page ───────────────────────────────────────────────────────── */

@keyframes prof-banner-in {
  from {
    transform: scale(1.06);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes prof-avatar-in {
  from {
    transform: scale(0.6) translateY(14px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
@keyframes prof-content-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes prof-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes prof-stat-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes prof-orb-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(var(--accent-rgb), 0.5),
      0 0 0 0 rgba(var(--accent-rgb), 0);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(var(--accent-rgb), 0.3),
      0 0 28px rgba(var(--accent-rgb), 0.35);
  }
}
@keyframes prof-feed-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes prof-tab-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@layer components {
  .dt-live-dot {
    @apply inline-block w-2 h-2 rounded-full bg-red-600;
    box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.6);
    animation: dt-live-pulse 1.6s ease-out infinite;
  }

  @keyframes dt-live-pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.6);
    }
    70% {
      box-shadow: 0 0 0 8px rgba(217, 48, 37, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(217, 48, 37, 0);
    }
  }
}
