:root {
  --c-hi: #f8e878;
  --c-lo: #68b8f8;
  --c-zone: #f8e878;
  --ff-win: #184090;
  --ff-edge: #f8f8f8;
  --ff-inner: #68b8f8;
  --beat-ms: 900ms;
  --ecg-ms: 2.4s;
  --glow: 0 0 18px color-mix(in srgb, var(--c-zone) 55%, transparent);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
  font-family: VT323, "Press Start 2P", "Segoe UI", sans-serif;
  color: #f8f8f8;
}

/* The stream canvas must be opaque edge-to-edge. Widget overlays stay
   transparent so they can sit on top of a camera in OBS. */
body.is-program {
  background: #05070d;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  --c-hi: #67e8f9;
  --c-lo: #c084fc;
}

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.vignette,
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.08) 2px 3px
  );
  opacity: 0.35;
  mix-blend-mode: overlay;
}

.hud {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px 18px;
}

.ff-win,
.session-strip .stat,
.coach,
.ecg-wrap,
.hold-banner,
.alert,
.sound-hint,
.hero-box {
  background: linear-gradient(180deg, #2458b8 0%, #184090 58%, #102868 100%);
  border: 3px solid var(--ff-edge);
  box-shadow:
    0 0 0 2px var(--ff-inner),
    4px 4px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px #4890d8;
  border-radius: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.12em;
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 10px;
  font-weight: 400;
  opacity: 0.95;
  text-shadow: 2px 2px 0 #000;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-zone);
  box-shadow: 0 0 12px var(--c-zone);
}

.live-pill {
  margin-left: auto;
  letter-spacing: 0.12em;
  font-size: 9px;
  padding: 4px 8px;
  border: 2px solid var(--ff-edge);
  border-radius: 0;
  color: var(--c-zone);
  opacity: 0.35;
  text-shadow: 2px 2px 0 #000;
}

.state-connected .live-pill {
  opacity: 1;
  animation: liveblink 1.6s ease-in-out infinite;
}

@keyframes liveblink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.core {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 8px 8px 8px;
  overflow: hidden;
  max-width: 132px;
}

#hero {
  width: 96px;
  height: 128px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hero-label {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f8e878;
  text-shadow: 2px 2px 0 #000;
  opacity: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xp-wrap {
  width: 84px;
  height: 6px;
  background: #102040;
  border: 2px solid #f8e878;
  box-shadow: 2px 2px 0 #000;
}

.xp-wrap i {
  display: block;
  height: 100%;
  width: 0;
  background: #f8e878;
}

#quest-line {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 6px;
  color: #f8e878;
  text-shadow: 2px 2px 0 #000;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#fight-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: #fb7185;
  text-shadow: 2px 2px 0 #000;
}

#fight-box[hidden] {
  display: none;
}

.hp-wrap {
  width: 72px;
  height: 6px;
  background: #401018;
  border: 2px solid #f8f8f8;
}

.hp-wrap i {
  display: block;
  height: 100%;
  width: 100%;
  background: #e05050;
}

.hero-bubble {
  position: relative;
  max-width: 220px;
  margin: 0 0 6px;
  padding: 8px 10px 10px;
  font-family: VT323, "Press Start 2P", monospace;
  color: #f8f8f8;
  text-shadow: 2px 2px 0 #000;
  animation: bubble-in 0.2s steps(3);
}

.hero-bubble::after {
  content: "";
  position: absolute;
  left: 28px;
  bottom: -8px;
  width: 10px;
  height: 8px;
  background: #184090;
  border-right: 3px solid #f8f8f8;
  border-bottom: 3px solid #f8f8f8;
  box-shadow: 2px 2px 0 #68b8f8;
  clip-path: polygon(0 0, 100% 0, 40% 100%);
}

#hero-bubble-who {
  display: block;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: #f8e878;
  margin-bottom: 4px;
}

#hero-bubble-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

@keyframes bubble-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.orbit {
  position: relative;
  width: 168px;
  height: 168px;
  flex: 0 0 auto;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--c-zone) 45%, transparent);
  animation: spin 16s linear infinite;
}

