#viewer-controls[hidden] { display: none; }
.cat-panel {
  position: fixed;
  top: 128px;
  left: 32px;
  width: 285px;
  padding: 14px;
  background: #17232ce8;
  border: 1px solid #ffffff3d;
  border-radius: 10px;
  backdrop-filter: blur(12px);
  z-index: 3;
}
.cat-panel[hidden] { display: none; }
#cat-reticle { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); pointer-events: none; color: #fff; text-shadow: 0 1px 3px #000; font-size: 24px; }
#cat-reticle[hidden] { display: none; }
.cat-panel p { margin: 8px 0 12px; font-size: 12px; line-height: 1.7; color: #e5e4d8; }
.camera-actions { display: grid; gap: 8px; }
.camera-actions button { font-size: 12px; padding: 10px; min-height: 44px; }
#stage-camera { background: #e4eff2; color: #17343e; border-color: #b2d7df; }
#stage-feed { background: #e8d7ae; border-color: #e8d7ae; color: #302b20; }
.camera-actions button:disabled { opacity: .5; cursor: default; }
.cat-panel #feed-status { margin: 9px 0; font-size: 11px; line-height: 1.6; }
.cat-panel .matatabi-note { margin: 5px 0; color: #ead9b5; font-size: 11px; }
.simulation-note { display: flex; align-items: center; gap: 10px; }
.simulation-note small { flex: 1; font-size: 10px; line-height: 1.6; color: #bed1d9; }
#cat-toggle { padding: 8px; min-height: 44px; flex-shrink: 0; font-size: 10px; color: #c5d8e0; }
@media (max-width:650px), (pointer:coarse) and (max-width:1024px) {
  .cat-panel { top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; width: min(360px, calc(100vw - 24px)); padding: 10px 12px; }
  .cat-panel > .eyebrow { display: none; }
  .cat-panel p { margin: 0 0 6px; font-size: 11px; }
  .camera-actions { grid-template-columns: 1fr 1.4fr; gap: 6px; }
  .camera-actions button { padding: 8px; font-size: 11px; }
  .cat-panel #feed-status { margin: 5px 0; }
}
@media (max-height:650px) and (min-width:651px) and (pointer:fine) {
  .cat-panel { top: 128px; left: 32px; width: 330px; padding: 10px 12px; }
  .cat-panel > .eyebrow { display: none; }
  .cat-panel p { margin: 0 0 6px; }
  .camera-actions { grid-template-columns: 1fr 1.4fr; }
}
@media (max-height:500px) and (min-width:651px) and (pointer:fine) {
  .cat-panel { top: 100px; }
}
.pad[hidden], #stage-banner[hidden] { display: none; }
#stage-banner { position: fixed; top: 18px; left: 24px; right: 24px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
#stage-banner > span:last-child { margin-left: auto; color: #a7c4ca; font-size: 10px; letter-spacing: .15em; }
.camera-dot { width: 8px; height: 8px; border-radius: 50%; background: #93d2b7; }
body[data-camera="stage"] { background: #0c171e; }
body[data-camera="stage"] #view { inset: 58px 16px 205px; display: flex; align-items: center; justify-content: center; }
body[data-camera="stage"] canvas { border: 1px solid #52616b; border-radius: 6px; max-width: 100%; }
body[data-camera="stage"] .cat-panel { top: auto; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(850px,calc(100% - 32px)); padding: 10px 16px; }
body[data-camera="stage"] .cat-panel > .eyebrow { display: none; }
body[data-camera="stage"] .cat-panel #cat-status { margin: 0 0 8px; }
body[data-camera="stage"] .camera-actions { grid-template-columns: 1fr 1.5fr; }
body[data-camera="stage"] .simulation-note { justify-content: space-between; }
body[data-camera="stage"] #hint { bottom: 215px; }
@media (max-width:650px) {
  body[data-camera="stage"] #view { inset: 56px 12px auto; height: calc((100vw - 24px) * 9 / 16); }
  body[data-camera="stage"] .cat-panel { top: calc(72px + (100vw - 24px) * 9 / 16); bottom: auto; width: calc(100% - 24px); padding: 10px 12px; }
  #stage-banner { left: 12px; right: 12px; font-size: 12px; }
}
@media (min-width:651px) and (max-height:500px) {
  body[data-camera="stage"] #view { inset: 48px 294px 12px 12px; }
  body[data-camera="stage"] .cat-panel { top: 48px; bottom: 12px; left: auto; right: 12px; transform: none; width: 266px; overflow-y: auto; padding: 10px 12px; }
  body[data-camera="stage"] .camera-actions { grid-template-columns: 1fr; gap: 6px; }
  body[data-camera="stage"] .cat-panel #feed-status { margin: 6px 0; }
}
.pad, .pad button, .pad svg {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.pad button { display: grid; place-items: center; }
.pad svg { width: 16px; height: 16px; fill: currentColor; pointer-events: none; }
.pad {
  position: fixed;
  right: calc(32px + env(safe-area-inset-right, 0px));
  bottom: calc(25px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
}
@media (max-width:650px) {
  .pad { right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-height:500px) {
  .pad { right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
#device-look {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  min-height: 44px;
  max-width: calc(100vw - 180px);
  padding: 10px 12px;
  font-size: 12px;
  background: #17232ce8;
  backdrop-filter: blur(12px);
}
#device-look[aria-pressed="true"] { background: #e3f3f6; color: #122f3b; }
#controls-toggle {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  min-width: 112px;
  min-height: 44px;
  padding: 11px 16px;
  background: #17232ce8;
  border-color: #bcd2dc99;
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px #0003;
}
@media (max-width:650px), (pointer:coarse) and (max-width:1024px) {
  /* Keep the persistent toggle clear of the movement pad and keyboard help. */
  .instructions, #mouse { display: none; }
}
@media (pointer:coarse) and (min-width:651px) and (max-height:500px) {
  #device-look {
    left: calc(140px + env(safe-area-inset-left, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .lens-control, .quality-control {
    top: 76px;
    width: min(300px, calc((100vw - 48px) / 2));
  }
  .lens-control { left: 16px; right: auto; padding: 10px 12px; }
  .lens-label { font-size: 12px; }
  .quality-control { right: 16px; }
  .quality-control, .quality-control[open] { max-height: calc(100dvh - 192px); }
}

body[data-preview="true"] #viewer-controls,body[data-preview="true"] #cat-panel,body[data-preview="true"] #stage-banner,body[data-preview="true"] #controls-toggle,body[data-preview="true"] #device-look,body[data-preview="true"] .pad,body[data-preview="true"] #hint{display:none!important}
body[data-preview="true"][data-camera="stage"] #view{inset:0;height:100%;width:100%}
body[data-preview="true"] canvas{border:0;border-radius:0}
body[data-embed="stage"] #viewer-controls,body[data-embed="stage"] #cat-panel,body[data-embed="stage"] #stage-banner,body[data-embed="stage"] #controls-toggle,body[data-embed="stage"] #device-look,body[data-embed="stage"] .pad,body[data-embed="stage"] #hint{display:none!important}
body[data-embed="stage"][data-camera="stage"] #view{inset:0;height:100%;width:100%}
body[data-embed="stage"] canvas{border:0;border-radius:0}
body[data-embed="stage"] #loading{padding:12px;text-align:center}
body[data-embed="stage"] #loading h2{font-size:clamp(13px,3vw,20px);margin:10px 0}
body[data-embed="stage"] #loading p{font-size:11px;margin:8px 0}
body[data-embed="stage"] #loading .eyebrow{font-size:10px}
#stage-live-label{display:none;position:absolute;z-index:2;top:calc((100% - var(--picture-height,100%))/2 + 12px);right:calc((100% - var(--picture-width,100%))/2 + 12px);align-items:center;gap:7px;padding:6px 10px;border-radius:5px;background:rgba(24,30,31,.85);color:#fff;font:700 14px/1.4 var(--font-site);letter-spacing:.03em;pointer-events:none;box-shadow:0 1px 6px #0003}#stage-live-label i{width:8px;height:8px;border-radius:50%;background:#ff4f60}body[data-camera="stage"] #stage-live-label{display:flex}body[data-preview="true"] #stage-live-label{display:none}body[data-embed="stage"] #stage-live-label{font-size:clamp(9px,2.5vw,14px);top:calc((100% - var(--picture-height,100%))/2 + 8px);right:calc((100% - var(--picture-width,100%))/2 + 8px);padding:4px 7px;gap:5px}@media(max-width:600px){#stage-live-label{font-size:11px;padding:4px 7px;top:calc((100% - var(--picture-height,100%))/2 + 8px);right:calc((100% - var(--picture-width,100%))/2 + 8px)}}
