/* The live concert player that switches camera: the card of a live stream on a near black page. The picture is three
   canvas cameras stacked in .live__view; the one on air sits at the bottom, the one being picked grows from its tile
   over it. GSAP moves the .cam layers, the bar, the tiles and the chat lines; the hover looks live on the faces inside
   (.tile__face, .follow__face, .heart__face), so the two never write the same transform. */
:root {
  --page: #08080a;            /* the page */
  --card: #111115;            /* the body of the card */
  --edge: rgba(255, 255, 255, 0.07); /* the edge of the card */
  --ink: #f1f0f4;             /* the words */
  --muted: #8c8a97;           /* the small words */
  --violet: #8a7bff;          /* the cool stage light */
  --amber: #ffb26b;           /* the warm stage light */
  --live: #ff3d5a;            /* the Live badge and the hearts */
  --glass: rgba(22, 21, 30, 0.46); /* the glass of the controls */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(138, 123, 255, 0.07), transparent 70%),
    var(--page);
}

/* the page's own grain */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><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.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* the light of the camera on air, behind the card (GSAP tweens its colour) */
.halo {
  --tint: rgba(138, 123, 255, 0.34);
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(110vw, 760px);
  height: min(70vh, 460px);
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tint), transparent);
  filter: blur(40px);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the card */
.live {
  position: relative;
  z-index: 1;
  width: min(100%, 600px, (100vh - 150px) * 1.62);
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(180deg, #16161b, var(--card) 40%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 24px -12px rgba(0, 0, 0, 0.7),
    0 40px 80px -30px rgba(0, 0, 0, 0.85);
  opacity: 0;
}

.live__view {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #050507;
  isolation: isolate;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.cam {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform-origin: 0 0;
  visibility: hidden;
}

.cam.is-on {
  visibility: visible;
}

.cam__pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* the thin light on the rim of a tile growing into the frame */
.cam__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55), inset 0 0 24px rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
}

.live__shade {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 26%),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.4));
}

/* the dark band under the controls, only while they are up */
.live__scrim {
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(4, 4, 8, 0.62), transparent);
  opacity: 0;
}

.live__grain {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.11;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.09),
    0 6px 18px -8px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------------------- top of the picture */
