/* Live editor and free rectangle presentation own both viewport sizes. */
.top-right:has(.live-layout-toggle) { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.top-right > .live-layout-toggle { grid-column: 2; grid-row: 1; min-height: 34px; }
.top-right:has(.live-layout-toggle) > .live-refresh { grid-column: 3; }
.top-right:has(.live-layout-toggle) .health-drawer > summary { margin-right: 270px; }
.top-right > .live-picture-toggle { grid-column: 2 / -1; grid-row: 2; justify-self: end; }
.top-right > .grid-fullscreen-toggle { grid-column: 4; grid-row: 1; }
@media (min-width: 901px) {
    body.live-page .top-right:has(.live-layout-toggle) { grid-template-columns: minmax(0, 1fr) auto auto auto auto; }
    body.live-page .top-right > .live-picture-toggle { grid-column: 5; grid-row: 1; align-self: start; }
    body.live-page .top-right:has(.live-layout-toggle) .health-drawer > summary { margin-right: 400px; }
}
body.live-page .top-right > :is(.live-layout-toggle,.live-refresh,.grid-fullscreen-toggle,.live-picture-toggle) {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; padding: 5px 9px; border: 1px solid var(--line);
    border-radius: var(--control-radius); background: var(--surface-soft);
    color: var(--text); box-shadow: none; font: 600 11px/1.2 system-ui,sans-serif;
    white-space: nowrap; cursor: pointer;
}
.grid-fullscreen-exit { position: fixed; z-index: 180; top: max(6px,env(safe-area-inset-top)); left: max(6px,env(safe-area-inset-left)); padding: 8px 10px; min-height: 36px; border: 1px solid #6e9890; border-radius: 6px; background: #102024e8; color: #fff; cursor: pointer; }
.grid-fullscreen-note { position: fixed; z-index: 180; bottom: max(8px,env(safe-area-inset-bottom)); left: 8px; right: 8px; max-width: 480px; margin: 0 auto; padding: 10px; background: #102024f0; color: #fff; font-size: 12px; }
.grid-fullscreen-exit[hidden], .grid-fullscreen-note[hidden] { display: none; }
body.grid-fullscreen > .top { visibility: hidden !important; opacity:0 !important; pointer-events:none !important; }
html body.live-page.grid-fullscreen:not(.has-expanded) #grid.custom-live-layout { top: 0; height: 100dvh; }
body.live-page .top-right > :is(.live-layout-toggle,.live-refresh,.live-picture-toggle):hover {
    border-color: var(--accent-border); background: var(--accent-wash);
}
body.live-page .top-right > :is(.live-layout-toggle,.live-refresh,.live-picture-toggle):focus-visible {
    outline: 2px solid var(--focus); outline-offset: 2px;
}
.top-right > :is(.live-layout-toggle,.live-refresh) svg {
    width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent);
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.layout-toggle-label { display: flex; flex-direction: column; gap: 1px; }
.layout-view-count { color: var(--muted); font-size: 9px; font-weight: 400; font-variant-numeric: tabular-nums; }
.live-layout-toggle.has-available-cameras .layout-view-count { color: var(--accent); font-weight: 600; }
.layout-camera-reminder {
    position: fixed; z-index: 125; bottom: calc(max(12px,env(safe-area-inset-bottom)) + 44px); left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 24px); box-sizing: border-box;
    padding: 6px 6px 6px 14px; border: 1px solid var(--accent-border); border-radius: 12px;
    background: color-mix(in srgb,var(--panel) 96%,transparent); color: var(--text); box-shadow: 0 4px 20px #0006;
}
.layout-camera-reminder[hidden], body:is(.has-expanded,.grid-fullscreen,.live-orientation-fullscreen,.editing-live-layout) .layout-camera-reminder { display: none; }
.layout-reminder-text { display: grid; gap: 2px; min-width: 0; }
.layout-reminder-text strong { font: 600 12px/1.4 system-ui,sans-serif; white-space: nowrap; }
.layout-reminder-text small { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11px/1.4 system-ui,sans-serif; color: var(--muted); }
.layout-camera-reminder button { flex: none; min-height: 44px; border: 0; border-radius: 8px; box-shadow: none; font: 600 12px/1.2 system-ui,sans-serif; cursor: pointer; touch-action: manipulation; }
.layout-reminder-add { padding: 8px 12px; background: var(--accent); color: var(--bg); }
.layout-reminder-dismiss { display: grid; place-items: center; min-width: 44px; padding: 10px; background: transparent; color: var(--muted); }
.layout-reminder-dismiss svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.layout-camera-reminder button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.layout-camera-reminder button:hover { filter: brightness(1.15); }
@media(max-width: 400px) { .layout-camera-reminder { gap: 6px; padding-left: 10px; } .layout-reminder-add { padding-inline: 8px; } }
.live-layout-editor[hidden], #grid > .tile[hidden], .layout-tile-controls[hidden] { display: none !important; }

/* Grid recording, FPS and camera identity share one compact bottom row. */
body.live-page #grid .tile:not(.expanded) .hud {
    inset: 0;
    padding: 0;
    background: none;
}
body.live-page #grid .tile:not(.expanded) .hud-meta-row { display: none; }
body.live-page #grid .tile:not(.expanded) .hud-row {
    position:absolute;bottom:2px;left:3px;right:3px;
    display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;gap:6px;align-items:end;
}
body.live-page #grid .tile:not(.expanded) .live-camera-name {
    grid-column:3;grid-row:1;min-width:0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    color: #fff;
    text-shadow: 0 1px 3px #000, 0 0 2px #000;
    background: linear-gradient(90deg, transparent, #0008 15%, #0008 85%, transparent);
}
body.live-page #grid .tile:not(.expanded) .live-camera-name span { display: inline-block; }
body.live-page #grid .tile:not(.expanded) .live-camera-name.is-overflowing { text-align: left; }
@media (prefers-reduced-motion: no-preference) {
    body.live-page #grid .tile:not(.expanded) .live-camera-name.is-overflowing span {
        animation: live-camera-name-pan var(--name-duration, 10s) linear infinite alternate;
    }
}
@keyframes live-camera-name-pan {
    from { transform: translateX(0); }
    to { transform: translateX(var(--name-travel, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
    body.live-page #grid .tile:not(.expanded) .live-camera-name.is-overflowing { text-overflow: ellipsis; }
    body.live-page #grid .tile:not(.expanded) .live-camera-name span { display: inline; }
}
.hud-recording-indicators { display: inline-flex; align-items: center; gap: 5px; }
body.live-page #grid .tile:not(.expanded) .hud-state-cluster { display: contents; }
body.live-page #grid .tile:not(.expanded) .hud-recording-indicators {
    grid-column:1;grid-row:1;
    flex-direction: row;
    align-items: flex-start;
    gap: 2px;
    margin: 0;
}
body.live-page #grid .tile:not(.expanded) .tile-detection-indicators {
    grid-column:4;grid-row:1;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 2px;
}
body.live-page #grid .tile:not(.expanded) .hud-state-cluster :is(.live-dot, .camera-mode, .tile-detection-indicators span) {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    padding: 1px 3px;
    border: 0;
    border-radius: 3px;
    box-shadow: none;
    background: #0009;
    font-size: 9px;
    line-height: 12px;
    letter-spacing: 0;
}
body.live-page #grid .tile:not(.expanded) .live-dot:is([data-state="live"], [data-state="off"]),
body.live-page #grid .tile:not(.expanded) .camera-mode:not([data-camera-mode-state="rec"]):not([aria-busy="true"]),
body.live-page #grid .tile:not(.expanded) .tile-detection-indicators:empty { display: none; }
.live-layout-editor { position: fixed; inset: 0 0 auto; z-index: 160; padding: 10px 16px; color: var(--text); background: #111c22; border-bottom: 1px solid #385e52; box-shadow: 0 6px 20px #0008; max-height: 43dvh; overflow-y: auto; }
.layout-heading, .layout-actions, .layout-profiles, .layout-profile-save form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.layout-heading { justify-content: space-between; }
.layout-title { display:flex; align-items:center; gap:6px; }
.layout-heading strong { font-size: 15px; }
.live-layout-editor button, .live-layout-editor select, .live-layout-editor input { min-height: 36px; border: 1px solid #425e63; border-radius: 7px; background: #1b2b32; color: var(--text); padding: 6px 10px; font-size: 12px; }
.live-layout-editor button { cursor: pointer; }
.live-layout-editor :disabled { opacity: .45; cursor: default; }
.live-layout-editor .layout-done { background: #235440; border-color: #70c6a4; }
.live-layout-editor .layout-adjust[aria-pressed="true"] { background: #235440; border-color: #70c6a4; }
.live-layout-editor .layout-icon-action { display:inline-grid; place-items:center; width:36px; padding:6px; border:0; background:none; }
.live-layout-editor .layout-icon-action svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.live-layout-editor .layout-icon-action:is(:hover,:focus-visible) { color:var(--accent); background:var(--accent-wash); }
.live-layout-editor .layout-icon-action[hidden] { display:none; }
.layout-tools-toggle svg { transform:none; }
.live-layout-editor .ui-help { border:0; background:none; padding:0; color:var(--control-help); }
.layout-help, .layout-feedback, .layout-profile-metadata { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.layout-feedback:empty, .layout-profile-metadata:empty { display: none; }
.layout-profiles { margin-top: 6px; }
.layout-profiles > select { max-width: min(280px, 55vw); }
.layout-profile-save summary, .layout-camera-choice summary { cursor: pointer; padding: 7px 0; font-size: 12px; }
.layout-profile-save[open] { flex-basis: 100%; }
.layout-profile-save input { width: min(220px, 60vw); }
.layout-camera-picker { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 8px; padding: 4px 0 8px; }
.layout-camera-picker .camera-pad { min-height: 76px; }
.layout-camera-picker .camera-pad[aria-pressed="false"] { opacity: .48; filter: grayscale(1); }
.layout-camera-picker .camera-pad[aria-pressed="true"] { border-color: #71d8a6; box-shadow: inset 0 0 0 1px #71d8a6; }
.layout-camera-picker .camera-pad.layout-camera-available { opacity: 1; filter: none; border-color: var(--accent-border); background: var(--accent-wash); }
.layout-camera-picker .camera-pad-state { display: block; font: 500 10px/1.3 system-ui,sans-serif; color: var(--muted); }
.layout-camera-picker .layout-camera-available .camera-pad-state { color: var(--accent); }
body.live-page:not(.has-expanded) #grid,
body.live-page:not(.has-expanded) #grid .tile,
body.live-page:not(.has-expanded) #grid .tile :is(live-tile, video, .rewind-stage) { touch-action: pan-y; overscroll-behavior: auto; }
html.ui-ios body.live-page:not(.has-expanded) #grid { overscroll-behavior: none; }
body.live-page:not(.has-expanded) #grid .tile video { cursor: pointer !important; }
body.live-page:not(.has-expanded):not(.editing-live-layout) #grid .tile.media-zoomed video { cursor: grab !important; }
body.live-page:not(.has-expanded):not(.editing-live-layout) #grid .tile.is-panning video { cursor: grabbing !important; }
.grid-picture-controls { position: absolute; z-index: 36; top: var(--grid-picture-top,4px); right: 4px; display: flex; gap: 3px; }
.grid-picture-controls button { min-height: 32px; min-width: 32px; padding: 4px 7px; border: 1px solid #617d79; border-radius: 5px; background: #102024dd; color: #e5f5ef; font: 600 10px/1 system-ui,sans-serif; cursor: pointer; touch-action: manipulation; }
.grid-picture-zoom { display: flex; gap: 3px; }
body:not(.toolbar-pinned) .grid-picture-controls, .grid-picture-zoom[hidden], .tile.expanded .grid-picture-controls, body.editing-live-layout .grid-picture-controls { display: none; }
body.live-page .top-right > .live-picture-toggle[aria-pressed="true"] { background: #235440; border-color: #70c6a4; }
body.live-page:not(.has-expanded) #grid .tile.picture-adjusting,
body.live-page:not(.has-expanded) #grid .tile.picture-adjusting :is(live-tile,video,.rewind-stage) { touch-action: none; }
body.editing-live-layout > .top { visibility: hidden; }
body.editing-live-layout .grid-scroll-cue { display: none !important; }
html body.live-page #grid.custom-live-layout { position: fixed; inset: 0; height: 100dvh; transform: none; }
html body.live-page.toolbar-pinned #grid.custom-live-layout { top: var(--live-toolbar-open-height, 0px); height: calc(100dvh - var(--live-toolbar-open-height, 0px)); transform: none; }
html body.live-page.editing-live-layout #grid.custom-live-layout { position: fixed; inset: var(--layout-editor-height, 160px) 0 0; height: calc(100dvh - var(--layout-editor-height, 160px)); transform: none; }
html body.live-page.editing-live-layout.layout-editor-maximized #grid.custom-live-layout { inset:0; height:100dvh; }
body.layout-editor-maximized .live-layout-editor { inset:auto 8px max(8px,env(safe-area-inset-bottom)); max-width:1100px; margin-inline:auto; border:1px solid var(--line); border-radius:10px; background:color-mix(in srgb,var(--panel) 95%,transparent); }
body.layout-editor-maximized .live-layout-editor[data-tools-position^="top-"] {inset:max(8px,env(safe-area-inset-top)) 8px auto;}
body.layout-editor-maximized .live-layout-editor[data-tools-position="top-hidden"] {padding:0;width:44px;overflow:visible;}
body.layout-editor-maximized .live-layout-editor[data-tools-position="top-hidden"] .layout-title,
body.layout-editor-maximized .live-layout-editor[data-tools-position="top-hidden"] .layout-actions > :not(.layout-tools-toggle) {display:none;}
body.layout-editor-maximized .live-layout-editor[data-tools-position="top-hidden"] .layout-heading,
body.layout-editor-maximized .live-layout-editor[data-tools-position="top-hidden"] .layout-actions {margin:0;justify-content:center;}
body.layout-editor-maximized .layout-tools-toggle {min-width:44px;min-height:44px;}
body.layout-editor-maximized .live-layout-editor.layout-tools-collapsed > :not(.layout-heading),
body.layout-editor-maximized .layout-tools-collapsed .layout-actions > :not(.layout-maximize):not(.layout-tools-toggle):not(.layout-cancel):not(.layout-done) { display:none; }
body.editing-live-layout .grid-fullscreen-exit { display:none; }
html body.live-page:not(.has-expanded) #grid.free-live-layout { display: block; padding: 0; gap: 0; overflow: hidden; }
body.live-page:not(.has-expanded) #grid.free-live-layout > .tile { position: absolute; width: auto; height: auto; min-width: 0; min-height: 0; margin: 0; border: 2px solid #0a1118; border-radius: 5px; box-sizing: border-box; }
body.live-page:not(.has-expanded) #grid.free-live-layout > .tile video { object-fit: contain; }
body.editing-live-layout #grid > .tile { outline: 2px solid #5ccd91; outline-offset: -3px; background: #0a1118; }
body.adjusting-live-pictures #grid > .tile.layout-picture-selected { outline: 3px solid #c1ffcf; }
body.editing-live-layout #grid > .tile > :not(.layout-frozen-picture):not(.layout-tile-controls) { visibility: hidden !important; pointer-events: none !important; }
.layout-frozen-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; z-index: 30; }
body.editing-live-layout #grid .layout-tile-controls { display: block; position: absolute; inset: 0; z-index: 35; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.adjusting-live-pictures #grid .layout-tile-controls { cursor: grab; }
body.adjusting-live-pictures #grid .tile.is-panning .layout-tile-controls { cursor: grabbing; }
body.adjusting-live-pictures #grid .layout-lock, body.adjusting-live-pictures #grid .layout-resize { display: none; }
.layout-picture-zoom { position: absolute; right: 5px; top: 5px; z-index: 4; display: flex; gap: 3px; }
.layout-picture-zoom[hidden] { display: none; }
.layout-tile-controls .layout-picture-zoom-button { min-width: 32px; min-height: 32px; padding: 3px 5px; border: 1px solid #8eb5a7; border-radius: 5px; background: #111c22dd; color: #fff; font: 600 10px/1 system-ui,sans-serif; cursor: pointer; touch-action: manipulation; }
.layout-tile-controls .layout-lock { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 34px; height: 32px; padding: 6px 7px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #c5d7cf; z-index: 4; cursor: pointer; touch-action: manipulation; }
.layout-tile-controls .layout-lock:is(:hover,:active) { background: transparent; box-shadow: none; color: #fff; }
.layout-lock svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px #000); }
.layout-lock[aria-pressed="true"] { color: #80efaf; }
.layout-presets { display:flex; flex-wrap:nowrap; gap:6px; margin:8px 0 4px; padding-bottom:4px; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:thin; scroll-snap-type:x proximity; }
.live-layout-editor .layout-preset { display:grid; justify-items:center; gap:4px; flex:0 0 82px; min-width:0; padding:6px 5px; scroll-snap-align:start; }
.layout-preset svg { display: block; width: 48px; height: 34px; fill: #375d50; stroke: #9bb7aa; stroke-width: .65; }
.layout-preset span { font-size: 11px; white-space: nowrap; }
html body.live-page:not(.has-expanded) #grid.free-live-layout.stack-live-layout { overflow-y: auto; overflow-x: hidden; }

.layout-resize { position: absolute; z-index: 2; touch-action: none; }
.layout-resize[data-edge="n"], .layout-resize[data-edge="s"] { left: 16px; right: 16px; height: 16px; cursor: ns-resize; }
.layout-resize[data-edge="n"] { top: 0; }
.layout-resize[data-edge="s"] { bottom: 0; }
.layout-resize[data-edge="e"], .layout-resize[data-edge="w"] { top: 16px; bottom: 16px; width: 16px; cursor: ew-resize; }
.layout-resize[data-edge="e"] { right: 0; }
.layout-resize[data-edge="w"] { left: 0; }
.layout-resize[data-edge="nw"], .layout-resize[data-edge="ne"], .layout-resize[data-edge="sw"], .layout-resize[data-edge="se"] { width: 24px; height: 24px; z-index: 3; }
.layout-resize[data-edge="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.layout-resize[data-edge="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.layout-resize[data-edge="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
.layout-resize[data-edge="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
body.editing-live-layout #grid .layout-dragging .layout-tile-controls { cursor: grabbing; }
body.editing-live-layout #grid .layout-locked .layout-tile-controls { cursor: default; }
.layout-locked .layout-resize { display: none; }
.layout-tile-controls:focus-visible, .layout-tile-controls button:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
@media (prefers-reduced-motion: no-preference) {
    body.editing-live-layout #grid > .tile { animation: layout-breathe 3.8s ease-in-out infinite; }
    body.editing-live-layout #grid > .tile:not(.layout-dragging) { transition: left .12s ease-out, top .12s ease-out, right .12s ease-out, bottom .12s ease-out; }
    @keyframes layout-breathe { 0%,100% { outline-color: #3a835f; box-shadow: inset 0 0 5px #4acb8133; } 50% { outline-color: #96ffc0; box-shadow: inset 0 0 17px #60ff9d55; } }
}
@media (max-width: 900px) {
    .live-layout-editor { padding: 8px; }
    .layout-heading strong { font-size: 13px; }
    .layout-heading, .layout-actions { gap: 5px; }
    .layout-actions button { padding: 6px 8px; }
    .layout-camera-picker { grid-template-columns: repeat(auto-fill,minmax(90px,1fr)); }
    .layout-tile-controls .layout-lock { width: 34px; height: 32px; }
}
.live-layout-editor .layout-preset[data-preset="kaleidoscope"] { flex-basis:112px; }
.layout-guides { position:absolute; left:0; top:0; width:100%; z-index:34; pointer-events:none; overflow:hidden; }
.layout-guides[hidden] { display:none; }
.layout-guides > span { position:absolute; pointer-events:none; }
.layout-guides > [data-axis="x"] { top:0; left:var(--guide-position); width:1px; height:100%; background:repeating-linear-gradient(to bottom,#d6eee547 0 3px,transparent 3px 7px); }
.layout-guides > [data-axis="y"] { left:0; top:var(--guide-position); width:100%; height:1px; background:repeating-linear-gradient(to right,#d6eee547 0 3px,transparent 3px 7px); }
.layout-guides > [data-center="true"] { background:#d6eee578; box-shadow:0 0 1px #0008; }
.live-kaleidoscope { position:absolute; inset:0; width:100%; height:100%; z-index:3; pointer-events:none; }
.live-kaleidoscope[hidden] { display:none; }
html body.live-page #grid.kaleidoscope-live-layout { gap:0; padding:0; overflow:hidden; }
html body.live-page #grid.kaleidoscope-live-layout > .tile { border:0; border-radius:0; box-shadow:none; }

@media(min-width:901px) {
 .layout-profile-save {flex-basis:100%;display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;}
 .layout-profile-save > strong {font-size:13px;}
 .layout-profile-save form {flex:1;}
 .layout-profile-save .layout-profile-metadata {flex-basis:100%;margin-top:0;}
 .live-layout-editor .layout-profiles > button[hidden] {display:none;}
 .layout-profile-quick {position:relative;min-width:130px;max-width:230px;}
 .layout-profile-quick > summary {cursor:pointer;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft);padding:10px;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
 .layout-profile-choices {position:absolute;z-index:170;top:calc(100% + 6px);left:0;width:270px;max-width:calc(100vw - 32px);max-height:360px;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:4px;box-shadow:0 8px 24px #0007;}
 .layout-profile-choices button {display:block;width:100%;min-height:36px;padding:8px;text-align:left;border:0;background:none;color:var(--text);font:13px/20px system-ui,sans-serif;cursor:pointer;}
 .layout-profile-choices button:is(:hover,:focus-visible,[aria-current=true]) {background:var(--accent-wash);color:var(--accent);}
 .layout-profile-choices p {font-size:12px;white-space:normal;padding:8px;}
 .layout-tools-toggle[aria-expanded=true] svg {transform:none;}
 .layout-tools-toggle svg {filter:drop-shadow(0 0 4px #83dbb34d);}
}

@media(max-width:900px) {
 .layout-profile-quick {position:relative;flex:none;}
 .layout-profile-quick > summary {display:grid;place-items:center;width:44px;min-height:44px;box-sizing:border-box;border:0;border-radius:8px;background:none;color:var(--text);cursor:pointer;list-style:none;}
 .layout-profile-quick > summary::-webkit-details-marker {display:none;}
 .layout-profile-quick[open] > summary {color:var(--accent);background:var(--accent-wash);}
 .layout-profile-choices {position:absolute;z-index:700;top:calc(100% + 6px);right:0;width:270px;max-width:calc(100vw - 24px);max-height:min(360px,55dvh);overflow:auto;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;padding:4px;background:var(--panel);color:var(--text);box-shadow:0 8px 24px #0007;}
 .layout-profile-choices[popover] {position:fixed;inset:auto;margin:0;}
 .layout-profile-choices button {display:block;width:100%;min-height:44px;padding:8px;text-align:left;border:0;border-radius:5px;background:none;color:var(--text);font:14px/20px system-ui,sans-serif;cursor:pointer;}
 .layout-profile-choices button:is(:focus-visible,[aria-current=true]) {background:var(--accent-wash);color:var(--accent);}
 .layout-profile-choices p {font-size:13px;white-space:normal;padding:8px;}
}

@media(min-width:901px) {
 .layout-profile-quick > summary,.layout-profile-choices button {font-size:16px;line-height:24px;}
 .layout-profile-choices button {min-height:40px;}
 .layout-profile-choices {max-height:400px;}
 .layout-profile-save > strong,.layout-profile-save form :is(input,select,button),.live-layout-editor :is(button,label,select) {font-size:16px;}
}

body.live-page .live-fps-reading {font-size:11px;line-height:18px;color:#fff;text-shadow:0 1px 3px #000;font-variant-numeric:tabular-nums;white-space:nowrap;}
body.live-page #grid .tile:not(.expanded) .live-fps-reading {grid-column:2;grid-row:1;}
body.live-page .tile:is(.expanded,:fullscreen,:-webkit-full-screen) .live-fps-reading {display:none;}

/* A tile's available width, independent of the phone/desktop shell. */
body.live-page #grid > .tile {container:live-camera / inline-size;}
body.live-page #grid .tile .hud-row > * {min-width:0;}
body.live-page #grid .tile .hud-meta-row {flex-wrap:wrap;}
body.live-page #grid .tile .hud-meta {min-width:0;overflow-wrap:anywhere;}
body.live-page #grid .tile:is(.expanded,:fullscreen) .live-camera-name {min-width:0;}
body.live-page #grid .tile:is(.expanded,:fullscreen) .live-camera-name {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
body.live-page #grid .tile:is(.expanded,:fullscreen) .hud-state-cluster {flex-wrap:wrap;white-space:normal;}
@container live-camera (max-width:320px) {
 body.live-page #grid .tile:not(.expanded) .hud-row {gap:3px;}
 body.live-page #grid .tile:not(.expanded) .live-fps-reading {font-size:10px;}
}
@container live-camera (max-width:180px) {
 body.live-page #grid .tile:not(.expanded) .hud-row {gap:2px;}
 body.live-page #grid .tile:not(.expanded) .live-camera-name {font-size:10px;}
 body.live-page #grid .tile:not(.expanded) .hud-state-cluster :is(.live-dot,.camera-mode,.tile-detection-indicators span) {padding-inline:2px;font-size:8px;}
}
