/* Call Trainer — Sesame/voice-mode inspired dark UI */

:root {
  --bg0: #05070f;
  --bg1: #0a0f1e;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #eef1f8;
  --muted: #9aa3bd;
  --accent: #6ee7ff;
  --accent2: #a78bfa;
  --gold: #f5c66b;
  --green: #4ade80;
  --red: #f87171;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: radial-gradient(1200px 800px at 50% -10%, #101a38 0%, var(--bg0) 55%) fixed, var(--bg0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; animation: fadein .45s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* ---------- Setup ---------- */
.setup-wrap { max-width: 640px; margin: 0 auto; padding: 48px 20px 64px; }
.brand { text-align: center; margin-bottom: 32px; }
.brand-orb {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a5f3fc, #38bdf8 35%, #6366f1 70%, #1e1b4b);
  box-shadow: 0 0 60px rgba(56, 189, 248, .45), inset 0 0 24px rgba(255,255,255,.25);
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.brand h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -0.5px; }
.tagline { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 0; }

.setup-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 28px 24px;
  backdrop-filter: blur(12px);
}
.field-label { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 22px 0 10px; }
.field-label:first-of-type { margin-top: 0; }
.hint { text-transform: none; letter-spacing: 0; font-size: 12px; opacity: .75; }
#trainee-name {
  width: 100%; padding: 14px 16px; font-size: 17px; border-radius: 12px;
  border: 1px solid var(--card-border); background: rgba(0,0,0,.35); color: var(--text);
  outline: none;
}
#trainee-name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,231,255,.15); }

.skill-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.skill-btn {
  background: rgba(0,0,0,.3); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 14px; padding: 14px 8px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; gap: 4px; transition: all .18s ease;
}
.skill-btn .skill-title { font-weight: 700; font-size: 15px; }
.skill-btn .skill-sub { font-size: 12px; color: var(--muted); }
.skill-btn.selected { border-color: var(--accent); background: rgba(110,231,255,.1); box-shadow: 0 0 18px rgba(110,231,255,.25); }

.scenario-list { display: flex; flex-direction: column; gap: 10px; }
.scenario-card {
  border: 1px solid var(--card-border); background: rgba(0,0,0,.3);
  border-radius: 14px; padding: 16px; cursor: pointer; transition: all .18s ease; text-align: left; color: var(--text); width: 100%;
}
.scenario-card .sc-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.scenario-card .sc-tag { color: var(--accent); font-size: 13px; margin-bottom: 6px; }
.scenario-card .sc-desc { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.scenario-card.selected { border-color: var(--accent2); background: rgba(167,139,250,.09); box-shadow: 0 0 18px rgba(167,139,250,.22); }

.primary-btn {
  width: 100%; margin-top: 26px; padding: 16px; font-size: 17px; font-weight: 700;
  border: none; border-radius: 14px; cursor: pointer; color: #04121a;
  background: linear-gradient(135deg, #6ee7ff, #38bdf8);
  box-shadow: 0 6px 28px rgba(56,189,248,.35); transition: transform .12s ease, opacity .2s;
}
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.ghost-btn {
  width: 100%; margin-top: 10px; padding: 14px; font-size: 16px; font-weight: 600;
  border: 1px solid var(--card-border); border-radius: 14px; cursor: pointer;
  background: transparent; color: var(--text);
}
.error { color: var(--red); font-size: 14px; margin-top: 12px; }
.loading { color: var(--muted); }

/* ---------- Live call ---------- */
.call-stage { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); position: relative; }
.call-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px 12px; }
.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); letter-spacing: 1px; }
.end-btn {
  background: rgba(248,113,113,.14); color: #fca5a5; border: 1px solid rgba(248,113,113,.4);
  padding: 10px 20px; border-radius: 999px; font-size: 15px; font-weight: 700; cursor: pointer;
}

