:root {
  --bg: #09090B;
  --surface: #18181B;
  --surface2: #27272A;
  --border: #3F3F46;
  --text: #FAFAFA;
  --muted: #A1A1AA;
  --blue: #2563EB;
  --blue-bg: rgba(30,58,138,0.13);
  --blue-text: #93C5FD;
  --green: #22C55E;
  --green-bg: rgba(20,83,45,0.13);
  --green-text: #86EFAC;
  --amber: #F59E0B;
  --amber-bg: rgba(120,53,15,0.13);
  --amber-text: #FCD34D;
  --red: #EF4444;
  --red-bg: rgba(127,29,29,0.13);
  --red-text: #FCA5A5;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px; overflow-x: hidden; overscroll-behavior: none;
  min-height: 100vh; padding-bottom: 80px;
}
.screen { display: none; padding: 16px; max-width: 600px; margin: 0 auto; }
.screen.active { display: block; }
.top-bar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
}
.top-bar-title { font-size: 16px; font-weight: 600; }
.top-bar-right { font-size: 13px; color: var(--muted); cursor: pointer; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; height: 60px; padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; border: none; background: transparent;
  color: var(--muted); font-size: 11px; font-weight: 500;
}
.nav-item.active { color: var(--blue); }
.nav-icon { font-size: 20px; }
#bug-btn {
  position: fixed; bottom: 72px; right: 14px; z-index: 90;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 18px;
  font-size: 14px; color: var(--text); z-index: 300;
  opacity: 0; transition: opacity 0.2s; pointer-events: none; white-space: nowrap;
  max-width: 90vw;
}
.toast.show { opacity: 1; }

/* BUTTONS */
.btn-primary {
  width: 100%; min-height: 52px; border-radius: var(--radius);
  background: var(--blue); border: none; color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 20px;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  width: 100%; min-height: 44px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); font-size: 14px; cursor: pointer; margin-top: 8px;
}
.btn-ghost:active { opacity: 0.8; }

/* SETUP SCREEN */
.setup-wrap { padding: 32px 0; text-align: center; }
.setup-icon { font-size: 44px; margin-bottom: 14px; }
.setup-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.setup-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }
.form-input {
  width: 100%; min-height: 48px; font-size: 16px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); outline: none; margin-bottom: 4px;
}
.form-input:focus { border-color: var(--blue); }

/* START SCREEN */
.section-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin: 20px 0 8px;
}
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-btn {
  flex: 1; min-width: 70px; min-height: 44px; padding: 8px 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted);
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.toggle-btn.active { background: var(--blue-bg); border-color: var(--blue); color: var(--blue-text); }
.toggle-btn:active { opacity: 0.8; }

/* PERSONA SCREEN */
.persona-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px 16px; text-align: center; margin-bottom: 12px;
}
.persona-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--blue-bg); color: var(--blue-text);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.persona-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.persona-biz { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.persona-loc { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.persona-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tag {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; color: var(--muted); font-size: 12px; padding: 4px 12px;
}
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
}
.info-card.tip { border-color: rgba(245,158,11,0.3); background: var(--amber-bg); }
.info-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.info-val { font-size: 14px; line-height: 1.5; }

/* CALL SCREEN */
.call-header {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 14px;
}
.call-timer { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; color: var(--red); min-width: 64px; }
.call-biz { font-size: 13px; color: var(--muted); }
.transcript {
  overflow-y: auto; padding: 4px 0; margin-bottom: 16px;
  max-height: calc(100vh - 300px); min-height: 160px;
  display: flex; flex-direction: column; gap: 8px;
}
.bubble { display: flex; flex-direction: column; max-width: 82%; }
.bubble-josh { align-self: flex-end; align-items: flex-end; }
.bubble-prospect { align-self: flex-start; align-items: flex-start; }
.bubble-role { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.bubble-text { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.bubble-josh .bubble-text { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble-prospect .bubble-text { background: var(--surface2); color: var(--text); border-bottom-left-radius: 4px; }
.call-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mic-btn {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface2); border: 2px solid var(--border);
  color: var(--text); font-size: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mic-btn.listening { background: var(--red-bg); border-color: var(--red); animation: pulse-mic 1s infinite; }
.mic-btn:active { transform: scale(0.93); }
.mic-hint { font-size: 13px; color: var(--muted); }
.end-btn {
  min-height: 44px; padding: 10px 32px; border-radius: var(--radius);
  background: var(--red-bg); border: 1px solid var(--red);
  color: var(--red-text); font-size: 15px; font-weight: 600; cursor: pointer;
}
@keyframes pulse-mic {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

/* DEBRIEF SCREEN */
.debrief-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 60px 0; color: var(--muted);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.debrief-header {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px;
}
.debrief-prospect { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.debrief-duration { font-size: 12px; color: var(--muted); }
.score-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 14px;
}
.score-num { font-size: 56px; font-weight: 800; color: var(--blue); line-height: 1; }
.score-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.debrief-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.debrief-section-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.debrief-item { font-size: 14px; padding: 8px 0; border-top: 1px solid var(--border); line-height: 1.5; }
.debrief-item:first-of-type { border-top: none; padding-top: 0; }
.debrief-item.landed { color: var(--green-text); }
.debrief-item.lost { color: var(--amber-text); }
.debrief-moment {
  font-size: 13px; padding: 6px 0; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start; line-height: 1.5;
}
.debrief-moment:first-of-type { border-top: none; }
.moment-ts {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; flex-shrink: 0; margin-top: 2px; min-width: 38px;
}
.replay-tip {
  background: var(--blue-bg); border: 1px solid rgba(37,99,235,0.3);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 10px; font-size: 14px; line-height: 1.6;
}
.replay-label { font-size: 12px; font-weight: 600; color: var(--blue-text); margin-bottom: 6px; }
.velma-caveat {
  background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 6px; padding: 8px 12px; font-size: 12px;
  color: var(--amber-text); margin-bottom: 10px; line-height: 1.5;
}

@media (min-width: 768px) {
  body { padding-bottom: 80px; }
  .screen { padding: 24px; }
}
