/* ============================================================================
   heatmeter.css – OBS-Widget "Heat Meter" (Head & Shoulders).

   Originalgetreuer Klon des für uns gestalteten Thermometer-Overlays
   (skylinetv.live/temp/heatmeter), reduziert auf das, was im Stream zu sehen
   sein soll:
     - KEIN Kopftext "HEAT METER"
     - KEINE Skalen-Labels (MAX HEAT / HEATING UP / WARM)
     - KEIN Fußband ("CHAT IS HEATING IT UP!")
     - Kolben-Icon = Head-&-Shoulders-Logo (statt Marken-Swirl)
     - Live-Badge zeigt die BERECHNETE PUNKTZAHL (kein "%"/"VOTES")

   Das Quecksilber (rot, oben) wächst mit dem HOT-Anteil der Stimmen; der blaue
   "Coolant" steigt von unten. Die Logik kommt aus heatmeter.js (window.HC).
   ========================================================================== */

/* ---- Sans Flake (Head-&-Shoulders-Markenschrift) ------------------------ */
@font-face {
  font-family: "SansFlake";
  src: url("/assets/fonts/SansFlake-Regular.woff2") format("woff2"),
  url("/assets/fonts/SansFlake-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SansFlake";
  src: url("/assets/fonts/SansFlake-Bold.woff2") format("woff2"),
  url("/assets/fonts/SansFlake-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Head-&-Shoulders-Markenblau #053e82 ist der Anker (--hs-navy). Die übrige
     Blau-Skala ist daraus abgeleitet – dunkler nach unten, heller (Kobalt/Cyan)
     nach oben –, damit die glasige Tiefe des Thermometers erhalten bleibt. */
  --hs-abyss: #021a3d;   /* tiefster Innenschatten */
  --hs-deep: #032f66;    /* dunkles Navy */
  --hs-navy: #053e82;    /* ← Marken-Anker (auch Fließtextfarbe) */
  --hs-blue: #0a5bb0;    /* Kobalt (mittlere Ableitung) */
  --hs-cobalt: #1f86d8;  /* helles Azur */
  --hs-cyan: #45c3f0;    /* Highlight-Cyan */
  --hs-bright: #7fe0fb;  /* hellste Kühlmittel-Spitze */
  --hs-ice: #e8f9ff;
  --heat-yellow: #ffe04c;
  --heat-orange: #ff8d1d;
  --heat-red: #ff281d;

  /* Vom JS gesetzt – hier nur sinnvolle Startwerte fürs erste Bild. */
  --level: 50%;            /* HOT-Anteil 0–100 % (rotes Quecksilber von oben) */
  --badge-top: 330px;      /* Y-Position der Live-Badge (folgt dem Pegel)     */
  --surface-rgb: 255 151 31;
  --transition-ms: 2200ms;

  --meter-left: clamp(22px, 3.1vw, 58px);
  --board-right: clamp(22px, 3.1vw, 58px);
  --meter-scale: 1;
  font-family: "SansFlake", "Arial Narrow", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

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

/* OBS-Overlay: standardmäßig transparent (Body trägt .is-transparent). */
body {
  color: var(--hs-navy);
  background: #ffffff;
}

body.is-transparent {
  background: transparent;
}

/* Operator-Schalter (über das 'settings'-WS-Event aus heatmeter.js):
   gesamtes Widget bzw. nur das Scoreboard ausblenden. */
body.hc-widget-hidden .overlay-stage { display: none; }
body.hc-scoreboard-hidden .scoreboard { display: none; }

.overlay-stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: var(--meter-left);
  background: transparent;
}

/* ---- Wurzel-Karte (nur noch der Thermometer-Block) ---------------------- */
.heatmeter {
  position: relative;
  isolation: isolate;
  width: 330px;
  height: 664px;            /* Kopf-/Fußzeile entfernt -> nur noch der Visual-Block */
  transform: scale(var(--meter-scale));
  transform-origin: left center;
  filter: drop-shadow(0 14px 24px rgba(0, 45, 105, 0.12));
}

.heatmeter::before {
  content: "";
  position: absolute;
  z-index: -2;
  left: 65px;
  top: 20px;
  width: 205px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(19, 184, 233, 0.11), transparent 69%);
  filter: blur(15px);
  pointer-events: none;
}

.heatmeter__visual {
  position: relative;
  width: 100%;
  height: 100%;
}

.thermometer {
  position: absolute;
  z-index: 3;
  left: 79px;
  top: 2px;
  width: 162px;
  height: 640px;
}

.thermometer__aura {
  position: absolute;
  z-index: -1;
  left: 26px;
  top: 1px;
  width: 109px;
  height: 538px;
  border-radius: 58px 58px 28px 28px;
  opacity: 0.35;
  background: linear-gradient(to top, rgba(255, 37, 24, 0.28), rgba(255, 132, 28, 0.12) 47%, rgba(18, 193, 238, 0.15) 73%, rgba(10, 91, 176, 0.22));
  filter: blur(12px);
  transition: opacity var(--transition-ms) ease, filter var(--transition-ms) ease, transform var(--transition-ms) ease;
}

.heatmeter[data-zone="warm"] .thermometer__aura {
  opacity: 0.65;
  filter: blur(15px);
}

.heatmeter[data-zone="hot"] .thermometer__aura {
  opacity: 1;
  filter: blur(20px);
  transform: scaleX(1.13);
  animation: hot-aura 1.8s ease-in-out infinite;
}

.thermometer__tube-outline {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  width: 94px;
  height: 548px;
  padding: 3px;
  border-radius: 49px 49px 23px 23px;
  background: linear-gradient(92deg, #053e82 0%, #1f86d8 38%, #55d0f5 63%, #075199 100%);
  box-shadow:
          0 0 0 1px rgba(0, 33, 91, 0.52),
          0 12px 24px rgba(0, 39, 100, 0.22),
          0 0 18px rgba(16, 190, 237, 0.28);
  transform: translateX(-50%);
}

.thermometer__tube-shell {
  width: 100%;
  height: 100%;
  padding: 7px;
  border-radius: 46px 46px 20px 20px;
  background: linear-gradient(90deg, #ffffff 0%, #d9e6ed 21%, #ffffff 49%, #cbdce7 77%, #ffffff 100%);
  box-shadow:
          inset 0 2px 3px rgba(255, 255, 255, 0.95),
          inset 6px 0 9px rgba(0, 48, 112, 0.08),
          inset -5px 0 8px rgba(0, 48, 112, 0.10);
}

.thermometer__track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 38px 38px 14px 14px;
  background:
          linear-gradient(to top,
          rgba(245, 17, 24, 0.22) 0%,
          rgba(255, 100, 20, 0.17) 31%,
          rgba(255, 221, 73, 0.10) 48%,
          rgba(39, 205, 240, 0.09) 62%,
          rgba(10, 91, 176, 0.18) 100%),
          linear-gradient(90deg, rgba(0, 44, 102, 0.14), rgba(255, 255, 255, 0.55), rgba(0, 45, 105, 0.09));
  box-shadow: inset 0 0 15px rgba(0, 35, 91, 0.22);
}

.thermometer__zone-glow {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
          radial-gradient(ellipse at 50% 90%, rgba(255, 39, 26, 0.38), transparent 29%),
          radial-gradient(ellipse at 50% 52%, rgba(255, 191, 54, 0.16), transparent 22%),
          radial-gradient(ellipse at 50% 12%, rgba(20, 189, 239, 0.20), transparent 31%);
  mix-blend-mode: screen;
}

.thermometer__coolant {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% - var(--level));
  min-height: 0;
  overflow: hidden;
  border-radius: 38px 38px 0 0;
  background:
          linear-gradient(to bottom,
          #053e82 0%,
          #0a5bb0 42%,
          #2ba7e2 78%,
          #7fe0fb 100%);
  box-shadow:
          inset 10px 0 12px rgba(255, 255, 255, 0.18),
          inset -10px 0 13px rgba(0, 27, 82, 0.25),
          0 8px 18px rgba(38, 205, 241, 0.50);
  transition: height var(--transition-ms) cubic-bezier(0.16, 1, 0.3, 1);
}

.thermometer__liquid {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--level);
  min-height: 0;
  overflow: hidden;
  border-radius: 0 0 14px 14px;
  background:
          radial-gradient(ellipse at 50% 88%, rgba(255, 255, 255, 0.16), transparent 34%),
          linear-gradient(to top,
          #e80018 0%,
          #ff271d 28%,
          #ff5c1c 55%,
          #ff9d21 79%,
          #ffe04c 100%);
  box-shadow:
          inset 10px 0 12px rgba(255, 255, 255, 0.17),
          inset -10px 0 13px rgba(112, 0, 24, 0.24),
          0 -8px 18px rgba(255, 86, 22, 0.50);
  transition: height var(--transition-ms) cubic-bezier(0.16, 1, 0.3, 1);
}

.thermometer__liquid::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
          radial-gradient(circle at 35% 78%, rgba(255, 255, 255, 0.24) 0 3px, transparent 3.8px),
          radial-gradient(circle at 62% 68%, rgba(255, 255, 255, 0.19) 0 2px, transparent 2.8px),
          linear-gradient(105deg, transparent 17%, rgba(255, 255, 255, 0.20) 34%, transparent 51%);
  animation: liquid-shimmer 4.3s ease-in-out infinite;
}

.thermometer__shimmer {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 18, 75, 0.11), transparent 28%, rgba(255, 255, 255, 0.20) 51%, transparent 70%, rgba(0, 18, 75, 0.12));
}

