/* PawCam — live camera screen (fe-cam). Dark, glassy pet-cam look; mobile first.
   Uses base.css tokens when present, with fallbacks. All classes are prefixed .cv */

.cv {
  --cv-bg: #07090c;
  --cv-panel: rgba(255, 255, 255, 0.055);
  --cv-panel-hi: rgba(255, 255, 255, 0.09);
  --cv-line: rgba(255, 255, 255, 0.085);
  --cv-fg: #f2f4f7;
  --cv-dim: rgba(228, 234, 242, 0.6);
  --cv-accent: var(--accent, #ff5a36);
  --cv-live: #ff3b30;
  --cv-radius: var(--radius, 18px);
  --cv-font: var(--font, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  --cv-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --cv-glass: rgba(10, 12, 16, 0.5);
  --cv-hud-pad: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  color: var(--cv-fg);
  background: var(--cv-bg);
  font-family: var(--cv-font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.cv *, .cv *::before, .cv *::after { box-sizing: border-box; }
.cv button { font-family: inherit; }

/* ------------------------------------------------------------ feed */

.cv-stage { position: relative; }

.cv-feed {
  /* clear the shell's sticky top bar when playback scrolls the feed into view */
  scroll-margin-top: calc(var(--bar-h, 56px) + var(--safe-top, 0px) + 8px);
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  transition: aspect-ratio 0.3s ease;
}
.cv--wide .cv-feed { aspect-ratio: 16 / 9; }
.cv-feed:focus-visible { box-shadow: inset 0 0 0 2px var(--cv-accent); }

@media (max-width: 699px) and (min-height: 900px) {
  .cv-feed { aspect-ratio: 4 / 5; }
}

.cv-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cv-videohost {
  position: absolute;
  width: 2px;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.cv-videohost video { width: 2px; height: 2px; }

/* 2D fallback: CSS vignette + a little softness in place of the shader */
.cv--2d .cv-feed::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.42) 100%);
}

/* ------------------------------------------------------------ HUD */

.cv-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #fff;
  z-index: 2;
}

.cv-hud-top {
  position: absolute;
  top: var(--cv-hud-pad);
  left: var(--cv-hud-pad);
  right: var(--cv-hud-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cv-hud-left, .cv-hud-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.cv-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font: 700 10.5px/1 var(--cv-font);
  letter-spacing: 0.09em;
}
.cv-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cv-live);
  animation: cv-pulse 2s ease-in-out infinite;
}
@keyframes cv-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.55); }
  50% { opacity: 0.55; box-shadow: 0 0 0 4px rgba(255, 59, 48, 0); }
}

.cv-camname {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 600 12px/1 var(--cv-font);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 8px rgba(0, 0, 0, 0.35);
}
.cv--foster .cv-camname { letter-spacing: 0.04em; }

.cv-ir {
  padding: 3px 5px 2px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  font: 700 10px/1 var(--cv-mono);
  letter-spacing: 0.08em;
}
.cv-ir[hidden] { display: none; }

