:root {
  color-scheme: dark;
  --ink: #07131f;
  --night: #050b12;
  --paper: #f7fafc;
  --muted: #8fa6b7;
  --cyan: #00d7ff;
  --cyan-soft: #96efff;
  --pad: clamp(18px, 3.2vw, 64px);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  background: var(--night);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.social-wall {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 83% 14%, rgba(0, 215, 255, .13), transparent 28%),
    linear-gradient(145deg, #07131f 0%, #03070c 74%);
}

.screen-background {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0;
  background-position: center;
  background-size: cover;
  transition: opacity 300ms ease;
}

.screen-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(3,7,12,.66), rgba(3,7,12,.82));
}

.social-wall.has-background .screen-background { opacity: .48; }

.social-wall::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, #000, transparent 68%);
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  padding: clamp(16px, 2.2vh, 28px) var(--pad);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(5,11,18,.56);
  backdrop-filter: blur(10px);
  font-size: clamp(11px, .8vw, 15px);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  pointer-events: auto;
}

.live-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(0,215,255,.12), 0 0 18px rgba(0,215,255,.65);
  animation: pulse 2s infinite;
}

.stage {
  position: absolute;
  z-index: 1;
  inset: 0 0 6px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, .85fr);
}

.ambient {
  position: absolute;
  inset: -8%;
  opacity: .2;
  filter: blur(70px) saturate(1.3);
  background-position: center;
  background-size: cover;
  transform: scale(1.08);
  transition: background-image 700ms ease;
}

.media-wrap {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 0 clamp(26px, 3.2vw, 56px) 0 0;
  background: #101923;
}

.media-wrap::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -34px;
  background-image: var(--media-image);
  background-position: center;
  background-size: cover;
  filter: blur(28px) saturate(.8);
  opacity: .42;
  transform: scale(1.08);
}

.media-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset -80px 0 110px rgba(3,7,12,.35);
  pointer-events: none;
}

#media, #video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 320ms ease;
}

.stage.changing #media, .stage.changing #video { opacity: 0; }
#video[hidden], #media[hidden] { display: none; }

.media-shade {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(2,6,10,.58));
}

.post-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding: clamp(30px, 4.3vw, 82px) var(--pad) clamp(28px, 4vh, 52px) clamp(32px, 4vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.account { display: flex; align-items: center; gap: 16px; }
.avatar { width: clamp(52px, 4.2vw, 74px); aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); }
.account-name { font-size: clamp(18px, 1.55vw, 28px); font-weight: 800; }
.account-handle { margin-top: 3px; color: var(--muted); font-size: clamp(13px, 1vw, 18px); }
.verified { display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 7px; border-radius: 50%; background: var(--cyan); color: var(--ink); font-size: 13px; vertical-align: 2px; }
.dot { margin: 0 5px; }
.x-mark { margin-left: auto; align-self: flex-start; font-size: clamp(25px, 2.2vw, 38px); }

.caption {
  max-width: 22ch;
  margin: clamp(30px, 5vh, 62px) 0 22px;
  font-size: clamp(25px, 2.4vw, 48px);
  line-height: 1.08;
  font-weight: 760;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.mention { color: var(--cyan-soft); }

.tags { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--cyan); font-size: clamp(16px, 1.35vw, 24px); font-weight: 760; }

.post-footer {
  margin-top: auto;
  padding-top: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.pager { display: flex; align-items: center; gap: 8px; }
.pager span { width: 8px; height: 8px; border-radius: 99px; background: #41515f; transition: width 250ms ease, background 250ms ease; }
.pager span.active { width: 30px; background: var(--cyan); }

.progress-track { position: absolute; z-index: 15; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--cyan); box-shadow: 0 0 14px rgba(0,215,255,.65); }
.progress-track span.running { animation: progress var(--duration) linear forwards; }

.nav, .pause {
  position: absolute;
  z-index: 20;
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  background: rgba(5,11,18,.55);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease, background 200ms ease;
  cursor: pointer;
}

.social-wall:hover .nav, .social-wall:hover .pause, .nav:focus-visible, .pause:focus-visible { opacity: 1; }
.nav:hover, .pause:hover { background: rgba(0,215,255,.18); transform: scale(1.06); }
.nav { top: 50%; width: 48px; height: 64px; border-radius: 14px; font-size: 36px; }
.prev { left: 18px; }
.next { right: 18px; }
.pause { right: var(--pad); top: clamp(76px, 8vh, 96px); width: 42px; height: 42px; border-radius: 50%; font-size: 14px; }

.error { position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 24px; border-radius: 14px; background: #111d28; color: #fff; font-weight: 700; }

@keyframes progress { to { width: 100%; } }
@keyframes pulse { 50% { opacity: .5; transform: scale(.85); } }

@media (max-aspect-ratio: 4/5) {
  .stage { grid-template-columns: 1fr; grid-template-rows: minmax(0, 56%) minmax(0, 44%); }
  .media-wrap { border-radius: 0 0 36px 36px; }
  .post-copy { padding: clamp(22px, 4vw, 42px) var(--pad) 26px; justify-content: flex-start; }
  .caption { max-width: 28ch; margin: 22px 0 14px; font-size: clamp(24px, 4.6vw, 44px); }
  .post-footer { padding-top: 16px; }
}

@media (max-width: 680px) {
  :root { --pad: 18px; }
  .topbar { height: auto; padding-top: 14px; padding-bottom: 14px; }
  .live-pill { padding: 8px 11px; font-size: 9px; }
  .stage { inset: 0 0 6px; grid-template-rows: minmax(0, 52%) minmax(0, 48%); }
  .account { gap: 10px; }
  .avatar { width: 46px; }
  .caption { font-size: clamp(22px, 6.2vw, 34px); }
  .pause { top: 62px; right: 18px; }
}

@media (max-height: 650px) and (min-aspect-ratio: 4/5) {
  .topbar { height: auto; padding-top: 10px; padding-bottom: 10px; }
  .stage { inset: 0 0 6px; }
  .post-copy { padding-top: 20px; padding-bottom: 18px; }
  .avatar { width: 46px; }
  .account-name { font-size: clamp(16px, 1.4vw, 22px); }
  .caption { margin: 18px 0 14px; font-size: clamp(21px, 2.35vw, 38px); line-height: 1.06; }
  .tags { font-size: clamp(13px, 1.1vw, 18px); }
  .post-footer { padding-top: 14px; }
  .pause { top: 60px; }
}

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