/* The live reactions that rise and gather in the counter: the player of a made-up live session channel (Coda Room)
   on a dark page. An abstract video of soft light, the LIVE pill, the counter and a tray of four reactions. */
:root {
  --page: #08090c;            /* the page */
  --page-light: #15171d;      /* the soft light on the page */
  --player: #111217;          /* the body of the player */
  --well: #191a21;            /* the well behind the reactions */
  --ink: #f3f2ef;             /* the words */
  --muted: #8b8c95;           /* the small words */
  --line: rgba(255, 255, 255, 0.07); /* the thin lines */
  --live: #ff4f7b;            /* the LIVE pill and the heart */
  --heart: #ff4f7b;           /* the heart */
  --flame: #ff9a3c;           /* the flame */
  --clap: #ffd36b;            /* the applause */
  --star: #b9a6ff;            /* the star */
  --scene-a: #2b1c4f;         /* the deep light of the video */
  --scene-b: #ff6a8e;         /* the warm light of the video */
  --scene-c: #5d7bff;         /* the cold light of the video */
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(70% 60% at 50% 12%, var(--page-light), transparent 72%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: min(4vw, 4vh);
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the player */
.player {
  --pad: clamp(8px, min(2.4vw, 2.4vh), 12px);
  --lx: 70%;
  --ly: 0%;
  position: relative;
  width: min(480px, 100%, calc((100vh - 8vh) * 1.12));
  padding: var(--pad);
  border-radius: clamp(18px, min(5vw, 5vh), 24px);
  background: linear-gradient(180deg, #16171d, var(--player) 45%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 0 0 rgba(255, 255, 255, 0.05) inset,
    0 10px 24px -8px rgba(0, 0, 0, 0.6),
    0 40px 80px -30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* the 1px edge that catches the light where the pointer is */
.player__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(260px 180px at var(--lx) var(--ly), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the abstract video */
.video {
  position: relative;
  aspect-ratio: 16 / 10.4;
  border-radius: clamp(12px, min(3.4vw, 3.4vh), 16px);
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 110%, #3a2350, var(--scene-a) 45%, #0d0b18 100%);
  isolation: isolate;
}

.video__scene,
.video__scene > span {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glow {
  border-radius: 50%;
}

.video__scene > .glow--a {
  inset: auto;
  left: 8%;
  top: 22%;
  width: 62%;
  height: 80%;
  background: radial-gradient(closest-side, rgba(255, 106, 142, 0.6), rgba(255, 106, 142, 0) 100%);
  mix-blend-mode: screen;
}

.video__scene > .glow--b {
  inset: auto;
  right: 0;
  top: 4%;
  width: 58%;
  height: 74%;
  background: radial-gradient(closest-side, rgba(93, 123, 255, 0.5), rgba(93, 123, 255, 0) 100%);
  mix-blend-mode: screen;
}

/* two soft stage beams from above, swaying slowly */
.video__scene > .beam {
  inset: auto;
  top: -12%;
  width: 46%;
  height: 128%;
  background: linear-gradient(180deg, rgba(255, 236, 220, 0.5), rgba(255, 236, 220, 0) 78%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  mix-blend-mode: screen;
  opacity: 0.32;
  transform-origin: 50% 0;
}

.video__scene > .beam--l {
  left: 6%;
}

.video__scene > .beam--r {
  right: 4%;
}

/* the floor of the room, a few hairlines in perspective */
.video__scene > .floor {
  inset: auto 0 0 0;
  height: 38%;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 14%),
    linear-gradient(180deg, rgba(10, 8, 20, 0), rgba(10, 8, 20, 0.7));
  transform: perspective(200px) rotateX(48deg);
  transform-origin: 50% 100%;
  opacity: 0.8;
}

/* a thin ring that hangs in the light, like a lamp of the set */
.video__scene > .ring {
  inset: auto;
  left: 50%;
  top: 22%;
  width: 34%;
  aspect-ratio: 1;
  margin-left: -17%;
  border-radius: 50%;
  border: 1px solid rgba(255, 230, 240, 0.28);
  box-shadow: 0 0 40px rgba(255, 106, 142, 0.18), inset 0 0 30px rgba(93, 123, 255, 0.16);
}

.video__scene > .grain {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  opacity: 0.12;
  mix-blend-mode: overlay;
}

.video__scene > .vignette {
  background:
    linear-gradient(180deg, rgba(6, 6, 10, 0.55), rgba(6, 6, 10, 0) 28%, rgba(6, 6, 10, 0) 58%, rgba(6, 6, 10, 0.78)),
    radial-gradient(130% 100% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.4));
}

/* ---------------------------------------------------------------- over the video */
.video__top,
.video__bottom {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(9px, min(2.8vw, 2.8vh), 14px);
  z-index: 2;
}

.video__top {
  top: 0;
}

.video__bottom {
  bottom: 0;
  align-items: flex-end;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live__pill {
  display: inline-block;
  padding: 4px 8px 3px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ff6189, var(--live));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset, 0 4px 12px -4px rgba(255, 79, 123, 0.7);
  font-size: clamp(9px, min(2.6vw, 2.6vh), 11px);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.live__time {
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(10px, min(2.8vw, 2.8vh), 12px);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.78);
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border-radius: 999px;
  background: rgba(14, 12, 22, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 6px 18px -8px rgba(0, 0, 0, 0.6);
}

.counter__icon {
  display: block;
  width: clamp(14px, min(4vw, 4vh), 17px);
  height: clamp(14px, min(4vw, 4vh), 17px);
}

.counter__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--heart);
  filter: drop-shadow(0 1px 4px rgba(255, 79, 123, 0.5));
}

.counter__num,
.watching__num {
  display: inline-flex;
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}

.counter__num {
  font-size: clamp(12px, min(3.4vw, 3.4vh), 14px);
  color: #fff;
}

/* a digit is a window one line tall with a column 0-9 0-9 inside */
.digit {
  position: relative;
  display: inline-block;
  height: 1em;
  overflow: hidden;
  -webkit-mask: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  padding: 0;
}

.digit__nudge,
.digit__col {
  display: block;
}

.digit__col span {
  display: block;
  height: 1em;
  line-height: 1;
}

.sign {
  display: inline-block;
  line-height: 1;
}

.channel {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.channel__mark {
  flex: none;
  width: clamp(24px, min(7vw, 7vh), 30px);
  height: clamp(24px, min(7vw, 7vh), 30px);
}

.channel__mark rect {
  fill: rgba(255, 255, 255, 0.1);
  stroke: rgba(255, 255, 255, 0.22);
}

.channel__mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.channel__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.channel__name {
  font-size: clamp(11px, min(3.2vw, 3.2vh), 13px);
  font-weight: 650;
  font-stretch: 108%;
  white-space: nowrap;
}

.channel__title {
  font-size: clamp(10px, min(2.9vw, 2.9vh), 12px);
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watching {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(10px, min(2.9vw, 2.9vh), 12px);
  color: rgba(255, 255, 255, 0.74);
}

.watching svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* ---------------------------------------------------------------- the controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(8px, min(2.4vw, 2.4vh), 12px) 2px 0 clamp(4px, 1.4vw, 8px);
}

.controls__left {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4vw, 12px);
  flex: 1;
  min-width: 0;
}

.ctl {
  flex: none;
  width: clamp(16px, min(4.6vw, 4.6vh), 19px);
  height: clamp(16px, min(4.6vw, 4.6vh), 19px);
  fill: rgba(255, 255, 255, 0.82);
}

.ctl--line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the live edge: a full hairline with the knob at its end */
.edge {
  position: relative;
  flex: 1;
  min-width: 18px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.edge__bar {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 79, 123, 0.3), var(--live));
}

.edge__knob {
  position: absolute;
  right: -4px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.tray {
  --size: clamp(34px, min(9.6vw, 9.6vh), 42px);
  position: relative;
  flex: none;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--well);
  box-shadow: 0 0 0 1px var(--line) inset, 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* the soft pill that slides under the reaction the pointer is on */
.tray__pill {
  position: absolute;
  left: 0;
  top: 3px;
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  opacity: 0;
  pointer-events: none;
}

.react {
  position: relative;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.react:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 1px;
}

.react__halo {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tint), transparent);
  opacity: 0;
  pointer-events: none;
}

.react__icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  height: 56%;
  margin: -28% 0 0 -28%;
  overflow: visible;
}

.react[data-react='heart'] { --tint: rgba(255, 79, 123, 0.55); }
.react[data-react='flame'] { --tint: rgba(255, 154, 60, 0.55); }
.react[data-react='clap'] { --tint: rgba(255, 211, 107, 0.5); }
.react[data-react='star'] { --tint: rgba(185, 166, 255, 0.55); }

.f-heart { fill: var(--heart); }
.f-flame { fill: var(--flame); }
.f-flame-in { fill: #ffe2a6; }
.f-clap { fill: var(--clap); }
.f-clap-b { fill: #ffb347; }
.f-spark { fill: none; stroke: var(--clap); stroke-width: 1.5; stroke-linecap: round; }
.f-star { fill: var(--star); stroke: var(--star); stroke-width: 1.6; stroke-linejoin: round; }

/* the canvas where the reactions fly, over the whole player */
.sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
  z-index: 5;
}

/* ---------------------------------------------------------------- the pointer of the walk on its own */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #0b0b0f;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .player {
    transition: opacity 0.6s ease;
  }
}
