/* Elsewhere: the chrome is window furniture. A lacquered sill along the
   bottom carries every control; the glass above it stays clear. */

:root {
  --lacquer: #f3eee3;
  --lacquer-glass: rgba(243, 238, 227, 0.86);
  --ink: #15211b;
  --mist: rgba(21, 33, 27, 0.58);
  --rule: rgba(21, 33, 27, 0.18);
  --moss: #2e5e45;
  --moss-deep: #244a37;
  --brass: #b8923e;
  --fog: #7f919c;
  --sill-h: 64px;
  --font: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fog);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  font-optical-sizing: auto;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The tracker reads the camera from this element; off screen rather than
   display:none so browsers keep decoding frames. */
.offscreen { position: fixed; width: 1px; height: 1px; left: -2px; top: -2px; opacity: 0; pointer-events: none; }

/* ---- Sill ---- */

.sill {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--lacquer-glass);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 -1px 0 var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.sill { transition: opacity 400ms ease, transform 400ms ease; }
.quiet .sill { opacity: 0; transform: translateY(6px); pointer-events: none; }
.sill-inner {
  min-height: var(--sill-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.wordmark {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font: 500 14px/1.2 var(--font);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.chip:hover { border-color: var(--ink); }
.chip.selected { background: var(--moss); border-color: var(--moss); color: var(--lacquer); }

.status {
  flex: 1 1 auto;
  margin: 0;
  color: var(--mist);
  font-size: 14px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.size {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-left: auto;
  color: var(--mist);
  font-size: 14px;
}
.size input {
  width: 4.5em;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1.2 var(--font);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.size input:focus { border-color: var(--moss); outline: none; box-shadow: 0 0 0 3px rgba(46, 94, 69, 0.2); }
.tools { display: flex; gap: 2px; }
.tool {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.tool:hover { background: rgba(21, 33, 27, 0.08); }
.tool[aria-pressed="false"] { color: var(--mist); }
/* The single brass fitting on the whole sill: lit while the camera follows you. */
.lamp {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 2px var(--lacquer);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 160ms ease, transform 160ms ease;
}
.tool[aria-pressed="true"] .lamp { opacity: 1; transform: scale(1); }

/* ---- Sash (settings) ---- */

.sash {
  position: fixed;
  right: 16px;
  bottom: calc(var(--sill-h) + 16px + env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - var(--sill-h) - 48px);
  overflow: auto;
  background: var(--lacquer-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px var(--rule), 0 18px 40px rgba(21, 33, 27, 0.18);
  border-radius: 14px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.sash h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }

.field { display: flex; flex-direction: column; gap: 3px; }
.field-name { font-weight: 600; font-size: 14px; }
.field-hint { font-size: 12.5px; color: var(--mist); line-height: 1.4; max-width: 44ch; }
.field input {
  margin-top: 5px;
  font: 400 16px/1.2 var(--font);
  font-variant-numeric: tabular-nums;
  padding: 9px 12px;
  width: 9em;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}
.field input:focus { border-color: var(--moss); outline: none; box-shadow: 0 0 0 3px rgba(46, 94, 69, 0.2); }

.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--moss); }

.hint { margin: 0; font-size: 12.5px; color: var(--mist); line-height: 1.45; }
.placement { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--rule); padding-top: 12px; }
.placement h3 { margin: 0; font-size: 14px; font-weight: 600; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 13px; align-items: center; }
.slider output { color: var(--mist); font-variant-numeric: tabular-nums; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--moss); margin: 0; }
.hint a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }

button.secondary {
  font: 600 15px/1.2 var(--font);
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
button.secondary { border: 1px solid var(--rule); background: transparent; color: var(--ink); }
button.secondary:hover { border-color: var(--ink); }

/* ---- Tracking details ---- */

.hud {
  position: fixed;
  left: 16px;
  bottom: calc(var(--sill-h) + 16px + env(safe-area-inset-bottom));
  margin: 0;
  padding: 10px 12px;
  background: var(--lacquer-glass);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px var(--rule);
  border-radius: 10px;
  font: 400 12.5px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
  white-space: pre;
  color: var(--ink);
}

@media (max-width: 700px) {
  .wordmark { display: none; }
  .sill-inner { flex-wrap: wrap; row-gap: 4px; }
  .status { flex-basis: 100%; order: 3; font-size: 13px; }
  .sash {
    left: 0;
    right: 0;
    bottom: calc(var(--sill-h) + env(safe-area-inset-bottom));
    width: auto;
    border-radius: 14px 14px 0 0;
    max-height: calc(100vh - var(--sill-h) - 24px);
  }
  .hud { left: 8px; right: 8px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .chip, .lamp, .sill, button.secondary { transition: none; }
}

.tracking { width:auto; display:flex; gap:8px; padding:0 14px; border-radius:999px; background:var(--moss); color:var(--lacquer)!important; font:500 13px var(--font); white-space:nowrap; }
.tracking:hover { background:var(--moss-deep); }
.tracking .lamp { right:5px; top:4px; }
.tools { align-items:center; }
.sill-inner { gap:12px; }
.chips { flex-wrap:nowrap; }
.chip { min-height:40px; }
.status { font-size:12px; }
.field select { width:100%; padding:10px; border:1px solid var(--rule); border-radius:8px; background:#fff9; color:var(--ink); font:14px var(--font); }
.quiet:focus-within .sill { opacity:1; transform:none; pointer-events:auto; }
@media(max-width:900px) { .wordmark { display:none; } .sill-inner { flex-wrap:wrap; gap:6px 10px; } .tools { margin-left:auto; } .status { flex-basis:100%; order:3; } }
@media(max-width:480px) { .sill-inner { padding:8px 10px; } .chip { padding:6px 12px; } .tracking { padding:0 10px; } .tracking svg { display:none; } .tools { gap:0; } .tool:not(.tracking) { width:34px; } }

.sill-inner { min-height:64px; }

@media(max-width:480px) { .tools { flex-basis:100%; margin:0; gap:4px; } .tracking { flex:1; justify-content:center; } .tool { min-height:44px; } .tool:not(.tracking) { width:44px; } }
