/* Gooners — vertical short-video feed.
   Original styling throughout. Dark, edge-to-edge, phone-first; the desktop
   case is handled by centring a phone-width column rather than inventing a
   second layout, because the whole interaction is built around full-bleed
   portrait video. */

:root {
  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, .62);
  --faint: rgba(255, 255, 255, .34);
  --line: rgba(255, 255, 255, .12);
  --hot: #ff2e63;      /* like / accent */
  --cool: #00f0ff;     /* secondary accent */
  --nav-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* An author `display:` rule BEATS the `hidden` attribute's UA style, so any
   element styled with display: here would ignore hidden entirely. That shipped
   broken: .sheet (flex) and .empty (grid) were both permanently on screen - the
   comments sheet could not be closed and the empty-state overlay covered the
   feed. One global rule rather than a per-selector [hidden] each time, because
   the next element with a display: rule would hit the same trap. */
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2;
      stroke-linecap: round; stroke-linejoin: round; }

/* On a wide screen the feed stays a phone-shaped column, centred. */
@media (min-width: 620px) {
  body::before {
    content: ''; position: fixed; inset: 0;
    background: radial-gradient(900px 600px at 50% -10%, #16121a, #000 70%);
  }
  .screen, .nav, .sheet {
    max-width: 440px; left: 50% !important; transform: translateX(-50%);
    box-shadow: 0 0 0 1px var(--line);
  }
  .sheet { transform: translateX(-50%) translateY(var(--sheet-y, 0)); }
}

.screen { position: fixed; inset: 0; bottom: 0; display: flex; flex-direction: column; }

/* ── feed ────────────────────────────────────────────────────────────── */
.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: linear-gradient(#000a, #0000);
  pointer-events: none;
}
.feed-top .tab, .feed-top .icon-btn { pointer-events: auto; }
.tab {
  font-size: 16px; font-weight: 600; color: var(--faint);
  padding: 2px 0; position: relative; transition: color .15s;
}
.tab.is-on { color: #fff; }
.tab.is-on::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; translate: -50% 0;
  width: 26px; height: 2.5px; border-radius: 2px; background: #fff;
}
.tab-sep { width: 1px; height: 14px; background: var(--line); }
.feed-search { position: absolute; right: 10px; top: calc(10px + env(safe-area-inset-top, 0px)); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }

.reel {
  flex: 1; overflow-y: auto; scroll-snap-type: y mandatory;
  scrollbar-width: none; overscroll-behavior-y: contain;
}
.reel::-webkit-scrollbar { display: none; }

.slide {
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; place-items: center; overflow: hidden; background: #0b0b0f;
}
.slide video, .slide .poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
/* With no media yet, the poster IS the slide. Generated from the video's hue so
   an empty library still looks deliberate rather than broken. */
.poster {
  background:
    radial-gradient(120% 80% at 20% 15%, hsl(var(--h) 85% 42% / .85), transparent 60%),
    radial-gradient(100% 90% at 85% 80%, hsl(calc(var(--h) + 60) 90% 45% / .75), transparent 62%),
    linear-gradient(160deg, #15101c, #05050a);
}
.poster::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, #fff0 0 22px, #ffffff07 22px 44px);
}
.pending {
  position: absolute; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--dim); background: #0009; backdrop-filter: blur(8px);
  border: 1px solid var(--line);
}
.pending i { width: 7px; height: 7px; border-radius: 50%; background: var(--cool);
             animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }

