:root {
  --bg-primary: #000000; /*pure black = transparent on additive display*/
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --accent-primary: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --warning: #ffaa00;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --success: #00ff88;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --focus-tf: transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
              border-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
              box-shadow 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
              background 300ms cubic-bezier(0.4, 0.04, 0.5, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
}

#app { width: 100%; height: 100%; position: relative; padding: 8px; box-sizing: border-box; }

.screen { width: 100%; height: 100%; display: flex; flex-direction: column; position: absolute; top: 0; left: 0; }
.screen.hidden { display: none; }

.header {
  display: flex; align-items: center; padding: 14px 20px;
  background: var(--bg-secondary); gap: 12px; flex-shrink: 0; border-radius: var(--radius-md);
}
.header h1 { font-size: 24px; font-weight: 700; flex: 1; }
.header-meta { font-size: 14px; color: var(--accent-secondary); font-variant-numeric: tabular-nums; }
.back-btn { background: var(--bg-tertiary); color: var(--text-primary); font-size: 22px; padding: 6px 14px; border-radius: var(--radius-sm); border: 2px solid transparent; }

.content { flex: 1; min-height: 0; padding: 16px; overflow: hidden; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.viz-content { justify-content: flex-start; align-items: center; padding-top: 20px; }

/* --- Scroll region + scrims --- */
.scroll-region { position: relative; flex: 1; min-height: 0; }
.scroll-body { height: 100%; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
.scroll-body::-webkit-scrollbar { display: none; }
.scrim { position: absolute; left: 0; right: 0; height: 56px; pointer-events: none; z-index: 5; opacity: 0; transition: opacity 250ms ease; }
.scrim-top { top: 0; background: linear-gradient(to bottom, #000000 0%, transparent 100%); }
.scrim-bottom { bottom: 0; background: linear-gradient(to top, #000000 0%, transparent 100%); }
.scrim.show { opacity: 1; }

/* --- Probe / detect rows --- */
.probe-row, .detect-row {
  display: flex; align-items: center; gap: 14px; min-height: 88px; padding: 12px 18px;
  background: var(--bg-tertiary); border: 2px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; flex-shrink: 0; transition: var(--focus-tf);
}
.row-name { flex: 1; font-size: 18px; font-weight: 600; }

/* --- Badges --- */
.badge { padding: 6px 14px; border-radius: 20px; font-size: 15px; font-weight: 700; background: var(--bg-card); color: var(--text-secondary); flex-shrink: 0; }
.badge-yes { background: rgba(0, 255, 136, 0.18); color: var(--success); }
.badge-no { background: rgba(255, 68, 102, 0.18); color: var(--danger); }
.badge-info { background: rgba(0, 212, 255, 0.18); color: var(--accent-primary); }

/* --- Log (websocket) --- */
.log {
  flex: 1; overflow-y: auto; background: var(--bg-card); border-radius: var(--radius-md);
  padding: 14px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.5;
  color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; scrollbar-width: none;
}
.log::-webkit-scrollbar { display: none; }
.log-line { margin-bottom: 4px; }
.log-in { color: var(--accent-secondary); }
.log-out { color: var(--accent-primary); }
.log-sys { color: var(--text-secondary); }
.log-err { color: var(--danger); }

/* --- Voice tests --- */
.voice-test {
  display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 18px;
  background: var(--bg-tertiary); border-radius: var(--radius-md);
}
.voice-test .row-name { flex: 1; }
.voice-status { font-size: 15px; font-weight: 700; color: var(--accent-secondary); text-align: right; max-width: 260px; word-break: break-word; }

/* --- Audio status --- */
.big-status { font-size: 24px; font-weight: 700; text-align: center; color: var(--accent-primary); }
.hint-text { font-size: 15px; color: var(--text-secondary); text-align: center; max-width: 480px; }

/* --- Canvas --- */
canvas { background: var(--bg-secondary); border-radius: var(--radius-md); max-width: 100%; }
#cam-video { width: 480px; max-width: 100%; height: 270px; background: #000; border-radius: var(--radius-md); object-fit: cover; }

/* --- Nav bar --- */
.nav-bar { display: flex; gap: 8px; padding: 12px 16px; background: var(--bg-secondary); flex-shrink: 0; border-radius: var(--radius-md); }
.nav-item {
  flex: 1; min-height: 88px; padding: 14px 12px; background: var(--bg-tertiary); border: 2px solid transparent;
  border-radius: var(--radius-md); color: var(--text-primary); font-size: 16px; font-weight: 600; cursor: pointer; transition: var(--focus-tf);
}
.nav-item.primary { background: var(--accent-primary); color: #0a0a0f; }
.nav-item.danger { background: var(--danger); color: #ffffff; }

/* --- Focus states --- */
.focusable { outline: none; }
.nav-item:focus, .back-btn:focus, .probe-row:focus, .detect-row:focus {
  border-color: var(--focus-ring); box-shadow: 0 0 24px var(--focus-glow); transform: scale(calc(1 - 8/88));
}
.probe-row:focus, .detect-row:focus { background: var(--bg-card); }

.hidden { display: none !important; }