.cv-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.7));
}
.cv-signal i { display: block; width: 3px; border-radius: 1px; background: #fff; transition: opacity 0.4s; }
.cv-signal i:nth-child(1) { height: 4px; }
.cv-signal i:nth-child(2) { height: 6.5px; }
.cv-signal i:nth-child(3) { height: 9px; }
.cv-signal i:nth-child(4) { height: 12px; }
.cv-signal[data-level="3"] i:nth-child(4),
.cv-signal[data-level="2"] i:nth-child(n + 3) { opacity: 0.28; }

.cv-hud-bottom {
  position: absolute;
  left: var(--cv-hud-pad);
  right: var(--cv-hud-pad);
  bottom: var(--cv-hud-pad);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.cv-time {
  font: 600 11.5px/1 var(--cv-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.93);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 7px rgba(0, 0, 0, 0.4);
}

.cv-viewtoggle, .cv-exit {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font: 600 11.5px/1 var(--cv-font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cv-viewtoggle::before {
  /* bigger touch target than the pill itself */
  content: "";
  position: absolute;
  inset: -10px -6px -10px -10px;
}
.cv-viewtoggle { position: relative; }
.cv-viewtoggle:focus-visible, .cv-exit:focus-visible { outline: 2px solid var(--cv-accent); outline-offset: 2px; }

.cv-exit {
  display: none;
  position: absolute;
  right: var(--cv-hud-pad);
  top: calc(var(--cv-hud-pad) + 34px);
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

.cv-motion {
  position: absolute;
  top: calc(var(--cv-hud-pad) + 34px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font: 600 11px/1 var(--cv-font);
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -4px);
}
.cv-motion-dot { width: 6px; height: 6px; border-radius: 50%; background: #ffb020; }
.cv-motion.is-on { animation: cv-motion 2.6s ease both; }
@keyframes cv-motion {
  0% { opacity: 0; transform: translate(-50%, -4px); }
  10%, 80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}

.cv-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(var(--cv-hud-pad) + 38px);
  max-width: 78%;
  padding: 9px 14px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font: 600 14px/1.25 var(--cv-font);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.96);
}
.cv-bubble.is-on { animation: cv-bubble 2.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes cv-bubble {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.96); }
  9%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -4px) scale(1); }
}

.cv-ripples { position: absolute; inset: 0; overflow: hidden; }
.cv-ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  animation: cv-ripple 0.95s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.cv-ripple--boop {
  border-color: #ffd2c4;
  box-shadow: 0 0 14px rgba(255, 120, 90, 0.55);
  animation-duration: 0.8s;
}
@keyframes cv-ripple {
  0% { opacity: 1; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(5.5); }
}

.cv-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font: 600 13px/1.2 var(--cv-font);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.25s, transform 0.25s;
}
.cv-toast.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.cv-connecting {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #000;
  color: rgba(255, 255, 255, 0.82);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.cv-connecting.is-on { opacity: 1; visibility: visible; transition: none; }
.cv-connecting-text { margin: 0; font: 500 13px/1.3 var(--cv-font); letter-spacing: 0.01em; }
.cv-connecting.is-slow .cv-connecting-text::after { content: " · weak signal, still trying"; color: rgba(255, 255, 255, 0.5); }
.cv-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: cv-spin 0.85s linear infinite;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }

.cv-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.cv-flash.is-on { animation: cv-flash 0.42s ease-out; }
@keyframes cv-flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* ------------------------------------------------------------ status line */

