:root {
  --bg: #05070b;
  --panel: rgba(11, 17, 29, 0.88);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f7fbff;
  --muted: #a9b6c8;
  --cyan: #00f2ea;
  --magenta: #ff00e5;
  --danger: #ff5f7a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html { height: 100%; background: var(--bg); }
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(0, 242, 234, 0.20), transparent 30%),
    radial-gradient(circle at 86% 16%, rgba(255, 0, 229, 0.18), transparent 34%),
    linear-gradient(140deg, #05070b 0%, #07101d 52%, #05070b 100%);
  overflow: hidden;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.shell {
  width: 100vw;
  height: 100dvh;
  padding: clamp(12px, 2vw, 26px);
  display: grid;
  place-items: stretch;
}

.panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: clamp(22px, 3vw, 38px);
  padding: clamp(18px, 3vw, 44px);
  background: linear-gradient(135deg, rgba(255,255,255,0.085), rgba(255,255,255,0.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.step-label {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

h1 {
  margin: 0;
  max-width: 980px;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.progress-number {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 15px;
  color: var(--cyan);
  font-weight: 900;
  background: rgba(255,255,255,0.055);
}

.progress-bar {
  flex: 0 0 auto;
  height: 10px;
  background: rgba(255,255,255,0.09);
  border-radius: 99px;
  overflow: hidden;
  margin: clamp(18px, 3vw, 34px) 0;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border-radius: inherit;
  transition: width 260ms ease;
}

.question-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(20px, 3vw, 42px);
  border-radius: clamp(18px, 2vw, 30px);
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.20);
  overflow: auto;
}
.question-card p {
  max-width: 900px;
  margin: 0 0 clamp(18px, 2vw, 28px);
  color: var(--muted);
  line-height: 1.65;
  font-size: clamp(17px, 1.6vw, 22px);
}

.answer-label, legend {
  display: block;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 900;
}
.text-answer {
  width: 100%;
  min-height: min(360px, 42dvh);
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 22px;
  background: rgba(0,0,0,0.32);
  color: var(--text);
  padding: 18px;
  outline: none;
  font-size: clamp(17px, 1.35vw, 20px);
}
.text-answer:focus {
  border-color: rgba(0,242,234,0.78);
  box-shadow: 0 0 0 4px rgba(0,242,234,0.12);
}

.primary, .ghost, .record, .stop {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 900;
}
.primary {
  color: #021011;
  background: linear-gradient(135deg, var(--cyan), #9dfffa);
  box-shadow: 0 14px 42px rgba(0,242,234,0.24);
}
.ghost {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
}
.record { color: #120013; background: linear-gradient(135deg, var(--magenta), #ff9df4); }
.stop { color: #160407; background: linear-gradient(135deg, var(--danger), #ffc0cb); }
.nav-row {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: clamp(14px, 2vw, 24px);
}

.agent-grid {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.choice-grid .agent-option {
  min-height: 120px;
}
.agent-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.055);
  border-radius: 20px;
}
.agent-option input { margin-top: 5px; accent-color: var(--cyan); }
.agent-option strong { display: block; margin-bottom: 5px; font-size: 18px; }
.agent-option span { color: var(--muted); font-size: 14px; line-height: 1.45; }

.voice-box { display: grid; gap: 18px; }
.voice-help { margin-top: 0; }
.recorder-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 18px;
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: 22px;
  background: rgba(0,0,0,0.20);
}
#recording-status { color: var(--muted); font-weight: 800; }
audio { width: 100%; }
.notice {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(0,242,234,0.35);
  background: rgba(0,242,234,0.08);
  color: #d8f8ff;
  line-height: 1.55;
}
.notice strong { color: var(--cyan); }
.success-box, .error-box { padding: 18px; border-radius: 18px; line-height: 1.6; }
.success-box { background: rgba(56,248,166,0.1); border: 1px solid rgba(56,248,166,0.35); }
.error-box { background: rgba(255,95,122,0.1); border: 1px solid rgba(255,95,122,0.35); }

@media (max-width: 760px) {
  body { overflow: auto; }
  .shell { min-height: 100dvh; height: auto; padding: 10px; }
  .panel { min-height: calc(100dvh - 20px); padding: 16px; border-radius: 22px; }
  .topbar { display: grid; }
  .question-card { min-height: 52dvh; padding: 16px; }
  .agent-grid, .choice-grid { grid-template-columns: 1fr; }
  h1 { font-size: clamp(34px, 10vw, 54px); }
}

@media (max-height: 720px) and (min-width: 761px) {
  .shell { padding: 14px 26px; }
  .panel { padding: 34px 38px; }
  .step-label { margin-bottom: 6px; }
  h1 { font-size: clamp(32px, 4.4vw, 58px); line-height: 0.98; }
  .progress-bar { margin: 16px 0 18px; height: 9px; }
  .question-card { padding: 22px 38px; }
  .question-card p { margin-bottom: 16px; font-size: 20px; line-height: 1.45; }
  .agent-option { padding: 10px 14px; }
  .choice-grid .agent-option { min-height: 64px; }
  .agent-option strong { font-size: 17px; margin-bottom: 3px; }
  .agent-option span { font-size: 13px; line-height: 1.28; }
  .nav-row { margin-top: 14px; }
}