.live__top {
  position: absolute;
  inset: clamp(8px, 2.4vw, 12px) clamp(8px, 2.4vw, 12px) auto;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

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

/* the Live badge: a word on red, never a dot */
.badge {
  padding: 3px 7px 3px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variation-settings: 'wdth' 112;
  color: #fff;
  background: linear-gradient(180deg, #ff5a72, var(--live));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px -4px rgba(255, 61, 90, 0.7);
}

.time {
  font-size: 11.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.viewers {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.viewers__icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1.3;
}

/* the rolling count: one column of ten digits per place */
.roll {
  display: inline-flex;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.roll__col {
  display: block;
  height: 1.2em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}

.roll__stack {
  display: flex;
  flex-direction: column;
}

.roll__stack span,
.roll__sym {
  display: block;
  height: 1.2em;
}

.roll__unit {
  margin-left: 4px;
  font-weight: 450;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------------------------------------------------------------- the camera name */
.toast {
  position: absolute;
  left: 50%;
  top: clamp(40px, 22%, 54px);
  z-index: 6;
  translate: -50% 0;
  pointer-events: none;
  opacity: 0;
}

.toast__glass {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.toast__icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the reactions */
.react {
  position: absolute;
  right: clamp(10px, 3vw, 18px);
  bottom: 0;
  width: 40px;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

.rx {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 0;
  height: 0;
}

.rx svg {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  overflow: visible;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}

.rx--heart path {
  fill: var(--live);
}

.rx--spark path {
  fill: var(--amber);
}

.rx--note path {
  fill: #ffffff;
}

/* ---------------------------------------------------------------- the glass controls */
.bar {
  position: absolute;
  left: clamp(6px, 2vw, 12px);
  right: clamp(6px, 2vw, 12px);
  bottom: clamp(6px, 2vw, 12px);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: clamp(2px, 1vw, 6px);
  height: clamp(36px, 9.5vw, 46px);
  padding: 0 clamp(4px, 1.4vw, 8px);
  border-radius: 14px;
  opacity: 0;
  visibility: hidden;
}

.ctl {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(26px, 7.4vw, 32px);
  height: clamp(26px, 7.4vw, 32px);
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.ctl svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctl__play {
  opacity: 0;
  fill: rgba(255, 255, 255, 0.92);
}

.ctl--vol {
  width: auto;
  display: flex;
  gap: 6px;
  padding: 0 6px;
}

.vol {
  position: relative;
  width: clamp(0px, 7vw, 38px);
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.vol__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  transform-origin: 0 50%;
  transform: scaleX(0.72);
}

.ctl--full {
  margin-left: 2px;
}

@media (hover: hover) {
  .ctl:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

.ctl:focus-visible,
.tile:focus-visible,
.follow:focus-visible,
.heart:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* the camera tiles: a live little picture each, the one on air with a light ring */
.tiles {
  display: flex;
  gap: clamp(4px, 1.2vw, 7px);
  margin-left: auto;
}

.tile {
  position: relative;
  flex: none;
  width: clamp(44px, 13vw, 66px);
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.tile__face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: #0b0a10;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 4px 10px -4px rgba(0, 0, 0, 0.7);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.tile__pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.78;
  transition: opacity 0.3s ease;
}

.tile__name {
  position: absolute;
  left: 4px;
  bottom: 2px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  font-variation-settings: 'wdth' 108;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.tile.is-on .tile__face {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.95), 0 0 14px -2px rgba(255, 255, 255, 0.28);
}

.tile.is-on .tile__pic,
.tile.is-hot .tile__pic {
  opacity: 1;
}

.tile.is-hot .tile__face {
  transform: translateY(-2px) scale(1.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 8px 16px -6px rgba(0, 0, 0, 0.8);
}

@media (hover: hover) {
  .tile:hover .tile__face {
    transform: translateY(-2px) scale(1.06);
  }

  .tile:hover .tile__pic {
    opacity: 1;
  }
}

/* ---------------------------------------------------------------- under the picture */
.live__info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(8px, 1.8vh, 12px) 8px clamp(6px, 1.2vh, 8px) 6px;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--violet), #3b2f8f 55%, #1a1530);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

.live__words {
  min-width: 0;
  flex: 1;
}

.live__title,
.live__sub {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live__title {
  font-size: 14px;
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.005em;
}

.live__sub {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.live__sep {
  width: 1px;
  height: 10px;
  background: rgba(255, 255, 255, 0.18);
}

.follow {
  flex: none;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.follow__face {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0 14px;
  border-radius: inherit;
  font-size: 12.5px;
  font-weight: 620;
  color: #0b0b0e;
  background: linear-gradient(180deg, #ffffff, #e4e3ea);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 12px -6px rgba(255, 255, 255, 0.4);
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.follow.is-done .follow__face {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

@media (hover: hover) {
  .follow:hover .follow__face {
    font-variation-settings: 'wdth' 116;
  }
}

/* ---------------------------------------------------------------- the chat */
.chat {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 8px 8px 6px;
}

.chat__list {
  --line: clamp(19px, 2.8vh, 21px);
  flex: 1;
  min-width: 0;
  height: calc(var(--line) * 3);
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 55%);
  mask-image: linear-gradient(180deg, transparent, #000 55%);
}

.chat__line {
  flex: none;
  height: var(--line);
  line-height: var(--line);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(241, 240, 244, 0.86);
}

.chat__who {
  font-weight: 640;
  margin-right: 6px;
  color: #c9c2ff;
}

.chat__who--warm {
  color: #ffd2a6;
}

.heart {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.heart__face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
}

.heart svg {
  width: 17px;
  height: 17px;
  overflow: visible;
}

.heart svg path {
  fill: rgba(255, 61, 90, 0);
  stroke: var(--live);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .heart:hover .heart__face {
    background: rgba(255, 61, 90, 0.12);
  }
}

@media (max-width: 380px) {
  .vol {
    display: none;
  }

  .ctl--vol {
    width: clamp(26px, 7.4vw, 32px);
    padding: 0;
  }
}
