/* ===== Reachy Spotter — Reachy Mini Detector app styles ===== */

:root {
  --bg: #eef0f4;
  --panel: #ffffff;
  --panel-2: #f4f5f8;
  --ink: #1a1d24;
  --ink-soft: #6b7280;
  --line: #d8dbe2;
  --accent: #f59e0b;
  --accent-ink: #1a1d24;
  --good: #16a34a;
  --bad: #dc2626;
  --shadow: 0 10px 30px rgba(20, 24, 33, 0.12);
  --radius: 16px;
}
body[data-theme="dark"] {
  --bg: #14161c;
  --panel: #1d2028;
  --ink: #f2f4f8;
  --ink-soft: #9aa3b2;
  --line: #2c313c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink, #1a1d24);
  -webkit-font-smoothing: antialiased;
}
body[data-theme="dark"] { color: var(--ink); }

/* Host shell mounts into #root when standalone. */
#root:empty { min-height: 100vh; }

main.app { max-width: 520px; margin: 0 auto; }

#main { padding-bottom: 96px; }

.screen { display: block; }
.screen[hidden] { display: none; }

.px { padding: 0 16px; }

/* ---------- brand ---------- */
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 12px;
}
.mascot { width: 40px; height: 40px; }
.brand-title {
  font-family: "Archivo Black", system-ui, sans-serif;
  font-size: 1.35rem; line-height: 1.02; letter-spacing: 0.02em;
  margin: 0; text-transform: uppercase;
}
.brand-accent { color: var(--accent); }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-soft); margin-left: auto; flex: none;
}
.status-dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.status-dot.busy { background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25); animation: pulse 1.2s infinite; }
.status-dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.5; } }

.page-title {
  font-family: "Archivo Black", system-ui, sans-serif;
  font-size: 1.3rem; letter-spacing: 0.03em;
  padding: 18px 16px 10px; margin: 0;
}

.section-title {
  font-family: "Archivo Black", system-ui, sans-serif;
  font-size: 0.8rem; letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin: 22px 0 10px;
}

/* ---------- video frame ---------- */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b0d11;
  box-shadow: var(--shadow);
}
.video-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.track-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-overlay { position: absolute; inset: 0; pointer-events: none; }
.video-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
}
.video-hint {
  margin: 0; color: #cbd0da; font-size: 0.95rem; font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.video-hint small { display: block; margin-top: 6px; font-weight: 400; opacity: 0.8; }
.video-center.hidden { display: none; }

.frame-controls {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 10px;
}

.demo-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(245, 158, 11, 0.92); color: #111;
  font-weight: 700; font-size: 0.7rem; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 999px;
}

/* HUD chips row inside the frame */
.hud {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
}
.chip {
  background: rgba(10, 12, 16, 0.65); color: #e8eaf0;
  font-size: 0.7rem; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.chip.alert { background: rgba(245, 158, 11, 0.85); color: #111; }

/* ---------- signal legend ---------- */
.signal-row {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 2px;
}
.signal-icon { font-size: 1.4rem; width: 1.8em; text-align: center; }
.signal-text { font-size: 0.9rem; color: var(--ink-soft); }
.signal-row b { color: var(--ink, #1a1d24); }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 1rem; }
.card .sub { color: var(--ink-soft); font-size: 0.85rem; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; }
.stat .v { font-family: "Archivo Black", system-ui; font-size: 1.15rem; }
.stat .k { font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.06em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 0.92rem; letter-spacing: 0.03em;
  padding: 12px 18px; color: #fff;
  background: #2c3442; transition: transform 0.06s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: #1a1d24; }
.btn-outline {
  background: transparent; color: var(--ink, #1a1d24);
  border: 2px solid var(--line);
}
.btn-danger { background: var(--bad); color: #fff; }
.btn-row { display: flex; gap: 10px; margin: 14px 0; }
.btn-row .btn { flex: 1; }

.icon-btn {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: 12px; width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink, #1a1d24);
}
.icon-btn .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------- forms ---------- */
.field-label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--ink-soft); margin: 16px 0 6px;
  text-transform: uppercase;
}
.field-hint { font-size: 0.8rem; color: var(--ink-soft); margin: 4px 0 0; }
select, input[type="range"], input[type="number"] {
  width: 100%;
  background: var(--panel); color: var(--ink, #1a1d24);
  border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 0.95rem;
}
select:focus, input:focus { outline: 2px solid var(--accent); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { font-weight: 700; min-width: 3.2em; text-align: right; }

.seg { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button {
  flex: 1; border: none; padding: 10px 6px; cursor: pointer;
  background: transparent; color: var(--ink-soft);
  font-weight: 700; font-size: 0.82rem;
}
.seg button + button { border-left: 2px solid var(--line); }
.seg button.active { background: var(--accent); color: #1a1d24; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0;
}
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { display: none; }
.switch .knob {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line); transition: background 0.15s;
  cursor: pointer;
}
.switch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: left 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.switch input { display: none; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { left: 25px; }

/* ---------- log list ---------- */
.search-row { display: flex; gap: 10px; margin: 4px 0 12px; }
.search-input {
  position: relative; flex: 1;
}
.search-input .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--ink-soft); fill: none; stroke-width: 2;
}
.search-input input { width: 100%; padding-left: 36px; }

.log-list { list-style: none; margin: 0; padding: 0; }
.log-item {
  display: flex; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; margin: 10px 0;
  cursor: pointer; box-shadow: var(--shadow);
}
.log-item img {
  width: 96px; height: 54px; object-fit: cover;
  border-radius: 9px; background: #0b0d11; flex: none;
}
.log-item .meta { min-width: 0; }
.log-item .t { font-weight: 700; font-size: 0.92rem; }
.log-item .s { font-size: 0.78rem; color: var(--ink-soft); }
.log-empty { color: var(--ink-soft); font-size: 0.9rem; text-align: center; padding: 24px 8px; }

.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px;
}
.back-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--panel);
  color: var(--ink, #1a1d24); font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.detail-title-row { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.detail-title-row h2 { margin: 0; font-size: 1.1rem; }
.detail-sub { color: var(--ink-soft); font-size: 0.85rem; margin: 4px 0 0; }

.info-list { margin: 8px 0 0; padding: 0; font-size: 0.9rem; }
.info-list div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.info-list dt { color: var(--ink-soft); }
.info-list dd { margin: 0; font-weight: 600; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 520px; margin: 0 auto;
  display: flex; justify-content: space-around;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: none; cursor: pointer;
  color: var(--ink-soft); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 4px 14px; border-radius: 10px;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.tab.active { color: var(--accent); }

/* ---------- toasts ---------- */
.toast-wrap {
  position: fixed; bottom: 92px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 60; pointer-events: none;
}
.toast {
  background: #111318; color: #fff;
  border-radius: 999px; padding: 9px 16px;
  font-size: 0.85rem; font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
  max-width: 86%;
}
.toast.err { background: var(--bad); }
.toast.ok { background: var(--good); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 10, 14, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 520px;
  background: var(--panel); color: var(--ink, #1a1d24);
  border-radius: 20px 20px 0 0;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 80vh; overflow: auto;
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet-title { font-family: "Archivo Black", system-ui; font-size: 1.05rem; }
.sheet-sub { color: var(--ink-soft); font-size: 0.85rem; margin: 4px 0 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

/* about panel */
.about h4 { margin: 14px 0 4px; }
.about p, .about li { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.45; }
.about a { color: var(--accent); }