:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --ink: #17201c;
  --muted: #63706a;
  --line: #dce3df;
  --accent: #0f766e;
  --accent-dark: #0b514b;
  --blue: #2f5f9f;
  --gold: #b7791f;
  --danger: #a33b32;
  --shadow: 0 18px 45px rgba(23, 32, 28, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.active {
  background: var(--accent);
}

.status-dot.error {
  background: var(--danger);
}

main {
  padding: clamp(16px, 4vw, 42px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(380px, 1.45fr) minmax(280px, 0.75fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;
}

.setup-panel,
.interview-panel,
.report-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-panel,
.report-panel {
  padding: 22px;
}

.interview-panel {
  min-height: 720px;
  padding: 22px;
}

.panel-heading {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.4rem;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
}

.setup-form,
.answer-box {
  display: grid;
  gap: 16px;
}

.voice-capture {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.voice-capture-main {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.mic-orb {
  display: grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.24);
}

.mic-orb span {
  position: relative;
  display: block;
  width: 18px;
  height: 28px;
  border: 3px solid currentColor;
  border-radius: 999px;
}

.mic-orb span::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 3px;
  height: 10px;
  background: currentColor;
  transform: translateX(-50%);
}

.mic-orb span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 22px;
  height: 12px;
  border-bottom: 3px solid currentColor;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.mic-orb:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.is-listening .mic-orb {
  animation: micPulse 1.1s ease-in-out infinite;
  background: #dc2626;
  box-shadow: 0 14px 30px rgba(220, 38, 38, 0.24);
}

@keyframes micPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.28);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
  }
}

.voice-copy {
  min-width: 0;
}

.candidate-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.candidate-heading .stage-label {
  margin: 0;
}

.transcript-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.transcript-toggle span {
  transition: transform 0.16s ease;
}

.answer-preview {
  display: -webkit-box;
  min-height: 62px;
  max-height: 128px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.answer-preview[hidden],
.text-fallback[hidden] {
  display: none;
}

#answerInput {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.edit-transcript-button {
  justify-self: start;
}

.edit-transcript-button[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.5);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.text-fallback {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.actions,
.answer-actions,
.section-heading,
.interview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.actions,
.answer-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.ghost-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-icon {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.support-note {
  min-height: 40px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.interviewer-stage {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 210px;
  margin: 24px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(47, 95, 159, 0.06)),
    var(--surface-2);
}

.voice-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--ink);
}

.voice-visual span {
  width: 8px;
  height: 30px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.72;
  transform-origin: center;
}

.is-speaking .voice-visual span,
.is-listening .voice-visual span {
  animation: pulseBar 0.8s ease-in-out infinite;
}

.voice-visual span:nth-child(2) {
  height: 48px;
  animation-delay: 0.12s;
}

.voice-visual span:nth-child(3) {
  height: 38px;
  animation-delay: 0.24s;
}

.voice-visual span:nth-child(4) {
  height: 56px;
  animation-delay: 0.36s;
}

@keyframes pulseBar {
  0%,
  100% {
    transform: scaleY(0.65);
  }
  50% {
    transform: scaleY(1.08);
  }
}

.stage-label {
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.question-text {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 2.35rem);
  font-weight: 800;
  line-height: 1.12;
}

.question-meter {
  display: grid;
  place-items: center;
  min-width: 76px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.transcript-wrap {
  margin-top: 22px;
}

.transcript {
  display: grid;
  gap: 12px;
  max-height: 330px;
  margin: 14px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.transcript li {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.transcript strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.transcript p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.score-card {
  display: grid;
  place-items: center;
  min-height: 164px;
  margin: 22px 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  text-align: center;
}

.score-value {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 700;
}

.score-list {
  display: grid;
  gap: 10px;
}

.score-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.score-list strong {
  color: var(--ink);
}

.feedback-block {
  margin-top: 22px;
}

.feedback-block ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.3fr);
  }

  .report-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .interviewer-stage {
    grid-template-columns: 1fr;
  }

  .voice-visual {
    width: 112px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 13ch;
    font-size: 2.45rem;
  }
}

@media (max-width: 520px) {
  main {
    padding: 12px;
  }

  .setup-panel,
  .interview-panel,
  .report-panel {
    padding: 16px;
  }

  .actions > *,
  .answer-actions > * {
    width: 100%;
  }

  .question-text {
    font-size: 1.35rem;
  }

  .voice-capture-main {
    grid-template-columns: 1fr;
  }

  .mic-orb {
    width: 78px;
  }
}
