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

:root {
  --bg: #0c0c10;
  --surface: #16161e;
  --surface2: #1e1e28;
  --border: #2a2a38;
  --text: #e2e2ec;
  --muted: #70708a;
  --purple: #6366f1;
  --green: #10b981;
  --orange: #f97316;
  --red: #ef4444;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  padding: 32px 16px 48px;
}

.app {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header ── */
header { text-align: center; }

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #55556a;
  margin-bottom: 10px;
}

/* ── Scenario cards ── */
.scenario-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scenario-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}

.scenario-btn:hover   { background: var(--surface2); border-color: #3a3a50; }
.scenario-btn.active  { border-color: var(--purple); background: rgba(99,102,241,0.08); }

.scenario-icon { font-size: 26px; flex-shrink: 0; }

.scenario-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scenario-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.scenario-btn.active .scenario-name { color: #a5b4fc; }

.scenario-desc {
  font-size: 12px;
  color: #65657a;
}
.scenario-btn.active .scenario-desc { color: #7070a0; }

/* ── Hints ── */
.hints-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.hints-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hints-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: #9090a8;
  line-height: 1.4;
}

.hints-list li::before {
  content: "→";
  color: var(--purple);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.hint-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
  flex-shrink: 0;
}
.hint-tag.interrupt  { background: rgba(239,68,68,0.15);   color: #f87171; }
.hint-tag.transcript { background: rgba(99,102,241,0.15);  color: #a5b4fc; }
.hint-tag.scenario   { background: rgba(16,185,129,0.15);  color: #6ee7b7; }

/* ── Call section ── */
.call-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.orb-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Orb ── */
.orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  transition: background 0.3s, box-shadow 0.3s;
}

.orb.idle  { background: #22222e; box-shadow: none; }
.orb.error { background: radial-gradient(circle at 35% 35%, var(--red), #7f1d1d); }

.orb.listening {
  background: radial-gradient(circle at 35% 35%, var(--purple), #312e81);
  box-shadow: 0 0 28px 8px rgba(99,102,241,0.45);
  animation: pulse 1.4s ease-in-out infinite;
}

.orb.speaking {
  background: radial-gradient(circle at 35% 35%, var(--green), #065f46);
  box-shadow: 0 0 36px 10px rgba(16,185,129,0.45);
  animation: pulse 0.7s ease-in-out infinite;
}

.orb.interrupted {
  background: radial-gradient(circle at 35% 35%, var(--orange), #92400e);
  box-shadow: 0 0 28px 8px rgba(249,115,22,0.5);
  animation: pulse 0.35s ease-in-out 3;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.07); }
}

/* ── Face ── */
.face {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  line-height: 1;
  user-select: none;
}

.orb.speaking    .face { animation: talk  0.35s ease-in-out infinite alternate; }
.orb.interrupted .face { animation: shake 0.1s  ease-in-out 4; }

@keyframes talk {
  from { transform: translate(-50%, -50%) scaleY(1); }
  to   { transform: translate(-50%, -50%) scaleY(0.88) scaleX(1.05); }
}
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  25%       { transform: translate(-50%, -50%) translateX(-3px); }
  75%       { transform: translate(-50%, -50%) translateX(3px); }
}

/* ── Status badge ── */
.status-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 20px;
  border: 2px solid var(--bg);
}
.status-badge.hidden      { display: none; }
.status-badge.listening   { background: var(--purple); color: #fff; }
.status-badge.speaking    { background: var(--green);  color: #000; }
.status-badge.interrupted { background: var(--orange); color: #fff; }

.status-text {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ── Transcript ── */
#transcript {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.transcript-empty {
  font-size: 13px;
  color: #3a3a50;
  margin: auto;
  text-align: center;
}

.line {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13.5px;
  line-height: 1.5;
}
.line .speaker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.line.user  .speaker { color: #f87171; }
.line.agent .speaker { color: #34d399; }
.line.user  .text    { color: #fecaca; }
.line.agent .text    { color: #d0fae8; }

/* ── Controls ── */
.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

button {
  padding: 11px 32px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #5254cc; }
.btn-danger  { background: #2a1e1e; color: #f87171; border: 1.5px solid #3f1f1f; }
.btn-danger:hover:not(:disabled)  { background: #3a2020; }

/* ── Developer panel ── */
.dev-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.dev-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #55556a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
  list-style: none;
}
.dev-panel summary::-webkit-details-marker { display: none; }
.dev-panel summary::before {
  content: "▶";
  font-size: 9px;
  margin-right: 8px;
  transition: transform 0.2s;
}
.dev-panel[open] summary::before { transform: rotate(90deg); }

.dev-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: #55556a;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.dev-stats strong { color: #9090a8; }

.event-log {
  border-top: 1px solid var(--border);
  height: 180px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
}

.event-entry {
  display: flex;
  gap: 10px;
  align-items: baseline;
  line-height: 1.6;
}
.event-time  { color: #3a3a50; min-width: 48px; }
.event-type  { font-weight: 600; min-width: 180px; }
.event-data  { color: #55556a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.event-session    .event-type { color: #6366f1; }
.event-input      .event-type { color: #818cf8; }
.event-reply      .event-type { color: #34d399; }
.event-transcript .event-type { color: #94a3b8; }
.event-latency    .event-type { color: #f59e0b; }
.event-ws         .event-type { color: var(--red); }

/* ── Footer ── */
footer { text-align: center; }

.cta {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
  padding: 10px 20px;
  border: 1.5px solid rgba(99,102,241,0.3);
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.cta:hover {
  background: rgba(99,102,241,0.08);
  border-color: var(--purple);
}
