/* Body Zen Lab: the rivals line (lab-rivals.js). The task pill's place inside the ring, above the BPM number, in
   the same pill style but quieter; up to two short lines, so a full sentence never gets cut. */
#lab-rival {
  position: absolute; left: 50%; top: 30%; z-index: 6;
  width: max-content; max-width: calc(100% - 34px); box-sizing: border-box;
  padding: 5px 12px; border-radius: 14px;
  background: #1d2025cc; border: 1px solid #3a3f47; color: #dfe2e6;
  font: 400 12px/1.3 system-ui, -apple-system, sans-serif; text-align: center; text-wrap: balance;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateX(-50%);
  transition: opacity .6s ease, visibility 0s linear .6s;
  pointer-events: none;
}
body.zen-mode #pulse-center > #lab-rival { transform: translateX(-50%) scale(calc(1 / var(--beat-scale, 1))); }
#lab-rival.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
#lab-rival .lr-tag { color: #e8c37a; margin-right: 6px; }
#lab-rival .lr-tag[hidden] { display: none; }
#pulse-center.lr-on #pulse-phase-icon { opacity: 0 !important; transition: opacity .3s; }

/* Video layouts: one quiet line in the header's status row, sharing the task/countdown position. */
#lab-video-slot-pill > #lab-rival {
  position: absolute !important; left: 50% !important; top: auto !important; bottom: 0 !important; transform: translateX(-50%) !important;
  max-width: 100% !important; height: 32px; padding: 7px 12px; background: rgba(10, 10, 12, .62);
  display: block; white-space: nowrap; text-overflow: ellipsis;
}
#lab-video-slot:has(#challenge-status:not([hidden])) #lab-rival { -webkit-line-clamp: 1; }
#lab-video-slot.is-cramped #lab-rival { opacity: 0 !important; visibility: hidden !important; transition: none !important; }
body.lab-video-on.lab-ui-asleep #lab-rival { opacity: 0 !important; visibility: hidden !important; transition: none !important; }

/* Session summary: the rival result, under the session points. */
.lr-sum { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; color: #a0a8b0; font-weight: 400; }

/* The countdown and the task share the slot and win it the same frame they appear, before the next check runs. */
:is(#pulse-center, #lab-video-slot-pill):has(> #lab-rhythm-cd.is-on, > #lab-task.is-on) > #lab-rival { opacity: 0 !important; visibility: hidden !important; transition: none !important; }