.prospect-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 14px 16px; backdrop-filter: blur(12px);
}
.prospect-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #0a0f1e;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
}
.prospect-name { font-weight: 700; font-size: 17px; }
.prospect-role { color: var(--muted); font-size: 13px; }
.mood-badge {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.06);
  border: 1px solid var(--card-border); white-space: nowrap;
  transition: all .3s ease;
}
.mood-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: background .3s; }
.mood-badge[data-mood="warm"] { color: #86efac; border-color: rgba(74,222,128,.4); } .mood-badge[data-mood="warm"] .mood-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.mood-badge[data-mood="neutral"] { color: var(--muted); }
.mood-badge[data-mood="skeptical"] { color: #fcd34d; border-color: rgba(252,211,77,.4); } .mood-badge[data-mood="skeptical"] .mood-dot { background: #fcd34d; box-shadow: 0 0 8px #fcd34d; }
.mood-badge[data-mood="rushed"] { color: #fdba74; border-color: rgba(253,186,116,.4); } .mood-badge[data-mood="rushed"] .mood-dot { background: #fdba74; box-shadow: 0 0 8px #fdba74; }
.mood-badge[data-mood="annoyed"] { color: #fca5a5; border-color: rgba(248,113,113,.45); } .mood-badge[data-mood="annoyed"] .mood-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.mood-badge[data-mood="convinced"] { color: var(--gold); border-color: rgba(245,198,107,.5); } .mood-badge[data-mood="convinced"] .mood-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.orb-wrap { position: relative; flex: 1; min-height: 300px; display: flex; align-items: center; justify-content: center; }
#orb { width: min(78vw, 320px); height: min(78vw, 320px); }
.orb-status {
  position: absolute; bottom: 6px; left: 0; right: 0; text-align: center;
  color: var(--muted); font-size: 14px; letter-spacing: .4px;
}

.coach-feed { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; max-height: 220px; overflow-y: auto; }
.coach-tip {
  background: linear-gradient(135deg, rgba(167,139,250,.14), rgba(110,231,255,.08));
  border: 1px solid rgba(167,139,250,.35); border-radius: 14px; padding: 12px 15px;
  font-size: 14.5px; line-height: 1.5; animation: slidein .4s ease;
  box-shadow: 0 4px 20px rgba(167,139,250,.15);
}
.coach-tip .coach-tag { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent2); margin-bottom: 5px; font-weight: 800; }
.coach-tip.fading { opacity: 0; transition: opacity 1.2s ease; }
.coach-tip.compliance-alert {
  background: linear-gradient(135deg, rgba(248,113,113,.18), rgba(248,113,113,.06));
  border: 1px solid rgba(248,113,113,.55);
  box-shadow: 0 4px 20px rgba(248,113,113,.2);
}
.coach-tip.compliance-alert .coach-tag { color: #f87171; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.transcript-toggle { text-align: center; margin: 6px 0; }
.transcript-toggle button { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 8px 16px; }
.transcript-panel { max-height: 240px; overflow-y: auto; background: rgba(0,0,0,.35); border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.transcript-list { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; }
.t-line Caller, .t-line.prospect { max-width: 88%; }
.t-line.caller { align-self: flex-end; background: rgba(56,189,248,.14); border: 1px solid rgba(56,189,248,.25); border-radius: 12px 12px 4px 12px; padding: 8px 12px; }
.t-line.prospect { align-self: flex-start; background: rgba(255,255,255,.05); border: 1px solid var(--card-border); border-radius: 12px 12px 12px 4px; padding: 8px 12px; }
.next-move {
  background: linear-gradient(135deg, rgba(245,198,107,.16), rgba(245,198,107,.05));
  border: 1px solid rgba(245,198,107,.5); border-radius: 14px; padding: 12px 15px;
  margin-bottom: 10px; box-shadow: 0 4px 20px rgba(245,198,107,.15);
  animation: slidein .4s ease;
}
.next-move .nm-tag { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #f5c66b; margin-bottom: 5px; font-weight: 800; }
.next-move .nm-line { display: block; font-size: 16px; line-height: 1.5; font-weight: 600; }
.next-move .nm-why { display: block; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
@media (max-width: 640px) {
  .transcript-panel { max-height: 62vh; }
  .script-line { font-size: 15.5px; line-height: 1.55; }
  .next-move .nm-line { font-size: 17px; }
}
.script-head { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.script-list { display: flex; flex-direction: column; gap: 10px; }
.script-card { background: rgba(255,255,255,.04); border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 12px; }
.script-beat { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent2); font-weight: 800; margin-bottom: 6px; }
.script-line { font-size: 14px; line-height: 1.5; margin-bottom: 5px; }
.script-line:last-child { margin-bottom: 0; }
.t-line .who { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 3px; }

.fallback-bar { margin-top: 8px; }
.fallback-bar input {
  width: 100%; padding: 14px 16px; font-size: 15px; border-radius: 12px;
  border: 1px solid var(--accent); background: rgba(0,0,0,.4); color: var(--text); outline: none;
}

.call-error {
  margin-top: 10px; background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.4);
  border-radius: 14px; padding: 14px 16px; font-size: 14.5px; line-height: 1.5; text-align: center;
}
.call-error button { margin-top: 10px; background: rgba(248,113,113,.2); color: #fecaca; border: 1px solid rgba(248,113,113,.5); border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 700; cursor: pointer; }

/* ---------- Debrief ---------- */
.debrief-wrap { max-width: 560px; margin: 0 auto; padding: 44px 20px 64px; }
.debrief-wrap h2 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.5px; }
.debrief-sub { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
.meters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.meter-row { display: grid; grid-template-columns: 130px 1fr 30px; align-items: center; gap: 12px; font-size: 14px; }
.meter-row b { text-align: right; font-size: 16px; color: var(--gold); }
.meter { height: 12px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.meter-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, var(--gold));
  transition: width 1.4s cubic-bezier(.22,1,.36,1);
}
.notes-card, .drill-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.notes-card h3, .drill-card h3 { margin: 0 0 12px; font-size: 16px; }
.notes-card ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.notes-card li { font-size: 14.5px; line-height: 1.55; color: #dbe2f4; }
.drill-card p { margin: 0; font-size: 14.5px; line-height: 1.55; color: #dbe2f4; }
.drill-time { font-size: 11px; background: rgba(110,231,255,.15); color: var(--accent); padding: 3px 10px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.debrief-actions { margin-top: 8px; }

@media (max-width: 480px) {
  .meter-row { grid-template-columns: 108px 1fr 26px; font-size: 13px; }
  .skill-row { grid-template-columns: 1fr; }
}
