:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #fff;
  --muted: #888;
  --accent: #ff9500;
  --surface: #1a1a1a;
  --border: #222;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100svh;
}

#app {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Mode picker */
.mode-picker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 2rem;
  text-align: center;
}

.mode-picker h1 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  letter-spacing: 0.05em;
}

.mode-picker .tagline {
  margin: 0;
  color: var(--muted);
}

.mode-picker .modes {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-picker button {
  background: var(--surface);
  color: var(--fg);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.mode-picker button:active {
  transform: scale(0.98);
}

.mode-picker button:hover,
.mode-picker button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mode-picker .mode-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  max-width: 18rem;
}

/* Mode header */
.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mode-header .brand {
  font-weight: 600;
  letter-spacing: 0.05em;
}

.mode-header .switch-mode {
  background: none;
  color: var(--accent);
  border: none;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.mode-body {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.mode-body--side {
  padding: 0;
}

.placeholder {
  color: var(--muted);
  line-height: 1.5;
}

.placeholder ul {
  padding-left: 1.25rem;
}

/* Side-mode camera stage */
.camera-stage {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
}

.camera-feed {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.roi-overlay {
  position: absolute;
  border: 2px dashed var(--accent);
  border-radius: 2px;
  box-sizing: border-box;
  pointer-events: none;
}

@keyframes trigger-flash {
  0%   { box-shadow: inset 0 0 0 0 transparent; }
  10%  { box-shadow: inset 0 0 0 16px var(--accent); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}

.camera-stage.triggered {
  animation: trigger-flash 0.3s ease-out;
}

.diag {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.diag-label {
  color: var(--muted);
}

.diag-value {
  color: var(--fg);
}

.diag-value.warn {
  color: var(--accent);
}

.diag-audio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-meter {
  position: relative;
  display: inline-block;
  width: 4.5rem;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.level-meter-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.level-meter-peak {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  pointer-events: none;
  left: 0;
}

.level-db {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.5rem;
}

.error {
  margin: 2rem auto;
  padding: 1.5rem;
  max-width: 30rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.error h2 {
  margin: 0 0 0.5rem;
  color: var(--accent);
}

.error p {
  margin: 0;
  line-height: 1.5;
}
