@font-face {
  font-family: "Bebas Neue";
  src: url("../assets/fonts/bebas-neue.woff2") format("woff2");
  font-weight: 400 900;   /* one weight only: stops the browser faking bold */
  font-display: block;
}
:root {
  --bg: #0b0b0d;
  --bg-elevated: #16161a;
  --text: #f2f2f2;
  --text-dim: #9a9aa2;
  --accent: #FFAF2C;
  --accent-dim: #7a5a1c;
  --ok: #3ddc84;
  --warn: #ffcf4d;
  --danger: #ff4d4d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Titles / short UI labels: condensed bold, always uppercase. */
h1, h2, h3,
.btn,
.mode-tile span,
.icon-btn span,
.badge,
.viewfinder__topbar h2,
.ruler__value,
.ev-scale__label {
  font-family: "Bebas Neue", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Body copy: normal weight, sentence case, never forced uppercase. */
p, .connect__sub, .connect__status, .connect__note, .placeholder-note,
.event-log, .control label, .readout, #connectionLabel {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  text-transform: none;
  letter-spacing: normal;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* ---------- status bar ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: calc(14px + var(--safe-top)) 20px 14px;
  font-size: 13px;
  color: var(--text);
}
.statusbar__brand {   /* phones: compact two-line brand (name over connection state) so it fits beside the readouts */
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; justify-content: start; min-width: 0;
}
.statusbar__brandicon { grid-row: 1 / span 2; width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.statusbar__brandname { font-family: "Bebas Neue", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; line-height: 1.1; white-space: nowrap; }
.statusbar__connection {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  font-family: "Bebas Neue", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; color: var(--text-dim);
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot--off { background: var(--text-dim); }
.dot--on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

.statusbar__icons { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.statusbar__icon {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--accent);
}
.statusbar__icon svg { width: 24px; height: 16px; }
.statusbar__icon--badge svg { width: 20px; height: 20px; }
.statusbar__badgevalue {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
}
.statusbar__dots {
  position: absolute;
  left: 100%;
  bottom: 0;
  font-size: 10px;
  letter-spacing: -1px;
  color: var(--accent);
}
#iconFlashSlash { display: none; }
#iconBattery { gap: 6px; }
.statusbar__pct { font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
#iconBattery.statusbar__icon--warn { color: #ff6b5e; }
#iconFlash.statusbar__icon--off { color: rgba(255,175,44,0.5); }
#iconFlash.statusbar__icon--off #iconFlashSlash { display: block; }

.btn-gear {
  background: none;
  border: none;
  color: var(--text);
  width: 26px; height: 26px;
  cursor: pointer;
  padding: 0;
}
.btn-gear svg { width: 100%; height: 100%; }

@media (min-width: 820px) {
  .statusbar { justify-content: space-between; padding-left: 32px; padding-right: 32px; }
  .statusbar__brand { display: flex; align-items: center; gap: 12px; }
  .statusbar__brandicon { grid-row: auto; }
  .statusbar__brandicon { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
  .statusbar__brandname { font-family: "Bebas Neue", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 15px; }
  .statusbar__connection {
    display: flex; align-items: center; gap: 6px; margin-left: 4px;
    font-family: "Bebas Neue", sans-serif; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; color: var(--text-dim);
  }
  .statusbar__icons { margin-left: 0; }
}

/* ---------- generic screen ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px calc(24px + var(--safe-bottom));
}

.btn {
  border: none;
  border-radius: 0;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #1a1200; }
.btn--ghost { background: transparent; color: var(--text); border: 1.5px solid currentColor; }

/* ---------- connect screen ---------- */
/* (welcome screen layout lives in the "welcome v2" block at the end of this file) */
.connect__sub { color: var(--text); margin: 0 0 10px; font-size: 15px; max-width: 320px; line-height: 1.4; }
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0 8px;
}
.connect__howto { color: var(--text-dim); font-size: 13px; max-width: 300px; line-height: 1.5; margin: 0 0 12px; }
.connect__actions {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.connect__actions .btn { width: 100%; }
.connect__status { min-height: 20px; color: var(--text-dim); font-size: 13px; margin-top: 14px; }
.connect__note { color: var(--text-dim); font-size: 12px; max-width: 320px; margin-top: 24px; line-height: 1.5; }

@media (min-width: 820px) {
  .connect__actions { flex-direction: row-reverse; justify-content: center; max-width: none; }
  .connect__actions .btn { width: auto; padding-left: 32px; padding-right: 32px; white-space: nowrap; }
}

/* ---------- home / mode grid ---------- */
.screen--home { padding-top: 8px; }
.camera-hero {
  width: 100%;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 20px;
}
.camera-hero__shadow {
  position: absolute;
  bottom: 14px;
  width: 55%;
  max-width: 200px;
  opacity: 0.6;
}
.camera-hero__body {
  position: relative;
  width: 46%;
  max-width: 170px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4));
}

/* Mobile: single-row swipeable carousel, one card (+ a sliver of the next) per view. */
.mode-grid {
  width: 100%;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 20px;
  padding: 0 16vw 24px 6vw;
  margin: 0 -20px 0;
}
.mode-grid::-webkit-scrollbar { display: none; }
.mode-tile {
  flex: 0 0 min(70vw, calc(var(--app-h, 100vh) * 0.3));   /* square tile: capped by the visible height so the whole page fits above the footer */
  scroll-snap-align: center;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  cursor: pointer;
  color: var(--text);
  outline: none;
}
.mode-tile:active { transform: scale(0.98); }
.mode-tile:focus-visible .mode-art { outline: 2px solid var(--accent); outline-offset: 3px; }
.mode-art {
  position: relative; width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; padding: 0;
}
.mode-art svg { width: 46%; height: 46%; }
.mode-tile .mode-art { order: 2; font-size: 0; line-height: 0; }
.mode-art--live { background: var(--accent); color: #0b0b0d; }                       /* Impossible yellow */
.mode-art--wip { background: #000; color: var(--accent); border: 2px solid var(--accent); flex-direction: column; gap: 4%; }
.mode-art--wip svg { width: 38%; height: 38%; opacity: 0.9; }
.mode-art--wip em {
  font-style: normal; font-family: "Bebas Neue", sans-serif; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; line-height: 1; color: var(--accent);
}
.mode-tile span {
  order: 1;
  font-size: 24px;
  text-align: center;
  color: var(--text);
  line-height: 1.15;
  padding: 0;
}

@media (min-width: 820px) {
  .mode-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px 28px;
    overflow: visible;
    padding: 0;
    margin: 0 0 40px;
  }
  .mode-tile { gap: 16px; }
  .mode-tile span { font-size: 17px; }
}

.btn--disconnect { padding-left: 40px; padding-right: 40px; margin-bottom: 8px; }

/* ---------- mode screens ---------- */
.screen--mode { align-items: stretch; }
.mode-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.mode-header h2 { margin: 0; font-size: 20px; }
.btn-back {
  background: var(--bg-elevated);
  border: none;
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.control { margin-bottom: 18px; }
.control label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.control input[type="range"] { width: 100%; accent-color: var(--accent); }
.control--split { display: flex; gap: 16px; }
.control--split > div { flex: 1; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.btn--shutter {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--accent);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.shutter-ring {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2.5px solid #000;
}

.event-log {
  margin-top: auto;
  background: var(--bg-elevated);
  border-radius: 0;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-dim);
  max-height: 140px;
  overflow-y: auto;
}
.event-log__line { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.event-log__line:last-child { border-bottom: none; }

.placeholder-note {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg-elevated);
  border-radius: 0;
  padding: 16px;
}
.placeholder-note code { color: var(--accent); }

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 0;
  background: var(--warn);
  color: #2a2200;
  margin-left: 6px;
}

/* ---------- persistent bottom connect bar ---------- */
.connect-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  z-index: 20;
  background: var(--accent);
  color: #1a1200;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px calc(14px + var(--safe-bottom));
  font-family: "Bebas Neue", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 13px;
  cursor: pointer;
}
.connect-bar:disabled { opacity: 0.7; cursor: default; }

.app.has-connect-bar .screen--home,
.app.has-connect-bar .screen--mode,
.app.has-connect-bar .connect__body { padding-bottom: calc(64px + var(--safe-bottom)); }
.app.has-connect-bar .screen--manual .shutter-bar { padding-bottom: calc(64px + var(--safe-bottom)); }


/* =====================================================================
   Manual mode — live viewfinder
   ===================================================================== */

.screen--manual {
  padding: 0;
  flex-direction: column;
  align-items: stretch;
}

/* The whole viewfinder is square, like the finished Polaroid — the video
   fills it edge to edge, and the rulers/EV scale/icon row overlay directly
   on top of it (positioned in percentages so they scale with it). */
.viewfinder {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  flex: none;
  overflow: hidden;
  background: #050505;
  color: #fff;
}

.viewfinder__feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050505;
}

.viewfinder__nofeed {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 100px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
  z-index: 1;
}

.viewfinder__topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 14px 24px;
  background: linear-gradient(rgba(0,0,0,0.65), transparent);
}
.viewfinder__topbar h2 { margin: 0; font-size: 15px; }
.viewfinder__topbar .btn-back,
.viewfinder__topbar .btn-more {
  background: rgba(0,0,0,0.35);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.viewfinder__topbar .btn-more { font-size: 20px; letter-spacing: 2px; }

/* EV compensation scale (top) — a ruler with minor ticks along the whole
   track, a taller major tick above each labeled stop, and a flag-shaped
   marker, matching the reference app's light-meter scale. */
.ev-scale {
  position: absolute;
  top: 10%;
  left: 24px; right: 24px;
  height: 46px;
  z-index: 4;
}
.ev-scale__track {
  position: absolute;
  left: 0; right: 0;
  top: 20px;
  height: 8px;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.4) 0, rgba(255,255,255,0.4) 1px,
    transparent 1px, transparent 8.3333%
  );
  background-position: left top;
}
.ev-scale__ticks {
  position: relative;
  height: 100%;
}
.ev-scale__label {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}
.ev-scale__label:first-child { transform: translateX(0); }
.ev-scale__label:last-child { transform: translateX(-100%); }
.ev-scale__label::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 6px;
  width: 1.5px;
  height: 14px;
  background: rgba(255,255,255,0.9);
  transform: translateX(-50%);
}
.ev-scale__label.ruler__value--active::before { background: var(--accent); }
.ev-scale__knob {
  position: absolute;
  bottom: 26px;
  width: 14px; height: 18px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
  transform: translateX(-7px);
  transition: left 0.15s ease-out;
}