.orbit-ring.r2 {
  inset: 12px;
  animation-duration: 11s;
  animation-direction: reverse;
  border-style: solid;
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.orbit-ring.r3 {
  inset: 24px;
  animation-duration: 7s;
  opacity: 0.55;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.heart-wrap {
  position: absolute;
  inset: 36px;
  display: grid;
  place-items: center;
}

.heart {
  width: 88px;
  height: 88px;
  transform-origin: 50% 55%;
  filter: drop-shadow(0 0 16px var(--c-zone));
  animation: lubdub var(--beat-ms, 850ms) ease-in-out infinite;
}

@keyframes lubdub {
  0%,
  100% {
    transform: scale(1);
  }
  12% {
    transform: scale(1.2);
  }
  24% {
    transform: scale(0.92);
  }
  36% {
    transform: scale(1.12);
  }
  50% {
    transform: scale(1);
  }
}

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

.bpm-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#bpm {
  font-family: "Press Start 2P", VT323, monospace;
  font-size: 64px;
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow: 3px 3px 0 #000, var(--glow);
  font-variant-numeric: tabular-nums;
}

.unit {
  font-size: 16px;
  letter-spacing: 0.24em;
  opacity: 0.7;
}

.pulse-strip {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
  margin-top: 10px;
}

.pulse-strip i {
  flex: 1;
  min-width: 2px;
  height: 100%;
  border-radius: 2px;
  transform-origin: 50% 100%;
  background: linear-gradient(
    180deg,
    var(--c-zone),
    color-mix(in srgb, var(--c-zone) 25%, transparent)
  );
  opacity: 0.55;
  animation: pulse-bar var(--beat-ms, 900ms) ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -55ms);
}

@keyframes pulse-bar {
  0%,
  100% {
    transform: scaleY(0.18);
    opacity: 0.4;
  }
  14% {
    transform: scaleY(1);
    opacity: 1;
  }
  30% {
    transform: scaleY(0.42);
    opacity: 0.6;
  }
  44% {
    transform: scaleY(0.72);
    opacity: 0.85;
  }
  62% {
    transform: scaleY(0.24);
    opacity: 0.45;
  }
}

.beat-flash .pulse-strip i {
  filter: drop-shadow(0 0 8px var(--c-zone));
}

.trend-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  font-style: normal;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 1px currentcolor;
  color: #94a3b8;
  transition: color 0.3s ease;
}

.trend-badge i,
.trend-badge em {
  font-style: normal;
}

.trend-badge.up {
  color: #fb923c;
}

.trend-badge.down {
  color: #4ade80;
}

.trend-wrap {
  height: 34px;
  margin-top: 6px;
  opacity: 0.85;
}

.trend {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.trend polyline {
  fill: none;
  stroke: var(--c-zone);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px var(--c-zone));
  transition: stroke 0.4s ease;
}

.sound-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 5;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--c-zone);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid color-mix(in srgb, var(--c-zone) 45%, transparent);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.zone-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--c-zone);
  letter-spacing: 0.08em;
}

.zone-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 10px;
}

.zone-bar i {
  height: 10px;
  border-radius: 0;
  background: #102050;
  box-shadow: inset 0 0 0 2px #68b8f8;
}

.zone-bar i.on {
  background: var(--c-zone);
  box-shadow: 0 0 10px var(--c-zone);
}

.ecg-wrap {
  height: 92px;
  overflow: hidden;
  color: var(--c-zone);
}

.ecg-track {
  display: flex;
  width: 200%;
  height: 100%;
  will-change: transform;
  animation: ecg-scroll var(--ecg-ms, 2.4s) linear infinite;
}

.ecg-wave {
  display: block;
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  overflow: visible;
}

.ecg-wave path {
  fill: none;
  stroke: var(--c-zone);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--c-zone));
}

@keyframes ecg-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

.session-strip {
  display: grid;
  /* Column count follows the markup, so a stat can be added without retuning. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin-top: 2px;
}

.session-strip .stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
}

.session-strip b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.session-strip span {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
}

.zone-time {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  height: 8px;
  margin-top: 8px;
}

.zone-time i {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.zone-time i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: var(--zc, var(--c-zone));
  box-shadow: 0 0 8px var(--zc, var(--c-zone));
  transition: width 0.6s ease;
}

/* Zone alert */
.alert {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 6;
  transform: translate(-50%, -50%) scale(0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 30px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c-alert, var(--c-zone)) 60%, transparent),
    0 0 40px color-mix(in srgb, var(--c-alert, var(--c-zone)) 45%, transparent);
  opacity: 0;
  pointer-events: none;
  animation: alert-pop 2.6s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.alert-kicker {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.34em;
  opacity: 0.75;
  color: var(--c-alert, var(--c-zone));
}

.alert-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--c-alert, var(--c-zone));
  text-shadow: 0 0 22px var(--c-alert, var(--c-zone));
  white-space: nowrap;
}

