/* ============================================================
   Interview Agent - design tokens
   Identity: calm, focused, trustworthy. Deep ink + signal teal.
   One screen, three phases (check-in, live call, report) that
   transform smoothly into each other.
   ============================================================ */
:root {
  /* palette */
    --ink: #101828;
    --ink-2: #344054;
    --ink-3: #667085;
    --paper: #f6f7f9;
    --surface: #ffffff;
    --line: #e4e7ec;
    --accent: #0e7490;
    --accent-deep: #155e75;
    --accent-soft: #e0f2fe;
  --accent-ink: #ffffff;
  --ok: #067647;
    --warn: #b54708;
  --danger: #b42318;
  --stage-grad: radial-gradient(120% 120% at 50% 0%, #17304d 0%, #0b1626 55%, #0a0f18 100%);
  
    /* type */
    --display: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
  
    /* shape + motion */
    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
    background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid rgba(14, 116, 144, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

button {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button.primary:hover {
  background: var(--accent-deep);
}

button.primary:disabled {
  background: #a0c6d3;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
}

button.ghost:hover {
  background: var(--accent-soft);
}

select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--body);
}

textarea {
  resize: vertical;
  min-height: 56px;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 10px 0 0;
}

.muted {
  color: var(--ink-3);
}

/* ============================================================
   Single screen, three phases - smooth transforms
   ============================================================ */
#app {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.99);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0.5s;
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.call {
  overflow: hidden;
}

/* ---------- Phase 1: Check-in ---------- */
.checkin {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 24px;
  background:
    radial-gradient(90% 50% at 50% -10%, #dff3fb 0%, transparent 60%),
    var(--paper);
}

.topbar {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 4px 10px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
}

.tagline {
  color: var(--ink-3);
  font-size: 0.85rem;
}

.checkin-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px 24px;
    margin-top: 8px;
}

.checkin-card h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 1.2;
  margin: 0 0 8px;
}

.checkin-card > p {
  margin: 0 0 20px;
}

.checkin-card label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 6px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row select {
  flex: 1 1 220px;
}

.device-checks {
  margin: 18px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.dev {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
    font-size: 0.92rem;
}

.dev + .dev {
  border-top: 1px solid var(--line);
}

.dev-icon {
  font-size: 1rem;
}

.dev-state {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.dev-state.ok {
  color: var(--ok);
}

.dev-state.bad {
  color: var(--warn);
}

.dev-state.pending {
  color: var(--ink-3);
}

.resume-banner {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 14px 0 6px;
}

.resume-banner p {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--accent-deep);
}

button.join {
  width: 100%;
  margin-top: 18px;
    padding: 13px;
    font-size: 1.05rem;
}
.footnote {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--ink-3);
  text-align: center;
  max-width: 480px;
}

/* ---------- Phase 2: Live call (single centered stage) ---------- */
.call .stage {
  position: relative;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--stage-grad);
  color: #eef3f8;
}

.stage-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.stage-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}

.interviewer-name {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.live-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #7ee0b8;
  border: 1px solid rgba(126, 224, 184, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
}

button.pill {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #eef3f8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.82rem;
}

button.pill:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* the avatar lives in its own band, captions stay clear of it */
.stage-avatar {
  position: relative;
  z-index: 1;
  flex: 1 1 44%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-box {
  width: 100%;
  height: 100%;
  position: relative;
}
.avatar-box canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.85);
}

.avatar-mark {
  font-size: 4rem;
}

/* captions centered in the middle band of the screen */
.captions {
  position: relative;
  z-index: 2;
  flex: 1 1 34%;
  min-height: 0;
  padding: 4px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
    align-items: center;
  gap: 10px;
}
.bubble {
  max-width: 680px;
  width: fit-content;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  }
  
  .bubble.interviewer {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f7fafc;
    border-bottom-left-radius: 6px;
    text-align: left;
  }
  
  .bubble.interviewer.speaking::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: #7ee0b8;
    animation: pulse 1.1s infinite;
}
.bubble.candidate {
  display: flex;
  gap: 10px;
  background: rgba(14, 116, 144, 0.94);
  border: 1px solid rgba(127, 199, 224, 0.4);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  text-align: left;
  max-width: 560px;
}
.bubble.candidate .you {
  font-weight: 700;
  opacity: 0.9;
  flex: 0 0 auto;
}

