/* ---------------------------------------------------------------- Today (ranked)
   Phones and tablets: one column. Record + Updates, then Live now + Top videos,
   then Top songs / sounds / packs, then Latest.
   1100px and up: two columns, with Live now + Top videos in a rail on the right
   that stays in view. Same rhythm as the rest of the site: ~32px between
   sections, 12px from a section title to its content. */

.today-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px;
  grid-template-areas: "top" "rail" "main";
}
.today-top { grid-area: top; }
.today-rail { grid-area: rail; }
.today-main { grid-area: main; }
.today-top, .today-main, .today-rail { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.today-rail[hidden], .t-sec[hidden] { display: none; }
.t-sec { display: flex; flex-direction: column; gap: var(--sec-gap, 12px); min-width: 0; }
.t-sec > .shelf-title { margin: 0; }
.today-top .record-bar { margin: 0; }
.t-latest #feed > .day-head:first-child { margin-top: 0; }

@media (min-width: 1100px) {
  .today-grid:not(.no-rail) {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 44%);
    grid-template-rows: auto 1fr;
    grid-template-areas: "top rail" "main rail";
    column-gap: 40px;
  }
  .today-rail {
    position: sticky; top: calc(var(--header-h) + 16px); align-self: start;
    max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: none; padding-bottom: 8px;
  }
  .today-rail::-webkit-scrollbar { display: none; }
  /* in the rail, the live faces wrap instead of scrolling sideways */
  .today-rail .live-row { flex-wrap: wrap; overflow: visible; }
}

/* loading placeholder for a shelf */
.t-skel { width: 100%; height: 220px; border-radius: var(--r-md); background: var(--surface-2); animation: shimmer 1.4s ease-in-out infinite; }
.hot-shelf > .t-skel { grid-column: 1 / -1; width: min(100%, 720px); }

