:root {
  color-scheme: dark;
  --bg: #07080b; --fg: #f2f4f8; --muted: #9aa3b5; --line: #ffffff1f;
  --glass: rgba(10, 12, 18, .55); --glass-strong: rgba(14, 16, 24, .92);
  --smoke: #8be9ff; --radius: 18px;
  font: 16px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }

/* camera fills the screen; the overlay sits exactly on top (same object-fit) */
.stage { position: fixed; inset: 0; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#overlay { filter: blur(5px); mix-blend-mode: screen; }
.mirror .stage video, .mirror .stage canvas { transform: scaleX(-1); }

/* top bar: brand + two round icon buttons */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(#000a, #0000); }
.brand { font-weight: 800; letter-spacing: .02em; font-size: 18px; padding: 6px 12px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(12px); }
.spacer { flex: 1; }
.icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(12px);
  display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.ghost { background: transparent; border: 0; width: 36px; height: 36px; font-size: 18px; color: var(--muted); }

/* bottom: one status pill with the smoke meter */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 24px 16px max(22px, env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000a); pointer-events: none; }
.status { min-width: min(320px, 86vw); padding: 14px 20px 12px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); text-align: center; transition: border-color .25s, box-shadow .25s; }
#state { display: block; font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.meter { height: 6px; margin-top: 10px; border-radius: 999px; background: #ffffff1a; overflow: hidden; }
#meterFill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5bd6ff, #e9fbff); transition: width .15s linear; }
.status.smoke { border-color: #8be9ff88; box-shadow: 0 0 32px #8be9ff40; }
.status.wait #state { color: var(--muted); font-weight: 600; font-size: 17px; }

/* toast: short confirmations ("Got your room's vapor color") */
.toast { position: fixed; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 64px); transform: translate(-50%, -8px); opacity: 0;
  padding: 10px 16px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); font-size: 15px;
  pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* settings sheet (native <dialog>), slides up from the bottom */
.sheet { margin: auto auto 0; width: min(520px, 100%); max-height: 85vh; border: 0; padding: 0; border-radius: 22px 22px 0 0;
  background: var(--glass-strong); color: var(--fg); backdrop-filter: blur(20px); }
.sheet::backdrop { background: #0008; }
.sheet form { padding: 8px 20px max(20px, env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 20px; margin: 8px 0 0; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-weight: 600; }
.field input[type=range] { width: 100%; accent-color: var(--smoke); }
.ends { display: flex; justify-content: space-between; color: var(--muted); }
.row-btn { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: #ffffff08; cursor: pointer; }
.row-btn small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.swatch { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff5; background: #d8dde6; }
.swatch.hollow { background: transparent; border-style: dashed; }

.dev { display: none; border-top: 1px solid var(--line); padding-top: 12px; }
.devmode .dev { display: block; }
.dev h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.dev-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-row button, .dev-row .btn { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: #ffffff0d; cursor: pointer; font-size: 14px; }
.info { color: var(--muted); font-size: 12px; margin: 10px 0 0; font-variant-numeric: tabular-nums; }

button:focus-visible, input:focus-visible, .btn:focus-within { outline: 2px solid var(--smoke); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
