/* RANGO live cameras: compact camera button inside the picture, small menu, split screen. Mobile first. */
.cams-ctl { position: absolute; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 7; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.cams-ctl[hidden] { display: none; }
.cams-fab { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid #ffffff2e; background: #120d0a8c; color: #fff; font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .02em; cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 4px 14px #0006; opacity: .82; transition: opacity .35s ease, transform .35s ease, background .2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.cams-fab svg { width: 18px; height: 18px; flex: none; }
.cams-fab:hover, .cams-ctl.open .cams-fab { opacity: 1; background: #120d0acc; }
.cams-fab:focus-visible, .cams-item:focus-visible { outline: 2px solid #f3c77a; outline-offset: 2px; }
.cams-ctl.idle .cams-fab { opacity: 0; transform: translateY(6px); pointer-events: none; }
/* Bigger touch target without a bigger look */
.cams-fab::after { content: ''; position: absolute; inset: -8px -6px; }
.cams-fab { position: relative; }

.cams-menu { pointer-events: auto; order: -1; margin-bottom: 8px; width: min(290px, calc(100vw - 32px)); max-height: min(360px, calc(var(--cams-room, 100vh) - 60px)); overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 16px; border: 1px solid #ffffff24; background: #120d0ad9; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 12px 34px #000a; color: #fff; transform-origin: 50% 100%; animation: cams-in .2s cubic-bezier(.2, .8, .2, 1); }
.cams-menu[hidden] { display: none; }
.cams-menu.closing { animation: cams-out .18s ease forwards; }
@keyframes cams-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes cams-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
.cams-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 11px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.cams-item + .cams-item { margin-top: 2px; }
.cams-item:hover { background: #ffffff14; }
.cams-item[aria-checked="true"] { background: #f3c77a26; box-shadow: inset 0 0 0 1px #f3c77a80; }
.cams-pic { position: relative; flex: none; width: 64px; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: #0b0907 url('/assets/terrarium.webp') center / cover; }
.cams-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cams-pic img.broken { visibility: hidden; }
.cams-split-pic { display: grid; place-items: center; background: #ffffff12; }
.cams-split-pic svg { width: 26px; height: 26px; }
.cams-dot { position: absolute; top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: #9a8f80; box-shadow: 0 0 0 2px #0008; }
.cams-item[data-ready="on"] .cams-dot { background: #52d273; }
.cams-item[data-ready="off"] .cams-dot { background: #ff5a4f; }
.cams-item[data-ready="off"] .cams-pic img { filter: grayscale(1) brightness(.55); }
.cams-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cams-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cams-meta small { font-size: 12px; opacity: .72; }

/* Split screen: main camera left, second camera right (portrait phones: top / bottom). Both muted. */
#livestream.cams-split #stream-video { width: 50% !important; }
#stream-picture > .cams-split-video { position: absolute; top: 0; right: 0; width: 50%; height: 100%; object-fit: contain; background: #0b0907; z-index: 2; border-left: 2px solid #000; }
.cams-split-label { position: absolute; left: calc(50% + 10px); top: 10px; z-index: 3; padding: 3px 9px; border-radius: 999px; background: #000a; color: #fff; font-size: 12px; pointer-events: none; }
@media (max-width: 640px) and (orientation: portrait) {
  #livestream.cams-split #stream-video { width: 100% !important; height: 50% !important; }
  #stream-picture > .cams-split-video { top: auto; bottom: 0; width: 100%; height: 50%; border-left: 0; border-top: 2px solid #000; }
  .cams-split-label { left: 10px; top: calc(50% + 8px); }
}
/* Small or short pictures (landscape phones): smaller button and a menu that fits */
@media (max-height: 480px), (max-width: 380px) {
  .cams-fab { height: 30px; font-size: 12px; padding: 0 10px 0 8px; }
  .cams-menu { width: min(260px, calc(100vw - 24px)); max-height: calc(100vh - 70px); }
  .cams-pic { width: 52px; }
}
/* Compact row for small pictures (set by cams.js when the picture is lower than 300 px) */
.cams-ctl.compact .cams-fab { height: 30px; padding: 0 9px; }
.cams-ctl.compact .cams-fab-label { display: none; }
.cams-ctl.compact .cams-menu { display: flex; gap: 4px; width: auto; max-width: calc(var(--cams-width, 100vw) - 16px); max-height: none; padding: 4px; border-radius: 999px; }
.cams-ctl.compact .cams-menu[hidden] { display: none; }
.cams-ctl.compact .cams-item { width: auto; padding: 7px 12px; border-radius: 999px; gap: 6px; }
.cams-ctl.compact .cams-item + .cams-item { margin-top: 0; }
.cams-ctl.compact .cams-pic { display: none; }
.cams-ctl.compact .cams-meta small { display: none; }
.cams-ctl.compact .cams-meta b { display: none; }
.cams-short { display: none; font-style: normal; font-weight: 700; font-size: 13px; white-space: nowrap; }
.cams-ctl.compact .cams-short { display: inline; }
.cams-ctl.compact .cams-item[data-ready="off"] b { opacity: .5; }
/* Sleep screen: every camera offline (devices at home off for the night). Friendly, no technical wording. */
#livestream[data-sleep="1"] .stream-standby { opacity: 1; }
.stream-standby.is-sleep { background: radial-gradient(120% 90% at 70% 10%, #2a2f5a 0%, #141629 55%, #0b0c18 100%); }
.stream-standby.is-sleep::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(1.5px 1.5px at 18% 26%, #fff9 50%, transparent 51%), radial-gradient(1px 1px at 72% 18%, #fff8 50%, transparent 51%), radial-gradient(1.5px 1.5px at 84% 62%, #fff7 50%, transparent 51%), radial-gradient(1px 1px at 34% 70%, #fff6 50%, transparent 51%), radial-gradient(1px 1px at 58% 40%, #fff7 50%, transparent 51%); animation: cams-twinkle 5s ease-in-out infinite alternate; }
@keyframes cams-twinkle { to { opacity: .45; } }
.stream-sleep { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 34ch; }
.stream-sleep b { font-size: clamp(30px, 7vw, 48px); line-height: 1; animation: cams-float 4s ease-in-out infinite; }
@keyframes cams-float { 50% { transform: translateY(-5px); } }
.stream-standby.is-sleep strong { color: #fff4d6; }
.stream-standby.is-sleep span { color: #d6d4ef; }
@media (prefers-reduced-motion: reduce) { .stream-standby.is-sleep::before, .stream-sleep b { animation: none; } }
@media (prefers-reduced-motion: reduce) { .cams-menu, .cams-menu.closing { animation: none; } .cams-fab { transition: none; } }
