:root{
  --bg:#0E141C; --surface:#141D27; --surface2:#18232F;
  --ink:#E9EFF3; --muted:#93A4B1; --faint:#5F7280;
  --accent:#3FE0CE; --accent-ink:#0E141C;
  --line:#243140; --danger:#E86A6A;
  --safe-top:env(safe-area-inset-top,0px); --safe-bot:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html,body{margin:0; height:100%}
body{
  background:var(--bg); color:var(--ink);
  font-family:"IBM Plex Sans",-apple-system,"Segoe UI",sans-serif;
  font-size:16px; line-height:1.5; overscroll-behavior:none;
}
#view{min-height:100%; max-width:640px; margin:0 auto}
button{font:inherit; color:inherit; background:none; border:none; cursor:pointer}
input{font:inherit}

.topbar{
  display:flex; align-items:center; gap:8px;
  padding:calc(14px + var(--safe-top)) 16px 12px; border-bottom:1px solid var(--line);
  position:sticky; top:0; background:var(--bg); z-index:5;
}
.topbar h1{font-family:"Chakra Petch",sans-serif; font-size:1.15rem; font-weight:600; margin:0; flex:1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.back{font-size:1.9rem; line-height:1; color:var(--accent); text-decoration:none; padding:0 6px 4px 0}
.back-spacer{width:6px}
.top-actions{display:flex; gap:8px}
.icon-btn{font-size:1.2rem; color:var(--muted); text-decoration:none; padding:4px 6px}

.pad{padding:18px 16px calc(28px + var(--safe-bot))}
.muted{color:var(--muted)} .small{font-size:.85rem}
.eyebrow-row{
  font-family:"IBM Plex Mono",monospace; font-size:.72rem; letter-spacing:.15em;
  text-transform:uppercase; color:var(--accent); margin:18px 0 10px;
}
.eyebrow-row:first-child{margin-top:0}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border-radius:10px; padding:12px 18px; font-weight:600; font-size:.95rem;
  border:1px solid var(--line); background:var(--surface); transition:filter .15s;
}
.btn:active{filter:brightness(1.25)}
.btn.primary{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}
.btn.ghost.on{border-color:var(--accent); color:var(--accent)}
.btn.wide{display:flex; width:100%; margin-top:14px}
.btnrow{display:flex; gap:10px; margin-top:14px}
.btnrow .btn{flex:1}

.empty{text-align:center; color:var(--muted); padding:48px 12px 8px}
.cardlist{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px}
.cardlist li{display:flex; align-items:stretch; background:var(--surface); border:1px solid var(--line); border-radius:12px; overflow:hidden}
.cardlist a{flex:1; display:flex; flex-direction:column; gap:2px; padding:14px 16px; color:inherit; text-decoration:none}
.cardlist .del{color:var(--faint); font-size:1.3rem; padding:0 16px}
.cardlist .del:active{color:var(--danger)}

.shotgrid{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:6px}
.shot-thumb{position:relative; display:block; border-radius:10px; overflow:hidden; border:1px solid var(--line); background:var(--surface)}
.shot-thumb canvas{display:block; width:100%; height:auto}
.badge{
  position:absolute; left:8px; bottom:8px; font-family:"IBM Plex Mono",monospace;
  font-size:.62rem; letter-spacing:.1em; background:rgba(14,20,28,.8); color:var(--accent);
  padding:3px 8px; border-radius:5px;
}

.field{display:flex; flex-direction:column; gap:6px; margin:12px 0; font-size:.88rem; color:var(--muted)}
.field input{
  background:var(--surface); border:1px solid var(--line); border-radius:9px;
  color:var(--ink); padding:11px 13px; outline:none;
}
.field input:focus{border-color:var(--accent)}

/* capture */
.capture{position:fixed; inset:0; background:#000; display:flex; align-items:center; justify-content:center; z-index:20}
/* Capture always frames the TRUE lens view so the installer shoots the room the
   way they see it; the profile sim is a preview, applied to the shot afterward. */
.capture video{display:none; max-width:100%; max-height:100%}
.capture canvas{max-width:100%; max-height:100%}
.capture.true-view video{display:block}
.capture.true-view canvas{display:none}
.view-toggle{
  display:flex; gap:0; border:1px solid var(--line); border-radius:9px;
  overflow:hidden; background:rgba(20,29,39,.85);
}
.view-toggle button{
  flex:1; padding:8px 10px; font-size:.72rem; font-weight:600; letter-spacing:.06em;
  color:var(--muted); background:transparent; border:0;
}
.view-toggle button.on{background:var(--accent); color:#08131c}
.cap-top{position:absolute; top:calc(10px + var(--safe-top)); left:0; right:0; display:flex; align-items:flex-start; gap:10px; padding:0 14px; z-index:2}
.cap-close{font-size:2rem; line-height:1; color:#fff; text-decoration:none; padding:2px 10px}
.cap-col{flex:1; display:flex; flex-direction:column; gap:6px; margin-right:44px}
.cap-col .cap-hint{margin-right:0}
.orient-line{
  align-self:center; font-family:"IBM Plex Mono",monospace; font-size:.68rem; letter-spacing:.12em;
  color:var(--accent); background:rgba(14,20,28,.72); border-radius:7px; padding:5px 12px;
}
.orient-line[hidden]{display:none}
.browser-note{
  background:rgba(14,20,28,.92); border:1px solid #e5484d; border-radius:9px;
  padding:10px 12px; font-size:.78rem; line-height:1.45; color:var(--ink);
}
.browser-note b{color:#ff8a8d; display:block; margin-bottom:2px}
.browser-note .btn.small{margin-top:8px; padding:6px 10px; font-size:.72rem; width:100%}
.install-line{
  font-family:"IBM Plex Mono",monospace; font-size:.74rem; letter-spacing:.08em;
  color:var(--accent); border:1px dashed var(--accent); border-radius:8px;
  padding:9px 12px; margin:10px 0 0;
}
.install-line[hidden]{display:none}
.cardlist .edit{color:var(--faint); font-size:.95rem; padding:0 4px 0 12px}
.cardlist .edit:active{color:var(--accent)}
.cap-hint{
  flex:1; text-align:center; font-size:.82rem; color:var(--ink);
  background:rgba(14,20,28,.72); border-radius:9px; padding:8px 12px; margin-right:44px;
}
.cap-profiles{
  position:absolute; left:0; right:0; bottom:calc(150px + var(--safe-bot));
  display:flex; gap:8px; overflow-x:auto; padding:8px 14px; z-index:2; scrollbar-width:none;
}
.cap-profiles::-webkit-scrollbar{display:none}
.cap-profiles button{
  flex-shrink:0; display:flex; flex-direction:column; align-items:flex-start;
  background:rgba(20,29,39,.85); border:1px solid var(--line); border-radius:9px;
  padding:7px 12px; font-size:.8rem; font-weight:600; color:var(--ink);
}
.cap-profiles button span{font-weight:400; font-size:.68rem; color:var(--muted)}
.cap-profiles button.on{border-color:var(--accent); color:var(--accent)}
.cap-profiles.light{position:static; padding:10px 16px 0}
.cap-profiles.wrap{flex-wrap:wrap; overflow:visible}
.cap-controls{
  position:absolute; left:0; right:0; bottom:0; z-index:2;
  padding:10px 18px calc(16px + var(--safe-bot)); background:linear-gradient(transparent, rgba(0,0,0,.75));
}
.zoomrow{display:flex; align-items:center; gap:12px; font-size:.82rem; color:var(--muted); margin:8px 0}
.zoomrow input{flex:1; accent-color:var(--accent)}
.zoomrow span{font-family:"IBM Plex Mono",monospace; font-size:.8rem; color:var(--ink); min-width:3.2em; text-align:right}
.src-row select{
  flex:1; background:var(--surface); border:1px solid var(--line); border-radius:8px;
  color:var(--ink); padding:8px 10px; font:inherit; font-size:.85rem; outline:none;
}
.src-row select:focus{border-color:var(--accent)}
.src-row[hidden]{display:none}
.cap-buttons{display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:4px}
.shutter{
  width:68px; height:68px; border-radius:50%; background:#fff;
  border:5px solid rgba(255,255,255,.35); background-clip:padding-box;
}
.shutter:active{transform:scale(.93)}
.shutter.sweep-go{background:#e5484d; border-color:rgba(229,72,77,.4)}
/* Guided sweep — briefing card, then a heads-up display over the live view. */
.sweep-brief{
  position:absolute; inset:0; z-index:5; display:flex; align-items:center; justify-content:center;
  background:rgba(6,10,14,.93); padding:20px;
}
.sweep-brief[hidden]{display:none}
.brief-card{max-width:420px; width:100%}
.brief-card h2{margin:0 0 6px; font-size:1.3rem}
.brief-steps{margin:16px 0 22px; padding-left:20px; display:flex; flex-direction:column; gap:11px}
.brief-steps li{font-size:.88rem; line-height:1.45; color:var(--ink)}
.brief-steps b{color:var(--accent)}
.brief-note{
  font-size:.76rem; line-height:1.45; color:var(--muted);
  border-left:2px solid var(--accent); padding-left:10px; margin:0 0 18px;
}
.brief-actions{display:flex; gap:10px}
.brief-actions .btn{flex:1}

.sweep-hud{
  position:absolute; left:0; right:0; bottom:0; z-index:4;
  padding:16px 18px calc(18px + var(--safe-bot));
  background:linear-gradient(transparent, rgba(0,0,0,.88) 32%);
  display:flex; flex-direction:column; gap:12px;
}
.sweep-hud[hidden]{display:none}
/* While sweeping, the HUD owns the screen — no competing controls. */
.capture.sweeping .cap-profiles,
.capture.sweeping .cap-controls,
.capture.sweeping .browser-note{display:none}
.hud-top{display:flex; align-items:center; justify-content:space-between}
.hud-deg{font-family:"IBM Plex Mono",monospace; color:var(--ink)}
.hud-deg b{font-size:2rem; color:var(--accent)}
.hud-deg span{font-size:.8rem; color:var(--muted)}
.hud-level{
  font-family:"IBM Plex Mono",monospace; font-size:.7rem; letter-spacing:.14em;
  color:#08131c; background:var(--accent); border-radius:6px; padding:5px 11px;
}
.hud-level.off{background:#e5484d; color:#fff}
.hud-track{position:relative; height:12px; border-radius:6px; background:rgba(255,255,255,.16); overflow:hidden}
.hud-fill{height:100%; width:0; background:#e5484d; transition:width .15s linear}
.hud-fill.enough{background:var(--accent)}
.hud-goal{position:absolute; top:0; bottom:0; width:2px; background:rgba(255,255,255,.75)}
.hud-goal span{
  position:absolute; bottom:15px; left:-13px; font-family:"IBM Plex Mono",monospace;
  font-size:.6rem; color:var(--muted);
}
.hud-track{margin-top:4px; overflow:visible}
.hud-fill{border-radius:6px}
.hud-arrow{display:flex; align-items:center; gap:12px; margin-top:6px}
.arrow-glyph{
  font-size:1.9rem; line-height:1; color:var(--accent);
  animation:sweep-nudge 1.15s ease-in-out infinite;
}
.hud-arrow.ok .arrow-glyph{animation:none; opacity:.45}
.arrow-text{font-size:.9rem; font-weight:600; color:#fff}
@keyframes sweep-nudge{0%,100%{transform:translateX(-5px); opacity:.5} 50%{transform:translateX(6px); opacity:1}}
@media (prefers-reduced-motion:reduce){.arrow-glyph{animation:none}}
.sweep-hud .btn[disabled]{opacity:.45}

/* shot viewer */
.shotview .stage{
  position:relative; display:flex; align-items:center; justify-content:center;
  background:#000; min-height:44vh; max-height:60vh;
}
.stage canvas{max-width:100%; max-height:60vh}
/* AS CAPTURED shows the honest shot; camera controls belong to CAMERA VIEW. */
.stage.true-view #shotCanvas{display:none}
.stage:not(.true-view) #trueCanvas{display:none}
.shotview.true-view #shotProfiles,
.shotview.true-view .zoomrow,
.shotview.true-view #nightBtn{display:none}
.stamp{
  position:absolute; right:10px; top:10px; font-family:"IBM Plex Mono",monospace;
  font-size:.62rem; letter-spacing:.1em; color:var(--accent);
  background:rgba(14,20,28,.75); padding:4px 9px; border-radius:5px;
}
.controls{padding-top:8px}
.mount-row{
  display:flex; align-items:flex-start; gap:9px; margin:10px 0 2px;
  font-size:.78rem; color:var(--ink); line-height:1.35;
}
.mount-row input{accent-color:var(--accent); margin-top:1px; flex-shrink:0}
.mount-row i{font-style:normal; color:var(--muted)}
.mount-inset{
  position:absolute; right:10px; bottom:10px; width:23%; max-width:150px;
  padding:0; border:2px solid var(--accent); border-radius:7px; overflow:hidden;
  background:#000; line-height:0;
}
.mount-inset img{width:100%; display:block}
.mount-inset span{
  position:absolute; left:0; right:0; top:0; font-family:"IBM Plex Mono",monospace;
  font-size:.55rem; letter-spacing:.1em; color:var(--accent);
  background:rgba(8,19,28,.82); padding:3px 0; line-height:1.2;
}
.mount-inset.big{width:62%; max-width:none}

/* compare */
.cmp-stack{display:flex; flex-direction:column; gap:14px; margin-top:16px}
.cmp-cell{position:relative; border-radius:10px; overflow:hidden; border:1px solid var(--line); background:#000;
  display:flex; align-items:center; justify-content:center; min-height:160px}
.cmp-cell canvas{max-width:100%; display:block}
.cmp-label{
  position:absolute; left:10px; bottom:10px; font-size:.72rem; font-family:"IBM Plex Mono",monospace;
  background:rgba(14,20,28,.82); color:var(--ink); padding:4px 10px; border-radius:5px;
}

/* camera wall */
.bank-bar{display:flex; gap:6px; overflow-x:auto; padding:10px 16px 4px; scrollbar-width:none}
.bank-bar::-webkit-scrollbar{display:none}
.bank-bar button{
  flex-shrink:0; font-family:"IBM Plex Mono",monospace; font-size:.68rem; letter-spacing:.1em;
  border:1px solid var(--line); border-radius:7px; padding:6px 12px; color:var(--muted);
}
.bank-bar button.on{border-color:var(--accent); color:var(--accent)}
.wall-grid{display:grid; gap:4px; background:#05080C; padding:4px; margin-top:8px}
.wall-tile{position:relative; background:#0A0F15; aspect-ratio:16/9; overflow:hidden; cursor:pointer}
.wall-tile canvas{width:100%; height:100%; display:block; object-fit:cover}
.no-signal{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family:"IBM Plex Mono",monospace; font-size:.72rem; letter-spacing:.18em; color:var(--faint);
  background:repeating-linear-gradient(45deg,#0A0F15,#0A0F15 8px,#0C121A 8px,#0C121A 16px);
}
.tile-label{
  position:absolute; left:0; right:0; bottom:0; display:flex; align-items:center; gap:6px;
  font-family:"IBM Plex Mono",monospace; font-size:.6rem; letter-spacing:.06em; color:var(--ink);
  background:rgba(5,8,12,.72); padding:4px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.rec{width:7px; height:7px; border-radius:50%; background:#E86A6A; flex-shrink:0; animation:blink 1.6s infinite}
@keyframes blink{0%,60%{opacity:1}70%,100%{opacity:.2}}
@media (prefers-reduced-motion: reduce){.rec{animation:none}}

/* storage options */
.storage-list{display:flex; flex-direction:column; gap:10px; margin:12px 0}
.storage-opt{
  display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left;
  background:var(--surface); border:1px solid var(--line); border-radius:11px;
  padding:13px 16px; font-weight:600;
}
.storage-opt span{font-weight:400; font-size:.8rem; color:var(--faint)}
.storage-opt.active{border-color:var(--accent)}
.storage-opt.active span{color:var(--accent)}
.storage-opt:disabled{opacity:.55; cursor:default}

/* onboarding */
#onboard{
  position:fixed; inset:0; z-index:50; background:var(--bg);
  display:flex; align-items:center; justify-content:center; padding:24px;
}
#onboard[hidden]{display:none}
.ob-card{max-width:420px; width:100%; display:flex; flex-direction:column; min-height:60vh}
#obBody{flex:1}
.ob-icon{width:86px; height:86px; border-radius:20px; margin-bottom:20px}
.ob-card h2{font-family:"Chakra Petch",sans-serif; font-size:1.5rem; line-height:1.2; margin:0 0 12px}
.ob-card p{color:var(--muted)}
.ob-foot{display:flex; align-items:center; justify-content:space-between; margin-top:26px}
.ob-dots{display:flex; gap:7px}
.ob-dots i{width:8px; height:8px; border-radius:50%; background:var(--line)}
.ob-dots i.on{background:var(--accent)}
.cam-diag{font-family:"IBM Plex Mono",monospace; font-size:.62rem; color:var(--faint); padding:2px 0 6px}
.cam-diag[hidden]{display:none}