/* ---------------------------------------------------------------- Top sounds: numbered rows */
.rank-list .row.rank-row,
.rank-list .row.rank-row:not(.is-skeleton) {
  grid-template-columns: 22px 40px minmax(0, 1fr) auto;
  grid-template-areas: "n play text stat";
  gap: 12px; padding: 10px 16px; align-items: center;
}
.rank-row > .rank-n { grid-area: n; text-align: right; color: var(--ink-3); font-size: 14px; font-weight: 500; }
.rank-row > .play-btn { grid-area: play; width: 40px; height: 40px; }
.rank-row > .play-btn svg { width: 16px; height: 16px; }
.rank-text { grid-area: text; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rank-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-row .row-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; overflow-wrap: normal; }
.rank-row .row-cover { flex: none; display: block; width: 24px; height: 24px; border-radius: 6px; overflow: hidden; }
.rank-row .row-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-row .row-by { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-stat { grid-area: stat; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 600px) {
  .rank-list .row.rank-row:not(.is-skeleton) { grid-template-columns: 18px 40px minmax(0, 1fr) auto; gap: 10px; padding: 10px var(--gutter); }
}
@media (max-width: 380px) { .rank-stat { display: none; } }

/* ---------------------------------------------------------------- Top videos: tall cards */
.tv-grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 0; }
.tv-grid::-webkit-scrollbar { display: none; }
@media (max-width: 600px) { .tv-grid { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); } }
@media (min-width: 1100px) {
  .today-rail .tv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
}
.tv { position: relative; flex: 0 0 140px; aspect-ratio: 9 / 16; border-radius: var(--r-md); overflow: hidden; background: #0D0D10; scroll-snap-align: start; box-shadow: var(--shadow-2); }
@media (min-width: 601px) and (max-width: 1099px) { .tv { flex-basis: 160px; } }
.tv-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-hit { position: absolute; inset: 0; z-index: 1; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: inherit; }
.tv::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(transparent, rgb(0 0 0 / 0.6)); pointer-events: none; }
.tv-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / 0.5); color: #fff; pointer-events: none; transition: opacity var(--t-fast) var(--ease-out); }
.tv-play svg { width: 22px; height: 22px; transform: translateX(1px); }
.tv.is-playing .tv-play { opacity: 0; }
.tv-sound { position: absolute; z-index: 3; right: 8px; top: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / 0.55); color: #fff; cursor: pointer; padding: 0; }
.tv-sound[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); }
.tv-by { position: absolute; z-index: 3; left: 8px; right: 8px; bottom: 26px; display: flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font: 600 13px var(--font-body); min-width: 0; }
.tv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); }
.avatar-tv { width: 22px; height: 22px; flex: none; font-size: 9px; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.85); }
.tv-views { position: absolute; z-index: 2; left: 8px; bottom: 9px; font-size: 11px; line-height: 1; color: rgb(255 255 255 / 0.9); pointer-events: none; }
@media (hover: hover) {
  .tv-sound:hover { background: rgb(0 0 0 / 0.75); }
  .tv-by:hover .tv-name { text-decoration: underline; }
}
@media (max-width: 600px) {
  .tv-sound { width: 36px; height: 36px; }
  .tv-sound::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; }
}
/* Top videos: like + "+ My page" on each card */
.tv-like, .tv-mine { position: absolute; z-index: 3; top: 8px; height: 30px; border: 0; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 4px; background: rgb(0 0 0 / 0.55); color: #fff; padding: 0 9px; font: 600 12px var(--font-mono); }
.tv-like { left: 8px; }
.tv-like svg, .tv-mine svg { width: 14px; height: 14px; }
.tv-like.is-on svg { color: var(--signal); }
.tv-mine { right: 8px; top: 46px; width: 32px; padding: 0; justify-content: center; }
.tv-mine span { display: none; }
@media (hover: hover) { .tv-like:hover, .tv-mine:hover { background: rgb(0 0 0 / 0.75); } }

/* ---------------------------------------------------------------- Live + Hit clips: one big box each, tabs on top */
.hot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 36px; }
.hot-head .shelf-title { flex: none; }
.hot-tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.hot-tabs:empty { display: none; }
.hot-tabs::-webkit-scrollbar { display: none; }
.hot-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: none; color: var(--ink-2); font: 600 13px/1 var(--font-body); white-space: nowrap; cursor: pointer; }
.hot-tabs button span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.hot-tabs button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.hot-tabs button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.avatar-tab { width: 20px; height: 20px; font-size: 8px; }
.hot-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #0D0D10; color: #fff; box-shadow: var(--shadow-2); }
.hot-skel { background: var(--surface-2); box-shadow: none; animation: shimmer 1.4s ease-in-out infinite; }
.hot-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--signal) 22%, #15121c), #0D0D10 70%); }
.hot-empty strong { font: 700 1.15rem/1.2 var(--font-display); }
.hot-empty span { color: rgb(255 255 255 / 0.7); font-size: 14px; }
.hot-empty .btn { margin-top: 6px; }
.hot-empty-icon .live-dot { width: 12px; height: 12px; background: var(--live); }
.live-poster { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center;
  background: radial-gradient(110% 90% at 50% 30%, color-mix(in srgb, var(--live) 40%, #160d10), #0D0D10 72%); }
.avatar-hot { width: 72px; height: 72px; font-size: 22px; box-shadow: 0 0 0 3px var(--live), 0 0 0 6px rgb(255 255 255 / 0.12); }
.poster-name { font: 700 1.2rem/1.2 var(--font-display); }
.poster-title { color: rgb(255 255 255 / 0.75); font-size: 14px; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-watch { margin-top: 6px; }
.hot-open { position: absolute; right: 12px; bottom: 10px; color: rgb(255 255 255 / 0.85); font-size: 13px; font-weight: 600; text-decoration: none; }
@media (hover: hover) { .hot-open:hover { color: #fff; text-decoration: underline; } }
.tv.tv-stage { flex: none; width: 100%; aspect-ratio: 16 / 9; }
.tv-stage .tv-media { object-fit: contain; }
.tv-stage .tv-play { width: 58px; height: 58px; }
.tv-stage .tv-play svg { width: 26px; height: 26px; }
@media (max-width: 600px) { .hot-tabs button { height: 34px; } .avatar-hot { width: 56px; height: 56px; } }
@media (prefers-reduced-motion: reduce) { .hot-skel { animation: none; } }

/* ---------------------------------------------------------------- Home tabs */
/* Signed-out visitors: one line that says what this place is. */
.home-pitch { margin: 0 0 14px; max-width: 34em; font-size: 1.02rem; line-height: 1.4; color: var(--ink-2); text-wrap: balance; }
.home-pitch strong { display: block; color: var(--ink); font-size: 1.3rem; line-height: 1.2; letter-spacing: -.01em; margin-bottom: 4px; }
.home-tabs { gap: 22px; margin-bottom: 18px; }
.home-tabs a { flex: none; white-space: nowrap; }
/* The Live tab's dot only shows (red) while someone is streaming. */
.home-tabs .live-dot { display: none; margin-right: 2px; }
.home-tabs a.is-live .live-dot { display: inline-block; color: var(--live); }
.shelf-title .shelf-all { margin-left: 10px; font: 500 var(--fs-sm)/1 var(--font-body); color: var(--ink-3); text-decoration: none; }
.shelf-title .shelf-all:hover { color: var(--ink); text-decoration: underline; }
.feed-start { margin-bottom: 24px; }
.home-live .hot-box { max-width: 720px; }
.home-tab > .today-top { margin-bottom: 32px; }
.record-bar .btn-golive { margin-left: 10px; }
/* Nobody live: no empty column, no empty row. */
.today-grid.no-rail .today-rail { display: none; }
/* Hot: songs + packs on the left, top sounds on the right, when there is room. */
.hot-cols, .hot-col { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
@media (min-width: 1100px) {
  .today-grid.no-rail .hot-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 40px; align-items: start; }
}
.today-main > .sauce-banner { margin: 0; }
/* Packs tab: whole titles, so "Vol. 2" and "Vol. 4" can be told apart. */
.home-packs .pack-name { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* Photos & video: a picture grid, not rows, and not a wall of tall reels. */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.media-tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--surface-2); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.media-tile:hover img { transform: scale(1.03); }
.media-by { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; color: #fff; font: 600 13px/1.2 var(--font-body); background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.media-videos .tv { width: 100%; aspect-ratio: 1; }
@media (max-width: 700px) {
  .home-tabs { gap: 18px; margin-bottom: 12px; margin-inline: calc(var(--page-pad, 16px) * -1); padding-inline: var(--page-pad, 16px); }
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .media-tile { border-radius: 4px; }
  .media-by { font-size: 11px; padding: 14px 6px 5px; }
  .media-videos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
/* The grid only has rows for what is on the page (an unused row would still add its gap). */
.home-tab .today-grid { grid-template-areas: "rail" "main"; }
.home-tab .today-grid.no-rail { grid-template-areas: "main"; }
@media (min-width: 1100px) {
  .home-tab .today-grid:not(.no-rail) { grid-template-areas: "main rail"; grid-template-rows: auto; }
}
.hot-head[hidden] { display: none; }

/* ---------------------------------------------------------------- Home: New / Audio / Feed / Live */
.who-tabs { display: flex; gap: 8px; margin: 0 0 14px; }
.who-tabs .chip-toggle { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; border-radius: var(--r-pill); font-weight: 600; font-size: var(--fs-sm); }
.who-tabs .chip-toggle.is-on { color: var(--bg); }
.home-audio .t-sec + .t-sec { margin-top: 22px; }

/* Feed: photos and videos one under another */
.ig-feed { display: flex; flex-direction: column; gap: 26px; max-width: 34rem; margin: 0 auto; width: 100%; }
.ig-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 34rem; margin: 0 auto 14px; width: 100%; }
.ig-hint { color: var(--ink-3); font-size: var(--fs-sm); }
.ig-shorts-btn { min-height: 44px; gap: 6px; }
.ig-shorts-btn svg { width: 14px; height: 14px; }
.ig { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ig-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.ig-who { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; color: var(--ink); text-decoration: none; }
.ig-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-when, .ig-views { color: var(--ink-3); font-size: 13px; flex: none; }
.ig-media { display: block; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); line-height: 0; }
.ig-media img { width: 100%; height: auto; max-height: 80vh; object-fit: cover; display: block; }
.ig .tv.ig-tv { flex: none; width: 100%; aspect-ratio: 4 / 5; max-height: 78vh; }
.ig-actions { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.ig-actions .stat-btn, .ig-actions .vlike, .ig-actions .vmine { min-height: 44px; min-width: 44px; }
.ig-actions .ig-play { margin-left: auto; }
.ig-actions .ig-views { margin-left: auto; }
.ig-cap { margin: 0; overflow-wrap: anywhere; line-height: 1.45; }
.ig-cap a { color: var(--ink); text-decoration: none; }
@media (max-width: 600px) {
  .ig-media, .ig .tv.ig-tv { border-radius: 0; margin-inline: calc(-1 * var(--gutter)); width: auto; }
}

/* Shorts: videos full screen, one per swipe */
.shorts { position: fixed; inset: 0; z-index: 400; background: #000; color: #fff; }
body.shorts-open { overflow: hidden; }
.shorts-track { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; outline: 0; }
.shorts-track::-webkit-scrollbar { display: none; }
.short { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; overflow: hidden; }
.short-media { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.short-hit { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: pointer; }
.short-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / 0.5); pointer-events: none; transition: opacity 0.15s; }
.short-play svg { width: 28px; height: 28px; transform: translateX(2px); }
.short.is-playing .short-play { opacity: 0; }
.short-side { position: absolute; right: 10px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 2; }
.short-side button { min-width: 48px; min-height: 48px; border: 0; border-radius: 24px; padding: 6px 8px; background: rgb(0 0 0 / 0.5); color: #fff; display: grid; place-items: center; gap: 2px; font-size: 12px; cursor: pointer; }
.short-side button svg { width: 24px; height: 24px; }
.short-side .vlike.is-on { color: var(--live, #ff4d5e); }
.short-side .short-sound[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); }
.short-by { position: absolute; left: 14px; right: 80px; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px; min-height: 44px; color: #fff; text-decoration: none; text-shadow: 0 1px 3px rgb(0 0 0 / 0.7); z-index: 2; }
.short-by strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shorts-x { position: absolute; z-index: 3; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.5); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shorts-x svg { width: 22px; height: 22px; }
.shorts button:focus-visible, .short-by:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Pull down to refresh */
.ptr { position: fixed; z-index: 350; left: 50%; top: calc(env(safe-area-inset-top, 0px) - 44px); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); opacity: 0; transform: translate(-50%, 0); pointer-events: none; transition: transform 0.2s ease, opacity 0.2s ease; }
.ptr.is-moving { transition: none; }
.ptr-ring { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--signal); }
.ptr.is-armed .ptr-ring { border-color: var(--signal); border-top-color: var(--ink); }
.ptr.is-busy .ptr-ring { animation: ptr-spin 0.7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr, .ptr.is-busy .ptr-ring { transition: none; animation: none; } }
/* Touch screens: the browser's own pull-to-refresh steps aside for this one. */
@media (pointer: coarse) { html { overscroll-behavior-y: contain; } }