.cv-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  font: 600 15px/1.3 var(--cv-font);
  letter-spacing: -0.005em;
  border-bottom: 1px solid var(--cv-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0));
}
.cv-status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18);
  transition: background 0.4s, box-shadow 0.4s;
}
.cv-status[data-state="asleep"] .cv-status-dot { background: #8b8df6; box-shadow: 0 0 0 3px rgba(139, 141, 246, 0.2); }
.cv-status[data-state="moving"] .cv-status-dot { background: #ffb020; box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.2); }
.cv-status-text { min-width: 0; }

/* ------------------------------------------------------------ panel */

.cv-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px calc(22px + env(safe-area-inset-bottom, 0px));
}

.cv-card, .cv-timeline {
  border: 1px solid var(--cv-line);
  border-radius: var(--cv-radius);
  background: var(--cv-panel);
}

.cv-card { padding: 14px; }
.cv-card-head { display: flex; align-items: center; gap: 12px; }
.cv-card-id { min-width: 0; flex: 1; }
.cv-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  background: #1b1e23;
  border: 2px solid rgba(255, 255, 255, 0.14);
}
.cv-name {
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 700 22px/1.12 var(--cv-font);
  letter-spacing: -0.015em;
}
.cv-meta { margin: 3px 0 0; font: 500 13px/1.35 var(--cv-font); color: var(--cv-dim); }
.cv-chip {
  flex: none;
  padding: 5px 9px;
  border-radius: 999px;
  font: 700 10.5px/1 var(--cv-font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cv-chip--foster { background: rgba(255, 176, 32, 0.16); color: #ffcf7a; border: 1px solid rgba(255, 176, 32, 0.3); }

.cv-growth { margin-top: 13px; }
.cv-growth-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font: 500 13px/1.2 var(--cv-font); }
.cv-stage-label { font-weight: 700; }
.cv-next { color: var(--cv-dim); text-align: right; }
.cv-progress { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.cv-progress[hidden] { display: none; }
.cv-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffbf5e, var(--cv-accent));
  transition: width 0.8s ease;
}

.cv-traits { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.cv-trait {
  padding: 6px 10px;
  border: 1px solid var(--cv-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font: 600 12px/1 var(--cv-font);
  color: rgba(255, 255, 255, 0.86);
}
.cv-today { margin: 11px 0 0; font: 500 12.5px/1.35 var(--cv-font); color: var(--cv-dim); }

/* controls */
.cv-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); gap: 5px; margin: 0 -2px; }
.cv-ctl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 70px;
  padding: 9px 2px 8px;
  border: 1px solid var(--cv-line);
  border-radius: 16px;
  background: var(--cv-panel);
  color: var(--cv-fg);
  font: 600 10.5px/1.1 var(--cv-font);
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.2s ease;
}
.cv-ctl[hidden] { display: none; }
.cv-ctl:hover { background: var(--cv-panel-hi); }
.cv-ctl:active { transform: scale(0.95); }
.cv-ctl:focus-visible { outline: 2px solid var(--cv-accent); outline-offset: 2px; }
.cv-ctl-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s, color 0.2s;
}
.cv-ctl-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cv-ctl[data-act="talk"] .cv-ctl-icon { background: var(--cv-accent); color: #fff; box-shadow: 0 4px 14px rgba(255, 90, 54, 0.35); }
.cv-ctl.is-on .cv-ctl-icon { background: #fff; color: #111; }
.cv-ctl.is-empty { opacity: 0.5; }
.cv-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 9px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font: 800 10.5px/17px var(--cv-font);
  text-align: center;
}
.cv-ctl.is-empty .cv-badge { display: none; }

.cv-adopt { display: flex; flex-direction: column; gap: 8px; }

.cv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font: 700 15px/1 var(--cv-font);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, filter 0.2s;
}
.cv-btn:active { transform: scale(0.97); }
.cv-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cv-btn--primary { background: var(--cv-accent); color: #fff; box-shadow: 0 6px 20px rgba(255, 90, 54, 0.32); }
.cv-btn--primary:hover { filter: brightness(1.06); }
.cv-btn--glass { background: rgba(255, 255, 255, 0.08); border-color: var(--cv-line); color: var(--cv-fg); }

/* timeline (recordings) */
.cv-timeline { padding: 14px 10px 4px; }
.cv-tl-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 6px; }
.cv-tl-title { margin: 0; font: 700 15px/1.2 var(--cv-font); }
.cv-tl-date { flex: 1; font: 500 12px/1.2 var(--cv-font); color: var(--cv-dim); }
.cv-hl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(255, 90, 54, 0.35);
  border-radius: 999px;
  background: rgba(255, 90, 54, 0.12);
  color: #ffb49f;
  font: 700 12px/1 var(--cv-font);
  cursor: pointer;
}
.cv-hl-btn[hidden] { display: none; }
.cv-hl-btn .cv-icon { fill: currentColor; }
.cv-tl-list { margin: 0; padding: 0; list-style: none; }
.cv-tl-item { border-top: 1px solid var(--cv-line); }
.cv-tl-item:first-child { border-top: 0; }
.cv-tl-btn {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cv-tl-btn:hover, .cv-tl-item.is-playing .cv-tl-btn { background: rgba(255, 255, 255, 0.05); }
.cv-tl-btn:focus-visible { outline: 2px solid var(--cv-accent); outline-offset: -2px; }
.cv-tl-thumb {
  position: relative;
  width: 64px;
  height: 48px;
  overflow: hidden;
  border-radius: 9px;
  background: #15181d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.cv-tl-thumb img { position: absolute; max-width: none; }
.cv-tl-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.cv-tl-item.is-current .cv-tl-thumb::after { box-shadow: inset 0 0 0 2px var(--cv-accent); }
.cv-tl-item.is-playing .cv-tl-thumb::after { box-shadow: inset 0 0 0 2px #fff; }
.cv-tl-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cv-tl-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 14px/1.25 var(--cv-font); }
.cv-tl-time { font: 500 12px/1 var(--cv-font); font-variant-numeric: tabular-nums; color: var(--cv-dim); white-space: nowrap; }
.cv-tl-item.is-you .cv-tl-label { color: #ffe1b0; }
.cv-tl-now {
  font: 700 10px/1 var(--cv-font);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cv-accent);
}
.cv-tl-empty { padding: 12px 4px; color: var(--cv-dim); font-size: 14px; }
.cv-tl-more {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 2px 0 4px;
  border: 0;
  border-top: 1px solid var(--cv-line);
  background: none;
  color: var(--cv-accent);
  font: 600 13.5px/1 var(--cv-font);
  cursor: pointer;
}
.cv-tl-more[hidden] { display: none; }

/* play: ball handle, hint, HUD tools — interactive HUD controls stay above the handle */
.cv-hud-top, .cv-hud-bottom, .cv-exit, .cv-pb, .cv-pb-live { z-index: 2; }
.cv-hud-tools { display: inline-flex; align-items: center; gap: 6px; pointer-events: auto; }
.cv-fsbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
}
.cv--playback .cv-fsbtn { display: none; }
.cv-ballhandle {
  z-index: 1;
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.cv-ballhandle[hidden] { display: none; }
.cv--dragging .cv-ballhandle { cursor: grabbing; width: 120px; height: 120px; margin: -28px 0 0 -28px; }
.cv-hint {
  position: absolute;
  left: 0;
  top: 0;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font: 700 12px/1 var(--cv-font);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.cv-hint[hidden] { display: none; }
.cv-hint::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: inherit;
  transform: rotate(45deg);
}

/* playback */
.cv-pbadge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font: 800 10.5px/1 var(--cv-font);
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.cv-hud.is-playback .cv-pbadge { display: inline-flex; }
.cv-hud.is-playback .cv-live, .cv-hud.is-playback .cv-signal { display: none; }
.cv-pb, .cv-pb-live { display: none; pointer-events: auto; }
.cv--playback .cv-pb {
  position: absolute;
  left: var(--cv-hud-pad);
  right: var(--cv-hud-pad);
  bottom: var(--cv-hud-pad);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.cv--playback .cv-hud-bottom { bottom: calc(var(--cv-hud-pad) + 52px); }
.cv--playback .cv-viewtoggle { display: none; }
.cv-pb-play {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  cursor: pointer;
}
.cv-pb-play .cv-icon { fill: currentColor; }
.cv-pb-range {
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  background: none;
  accent-color: var(--cv-accent);
  -webkit-appearance: none;
  appearance: none;
  touch-action: none;
}
.cv-pb-range::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.28); }
.cv-pb-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.cv-pb-range::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.28); }
.cv-pb-range::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
.cv-pb-time { flex: none; font: 600 11.5px/1 var(--cv-mono); font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.85); }
.cv--playback .cv-pb-live {
  position: absolute;
  top: var(--cv-hud-pad);
  right: var(--cv-hud-pad);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font: 700 11.5px/1 var(--cv-font);
  cursor: pointer;
}
.cv--playback .cv-hud-right { margin-right: 118px; }
.cv-status[data-state="playback"] .cv-status-dot { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18); }
.cv-icon { flex: none; }