.heat-particle {
  position: absolute;
  z-index: 4;
  left: var(--x);
  bottom: -12px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  opacity: 0;
  background: rgba(255, 244, 173, var(--alpha));
  box-shadow:
          0 0 7px rgba(255, 226, 86, 0.95),
          0 0 13px rgba(255, 83, 25, 0.54);
  animation: particle-rise var(--duration) linear var(--delay) infinite;
}

.thermometer__surface {
  position: absolute;
  z-index: 6;
  left: 1px;
  right: 1px;
  bottom: calc(var(--level) - 6px);
  height: 13px;
  border-radius: 50%;
  opacity: 0.96;
  background: rgb(var(--surface-rgb));
  box-shadow:
          0 0 9px rgb(var(--surface-rgb) / 0.96),
          0 0 19px rgb(var(--surface-rgb) / 0.70),
          inset 0 3px 4px rgba(255, 255, 255, 0.72);
  transition: bottom var(--transition-ms) cubic-bezier(0.16, 1, 0.3, 1), background-color 700ms ease, box-shadow 700ms ease;
  animation: surface-pulse 1.55s ease-in-out infinite;
}

.thermometer__ticks {
  position: absolute;
  z-index: 7;
  inset: 18px 0 20px;
  opacity: 0.82;
  background:
          repeating-linear-gradient(to bottom,
          transparent 0 48px,
          rgba(255, 255, 255, 0.92) 48px 50px,
          transparent 50px 61px),
          repeating-linear-gradient(to bottom,
          transparent 0 23px,
          rgba(255, 255, 255, 0.60) 23px 24px,
          transparent 24px 30px);
  -webkit-mask-image: linear-gradient(90deg, #000 0 20%, transparent 20% 80%, #000 80% 100%);
  mask-image: linear-gradient(90deg, #000 0 20%, transparent 20% 80%, #000 80% 100%);
  pointer-events: none;
}

.thermometer__highlight {
  position: absolute;
  z-index: 8;
  left: 10px;
  top: 30px;
  bottom: 32px;
  width: 9px;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.05));
  filter: blur(0.3px);
  pointer-events: none;
}