/* Aperture / exposure vertical rulers */
.ruler {
  position: absolute;
  top: 24%;
  bottom: 22%;
  width: 92px;
  z-index: 3;
  touch-action: none;
}
.ruler--left { left: 0; }
.ruler--right { right: 0; }
.ruler__ticks {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
}
.ruler--left .ruler__ticks { position: absolute; left: 10px; }
.ruler--right .ruler__ticks { position: absolute; right: 10px; }
.ruler__value {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}
.ruler__value--active { color: var(--accent); }
.ruler--left .ruler__value { text-align: left; }
.ruler--right .ruler__value { text-align: right; }

.ruler__knob {
  position: absolute;
  width: 38px; height: 38px;
  margin-top: -19px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 1;
}
.ruler__knob svg { width: 19px; height: 19px; color: #1a1200; }
.ruler--left .ruler__knob { left: 54px; }
.ruler--right .ruler__knob { right: 54px; }
.ruler__knob::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 1.5px;
  background: var(--accent);
}
.ruler--left .ruler__knob::after { right: 100%; }
.ruler--right .ruler__knob::after { left: 100%; }

/* Center focus reticle */
.reticle {
  position: absolute;
  top: 50%; left: 50%;
  width: 64px; height: 64px;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}
.reticle span {
  position: absolute;
  width: 14px; height: 14px;
  border: 1.5px solid var(--accent);
}
.reticle span:nth-child(1) { top: 0; left: 0; border-right: none; border-bottom: none; }
.reticle span:nth-child(2) { top: 0; right: 0; border-left: none; border-bottom: none; }
.reticle span:nth-child(3) { bottom: 0; left: 0; border-right: none; border-top: none; }
.reticle span:nth-child(4) { bottom: 0; right: 0; border-left: none; border-top: none; }