/* ------------------------------------------------------------ sheets & modals */

.cv-sheet, .cv-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: cv-fade 0.2s ease;
}
.cv-modal { align-items: center; z-index: 1200; }
.cv-sheet-card, .cv-modal-card {
  width: min(440px, 100%);
  padding: 14px;
  border: 1px solid var(--cv-line);
  border-radius: 22px;
  background: rgba(26, 28, 33, 0.97);
  color: var(--cv-fg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: cv-rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cv-sheet-img { display: block; width: 100%; border-radius: 14px; background: #000; }
.cv-sheet-note { margin: 12px 4px; font: 600 15px/1.35 var(--cv-font); }
.cv-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-sheet-actions > * { flex: 1 1 0; min-width: 0; }
.cv-sheet-actions .cv-btn { padding: 0 10px; font-size: 14.5px; white-space: nowrap; }
.cv-sheet:focus, .cv-modal:focus { outline: none; }
.cv-link-input {
  width: 100%;
  min-height: 46px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--cv-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--cv-fg);
  font: 500 13px/1 var(--cv-mono);
}

.cv-modal-card { padding: 22px 18px 18px; text-align: center; }
.cv-kicker { margin: 0; font: 700 11px/1 var(--cv-font); letter-spacing: 0.1em; text-transform: uppercase; color: #ffbf5e; }
.cv-modal-title { margin: 8px 0 0; font: 800 24px/1.15 var(--cv-font); letter-spacing: -0.02em; }
.cv-modal-text { margin: 0 0 16px; font: 500 14.5px/1.45 var(--cv-font); color: var(--cv-dim); }
.cv-modal-card .cv-btn { width: 100%; }
.cv-ba-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px 0; }
.cv-ba { margin: 0; }
.cv-ba img, .cv-ba-blank {
  display: block;
  width: min(34vw, 136px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
  background: #22252b;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.cv-ba figcaption { margin-top: 8px; font: 600 12px/1.3 var(--cv-font); color: var(--cv-dim); }
.cv-ba-arrow { width: 22px; height: 2px; background: rgba(255, 255, 255, 0.35); position: relative; flex: none; }
.cv-ba-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.35);
  border-right: 2px solid rgba(255, 255, 255, 0.35);
  transform: rotate(45deg);
}

@keyframes cv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cv-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ landscape phones */

@media (orientation: landscape) and (max-height: 520px) {
  /* --cv-top: height of the app bar above the camera (shell can override). */
  .cv-feed, .cv--wide .cv-feed { aspect-ratio: auto; height: calc(100vh - var(--cv-top, 56px)); height: calc(100dvh - var(--cv-top, 56px)); }
  .cv-viewtoggle { display: none; }
  .cv-status {
    position: absolute;
    left: 50%;
    bottom: calc(var(--cv-hud-pad) + 30px);
    z-index: 3;
    max-width: 80%;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: var(--cv-glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
  }
  .cv-hud-top, .cv-hud-bottom { left: max(var(--cv-hud-pad), env(safe-area-inset-left, 0px)); right: max(var(--cv-hud-pad), env(safe-area-inset-right, 0px)); }
}

/* ------------------------------------------------------------ desktop / tablet landscape */

@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .cv {
    --cv-hud-pad: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 27vw, 380px);
    align-items: start;
    gap: 20px;
    padding: 20px 24px 28px;
  }
  .cv-stage { position: sticky; top: 16px; }
  .cv-feed, .cv--wide .cv-feed {
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 120px);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
  .cv-viewtoggle { display: none; }
  .cv-status {
    position: absolute;
    left: 50%;
    bottom: calc(var(--cv-hud-pad) + 2px);
    z-index: 3;
    max-width: 70%;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: var(--cv-glass);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    font-size: 14.5px;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
  }
  .cv-panel { padding: 0; }
  .cv-live { font-size: 11.5px; padding: 6px 11px 6px 10px; }
  .cv-camname { font-size: 13.5px; }
  .cv-time { font-size: 13.5px; }
  .cv-signal { height: 14px; }
  .cv-bubble { bottom: calc(var(--cv-hud-pad) + 56px); font-size: 15px; }
  .cv-motion { top: calc(var(--cv-hud-pad) + 40px); font-size: 12px; }
  .cv-connecting-text { font-size: 15px; }
  .cv-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cv--foster .cv-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cv-sheet { align-items: center; }
}

/* ------------------------------------------------------------ immersive / fullscreen */

.cv--immersive, .cv:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: block;
  padding: 0;
  background: #000;
}
.cv:-webkit-full-screen { position: fixed; inset: 0; display: block; padding: 0; background: #000; }
.cv--immersive .cv-panel, .cv:fullscreen .cv-panel { display: none; }
.cv--immersive .cv-stage, .cv:fullscreen .cv-stage { position: absolute; inset: 0; }
.cv--immersive .cv-feed, .cv:fullscreen .cv-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}
.cv--immersive.cv--wide .cv-feed, .cv--wide:fullscreen .cv-feed {
  inset: 50% 0 auto 0;
  height: auto;
  aspect-ratio: 16 / 9;
  transform: translateY(-50%);
}
.cv--immersive, .cv:fullscreen { --cv-hud-pad: max(12px, env(safe-area-inset-top, 0px)); }
.cv--immersive .cv-exit, .cv:fullscreen .cv-exit { display: inline-flex; }
.cv--immersive .cv-viewtoggle, .cv:fullscreen .cv-viewtoggle { display: inline-flex; }
.cv--immersive .cv-status, .cv:fullscreen .cv-status {
  position: absolute;
  left: 50%;
  bottom: calc(var(--cv-hud-pad) + 40px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  max-width: 86%;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: var(--cv-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}
.cv--immersive .cv-hud-bottom, .cv:fullscreen .cv-hud-bottom { bottom: calc(var(--cv-hud-pad) + env(safe-area-inset-bottom, 0px)); }
html.cv-noscroll, html.cv-noscroll body { overflow: hidden; }

/* ------------------------------------------------------------ motion preferences / QA */

@media (prefers-reduced-motion: reduce) {
  .cv-live-dot { animation: none; }
  .cv-spinner { animation-duration: 2.4s; }
  .cv-ripple { animation: cv-fade-out 0.6s ease forwards; transform: scale(2.2); }
  .cv-bubble.is-on, .cv-motion.is-on { animation-name: cv-fade-in-out; }
  .cv-sheet, .cv-modal, .cv-sheet-card, .cv-modal-card { animation: none; }
  .cv-feed { transition: none; }
}
@keyframes cv-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes cv-fade-in-out { 0% { opacity: 0; } 10%, 85% { opacity: 1; } 100% { opacity: 0; } }

.cv--freeze *, .cv--freeze *::before, .cv--freeze *::after { animation: none !important; transition: none !important; }
