/* Reachy Mini JS template: mobile-first, light/dark via [data-theme]
   (set by the theme bootstrap in index.html + handle.onThemeChange). */
:root, [data-theme="dark"] {
  --bg: #0f0f1a;
  --card: #1a1f35;
  --border: #2c3354;
  --text: #f2f4f8;
  --muted: #a0aec0;
  --accent: #ff6b35;
  --accent-text: #1a1a2e;
  --danger: #f56565;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #dde1ea;
  --text: #1a1a2e;
  --muted: #5a6478;
  --accent: #e5582b;
  --accent-text: #ffffff;
  --danger: #c53030;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: grid;
  gap: 12px;
}

.status { margin: 0; padding: 8px 12px; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.status.error { color: var(--danger); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.card h2 { margin: 0; font-size: 1rem; }
.card > button { justify-self: start; }
.hint { margin: 0; font-size: 0.875rem; color: var(--muted); }

video {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 8px;
  object-fit: contain;
}

.meter { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
#meter-bar { height: 100%; width: 0; background: var(--accent); transition: width 60ms linear; }

.row { display: flex; flex-wrap: wrap; gap: 8px; }

button, .file {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button:focus-visible, .file:focus-within, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }

label { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 8px; font-size: 0.875rem; }
.file { display: inline-flex; position: relative; font-size: 1rem; }
input[type="range"] { width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); }
