/* =========================================================================
   VideoHub — mobile-first dark UI.
   No webfonts by design: subscribers are on metered data, so the type scale
   does the work instead of a download.
   ========================================================================= */

:root {
  --ink:        #150B22;
  --ink-2:      #241338;
  --ink-3:      #34205010;
  --surface:    rgba(255, 255, 255, 0.06);
  --surface-2:  rgba(255, 255, 255, 0.12);
  --line:       rgba(255, 255, 255, 0.14);

  --gold:       #FFB020;
  --hot:        #FF2D78;
  --mint:       #3DDC97;
  --sky:        #5AC8FF;
  --lilac:      #C77DFF;

  --text:       #F6F1FF;
  --text-dim:   rgba(246, 241, 255, 0.62);
  --text-faint: rgba(246, 241, 255, 0.38);

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;

  --bar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- type scale ---------- */
h1 { font-size: 1.875rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .4rem; font-weight: 800; }
h2 { font-size: 1.3125rem; line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .35rem; font-weight: 750; }
h3 { font-size: 1rem; margin: 0 0 .25rem; font-weight: 650; }
p  { margin: 0 0 .75rem; max-width: 62ch; }
small { font-size: .8125rem; }

/* =========================================================================
   The feed
   ========================================================================= */
.feed {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.slide {
  position: relative;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0C0614;
}

.slide video,
.slide .poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide .poster {
  filter: blur(0px) saturate(1.1);
  transition: opacity .35s ease;
}
.slide.playing .poster { opacity: 0; }

/* readability scrims, not decoration */
.slide::before,
.slide::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
}
.slide::before {
  top: 0; height: 22%;
  background: linear-gradient(to bottom, rgba(10,4,18,.75), transparent);
}
.slide::after {
  bottom: 0; height: 46%;
  background: linear-gradient(to top, rgba(10,4,18,.92), rgba(10,4,18,.35) 55%, transparent);
}

/* ---------- caption block ---------- */
.slide-meta {
  position: absolute;
  left: 16px;
  right: 92px;
  bottom: calc(var(--bar-h) + var(--safe-b) + 18px);
  z-index: 3;
}
.slide-meta .cat {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 700;
  background: rgba(0,0,0,.45);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.slide-meta .title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 4px;
}
.slide-meta .desc {
  font-size: .875rem;
  color: var(--text-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slide-meta .stats {
  margin-top: 8px;
  font-size: .8125rem;
  color: var(--text-faint);
}

/* ---------- action rail ---------- */
.rail {
  position: absolute;
  right: 10px;
  bottom: calc(var(--bar-h) + var(--safe-b) + 18px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.rail button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: .6875rem;
  color: var(--text-dim);
  font-weight: 600;
}
.rail .glyph {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0,0,0,.42);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  font-size: 1.375rem;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .18s;
}
.rail button:active .glyph { transform: scale(.88); }
.rail button.on .glyph {
  background: rgba(255,45,120,.22);
  border-color: rgba(255,45,120,.6);
}
.rail button.on { color: var(--text); }

/* pop when a reaction lands */
@keyframes pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.rail .glyph.pop { animation: pop .34s cubic-bezier(.34,1.56,.64,1); }

/* floating hearts on double tap */
.float-emoji {
  position: absolute;
  z-index: 6;
  font-size: 2.25rem;
  pointer-events: none;
  animation: floatUp 1.05s ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.4) rotate(-12deg); }
  18%  { opacity: 1; transform: translate(-50%, -12px) scale(1.25) rotate(6deg); }
  100% { opacity: 0; transform: translate(-50%, -160px) scale(.9) rotate(-8deg); }
}

/* tap-to-pause indicator */
.play-hint {
  position: absolute;
  z-index: 5;
  width: 84px; height: 84px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  font-size: 2rem;
  opacity: 0;
  transform: scale(.7);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.slide.paused .play-hint { opacity: 1; transform: scale(1); }

/* buffering */
.spinner {
  position: absolute;
  z-index: 5;
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.22);
  border-top-color: var(--gold);
  border-radius: 50%;
  opacity: 0;
  animation: spin .7s linear infinite;
}
.slide.buffering .spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* progress */
.progress {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--bar-h) + var(--safe-b));
  height: 3px;
  background: rgba(255,255,255,.14);
  z-index: 4;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--hot));
}

/* =========================================================================
   Paywall overlay
   ========================================================================= */
.gate {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 24px calc(var(--bar-h) + 40px);
  text-align: center;
  background: rgba(12, 6, 20, .82);
  backdrop-filter: blur(14px);
}
.slide.gated .gate { display: flex; animation: gateIn .32s ease-out; }
@keyframes gateIn { from { opacity: 0; } to { opacity: 1; } }

