:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #1b1e22;
  --panel-strong: #242930;
  --text: #f2f4f7;
  --muted: #aab3c0;
  --line: #363d47;
  --accent: #69d3bd;
  --accent-strong: #91f3ca;
  --warn: #ffb86b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(135deg, #101113 0%, #181c20 52%, #111417 100%);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
  width: calc(100vw - 16px);
  min-height: calc(100vh - 16px);
  margin: 8px auto;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.camera-frame {
  position: relative;
  width: min(100%, calc((100vh - 32px) * var(--camera-ratio, 1.7778)));
  max-width: 100%;
  aspect-ratio: var(--camera-aspect, 16 / 9);
  overflow: hidden;
  border-radius: 8px;
  background: #050607;
}

video,
.tracking-canvas,
.empty-state {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: contain;
  opacity: 0;
}

.tracking-canvas {
  z-index: 1;
  background: #050607;
  pointer-events: none;
}

.empty-state {
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
}

.empty-state.is-hidden {
  display: none;
}

.lens-mark {
  width: 82px;
  aspect-ratio: 1;
  margin: 0 auto 8px;
  border: 2px solid rgba(105, 211, 189, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(145, 243, 202, 0.9) 0 7px, transparent 8px),
    radial-gradient(circle, rgba(105, 211, 189, 0.18), transparent 62%);
  box-shadow: 0 0 0 12px rgba(105, 211, 189, 0.06);
}

.empty-state h1,
.empty-state p,
.brand h2,
.brand p {
  margin: 0;
}

.empty-state h1 {
  color: var(--text);
  font-size: clamp(2rem, 6vw, 4.4rem);
  font-weight: 760;
  line-height: 0.95;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 30, 34, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #101113 0 8px, transparent 9px),
    conic-gradient(from 40deg, var(--accent), #8ec5ff, #f5d36b, var(--accent));
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 760;
  text-transform: uppercase;
}

.brand h2 {
  font-size: 1.25rem;
  line-height: 1.1;
}

.status,
.calibration-status {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-strong);
  line-height: 1.4;
}

.status.is-warning {
  border-color: rgba(255, 184, 107, 0.55);
  color: var(--warn);
}

.toggle-stack {
  display: grid;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 1px solid rgba(105, 211, 189, 0.44);
  border-radius: 8px;
  color: #07100d;
  background: var(--accent);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button[aria-pressed="false"] {
  color: var(--text);
  background: transparent;
}

.copyright-notice {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: calc(100vw - 12px);
    margin: 6px auto;
  }

  .stage {
    min-height: 62vh;
  }

  .camera-frame {
    width: min(100%, calc((62vh - 16px) * var(--camera-ratio, 1.7778)));
  }
}
