/* =================================================================
   Intervion — AI Interview Practice UI
   Dark mode, animated AI orb, modern layout.
   ================================================================= */

:root {
  --bg-0: #07070b;
  --bg-1: #0d0e16;
  --bg-2: #161826;
  --fg: #e9ecf3;
  --muted: #8a90a4;
  --line: #1f2233;

  --primary: #6c8cff;
  --primary-2: #a76bff;
  --record: #ff5d6c;
  --good: #38d39f;
  --warn: #ffc857;

  --orb-blue: #4a7cff;
  --orb-purple: #a26bff;
  --orb-cyan: #4ee3d4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 800px at 50% -10%, #1a1d33 0%, var(--bg-0) 60%) fixed;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* -----------------------------------------------------------------
   Top bar
   ----------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 11, 18, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: conic-gradient(from 220deg,
              var(--orb-cyan), var(--orb-blue), var(--orb-purple), var(--orb-cyan));
  box-shadow: 0 0 14px rgba(108, 140, 255, 0.55);
}
.brand-name { font-size: 16px; }

.topic-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.topic-picker select {
  appearance: none;
  background: var(--bg-2);
  color: var(--fg);
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.topic-picker select:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* -----------------------------------------------------------------
   Stage
   ----------------------------------------------------------------- */
.stage {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* -----------------------------------------------------------------
   Orb
   ----------------------------------------------------------------- */
.orb-wrap {
  position: relative;
  margin-top: 18px;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s ease;
}
.orb-core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 38%),
    conic-gradient(from 200deg,
      var(--orb-cyan), var(--orb-blue), var(--orb-purple),
      var(--orb-blue), var(--orb-cyan));
  filter: saturate(1.1) blur(0.4px);
  box-shadow:
    0 0 60px rgba(108, 140, 255, 0.45),
    inset 0 0 60px rgba(78, 227, 212, 0.25);
  animation: spinSlow 18s linear infinite;
}
.orb-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,140,255,0.35) 0%, rgba(108,140,255,0) 70%);
  filter: blur(12px);
  animation: breathe 4s ease-in-out infinite;
  pointer-events: none;
}
.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.18);
  width: 100%;
  height: 100%;
  opacity: 0;
}
.orb-particles {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 38%, rgba(255,255,255,0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 30% 78%, rgba(255,255,255,0.6) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 84%, rgba(255,255,255,0.4) 0 1px, transparent 2px);
  pointer-events: none;
  animation: spinSlow 22s linear reverse infinite;
}

/* States */
.orb.idle .orb-core { animation: spinSlow 22s linear infinite, breathe 5s ease-in-out infinite; }
.orb.speaking .orb-glow { animation: breatheFast 0.9s ease-in-out infinite; }
.orb.speaking .orb-ring { animation: ripple 1.4s ease-out infinite; }
.orb.speaking .orb-ring.r2 { animation-delay: 0.45s; }
.orb.speaking .orb-ring.r3 { animation-delay: 0.9s; }
.orb.listening .orb-core {
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 38%),
    conic-gradient(from 200deg, #ff8f8f, #ff5d6c, #ffc857, #ff5d6c, #ff8f8f);
  box-shadow:
    0 0 60px rgba(255, 93, 108, 0.5),
    inset 0 0 60px rgba(255, 200, 87, 0.25);
}
.orb.listening .orb-ring {
  border-color: rgba(255, 93, 108, 0.45);
  animation: rippleListen 1.2s ease-out infinite;
}
.orb.listening .orb-ring.r2 { animation-delay: 0.4s; }
.orb.listening .orb-ring.r3 { animation-delay: 0.8s; }
.orb.thinking .orb-core { animation: spinFast 1.2s linear infinite; }
.orb.thinking .orb-glow { animation: breatheFast 1.4s ease-in-out infinite; }

@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes spinFast { to { transform: rotate(360deg); } }
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1.0; transform: scale(1.06); }
}
@keyframes breatheFast {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1.0; transform: scale(1.12); }
}
@keyframes ripple {
  0%   { opacity: 0.7; transform: scale(0.85); border-color: rgba(108,140,255,0.55); }
  100% { opacity: 0;   transform: scale(1.5);  border-color: rgba(108,140,255,0); }
}
@keyframes rippleListen {
  0%   { opacity: 0.7; transform: scale(0.85); }
  100% { opacity: 0;   transform: scale(1.5);  }
}

/* Status text below orb */
.status-line {
  position: absolute;
  bottom: -14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

/* -----------------------------------------------------------------
   QA panel
   ----------------------------------------------------------------- */
.qa {
  width: 100%;
  background: linear-gradient(180deg, rgba(22,24,38,0.85), rgba(13,14,22,0.85));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  text-align: center;
}
.meta-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pill {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(108,140,255,0.12);
  border: 1px solid rgba(108,140,255,0.3);
  color: #cdd6ff;
  letter-spacing: 0.3px;
}
.question {
  font-size: 22px;
  line-height: 1.45;
  margin: 4px 0 14px;
}
.transcript {
  color: var(--muted);
  font-size: 14px;
  min-height: 18px;
  font-style: italic;
}

/* -----------------------------------------------------------------
   Controls
   ----------------------------------------------------------------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 12px 20px;
  border-radius: 12px;
  color: white;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 24px rgba(108,140,255,0.35);
}
.btn.record {
  background: linear-gradient(135deg, #ff5d6c, #ff8a4a);
  box-shadow: 0 8px 24px rgba(255,93,108,0.35);
}
.btn.stop {
  background: #2a2e44;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
}
.btn.finish {
  background: linear-gradient(135deg, #38d39f, #4ee3d4);
  color: #0a0d12;
  box-shadow: 0 8px 24px rgba(56,211,159,0.35);
}

/* -----------------------------------------------------------------
   Report
   ----------------------------------------------------------------- */
.hidden { display: none !important; }

.report {
  width: 100%;
  background: linear-gradient(180deg, rgba(22,24,38,0.9), rgba(13,14,22,0.9));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
}
.report h2 { margin: 0 0 14px; font-size: 24px; }
.report h3 { margin: 18px 0 8px; font-size: 16px; color: #cdd6ff; }

.score-wheel {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 12px;
}
.score-num {
  font-size: 64px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--orb-cyan), var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.score-label { color: var(--muted); }

.summary { color: #c8cee0; line-height: 1.5; text-align: center; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 4px;
}
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.two-col ul { padding-left: 18px; margin: 6px 0 0; color: #c8cee0; }

.exchanges { padding-left: 22px; margin: 6px 0 0; }
.exchanges li {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13,14,22,0.55);
}
.ex-question { font-weight: 600; color: #e9ecf3; }
.ex-transcript { color: #c8cee0; margin-top: 6px; font-size: 14px; }
.ex-feedback { color: var(--muted); margin-top: 8px; font-size: 13px; font-style: italic; }
.ex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}
.ex-row audio { height: 32px; }
.ex-score {
  margin-left: auto;
  font-weight: 600;
  color: var(--good);
}
.report-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--muted);
}