/* Bottom icon row (single exp / focus distance / flash) */
.viewfinder__bottomicons {
  position: absolute;
  bottom: 6%;
  left: 0; right: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 40px;
}
.icon-btn {
  background: none;
  border: none;
  color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.icon-btn__circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn__circle svg { width: 22px; height: 22px; }
.icon-btn span { font-size: 9.5px; }
#flashSlash { display: none; }
.icon-btn--off #flashSlash { display: block; }
.icon-btn--off .icon-btn__circle { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.35); }
.icon-btn--off span { color: rgba(255,255,255,0.4); }

/* Shutter bar (below the viewfinder) */
.shutter-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 0 calc(18px + var(--safe-bottom));
  background: var(--bg);
}

.screen--manual .event-log { margin: 10px 16px calc(10px + var(--safe-bottom)); }

.ev-menu {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 6;
  background: rgba(20,20,22,0.92);
  border-radius: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
  backdrop-filter: blur(6px);
}
.ev-menu .checkbox { margin-bottom: 0; color: rgba(255,255,255,0.8); }

/* Laptop / wide viewport: same top-to-bottom stack as mobile (viewfinder,
   then shutter button below it), just width-capped and centered instead of
   going edge-to-edge. */
@media (min-width: 820px) {
  .app { max-width: 1000px; }
  .screen--manual { align-items: center; }
  .viewfinder {
    width: 100%;
    max-width: min(80vh, 620px);
  }
  .shutter-bar { width: 100%; max-width: min(70vh, 620px); }
  .screen--manual .event-log { width: 100%; max-width: min(70vh, 620px); }
}