.thermometer__connector {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 83px;
  width: 78px;
  height: 90px;
  padding: 3px 10px 0;
  background: linear-gradient(90deg, #043a78, #45c3f0 54%, #075199);
  box-shadow: 0 7px 16px rgba(0, 51, 119, 0.22);
  transform: translateX(-50%);
}

.thermometer__connector::before {
  content: "";
  position: absolute;
  inset: 3px 4px 0;
  background: linear-gradient(90deg, #ffffff 0%, #dbe9ef 30%, #ffffff 51%, #d3e3eb 76%, #ffffff 100%);
}

.thermometer__connector-liquid {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #075199, #2ba7e2 54%, #0a5bb0);
  box-shadow: inset 7px 0 9px rgba(255, 255, 255, 0.18);
}

.thermometer__bulb {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 0;
  width: 158px;
  height: 158px;
  border-radius: 50%;
  background: linear-gradient(135deg, #032f66, #2ba7e2 51%, #053e82);
  box-shadow:
          0 0 0 1px rgba(0, 30, 85, 0.68),
          0 14px 28px rgba(0, 39, 98, 0.28),
          0 0 24px rgba(22, 191, 235, 0.48);
  transform: translateX(-50%);
}

.thermometer__bulb-shell {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #d7e6ed 46%, #ffffff 75%);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.95);
}

.thermometer__bulb-ring {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #45c3f0, #0a5bb0 54%, #053e82);
  box-shadow:
          0 0 0 2px rgba(0, 75, 168, 0.72),
          0 0 20px rgba(25, 207, 242, 0.70),
          inset 0 4px 8px rgba(255, 255, 255, 0.30);
  animation: bulb-ring-pulse 2s ease-in-out infinite;
}

.thermometer__bulb-core {
  position: absolute;
  inset: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #1f86d8 0%, #053e82 54%, #021a3d 100%);
  box-shadow:
          inset -13px -14px 20px rgba(0, 16, 57, 0.48),
          inset 6px 7px 13px rgba(64, 192, 240, 0.22),
          0 0 0 1px rgba(255, 255, 255, 0.46);
  overflow: hidden;
}

/* Kolben-Icon: das Head-&-Shoulders-Logo (weiß) im Kern. */
.thermometer__bulb-core .brand-logo {
  width: 84px;
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 12, 40, 0.55));
}

.thermometer__bulb-glint {
  position: absolute;
  z-index: 15;
  left: 37px;
  top: 27px;
  width: 34px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  filter: blur(1px);
  transform: rotate(-26deg);
}

/* ========================================================================== */
/*  Live-Badge – zeigt die BERECHNETE PUNKTZAHL und zeigt mit dem Pointer auf  */
/*  den aktuellen Pegel (Y folgt --badge-top).                                 */
/* ========================================================================== */
.live-readout {
  position: absolute;
  z-index: 20;
  left: 218px;
  top: var(--badge-top);
  width: auto;
  min-width: 96px;
  max-width: 210px;
  padding: 10px 13px 9px 13px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(5, 62, 130, 0.98), rgba(14, 104, 190, 0.98));
  color: #ffffff;
  box-shadow:
          0 0 0 1px rgba(0, 52, 126, 0.72),
          0 9px 18px rgba(0, 47, 109, 0.24),
          inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(-50%);
  transition: top var(--transition-ms) cubic-bezier(0.16, 1, 0.3, 1), background 500ms ease;
}

