:root {
  --page: #0a0a0c;
  --panel: #131317;
  --card: #18181d;
  --line: rgba(255, 255, 255, 0.07);
  --ink: #f3f3f6;
  --soft: #a9a9b3;
  --muted: #6e6e79;
  --faint: #3a3a42;
  --accent: #b4a9ff;     /* the lilac of the liquid metal */
  --ice: #a6d6ff;        /* the cold side of the metal */
  --silver: #e6e6f0;     /* the bright side of the metal */
  --star: #ecebf3;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(90% 60% at 50% 0%, #15151b 0%, var(--page) 64%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.stage {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2.4vh, 28px) clamp(10px, 3vw, 28px);
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* the box that is scaled down when the panel is taller than the page (the script measures it) */
.fit {
  position: relative;
  flex: none;
  width: min(540px, 100%);
  transform-origin: 50% 50%;
}

/* ------------------------------------------------------------------ the panel */
.panel {
  position: relative;
  padding: clamp(12px, min(3.6vw, 2.8vh), 20px);
  border-radius: clamp(16px, 3.6vw, 22px);
  background: linear-gradient(180deg, #16161b 0%, var(--panel) 40%);
  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 -10px rgba(0, 0, 0, 0.7),
    0 40px 80px -30px rgba(0, 0, 0, 0.85);
  opacity: 0;
}
.panel::before {
  /* the top edge catching the light */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 32%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.panel__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(70% 34% at 30% 0%, rgba(180, 169, 255, 0.07), transparent 72%);
}

/* ------------------------------------------------------------------ head */
.head {
  display: flex;
  align-items: center;
  gap: clamp(9px, 2.4vw, 12px);
}
.head__thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(32px, 5vh, 40px);
  aspect-ratio: 1;
  border-radius: 11px;
  background: linear-gradient(160deg, #26262e, #18181d);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
.head__thumb svg {
  width: 58%;
  fill: none;
  stroke: var(--silver);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.head__title { display: grid; gap: 1px; min-width: 0; flex: 1; }
.head__name {
  font-size: clamp(13.5px, min(3.8vw, 2.5vh), 15.5px);
  font-weight: 620;
  letter-spacing: -0.01em;
}
.head__meta {
  font-size: clamp(10.5px, min(3vw, 1.9vh), 12px);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head__score { display: flex; align-items: center; gap: 8px; flex: none; }
.head__rating {
  font-size: clamp(22px, min(6.4vw, 4.2vh), 28px);
  font-weight: 560;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.head__right { display: grid; gap: 3px; justify-items: start; }
.head__count {
  font-size: clamp(10px, min(2.8vw, 1.8vh), 11.5px);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ stars, drawn in SVG by the script */
.stars { display: inline-flex; gap: 1.5px; line-height: 0; }
.stars svg { width: clamp(9px, min(2.6vw, 1.7vh), 11px); height: auto; overflow: visible; }
.stars--big svg { width: clamp(10px, min(2.9vw, 1.9vh), 12px); }
.star__back { fill: var(--faint); }
.star__front { fill: var(--star); }

/* ------------------------------------------------------------------ topics */
.topics {
  position: relative;
  display: flex;
  gap: 4px;
  margin-top: clamp(11px, 2.4vh, 18px);
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.topics__pill {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 60px;
  border-radius: 9px;
  background: linear-gradient(180deg, #2a2a33, #212128);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 6px 14px -6px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
}
.topics__metal {
  /* the liquid metal rim of the pill: a moving gradient seen through a 1px ring */
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    linear-gradient(100deg, rgba(166, 214, 255, 0.0) 0%, rgba(230, 230, 240, 0.75) 22%, rgba(180, 169, 255, 0.55) 40%, rgba(166, 214, 255, 0.1) 60%, rgba(230, 230, 240, 0.6) 80%, rgba(180, 169, 255, 0.1) 100%);
  background-size: 220% 100%;
  background-position: calc(var(--flow, 0) * 1%) 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.topic {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: clamp(30px, 5vh, 36px);
  padding: 0 6px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: clamp(11.5px, min(3.3vw, 2.1vh), 13px);
  font-weight: 520;
  cursor: pointer;
  transition: color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.topic:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.topic__name { white-space: nowrap; }
.topic__count {
  font-size: 0.85em;
  font-weight: 480;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.topic.is-on { color: var(--ink); }
.topic.is-on .topic__count { color: var(--accent); }
@media (hover: hover) {
  .topic:hover { color: var(--ink); }
}

/* ------------------------------------------------------------------ the summary */
.sum {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: clamp(10px, 2.2vh, 15px);
  padding: 0 2px;
  min-height: calc(clamp(12px, min(3.5vw, 2.2vh), 13.5px) * 1.4 * 2 + clamp(10px, min(2.8vw, 1.8vh), 11.5px) * 1.3 + 4px);
}
.sum__spark {
  flex: none;
  width: clamp(13px, 2.2vh, 15px);
  margin-top: 1px;
  fill: var(--accent);
}
.sum__body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.sum__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(10px, min(2.8vw, 1.8vh), 11.5px);
  line-height: 1.3;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sum__label { color: var(--soft); font-weight: 560; letter-spacing: 0.01em; }
.sum__mood { display: inline-flex; align-items: center; gap: 6px; opacity: 0; }
.sum__bar {
  position: relative;
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sum__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ice), var(--accent));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.sum__text {
  font-size: clamp(12px, min(3.5vw, 2.2vh), 13.5px);
  line-height: 1.4;
  color: var(--ink);
  font-weight: 440;
  letter-spacing: -0.003em;
}
.sum__text.is-idle { color: var(--muted); }
.sum__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--silver), var(--accent));
}

/* ------------------------------------------------------------------ reviews */
.reviews {
  display: grid;
  gap: clamp(6px, 1.2vh, 9px);
  margin-top: clamp(9px, 2vh, 14px);
}
.review {
  position: relative;
  padding: clamp(9px, 1.7vh, 13px) clamp(10px, 3vw, 14px) clamp(10px, 1.8vh, 13px);
  border-radius: 13px;
  background: linear-gradient(180deg, #1b1b21, var(--card));
  box-shadow: 0 0 0 1px var(--line) inset, 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition: box-shadow 0.4s ease;
}
.review.is-hit {
  box-shadow:
    0 0 0 1px rgba(180, 169, 255, 0.16) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 10px 26px -14px rgba(140, 120, 255, 0.28);
}
.review.is-quiet .review__head { opacity: 0.55; }
.review__light {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}
.review__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: clamp(10.5px, min(3vw, 1.9vh), 12px);
  transition: opacity 0.45s ease;
}
.review__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(18px, 3vh, 22px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(150deg, #34343e, #23232a);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07) inset;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--soft);
}
.review__who { font-weight: 580; color: var(--ink); }
.review__date { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.review__text {
  position: relative;
  margin: clamp(5px, 1vh, 8px) 0 0;
  font-size: clamp(11.5px, min(3.4vw, 2.1vh), 13.5px);
  line-height: 1.5;
  color: #c9c9d2;
}
.s { transition: color 0.45s ease, opacity 0.45s ease; }
.reviews.is-lit .s { opacity: var(--dim, 0.4); }
.reviews.is-lit .s.is-on { opacity: 1; color: #ffffff; }

/* ------------------------------------------------------------------ the pointer the demo drives by itself */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  fill: #ffffff;
  stroke: #0a0a0c;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 420px) {
  .topic { flex-direction: column; gap: 0; height: clamp(34px, 6vh, 40px); line-height: 1.15; }
  .head__score { gap: 6px; }
  .head__meta { font-size: 10.5px; }
}