@keyframes alert-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.96);
  }
}

/* Intensity: the readout should feel different at threshold and max */
.zone-4 .orbit-ring.r1,
.zone-5 .orbit-ring.r1 {
  animation-duration: 5s;
}

.zone-5 .hud {
  animation: intensity-shake var(--beat-ms, 850ms) ease-in-out infinite;
}

.zone-5 #bpm {
  animation: bpm-burn var(--beat-ms, 850ms) ease-in-out infinite;
}

@keyframes intensity-shake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  10% {
    transform: translate3d(-2px, 1px, 0);
  }
  22% {
    transform: translate3d(2px, -1px, 0);
  }
  38% {
    transform: translate3d(-1px, -1px, 0);
  }
  54% {
    transform: translate3d(1px, 1px, 0);
  }
}

@keyframes bpm-burn {
  0%,
  100% {
    text-shadow: var(--glow);
  }
  16% {
    text-shadow:
      0 0 34px var(--c-zone),
      0 0 70px color-mix(in srgb, var(--c-zone) 60%, transparent);
  }
}

.record-flash #bpm {
  animation: record-pop 1.4s ease-out;
}

@keyframes record-pop {
  0% {
    transform: scale(1);
  }
  18% {
    transform: scale(1.16);
    text-shadow: 0 0 60px #fde68a;
  }
  100% {
    transform: scale(1);
  }
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.65;
  text-transform: uppercase;
}

.music-tag {
  color: var(--c-zone);
  white-space: nowrap;
}

/* Komentarz AI */
.coach {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 13px;
  /* Slides up as it appears: motion in the corner of the eye is what makes a
     viewer notice a new line without a sound cue. */
  animation: coach-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.coach[hidden] {
  display: none;
}

.coach-mark {
  flex: none;
  margin-top: 1px;
  padding: 2px 7px;
  border-radius: 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #020617;
  background: var(--c-zone);
}

.coach p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #e2e8f0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

@keyframes coach-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layout-bar .coach {
  position: absolute;
  left: 18px;
  bottom: 10px;
  max-width: 46%;
  margin: 0;
  padding: 7px 11px;
}

.layout-bar .coach p {
  font-size: 13px;
}

.layout-full .coach {
  margin-top: 22px;
  padding: 16px 20px;
  border-radius: 20px;
}

.layout-full .coach p {
  font-size: 26px;
}

.layout-full .coach-mark {
  font-size: 14px;
  padding: 4px 11px;
}

/* Layouts */
.layout-widget {
  width: 520px;
  height: 560px;
}

.layout-widget .hud {
  width: 520px;
}

.layout-bar {
  width: 920px;
  height: 190px;
}

.layout-bar .hud {
  width: 920px;
  padding: 12px 18px;
  gap: 6px;
}

.layout-bar .core {
  gap: 14px;
}

.layout-bar .orbit {
  width: 118px;
  height: 118px;
}

.layout-bar .heart {
  width: 62px;
  height: 62px;
}

.layout-bar .heart-wrap {
  inset: 24px;
}

.layout-bar #bpm {
  font-size: 64px;
}

.layout-bar .pulse-strip {
  height: 18px;
  margin-top: 6px;
}

.layout-bar .trend-wrap,
.layout-bar .zone-time {
  display: none;
}

.layout-bar .session-strip {
  position: absolute;
  right: 18px;
  bottom: 10px;
  width: 340px;
  gap: 5px;
}

.layout-bar .session-strip .stat {
  padding: 6px;
}

.layout-bar .session-strip b {
  font-size: 13px;
}

.layout-bar .alert {
  top: 26%;
}

.layout-bar .ecg-wrap {
  position: absolute;
  right: 18px;
  top: 44px;
  width: 280px;
  height: 96px;
}

.layout-bar .brand {
  position: relative;
  z-index: 3;
}

.layout-full {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #184090;
  background-image:
    linear-gradient(180deg, #58a0e8 0%, #3870c8 38%, #486038 62%, #3a2c18 100%);
}

.layout-full::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.layout-full .vignette,
.layout-full .scanlines,
.layout-full #fx {
  position: absolute;
  inset: 0;
}

.layout-full .hud {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 3.5vh 4vw 2.5vh;
  justify-content: stretch;
  gap: 1.4vh;
}

