@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;700&family=JetBrains+Mono:wght@500&display=swap");

:root {
  --bg: rgba(8, 10, 18, 0.55);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f4f7ff;
  --muted: rgba(244, 247, 255, 0.65);
  --accent: #5eead4;
  --live: #fb7185;
  --brb: #fbbf24;
  --low-battery: #f97316;
  --battery-bar-fill: rgba(94, 234, 212, 0.85);
  --blur-px: 12px;
  --card-radius: 14px;
  --pill-font: 13px;
  --value-font: 18px;
  --label-font: 11px;
  --overlay-scale: 1;
  --wrap-max-width: 420px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
  font-family: "DM Sans", system-ui, sans-serif;
}

body {
  color: var(--text);
  display: flex;
  box-sizing: border-box;
}

body.pos-top-left {
  justify-content: flex-start;
  align-items: flex-start;
}

body.pos-top-right {
  justify-content: flex-end;
  align-items: flex-start;
}

body.pos-bottom-left {
  justify-content: flex-start;
  align-items: flex-end;
}

body.pos-bottom-right {
  justify-content: flex-end;
  align-items: flex-end;
}

.wrap {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  max-width: var(--wrap-max-width);
  transform: scale(var(--overlay-scale));
  transform-origin: var(--origin-x, left) var(--origin-y, top);
}

.wrap.wrap--compact {
  padding: 8px;
  gap: 6px;
}

.wrap.wrap--compact .card {
  padding: 8px 10px;
  min-width: 120px;
}

.wrap.wrap--compact .pill {
  padding: 6px 11px;
}

.branding-row {
  width: 100%;
  max-width: var(--wrap-max-width);
  order: -10;
}

.branding-row.branding-row--bottom {
  order: 50;
  margin-top: 2px;
}

.branding-items {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  align-items: center;
  gap: var(--brand-gap, 10px);
  justify-content: flex-start;
}

.branding-items img {
  width: auto;
  max-height: var(--brand-max-h, 40px);
  object-fit: contain;
  object-position: center;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  user-select: none;
}

body.pos-top-right .wrap,
body.pos-bottom-right .wrap {
  align-items: flex-end;
  --origin-x: right;
}

body.pos-bottom-left .wrap,
body.pos-bottom-right .wrap {
  --origin-y: bottom;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--blur-px));
  -webkit-backdrop-filter: blur(var(--blur-px));
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: var(--pill-font);
  text-transform: uppercase;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 12px rgba(100, 116, 139, 0.8);
}

.pill.live .dot {
  background: var(--live);
  box-shadow: 0 0 14px rgba(251, 113, 133, 0.9);
  animation: pulse 1.4s ease-in-out infinite;
}

.pill.brb .dot {
  background: var(--brb);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.85);
}

.pill.low .dot {
  background: var(--low-battery);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.92);
  }
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metrics-row.metrics--stack {
  flex-direction: column;
  width: 100%;
  align-items: stretch;
}

.metrics-row.metrics--stack .card {
  width: 100%;
  max-width: 100%;
}

.row-viewers-clock {
  width: 100%;
}

body.pos-top-right .row,
body.pos-bottom-right .row {
  justify-content: flex-end;
}

body.pos-top-right .metrics-row.metrics--stack,
body.pos-bottom-right .metrics-row.metrics--stack {
  align-items: flex-end;
}

.card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--card-radius);
  background: var(--bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--blur-px));
  -webkit-backdrop-filter: blur(var(--blur-px));
  min-width: 140px;
}

.card .card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.battery-bar-wrap {
  width: 100%;
  margin-top: 2px;
}

.battery-bar-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.battery-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--battery-bar-fill);
  transition: width 0.35s ease;
}

.stream-title-line {
  max-width: 100%;
  font-size: calc(var(--label-font) * 1.05);
  color: var(--muted);
  line-height: 1.35;
  padding: 4px 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-wrap {
  width: 100%;
  max-width: var(--wrap-max-width);
  border-radius: var(--card-radius);
  background: var(--bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(var(--blur-px));
  -webkit-backdrop-filter: blur(var(--blur-px));
  padding: 6px 0;
  overflow: hidden;
}

.ticker-viewport {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  gap: 3rem;
  animation: ticker-marquee 22s linear infinite;
}

.ticker-track.ticker-track--static {
  animation: none;
  width: 100%;
  justify-content: center;
  gap: 0;
  padding: 0 12px;
}

.ticker-seg {
  flex-shrink: 0;
  font-size: calc(var(--label-font) * 1.15);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.ticker-seg--single {
  text-align: center;
  white-space: normal;
  line-height: 1.35;
}

@keyframes ticker-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
  }
}

.last-update-line {
  margin: 0;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.last-update-line #lastUpdateVal {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.card .icon {
  font-size: 22px;
  line-height: 1;
}

.label {
  font-size: var(--label-font);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  font-size: var(--value-font);
  font-weight: 700;
}

.value.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: calc(var(--value-font) * 0.72);
  font-weight: 500;
}

#clockCard .value.mono {
  font-size: calc(var(--value-font) * 0.95);
}

.card.warn {
  border-color: rgba(249, 115, 22, 0.55);
}

.card.bad {
  border-color: rgba(251, 113, 133, 0.55);
}

/** Letztes POST /api/update zu lange her — Werte nur bedingt vertrauenswürdig */
.card.telemetry-stale {
  box-shadow: inset 3px 0 0 rgba(251, 191, 36, 0.55);
  opacity: 0.88;
}

.last-update-line.stale {
  color: rgba(251, 191, 36, 0.95);
}

.gps {
  width: 100%;
  max-width: var(--wrap-max-width);
}

.telemetry-hint {
  margin: 10px 0 0;
  padding: 0 2px;
  max-width: var(--wrap-max-width);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.92;
}

.telemetry-hint strong {
  color: var(--text);
  font-weight: 700;
}