.bubble.candidate .cand-text {
  min-width: 0;
}

.stage-foot {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
    gap: 14px;
    padding: 8px 16px 16px;
  }
  
  .status-pill {
    font-size: 0.82rem;
    color: #c8d4e2;
    background: rgba(10, 15, 24, 0.6);
    border-radius: 999px;
    padding: 7px 16px;
    min-width: 130px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .status-pill.listening {
    color: #7ee0b8;
    border-color: rgba(126, 224, 184, 0.4);
  }
  
  .status-pill.listening::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: #7ee0b8;
    animation: pulse 1.1s infinite;
  }
  
  .status-pill.thinking {
    color: #ffd9a0;
    border-color: rgba(255, 217, 160, 0.35);
  }
  
  .status-pill.speaking {
    color: #a9c6e8;
    border-color: rgba(169, 198, 232, 0.3);
}
.call-controls {
  display: flex;
  gap: 10px;
}

button.round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
    place-items: center;
    font-size: 1.2rem;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #eef3f8;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
  
  button.round:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  button.round[aria-pressed="false"] {
    opacity: 0.5;
  }
  
  .type-form {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 32px));
    z-index: 4;
    display: none;
    gap: 10px;
    align-items: flex-end;
    background: rgba(10, 15, 24, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  }
  
  .type-form.open {
    display: flex;
  }
  
  .type-form textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: #eef3f8;
    resize: none;
    min-height: 42px;
  }
  
  .type-form textarea::placeholder {
    color: #8fa0b3;
  }
  
  /* ============================================================
     Phase 3: Report
     ============================================================ */
  .feedback {
    display: flex;
    justify-content: center;
    padding: 20px 16px 48px;
}
.feedback-wrap {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: auto;
}

.feedback-head {
  display: flex;
  align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.feedback-head h2 {
  font-family: var(--display);
  margin: 0;
  font-size: 1.6rem;
}

.fb-block {
  background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.fb-block h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.fb-block ul { margin: 0; padding-left: 20px; }
.fb-block li { margin: 4px 0; }
#fb-summary {
  margin: 0;
  color: var(--ink-2);
}

.fb-block.strengths h3 {
  color: var(--ok);
}

.fb-block.gaps h3 {
  color: var(--warn);
}

.fb-block.next h3 {
  color: var(--accent-deep);
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
    color: var(--accent-deep);
    margin-left: 8px;
}

.badge.pri-high { background: #fdecea; color: var(--danger); }
.badge.pri-medium { background: #fef3e2; color: var(--warn); }
.badge.pri-low {
  background: #e7f6ee;
  color: var(--ok);
}
.practice-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 8px 0;
  background: var(--paper);
}

.practice-card summary { cursor: pointer; font-weight: 600; }
.practice-card p { margin: 8px 0 0; font-size: 0.9rem; }

.integrity-report {
  border-left: 4px solid var(--warn);
}

.integrity-report h3 {
  color: var(--warn);
}

.integrity-report ul {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  max-height: 220px;
  overflow-y: auto;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
  .checkin-card {
      padding: 22px 18px;
    }
  
    .bubble {
      font-size: 0.97rem;
      padding: 10px 14px;
    }
  
    .stage-top {
      padding: 12px 12px;
    }
  }
  
  /* short landscape: keep the face clear, compact the captions */
  @media (orientation: landscape) and (max-height: 520px) {
    .stage-avatar {
      flex: 1 1 38%;
    }
  
    .captions {
      flex: 1 1 40%;
      gap: 6px;
    }
  
    .bubble {
      font-size: 0.9rem;
      padding: 8px 12px;
      max-width: 560px;
    }
  
    .stage-foot {
      padding: 6px 12px 10px;
    }
  
    button.round {
      width: 42px;
      height: 42px;
    }
  
    .status-pill {
      min-width: 110px;
      padding: 5px 12px;
    }
  }
  
  /* ============================================================
     Motion + accessibility
     ============================================================ */
  @keyframes pulse {
  
    0%,
    100% {
      opacity: 1;
      transform: scale(1);
    }
  
    50% {
      opacity: 0.35;
      transform: scale(0.8);
    }
}

@media (prefers-reduced-motion: reduce) {
  * {
      animation: none !important;
      transition: none !important;
    }
}