.layout-full .core {
  justify-content: center;
  gap: clamp(24px, 4vw, 64px);
  flex: 0 0 auto;
}

.layout-full .orbit {
  width: clamp(160px, 22vw, 420px);
  height: clamp(160px, 22vw, 420px);
}

.layout-full .heart-wrap {
  inset: 22%;
}

.layout-full .heart {
  width: 55%;
  height: 55%;
}

.layout-full #bpm {
  font-size: clamp(72px, 16vw, 220px);
}

.layout-full .pulse-strip {
  height: clamp(28px, 6vh, 64px);
  gap: 6px;
  margin-top: 1.2vh;
}

.layout-full .trend-wrap {
  height: clamp(44px, 9vh, 90px);
  margin-top: 1vh;
}

.layout-full .trend-badge {
  font-size: clamp(16px, 2vw, 30px);
  padding: 6px 18px;
}

.layout-full .session-strip {
  gap: clamp(10px, 1.4vw, 18px);
  margin-top: auto;
}

.layout-full .session-strip b {
  font-size: clamp(22px, 3.2vw, 44px);
}

.layout-full .session-strip span {
  font-size: clamp(11px, 1.1vw, 14px);
}

.layout-full .zone-time {
  height: clamp(10px, 1.6vh, 16px);
  margin-top: 1.2vh;
}

.layout-full .alert-title {
  font-size: clamp(36px, 6vw, 76px);
}

.layout-full .alert-kicker {
  font-size: clamp(12px, 1.4vw, 18px);
}

.layout-full .ecg-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 14vh;
  margin-top: 1vh;
}

.layout-full .unit {
  font-size: clamp(16px, 2vw, 28px);
}

.layout-full .core {
  justify-content: center;
  gap: clamp(24px, 4vw, 64px);
}

.layout-full .orbit {
  width: clamp(160px, 22vw, 420px);
  height: clamp(160px, 22vw, 420px);
}

.layout-full .heart-wrap {
  inset: 22%;
}

.layout-full .heart {
  width: 55%;
  height: 55%;
}

.layout-full #bpm {
  font-size: clamp(72px, 16vw, 220px);
}

.layout-full .pulse-strip {
  height: clamp(28px, 6vh, 64px);
  gap: 6px;
  margin-top: 1.2vh;
}

.layout-full .trend-wrap {
  height: clamp(44px, 9vh, 90px);
  margin-top: 1vh;
}

.layout-full .trend-badge {
  font-size: clamp(16px, 2vw, 30px);
  padding: 6px 18px;
}

.layout-full .session-strip {
  gap: clamp(10px, 1.4vw, 18px);
  margin-top: 1.2vh;
}

.layout-full .session-strip b {
  font-size: clamp(22px, 3.2vw, 44px);
}

.layout-full .session-strip span {
  font-size: clamp(11px, 1.1vw, 14px);
}

.layout-full .zone-time {
  height: clamp(10px, 1.6vh, 16px);
  margin-top: 1.2vh;
}

.layout-full .alert-title {
  font-size: clamp(36px, 6vw, 76px);
}

.layout-full .alert-kicker {
  font-size: clamp(12px, 1.4vw, 18px);
}

.layout-full .ecg-wrap {
  height: clamp(72px, 16vh, 180px);
  margin-top: 1.6vh;
}

.layout-full .unit {
  font-size: clamp(16px, 2vw, 28px);
}

/* Themes */
.theme-cyber {
  --c-hi: #67e8f9;
  --c-lo: #e879f9;
}

.theme-cyber .vignette {
  background: radial-gradient(circle at 30% 40%, rgba(34, 211, 238, 0.16), transparent 42%);
}

.theme-medic {
  --c-hi: #4ade80;
  --c-lo: #86efac;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.theme-medic .vignette {
  background: radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.12), transparent 50%);
}

.theme-medic .orbit-ring {
  border-radius: 8px;
  border-style: solid;
}

.theme-ember {
  --c-hi: #fb923c;
  --c-lo: #ef4444;
}

.theme-ember .vignette {
  background: radial-gradient(circle at 40% 60%, rgba(239, 68, 68, 0.2), transparent 48%);
}

.theme-ember .scanlines {
  opacity: 0.15;
}

.theme-ice {
  --c-hi: #e0f2fe;
  --c-lo: #38bdf8;
}

.theme-ice .vignette {
  background: radial-gradient(circle at 50% 30%, rgba(125, 211, 252, 0.18), transparent 46%);
}