.live-readout__pointer {
  position: absolute;
  left: -26px;
  top: 50%;
  width: 28px;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 63, 139, 0.48), 0 0 8px rgba(0, 118, 207, 0.32);
}

.live-readout__pointer::after {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: rgb(var(--surface-rgb));
  box-shadow: 0 0 8px rgb(var(--surface-rgb) / 0.76);
  transition: background-color 700ms ease, box-shadow 700ms ease;
}

.live-readout__value {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 0.8;
}

.live-readout__value strong {
  font-size: 44px;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.heatmeter[data-zone="hot"] .live-readout {
  background: linear-gradient(145deg, #d81020, #ff6b1d);
}

/* ---- IDLE: alles leicht gedämpft, bis eine Runde läuft ------------------ */
.heatmeter.is-idle .thermometer__liquid,
.heatmeter.is-idle .thermometer__coolant {
  filter: saturate(0.5) brightness(0.82);
}
.heatmeter.is-idle .thermometer__aura {
  opacity: 0.28;
}
.heatmeter.is-idle .live-readout {
  opacity: 0.78;
}

/* ---- Eingangs-Animation -------------------------------------------------- */
.heatmeter.is-entering .live-readout {
  animation: enter-readout 0.85s 0.12s both cubic-bezier(0.16, 1, 0.3, 1);
}

.heatmeter.is-entering .thermometer {
  animation: enter-meter 0.95s 0.05s both cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes enter-readout {
  from { opacity: 0; transform: translate(16px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}

@keyframes enter-meter {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes particle-rise {
  0% { transform: translate3d(0, 20px, 0) scale(0.65); opacity: 0; }
  14% { opacity: var(--alpha); }
  82% { opacity: calc(var(--alpha) * 0.72); }
  100% { transform: translate3d(var(--drift), -525px, 0) scale(1.18); opacity: 0; }
}

@keyframes liquid-shimmer {
  0%, 15% { transform: translateX(-115%); }
  58%, 100% { transform: translateX(115%); }
}

@keyframes surface-pulse {
  0%, 100% { transform: scaleX(0.95) scaleY(0.88); }
  50% { transform: scaleX(1.04) scaleY(1.08); }
}

@keyframes bulb-ring-pulse {
  0%, 100% { filter: brightness(0.94); transform: scale(0.985); }
  50% { filter: brightness(1.13); transform: scale(1.015); }
}

@keyframes hot-aura {
  0%, 100% { transform: scaleX(1.08); }
  50% { transform: scaleX(1.18); }
}

/* ========================================================================== */
/*  Scoreboard – kompakte Top-Runden-Liste rechts (gleiche H&S-Blau-Optik wie  */
/*  die Live-Badge). Gespeist aus dem 'leaderboard'-Event über heatmeter.js.   */
/* ========================================================================== */
.scoreboard {
  position: fixed;
  z-index: 30;
  right: var(--board-right);
  top: 50%;
  width: clamp(252px, 22vw, 312px);
  padding: 15px 16px 13px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  background: linear-gradient(158deg, rgba(4, 44, 96, 0.96), rgba(11, 92, 172, 0.95));
  color: #ffffff;
  box-shadow:
          0 0 0 1px rgba(0, 52, 126, 0.72),
          0 16px 30px rgba(0, 40, 100, 0.28),
          inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transform: translateY(-50%) scale(var(--meter-scale));
  transform-origin: right center;
  animation: sb-enter 0.8s 0.15s both cubic-bezier(0.16, 1, 0.3, 1);
}

.scoreboard__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.scoreboard__logo {
  height: 24px;
  width: auto;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(0, 12, 40, 0.45));
}

.scoreboard__title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.scoreboard__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
}

.sb-row--1 { background: linear-gradient(100deg, rgba(255, 209, 102, 0.30), rgba(255, 255, 255, 0.05)); }
.sb-row--2 { background: linear-gradient(100deg, rgba(214, 228, 240, 0.26), rgba(255, 255, 255, 0.05)); }
.sb-row--3 { background: linear-gradient(100deg, rgba(224, 168, 124, 0.26), rgba(255, 255, 255, 0.05)); }

.sb-row__rank {
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}

.sb-row__rank.is-medal {
  font-size: 17px;
}

.sb-row__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.sb-row__points {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scoreboard__empty {
  margin: 4px 0 2px;
  font-size: 13px;
  opacity: 0.72;
  text-align: center;
}

@keyframes sb-enter {
  from { opacity: 0; transform: translate(18px, -50%) scale(var(--meter-scale)); }
  to { opacity: 1; transform: translate(0, -50%) scale(var(--meter-scale)); }
}

@media (max-width: 760px) {
  /* Auf schmalen Bühnen das Scoreboard ausblenden (Thermometer hat Vorrang). */
  .scoreboard { display: none; }
}

@media (max-height: 720px) {
  :root { --meter-scale: 0.9; }
}

@media (max-height: 620px) {
  :root { --meter-scale: 0.78; }
}

@media (max-height: 520px) {
  :root { --meter-scale: 0.66; }
}

@media (max-width: 520px) {
  :root { --meter-left: 14px; }
}

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