:root {
  --color-primary-50: #e3f2fd;
  --color-primary-500: #2196f3;
  --color-primary-900: #0d47a1;
  --color-listening: #39a1f1;
  --color-error: #d32f2f;
  --color-white: #ffffff;
  --color-black: #000000;
  --color-grey-50: #f6f6f4;
  --color-grey-100: #d9e0e3;
  --color-grey-300: #90a4ae;
  --color-grey-600: #546e7a;
  --color-grey-700: #455a64;
  --background-base: #ffffff;

  --font-heading: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-base: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-lg: 12px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-9: 64px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f5f7;
  font-family: var(--font-base);
  color: var(--color-black);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-nav {
  position: fixed;
  top: 18px;
  left: 20px;
  z-index: 10;
}

.flow-nav a {
  color: var(--color-grey-600);
  text-decoration: none;
  font-size: 0.75rem;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.flow-nav a:hover {
  opacity: 1;
}

.screen {
  max-width: 390px;
  width: 100%;
  height: calc(100vh - 80px);
  background: var(--background-base);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border-radius: 32px;
}

.screen--listening {
  background: var(--color-primary-50);
}

/* Scrollable content area */
.screen-content {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: center;
}

.screen--pad-md {
  padding: 40px 16px 16px;
}

.screen--pad-listening {
  padding: var(--space-9) 16px 16px;
}

.screen-content--centered {
  justify-content: center;
  align-items: center;
}

.screen-content--centered.screen--pad-md {
  padding-top: 16px;
}

.intro-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  text-align: center;
}

.intro-text-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

/* Typography */
.heading-lg {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 32px;
  line-height: 40px;
  color: var(--color-black);
  margin: 0;
}

.heading-md {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  color: var(--color-black);
  margin: 0;
}

.body-md {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: var(--color-grey-600);
  margin: 0;
}

.body-lg {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 20px;
  line-height: 28px;
  color: var(--color-black);
  margin: 0;
}

.body-sm {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--color-grey-700);
  margin: 0;
}

.body-xs {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-grey-600);
  margin: 0;
}

.listening-suffix {
  color: var(--color-listening);
}

.error-text {
  color: var(--color-error);
}

.text-link {
  color: var(--color-primary-500);
  text-decoration: underline;
  font-weight: 500;
}

.text-link:hover {
  color: #1c86e0;
}

/* Layout containers */
.question-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
}

.content-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
}

.description-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

/* Buttons */
.btn {
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 18px;
  line-height: 18px;
  letter-spacing: 0.002em;
  border: 1px solid var(--color-primary-500);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--color-primary-500);
  color: var(--color-white);
  padding: 16px 12px;
  width: 100%;
  text-align: center;
}

.btn-primary:hover {
  background: #1c86e0;
  border-color: #1c86e0;
}

.nav-row {
  display: flex;
  gap: var(--space-1);
  width: 100%;
  align-items: stretch;
}

.btn-back {
  background: var(--color-primary-500);
  border: 1px solid var(--color-primary-500);
  border-radius: var(--radius-lg);
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-back:hover {
  background: #1c86e0;
  border-color: #1c86e0;
}

.btn-back img {
  width: 24px;
  height: 24px;
}

.nav-row .btn-primary {
  flex: 1 0 0;
  width: auto;
}

/* Emoji rating scale (closed question) */
.rating-row {
  display: flex;
  gap: var(--space-1);
  width: 100%;
  height: 80px;
}

.rating-option {
  flex: 1 0 0;
  height: 80px;
  border: 1px solid var(--color-grey-100);
  border-radius: 8px;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-1);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.rating-option .emoji {
  font-size: 16px;
  line-height: 24px;
}

.rating-option .value {
  font-weight: 600;
  font-size: 14px;
  line-height: 14px;
  color: var(--color-black);
}

.rating-option:hover {
  border-color: var(--color-primary-500);
}

.rating-option.is-selected {
  border-color: var(--color-primary-500);
  border-width: 2px;
  background: var(--color-primary-50);
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

/* Primary voice input (mic-first open question) */
.voice-input {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  justify-content: center;
  height: 250px;
  width: 100%;
}

.mic-button-large {
  width: 120px;
  height: 120px;
  border-radius: 60px;
  background: var(--color-primary-900);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.mic-button-large:hover {
  transform: scale(1.04);
}

.mic-button-large img {
  width: 30px;
  height: 30px;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--color-white);
  border: 1px solid var(--color-grey-50);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: var(--font-base);
  font-size: 12px;
  line-height: 16px;
  color: var(--color-grey-600);
}

.mode-toggle:hover {
  border-color: var(--color-primary-500);
}

.mode-toggle img {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Typed answer textarea (Figma's 4px-radius variant, distinct from any shared textarea style) */
.speech-textarea-field {
  border: 1px solid var(--color-grey-50);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-align: left;
  width: 100%;
}

.speech-textarea-field textarea {
  border: none;
  outline: none;
  resize: none;
  width: 100%;
  min-height: 150px;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 24px;
  color: var(--color-black);
  background: transparent;
}

.speech-textarea-field textarea::placeholder {
  color: var(--color-grey-600);
}

.speech-textarea-field .char-count {
  align-self: flex-end;
}

.type-mode-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  width: 100%;
}

/* Speech recording screen */
.transcription-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.transcription-text {
  text-align: center;
  width: 100%;
}

.waveform {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.waveform-bar {
  width: 7px;
  border-radius: 3.5px;
  background: var(--color-listening);
  animation: waveform-pulse 1.1s ease-in-out infinite;
}

@keyframes waveform-pulse {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}

.recording-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  flex-shrink: 0;
}

.btn-recording {
  background: var(--color-listening);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  width: 100%;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 18px;
  line-height: 18px;
  letter-spacing: 0.002em;
  cursor: pointer;
}

.btn-cancel {
  background: none;
  border: none;
  color: var(--color-grey-600);
  padding: 16px 12px;
  width: 100%;
  font-family: var(--font-base);
  font-weight: 600;
  font-size: 18px;
  line-height: 18px;
  cursor: pointer;
}
