:root {
  --color-primary-500: #2196f3;
  --color-select: #1976d2;
  --color-white: #ffffff;
  --color-black: #000000;
  --color-grey-50: #f6f6f4;
  --color-grey-100: #d9e0e3;
  --color-grey-600: #546e7a;
  --color-grey-700: #455a64;
  --color-overlay: rgba(55, 71, 79, 0.8);
  --color-error: #d32f2f;
  --background-base: #ffffff;

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

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

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

* {
  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;
  position: relative;
}

/* 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-content--centered {
  justify-content: center;
  align-items: center;
}

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

/* Typography */
.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-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;
}

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

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

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

.description-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  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;
  flex-shrink: 0;
}

.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;
}

.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;
}

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

/* Plain answer textarea (Figma's 4px-radius variant) */
.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%;
  height: 200px;
}

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

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

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

/* Style picker */
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  width: 100%;
}

.style-card {
  position: relative;
  border: 1px solid var(--color-grey-100);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 173 / 159;
  cursor: pointer;
  padding: 0;
  background: none;
  display: block;
  width: 100%;
}

.style-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-card .radio-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-card .radio-badge img {
  width: 12px;
  height: 12px;
  display: none;
}

.style-card.is-selected {
  border: 2px solid var(--color-select);
}

.style-card.is-selected .radio-badge {
  background: var(--color-select);
  border-color: var(--color-white);
}

.style-card.is-selected .radio-badge img {
  display: block;
}

.btn-regenerate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-grey-100);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-base);
  font-weight: 500;
  font-size: 16px;
  color: var(--color-black);
}

.btn-regenerate img {
  width: 18px;
  height: 18px;
}

.btn-regenerate.is-loading img {
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Ideas overview + modal */
.ideas-top-nav {
  border-bottom: 1px solid var(--color-grey-50);
  padding: 20px 16px;
  width: 100%;
  flex-shrink: 0;
  text-align: center;
}

.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: 100%;
  align-content: flex-start;
}

.grid-item {
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  background: none;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  z-index: 20;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  width: 100%;
  height: 100%;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.modal-close-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

.modal-close-row img {
  width: 12.8px;
  height: 12.8px;
}

.modal-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-4);
  flex-shrink: 0;
}

.modal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-prompt-text {
  color: #111827;
  margin-top: var(--space-4);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-shrink: 0;
  padding-top: var(--space-4);
}

.modal-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.modal-nav-btn img {
  width: 25.6px;
  height: 25.6px;
}

.modal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.counter-badge {
  background: var(--color-grey-50);
  color: var(--color-grey-600);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 20px;
}