.gate .lock {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.5rem;
  background: linear-gradient(140deg, var(--gold), var(--hot));
  margin-bottom: 10px;
}
.gate h3 { font-size: 1.25rem; }
.gate p  { color: var(--text-dim); font-size: .9375rem; max-width: 30ch; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: .9375rem;
  transition: transform .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(120deg, var(--gold), var(--hot)); color: #1A0A10; }
.btn-ghost   { background: var(--surface); border: 1px solid var(--line); }
.btn-block   { display: flex; width: 100%; }

/* =========================================================================
   Bottom navigation
   ========================================================================= */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--bar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  background: rgba(15, 7, 26, .88);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: .6875rem;
  color: var(--text-faint);
  font-weight: 600;
  padding: 6px 0;
}
.tabbar a .ic { font-size: 1.25rem; line-height: 1; }
.tabbar a.active { color: var(--text); }
.tabbar a.active .ic { filter: drop-shadow(0 0 10px rgba(255,176,32,.55)); }

/* =========================================================================
   Comment sheet
   ========================================================================= */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 2, 12, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 50;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 74dvh;
  background: var(--ink-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: translateY(102%);
  transition: transform .32s cubic-bezier(.32,.72,0,1);
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.sheet.open { transform: translateY(0); }

.sheet-grip {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  margin: 10px auto 4px;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheet-head h3 { margin: 0; }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 18px;
  -webkit-overflow-scrolling: touch;
}

.cmt { display: flex; gap: 10px; margin-bottom: 16px; }
.cmt .who { font-size: .8125rem; font-weight: 700; }
.cmt .when { font-size: .75rem; color: var(--text-faint); margin-left: 6px; font-weight: 400; }
.cmt .body { font-size: .9375rem; margin: 2px 0 0; word-break: break-word; }
.cmt .acts { margin-top: 5px; font-size: .75rem; color: var(--text-faint); display: flex; gap: 14px; }
.cmt .acts button { font-size: .75rem; color: inherit; font-weight: 600; }
.cmt .acts button.on { color: var(--hot); }
.cmt.reply { margin-left: 42px; }

.av {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .75rem;
  font-weight: 800;
  color: #140820;
}
.av.lg { width: 60px; height: 60px; font-size: 1.125rem; }

.cmt-empty { text-align: center; color: var(--text-faint); padding: 40px 20px; }

/* composer */
.composer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + var(--safe-b));
  background: var(--ink-2);
}
.emoji-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.emoji-strip::-webkit-scrollbar { display: none; }
.emoji-strip button {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.25rem;
  transition: transform .15s;
}
.emoji-strip button:active { transform: scale(1.2); }

.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 110px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: .9375rem;
  line-height: 1.4;
}
.composer textarea::placeholder { color: var(--text-faint); }
.composer .send {
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--gold), var(--hot));
  color: #1A0A10;
  font-size: 1.125rem;
  display: grid; place-items: center;
  transition: opacity .2s, transform .15s;
}
.composer .send:disabled { opacity: .35; }
.composer .send:active { transform: scale(.9); }

.reply-chip {
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: .8125rem;
  color: var(--text-dim);
  padding: 6px 12px;
  margin-bottom: 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
}
.reply-chip.on { display: flex; }

/* reaction picker */
.react-pop {
  position: absolute;
  right: 68px;
  bottom: calc(var(--bar-h) + var(--safe-b) + 96px);
  z-index: 8;
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-radius: var(--r-pill);
  background: rgba(20, 10, 34, .94);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(8px) scale(.9);
  transform-origin: right bottom;
  pointer-events: none;
  transition: opacity .18s, transform .22s cubic-bezier(.34,1.56,.64,1);
}
.react-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.react-pop button {
  width: 40px; height: 40px;
  font-size: 1.375rem;
  border-radius: 50%;
  transition: transform .15s;
}
.react-pop button:active,
.react-pop button.on { transform: scale(1.25); }

/* =========================================================================
   Standard pages (leaderboard, subscribe, profile, login)
   ========================================================================= */
.page {
  min-height: 100dvh;
  padding: 22px 18px calc(var(--bar-h) + var(--safe-b) + 28px);
  max-width: 640px;
  margin: 0 auto;
}
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--text-dim); font-size: .9375rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid var(--line);
}
.pill.good { background: rgba(61,220,151,.14); border-color: rgba(61,220,151,.45); color: var(--mint); }
.pill.warn { background: rgba(255,176,32,.14); border-color: rgba(255,176,32,.45); color: var(--gold); }
.pill.off  { background: var(--surface); color: var(--text-faint); }