.theme-void {
  --c-hi: #fde68a;
  --c-lo: #f59e0b;
}

.theme-void .vignette {
  background: radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.14), transparent 40%);
}

.state-idle #bpm,
.state-error #bpm {
  opacity: 0.45;
}

.state-hold #bpm {
  opacity: 0.72;
}

.hold-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  min-width: min(86vw, 520px);
  padding: 14px 18px;
  border-radius: 16px;
  text-align: center;
  background: rgba(7, 11, 20, 0.82);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c-hi) 55%, transparent);
}

.hold-banner strong {
  display: block;
  letter-spacing: 0.16em;
  font-size: clamp(16px, 3.4vw, 28px);
  color: var(--c-hi);
}

.hold-banner span {
  display: block;
  margin-top: 6px;
  font-size: clamp(12px, 2.2vw, 16px);
  color: #cbd5e1;
}

.sleep-banner {
  box-shadow: 0 0 0 1px color-mix(in srgb, #818cf8 65%, transparent);
}

.sleep-banner strong {
  color: #a5b4fc;
}

#stage.mood-sleep {
  --c-zone: #a5b4fc;
}

#stage.mood-stress {
  --c-zone: #fb7185;
}

#stage.day-night,
#stage.theme-night {
  --c-zone: #818cf8;
}

#stage.day-dawn,
#stage.theme-dawn {
  --c-zone: #fdba74;
}

#stage.day-dusk,
#stage.theme-dusk {
  --c-zone: #f472b6;
}

.beat-flash .orbit-ring.r1 {
  box-shadow: 0 0 24px var(--c-zone);
}

.layout-vertical {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #070b14;
  background-image:
    radial-gradient(ellipse 90% 50% at 50% 22%, color-mix(in srgb, var(--c-hi) 36%, transparent), transparent 58%),
    radial-gradient(ellipse 80% 40% at 50% 88%, color-mix(in srgb, var(--c-lo) 24%, transparent), transparent 52%),
    linear-gradient(180deg, #10182a 0%, #070b14 42%, #05070d 100%);
}

.layout-vertical::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.layout-vertical .vignette,
.layout-vertical .scanlines,
.layout-vertical #fx {
  position: absolute;
  inset: 0;
}

.layout-vertical .hud {
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 3.2vh 5.5vw 2.4vh;
  justify-content: space-between;
  gap: 1.2vh;
}

.layout-vertical .core {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2vh;
}

.layout-vertical .orbit {
  width: min(58vw, 280px);
  height: min(58vw, 280px);
}

.layout-vertical .heart-wrap {
  inset: 22%;
}

.layout-vertical .heart {
  width: 55%;
  height: 55%;
}

.layout-vertical #bpm {
  font-size: clamp(84px, 22vw, 148px);
}

.layout-vertical .unit {
  font-size: clamp(16px, 4.2vw, 26px);
}

.layout-vertical .pulse-strip {
  height: clamp(22px, 3.4vh, 40px);
  gap: 5px;
  margin-top: 0.8vh;
}

.layout-vertical .trend-wrap {
  height: clamp(36px, 6vh, 64px);
  margin-top: 0.6vh;
}

.layout-vertical .trend-badge {
  font-size: clamp(14px, 3.4vw, 22px);
  padding: 5px 14px;
}

.layout-vertical .ecg-wrap {
  height: clamp(56px, 9vh, 110px);
  margin-top: 0.6vh;
}

.layout-vertical .session-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 8px;
  margin-top: auto;
}

.layout-vertical .session-strip .stat {
  text-align: center;
}

.layout-vertical .session-strip b {
  font-size: clamp(20px, 5.4vw, 34px);
}

.layout-vertical .session-strip span {
  font-size: clamp(10px, 2.6vw, 13px);
}

.layout-vertical .zone-time {
  height: clamp(10px, 1.4vh, 16px);
  margin-top: 0.8vh;
}

.layout-vertical .coach {
  margin-top: 1.2vh;
  padding: 14px 16px;
  border-radius: 18px;
}

.layout-vertical .coach p {
  font-size: clamp(15px, 3.8vw, 22px);
}

.layout-vertical .coach-mark {
  font-size: 12px;
  padding: 3px 9px;
}

.layout-vertical .alert-title {
  font-size: clamp(32px, 9vw, 64px);
}

.layout-vertical .alert-kicker {
  font-size: clamp(12px, 3vw, 16px);
}