.slide-shade {
  position: absolute; inset: auto 0 0 0; height: 52%;
  background: linear-gradient(#0000, #000c 62%, #000e);
  pointer-events: none;
}

/* caption block */
.meta {
  position: absolute; left: 0; right: 72px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  padding: 0 14px; z-index: 3;
}
.meta .who { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 16px; }
.meta .who .tick { width: 15px; height: 15px; color: var(--cool); }
.meta .cap { margin: 7px 0 0; font-size: 14px; line-height: 1.4; }
.meta .cap .tag { color: #fff; font-weight: 600; }
.meta .sound { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 13px; color: var(--dim); }
.meta .sound svg { width: 15px; height: 15px; flex: none; }
.ticker { overflow: hidden; white-space: nowrap; max-width: 190px; }
.ticker span { display: inline-block; animation: slide 11s linear infinite; }
@keyframes slide { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* action rail */
.rail {
  position: absolute; right: 8px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 17px;
}
.rail button { display: grid; place-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.rail svg { width: 31px; height: 31px; filter: drop-shadow(0 1px 3px #0008); }
.rail .n { font-size: 12px; text-shadow: 0 1px 3px #000a; }
.rail .like.on svg { fill: var(--hot); stroke: var(--hot); animation: pop .32s; }
.rail .save.on svg { fill: #ffd400; stroke: #ffd400; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.32); } 100% { transform: scale(1); } }

.avatar {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; color: #fff; overflow: hidden;
  background: linear-gradient(145deg, hsl(var(--h) 80% 48%), hsl(calc(var(--h) + 50) 85% 38%));
}
.rail .follow {
  position: absolute; bottom: -8px; left: 50%; translate: -50% 0;
  width: 21px; height: 21px; border-radius: 50%; background: var(--hot);
  display: grid; place-items: center; font-size: 15px; line-height: 1; font-weight: 700;
}
.rail .follow.on { background: #fff; color: var(--hot); }

/* the spinning sound disc */
.disc {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #2a2a33, #0c0c10);
  border: 1px solid var(--line); animation: spin 5s linear infinite;
}
.disc.paused { animation-play-state: paused; }
.disc i { width: 13px; height: 13px; border-radius: 50%;
          background: linear-gradient(145deg, hsl(var(--h) 80% 55%), hsl(calc(var(--h) + 60) 80% 45%)); }
@keyframes spin { to { transform: rotate(360deg); } }

/* double-tap heart */
.burst {
  position: absolute; z-index: 5; width: 96px; height: 96px; translate: -50% -50%;
  color: var(--hot); pointer-events: none; animation: burst .72s ease-out forwards;
}
.burst svg { width: 100%; height: 100%; fill: currentColor; stroke: none; }
@keyframes burst {
  0% { opacity: 0; transform: scale(.3) rotate(-14deg); }
  28% { opacity: 1; transform: scale(1.1) rotate(8deg); }
  100% { opacity: 0; transform: scale(1.5) rotate(12deg); }
}

.progress {
  position: absolute; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b));
  height: 2px; background: #ffffff1f; z-index: 4;
}
.progress i { display: block; height: 100%; width: 0; background: #fff; }

.play-badge {
  position: absolute; z-index: 5; width: 64px; height: 64px; opacity: 0;
  transition: opacity .18s; color: #fff;
}
.play-badge svg { width: 100%; height: 100%; fill: currentColor; stroke: none; filter: drop-shadow(0 2px 8px #000a); }
.slide.is-paused .play-badge { opacity: .88; }

/* ── empty state ─────────────────────────────────────────────────────── */
.empty {
  position: absolute; inset: 0; z-index: 7; display: grid; place-content: center;
  justify-items: center; text-align: center; gap: 10px; padding: 32px;
  background: radial-gradient(700px 500px at 50% 35%, #1a1320, #000 72%);
}
.empty-mark svg { width: 74px; height: 74px; fill: var(--hot); stroke: none; opacity: .9; }
.empty-mark .ring { fill: none; stroke: var(--cool); stroke-width: 3; }
.empty h2 { margin: 6px 0 0; font-size: 20px; }
.empty p { margin: 0; max-width: 300px; color: var(--dim); font-size: 14px; }
.empty code {
  margin-top: 6px; font-size: 12px; color: var(--cool);
  background: #ffffff0d; border: 1px solid var(--line); padding: 6px 11px; border-radius: 8px;
}

/* ── bars / scroll screens ───────────────────────────────────────────── */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  border-bottom: 1px solid var(--line); background: #000;
}
.bar-title { font-weight: 700; font-size: 16px; }
.bar-spacer { flex: 1; }
.bar-profile { justify-content: center; position: relative; }
.bar-profile .icon-btn { position: absolute; left: 6px; }

.search-wrap { flex: 1; display: flex; align-items: center; gap: 8px;
  background: #ffffff14; border-radius: 10px; padding: 8px 11px; }
.search-ico { width: 17px; height: 17px; color: var(--faint); flex: none; }
#q { flex: 1; background: none; border: 0; outline: none; color: #fff; font-size: 15px; }
#q::placeholder { color: var(--faint); }
.clear { color: var(--faint); font-size: 20px; line-height: 1; padding: 0 2px; }

.scroll { flex: 1; overflow-y: auto; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
.scroll::-webkit-scrollbar { width: 0; }

.sec-h { padding: 16px 14px 8px; font-size: 13px; font-weight: 700;
         letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px; }
.chip { background: #ffffff14; border: 1px solid var(--line); border-radius: 999px;
        padding: 7px 13px; font-size: 13.5px; font-weight: 600; }
.chip b { color: var(--cool); font-weight: 700; }

.row { display: flex; align-items: center; gap: 11px; padding: 10px 14px; width: 100%; text-align: left; }
.row .avatar { width: 42px; height: 42px; border-width: 0; font-size: 16px; }
.row .rt { flex: 1; min-width: 0; }
.row .rt b { display: block; font-size: 14.5px; }
.row .rt span { display: block; font-size: 12.5px; color: var(--faint);
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .btn-follow { border: 1px solid var(--hot); background: var(--hot); color: #fff;
                   border-radius: 7px; padding: 6px 15px; font-size: 13px; font-weight: 700; }
.row .btn-follow.on { background: none; color: var(--dim); border-color: var(--line); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.cell { position: relative; aspect-ratio: 9 / 15; overflow: hidden; background: #111; }
.cell .poster { position: absolute; inset: 0; }
.cell .n { position: absolute; left: 6px; bottom: 5px; font-size: 12px; font-weight: 700;
           display: flex; align-items: center; gap: 4px; text-shadow: 0 1px 3px #000; }
.cell .n svg { width: 13px; height: 13px; fill: #fff; stroke: none; }

.prof-head { display: grid; justify-items: center; gap: 8px; padding: 20px 14px 10px; }
.prof-head .avatar { width: 86px; height: 86px; font-size: 32px; border-width: 0; }
.prof-head h2 { margin: 2px 0 0; font-size: 17px; }
.prof-head .bio { color: var(--dim); font-size: 13.5px; text-align: center; max-width: 300px; margin: 0; }
.stats { display: flex; gap: 26px; margin: 6px 0 4px; }
.stats div { text-align: center; }
.stats b { display: block; font-size: 17px; }
.stats span { font-size: 12px; color: var(--faint); }

.muted { color: var(--faint); text-align: center; padding: 34px 20px; font-size: 14px; }

/* ── bottom nav ──────────────────────────────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around;
  background: #000; border-top: 1px solid var(--line);
}
.nav-item { display: grid; place-items: center; gap: 2px; color: var(--faint); flex: 1; }
.nav-item svg { width: 23px; height: 23px; }
.nav-item span { font-size: 10.5px; font-weight: 600; }
.nav-item.is-on { color: #fff; }

/* ── comments sheet ──────────────────────────────────────────────────── */
.sheet-scrim { position: fixed; inset: 0; background: #0008; z-index: 29; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: 68vh; display: flex; flex-direction: column;
  background: #15151a; border-radius: 16px 16px 0 0;
  padding-bottom: var(--safe-b);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(100%); } }
@media (min-width: 620px) { @keyframes rise { from { transform: translateX(-50%) translateY(100%); } } }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: #ffffff2e; margin: 8px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 8px 12px; }
.sheet-head .icon-btn { position: absolute; right: 6px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 14px 10px; }
.cmt { display: flex; gap: 10px; padding: 9px 0; }
.cmt .avatar { width: 34px; height: 34px; border-width: 0; font-size: 13px; flex: none; }
.cmt .ct { flex: 1; min-width: 0; }
.cmt .ct b { font-size: 13px; color: var(--dim); font-weight: 600; }
.cmt .ct p { margin: 2px 0 0; font-size: 14.5px; word-wrap: break-word; }
.cmt .ct time { font-size: 11.5px; color: var(--faint); }
.sheet-form { display: flex; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); }
#sheet-input { flex: 1; background: #ffffff14; border: 0; border-radius: 999px;
               padding: 10px 15px; color: #fff; outline: none; font-size: 14.5px; }
#sheet-send { color: var(--hot); font-weight: 700; padding: 0 6px; }
#sheet-send:disabled { color: var(--faint); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  translate: -50% 0; z-index: 40; background: #fff; color: #000;
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  animation: rise2 .2s;
}
@keyframes rise2 { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