/* =====================================================================
   Simple photo modes (Remote Trigger, and future modes that don't need
   the full manual viewfinder) — solid header, square photo, shutter
   below, same event log pattern as Manual Mode.
   ===================================================================== */

.mode-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  background: var(--bg);
}
.mode-topbar h2 { margin: 0; font-size: 15px; }
.mode-topbar .btn-back,
.mode-topbar .btn-more {
  background: var(--bg-elevated);
  border: none;
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.mode-topbar .btn-more { font-size: 20px; letter-spacing: 2px; }

.screen--remote { padding: 0; align-items: stretch; }
.mode-photo { width: 100%; }
.mode-photo .mode-art { width: 100%; }
.screen--remote .event-log { margin: 10px 16px calc(10px + var(--safe-bottom)); }

@media (min-width: 820px) {
  .screen--remote { align-items: center; }
  .mode-topbar { width: 100%; max-width: min(70vh, 620px); background: none; }
  .mode-photo { width: 100%; max-width: min(70vh, 620px); }
  .screen--remote .shutter-bar { width: 100%; max-width: min(70vh, 620px); }
  .screen--remote .event-log { width: 100%; max-width: min(70vh, 620px); }
}

/* =====================================================================
   Mode "learn more" bottom sheet
   ===================================================================== */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 29;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sheet-overlay.is-open { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  z-index: 30;
  background: #4d6270;
  color: #fff;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  transition: transform 0.28s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.is-open { transform: translateX(-50%) translateY(0); }

@media (min-width: 820px) {
  .sheet { max-width: 640px; border-radius: 20px; bottom: 20px; }
}

.sheet__header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 8px;
  background: #4d6270;
}
.sheet__header h2 { margin: 0; font-size: 18px; }
.sheet__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.sheet__body { padding: 8px 20px 32px; }
.sheet__photos {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}
.sheet__photos img { width: 50%; display: block; }
.sheet__body p {
  color: rgba(255,255,255,0.9);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 16px;
}
.sheet__body h3 {
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  font-size: 13px;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ---------- welcome v2: the 3D camera is the screen ---------- */
.app:has(.screen--connect:not([hidden])) { max-width: none; }
/* phones: 100vh is taller than what is visible with the browser toolbars, so the welcome page used to load scrolled. --app-h (set from the real visible height in app.js) pins it to the screen. */
html:has(.screen--connect:not([hidden])), body:has(.screen--connect:not([hidden])) { height: var(--app-h, auto); overflow: hidden; overscroll-behavior: none; }
.app:has(.screen--connect:not([hidden])) { min-height: var(--app-h, 100dvh); height: var(--app-h, auto); overflow: hidden; }
.screen--connect {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-h, 100dvh);
  max-height: var(--app-h, none);
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  align-items: stretch;
  background:
    radial-gradient(ellipse 60% 50% at 50% 46%, rgba(255,175,44,0.10), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, #17161a 0%, var(--bg) 75%);
  --pair: 0;
}
.connect__render { position: absolute; inset: 0; width: auto; margin: 0; aspect-ratio: auto; z-index: 1; }
.connect__render canvas { position: relative; z-index: 2; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.connect__render canvas:active { cursor: grabbing; }

.connect__ghost {
  position: absolute; inset: 0; z-index: 0; display: grid; place-items: center;
  pointer-events: none; user-select: none; overflow: hidden;
}
.connect__ghost { color: rgba(255,175,44,0.6); transition: color 0.6s ease; }
.connect__ghost { --gw: 1100px; }   /* fixed size: the wordmark does not scale with the screen */
.connect__ghost svg {
  position: absolute; left: 0; top: 50%;
  width: var(--gw); height: auto; overflow: visible;
  /* --pan runs 0..1: glyph right edge at the left screen edge -> glyph left edge at the right screen edge, then wraps */
  transform: translate(calc(var(--pan, 0.5) * (100vw + 0.72 * var(--gw)) - 0.86 * var(--gw)), calc(-50% - 4vh));
  will-change: transform;
}
.connect__glow {
  position: absolute; left: 50%; top: 46%; z-index: 1;
  width: min(150vw, 150vh); aspect-ratio: 1;
  border-radius: 50%; pointer-events: none;
  /* --led (0..1) is the 3D model's blue LED level, so the glow fades in, holds and fades out with it */
  opacity: var(--led, 0);
  transform: translate(-50%, -50%) scale(calc(0.9 + var(--led, 0) * 0.15));
  background: radial-gradient(circle, rgba(70,150,255,0.40) 0%, rgba(70,150,255,0.16) 28%, rgba(70,150,255,0.05) 48%, transparent 66%);
  mix-blend-mode: screen;
}

.connect__hud {
  position: absolute; z-index: 3; top: calc(16px + var(--safe-top)); left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 20px; pointer-events: none;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px;
}
.connect__kicker { color: var(--text-dim); }
.connect__chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 999px;
  background: rgba(11,11,13,0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.connect__chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.connect__panel {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 16px;
  padding: 72px 20px calc(76px + var(--safe-bottom));
  background: linear-gradient(to top, rgba(11,11,13,0.92) 30%, rgba(11,11,13,0));
  pointer-events: none;
}
.connect__panel > * { pointer-events: auto; }
.screen--connect .connect__title {
  margin: 0; font-size: clamp(44px, 13vw, 120px); line-height: 0.88; letter-spacing: 0.01em;
  text-align: left; pointer-events: none; white-space: nowrap;
}
.screen--connect .connect__title .t-dots { display: inline-block; animation: dots 1.2s steps(4, end) infinite; overflow: hidden; width: 0.9em; vertical-align: bottom; }
@keyframes dots { 0% { width: 0; } 100% { width: 0.9em; } }
.connect__copy { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.screen--connect .connect__sub { max-width: 420px; margin: 0 0 6px; font-size: 16px; }
.screen--connect .connect__status { margin-top: 6px; }
.screen--connect .connect__note { margin-top: 10px; }
.screen--connect .connect__actions { margin: 0; max-width: 420px; width: 100%; flex-direction: column; }

/* idle / pairing copy swap */
.screen--connect .t-pair { display: none; }
.screen--connect.is-pairing .t-idle { display: none; }
.screen--connect.is-pairing .t-pair { display: inline; }
.screen--connect.is-pairing .connect__ghost { color: rgba(90,160,255,0.7); }
.screen--connect.is-pairing .connect__chip i { background: #5aa0ff; box-shadow: 0 0 0 0 rgba(90,160,255,0.7); animation: chipPulse 1.2s ease-out infinite; }
@keyframes chipPulse { to { box-shadow: 0 0 0 10px rgba(90,160,255,0); } }

@media (min-width: 820px) {
  .connect__hud { padding: 0 40px; top: 28px; font-size: 13px; }
  .connect__panel { padding: 96px 40px calc(84px + var(--safe-bottom)); }
}
/* side-by-side only once the title, copy and buttons all fit without squeezing; below this they stack */
@media (min-width: 1280px) {
  .connect__panel { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 40px; }
  .screen--connect .connect__title { flex: 1 1 auto; font-size: clamp(56px, 7.4vw, 120px); }
  .connect__copy { flex: 0 1 380px; }
  .screen--connect .connect__actions { flex: 0 0 300px; max-width: 300px; width: 300px; }
  .screen--connect .connect__actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .screen--connect.is-pairing .connect__chip i, .screen--connect .connect__title .t-dots { animation: none; }
}

/* ---------- yellow footer: connect status + credit + non-affiliation line ---------- */
.connect-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 12px;
  padding: 14px 20px calc(14px + var(--safe-bottom));
  background: var(--accent); color: #1a1200;
}
.connect-footer:has(#connectBar[hidden]) { display: none; }
.connect-footer .connect-bar {
  position: static; width: auto; padding: 0; background: transparent; z-index: auto;
  grid-column: 2; grid-row: 1;
}
.connect-disclaimer {
  grid-column: 1; grid-row: 1; justify-self: start; margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; font-size: 12px; line-height: 1.3; opacity: 0.8;
}
.connect-credit {
  grid-column: 3; grid-row: 1; justify-self: end; margin: 0;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1;
}
.connect-credit a { color: inherit; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.connect-credit a svg { width: 12px; height: 12px; flex: none; }
.connect-credit a:hover svg { transform: translate(1px, -1px); }
.connect-credit__heart { width: 17px; height: 17px; flex: none; }

/* narrow screens: one centered column, in this order: status, credit, disclaimer */
@media (max-width: 700px) {
  .connect-footer { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 4px; padding-top: 8px; padding-bottom: max(8px, calc(var(--safe-bottom) - 22px)); }   /* sit lower, just above the browser's floating toolbar */
  .connect-credit { font-size: 12px; }
  .connect-credit__heart { width: 13px; height: 13px; }
  .connect-credit a svg { width: 10px; height: 10px; }
  .connect-footer .connect-bar { font-size: 12px; }
  .connect-footer .connect-bar, .connect-credit, .connect-disclaimer { grid-column: 1; justify-self: center; }
  .connect-footer .connect-bar { grid-row: 1; }
  .connect-credit { grid-row: 2; }
  .connect-disclaimer { grid-row: 3; font-size: 10px; line-height: 1.25; }
  .app.has-connect-bar .screen--home,
  .app.has-connect-bar .screen--mode { padding-bottom: calc(var(--footer-h, 100px) + 12px); }
}

/* top HUD: keep each item on one line on narrow phones */
.connect__chip { white-space: nowrap; flex: none; }
.connect__kicker { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- home: the 3D camera as a hero ---------- */
.app:has(.screen--home:not([hidden])) { max-width: none; }
.home-hero {
  position: relative; align-self: stretch; overflow: hidden;
  margin: -8px -20px 8px; height: clamp(300px, 46vh, 560px);
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255,175,44,0.10), transparent 70%),
    radial-gradient(ellipse 120% 100% at 50% 40%, #17161a 0%, var(--bg) 80%);
}
.home-hero::after {            /* fade the hero into the page */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
  background: linear-gradient(to top, var(--bg), rgba(11,11,13,0)); pointer-events: none; z-index: 3;
}
@media (min-width: 820px) {
  .screen--home .mode-grid { width: 100%; max-width: 1100px; margin: 0 auto 40px; }
}

/* ---------- home, wide screens: side dock (camera panel left, modes right) ---------- */
@media (min-width: 900px) {
  .screen--home {
    display: grid; grid-template-columns: minmax(400px, 47vw) 1fr; grid-template-rows: 1fr auto;
    align-items: start; padding: 0; column-gap: 0;
  }
  .screen--home .home-hero {
    grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; align-self: start;
    margin: 0; height: 84vh;   /* same frame as the Manual Mode panel, so the model doesn't jump when a mode opens */
  }
  .screen--home .home-hero::after { display: none; }
  .screen--home .home-hero, .screen--manual .manual-hero, .screen--remote .manual-hero { background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255,175,44,0.10), transparent 70%); }   /* no panel tint, so there is no visible edge against the page */
  .screen--home .home-hero, .screen--manual .manual-hero, .screen--remote .manual-hero {   /* fog: the panel's contents melt away toward the modes instead of being cut off */
    -webkit-mask-image: linear-gradient(to right, #000 62%, transparent 100%); mask-image: linear-gradient(to right, #000 62%, transparent 100%);
  }
  .screen--home .mode-grid {
    grid-column: 2; grid-row: 1; max-width: none; width: auto; margin: 0;
    padding: 40px; grid-template-columns: repeat(3, minmax(0, 220px)); justify-content: center; gap: 28px 24px;   /* compact tiles; bottom padding keeps enough scroll range to reach the camera's front view */
  }
  .screen--home .btn--disconnect { grid-column: 2; grid-row: 2; justify-self: start; margin: 0 40px 32px; }
}
@media (max-width: 899px) {
  .home-hero { height: clamp(220px, calc(var(--app-h, 100vh) * 0.34), 460px); }
}

/* ---------- manual mode, wide screens: camera model left, viewfinder right ---------- */
.manual-hero { display: none; }
@media (min-width: 900px) {
  .app:has(.screen--manual:not([hidden])), .app:has(.screen--remote:not([hidden])) { max-width: none; }
  .screen--manual:not([hidden]), .screen--remote:not([hidden]) {
    display: grid; grid-template-columns: minmax(400px, 47vw) 1fr; grid-template-rows: auto auto 1fr;
    align-items: start; justify-items: center; padding: 0;
  }
  .screen--manual .manual-hero, .screen--remote .manual-hero {
    display: block; grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; align-self: start;
    margin: 0; width: 100%; height: 84vh;   /* shorter than the screen, so the model and logo sit a bit higher */
  }
  .screen--manual .manual-hero::after, .screen--remote .manual-hero::after { display: none; }
  .screen--manual .viewfinder, .screen--manual .shutter-bar, .screen--manual .event-log,
  .screen--remote .mode-topbar, .screen--remote .mode-photo, .screen--remote .shutter-bar, .screen--remote .event-log { grid-column: 2; }
  .screen--manual .viewfinder { margin-top: 24px; }
  .screen--remote .mode-topbar { margin-top: 24px; }
  .screen--remote .mode-topbar, .screen--remote .mode-photo, .screen--remote .shutter-bar, .screen--remote .event-log { max-width: min(80vh, 620px); }
}

/* wide home: Disconnect fills the grid's last slot, level with the photos (below their labels) */
@media (min-width: 900px) {
  .screen--home .mode-grid .btn--disconnect {
    grid-column: auto; grid-row: auto; justify-self: stretch; align-self: start;
    margin: 33px 0 0; width: 100%; aspect-ratio: 1; padding: 0;
  }
}

/* wide home / Manual Mode: the status icons sit over the middle of the right-hand column (tile grid, viewfinder), not the middle of the window */
@media (min-width: 900px) {
  .app:has(.screen--home:not([hidden])) .statusbar,
  .app:has(.screen--manual:not([hidden])) .statusbar,
  .app:has(.screen--remote:not([hidden])) .statusbar { position: relative; }
  .app:has(.screen--home:not([hidden])) .statusbar__icons,
  .app:has(.screen--manual:not([hidden])) .statusbar__icons,
  .app:has(.screen--remote:not([hidden])) .statusbar__icons {
    position: absolute; left: calc(47vw + (100% - 47vw) / 2); top: 50%; transform: translate(-50%, -50%);
  }
}

/* phones: no room for the DEMO badge beside the readouts; the dot and "Connected" stay */
@media (max-width: 519px) {
  .statusbar__connection .badge { display: none; }
  .statusbar__icons { gap: 12px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-bottom)); z-index: 50;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 20px; box-sizing: border-box; text-align: center;
  background: #000; color: var(--accent); border: 1.5px solid var(--accent);
  font-family: "Bebas Neue", sans-serif; font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* wide screens: the "learn more" dialog is centred over the right-hand column (same column as the mode content), not the window */
@media (min-width: 900px) {
  .sheet { left: calc(47vw + (100vw - 47vw) / 2); max-width: min(640px, calc(53vw - 48px)); }
}

/* phones: a compact text block so more of the (full-size) camera shows — one-line title, smaller copy, the two buttons stacked at full width */
@media (max-width: 819px) {
  .screen--connect .connect__panel { gap: 8px; padding: 24px 20px calc(var(--footer-h, 130px) + 14px); }
  .screen--connect .connect__title { font-size: clamp(30px, 8.4vw, 46px); line-height: 1; }
  .screen--connect .connect__title .t-idle br { display: none; }
  .screen--connect .connect__sub { font-size: 14px; line-height: 1.35; margin: 0 0 4px; max-width: none; }
  .screen--connect .connect__note { font-size: 11px; line-height: 1.35; margin-top: 4px; max-width: none; }
  .screen--connect .connect__status { margin-top: 2px; min-height: 0; }
  .screen--connect .connect__actions { flex-direction: column; gap: 10px; max-width: none; width: 100%; }
  .screen--connect .connect__actions .btn { width: 100%; padding: 13px 8px; font-size: 15px; white-space: nowrap; }
}