/* ---------- leaderboard ---------- */
.period-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 18px;
  scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tabs a {
  flex: none;
  padding: 8px 15px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-dim);
}
.period-tabs a.active {
  background: linear-gradient(120deg, var(--gold), var(--hot));
  color: #1A0A10;
  border-color: transparent;
}

/* podium: three columns, middle raised */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 8px;
  margin-bottom: 24px;
}
.podium .slot { text-align: center; }
.podium .plinth {
  margin-top: 10px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 10px 4px 14px;
  background: linear-gradient(to bottom, var(--surface), transparent);
}
.podium .p1 .plinth { height: 104px; border-color: rgba(255,176,32,.5); }
.podium .p2 .plinth { height: 78px; }
.podium .p3 .plinth { height: 62px; }
.podium .rank { font-size: 1.5rem; font-weight: 800; }
.podium .p1 .rank { color: var(--gold); }
.podium .p2 .rank { color: var(--text-dim); }
.podium .p3 .rank { color: #C98B5E; }
.podium .nm { font-size: .8125rem; font-weight: 700; margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .pts { font-size: .75rem; color: var(--text-faint); }
.podium .av { margin: 0 auto; }

/* the winner's crown gets the one piece of ambient motion on the page */
@keyframes hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.podium .p1 .crown { font-size: 1.5rem; animation: hover 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .podium .p1 .crown { animation: none; }
}

.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid transparent;
  margin-bottom: 8px;
}
.board-row .pos {
  width: 26px;
  font-weight: 800;
  font-size: .9375rem;
  color: var(--text-faint);
  text-align: center;
  flex: none;
}
.board-row .nm { flex: 1; font-weight: 650; font-size: .9375rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .sub { font-size: .75rem; color: var(--text-faint); font-weight: 400; }
.board-row .pts { font-weight: 800; color: var(--gold); font-size: .9375rem; }
.board-row.me {
  border-color: rgba(255,176,32,.5);
  background: rgba(255,176,32,.1);
}

.me-strip {
  position: sticky;
  bottom: calc(var(--bar-h) + var(--safe-b) + 8px);
  margin-top: 16px;
  z-index: 10;
}

/* ---------- plan cards ---------- */
.plan {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 10px;
  background: var(--surface);
  transition: border-color .2s, background .2s, transform .15s;
}
.plan:active { transform: scale(.99); }
.plan.best { border-color: rgba(255,176,32,.55); background: rgba(255,176,32,.08); }
.plan .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan .name { font-weight: 750; font-size: 1.0625rem; }
.plan .price { font-weight: 800; font-size: 1.25rem; color: var(--gold); }
.plan .blurb { color: var(--text-dim); font-size: .875rem; margin: 4px 0 0; }
.plan .tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: .6875rem;
  font-weight: 800;
  color: var(--gold);
}

/* ---------- misc ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; padding: 14px 6px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.375rem; font-weight: 800; }
.stat span { font-size: .75rem; color: var(--text-faint); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--safe-b) + 22px);
  transform: translate(-50%, 20px);
  z-index: 90;
  padding: 11px 18px;
  border-radius: var(--r-pill);
  background: rgba(20, 10, 34, .96);
  border: 1px solid var(--line);
  font-size: .875rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.points { border-color: rgba(255,176,32,.55); color: var(--gold); }

.empty { text-align: center; padding: 60px 24px; color: var(--text-faint); }
.empty .big { font-size: 2.5rem; margin-bottom: 10px; }

.field {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  margin-bottom: 12px;
}
.field::placeholder { color: var(--text-faint); }
label.lbl { display: block; font-size: .8125rem; color: var(--text-dim); margin-bottom: 6px; }

.note { font-size: .8125rem; color: var(--text-faint); }
.error-box {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: rgba(255,45,120,.14);
  border: 1px solid rgba(255,45,120,.45);
  font-size: .875rem;
  margin-bottom: 14px;
}
.ok-box {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: rgba(61,220,151,.14);
  border: 1px solid rgba(61,220,151,.45);
  font-size: .875rem;
  margin-bottom: 14px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .feed { scroll-behavior: auto; }
}

/* wider screens: keep the phone shape, the content is vertical video */
@media (min-width: 760px) {
  .slide video, .slide .poster { object-fit: contain; }
  .slide { background: #0A0410; }
  .sheet { left: auto; right: 0; width: 420px; height: 100dvh;
           border-radius: var(--r-lg) 0 0 var(--r-lg); transform: translateX(102%); }
  .sheet.open { transform: translateX(0); }
}
