/* ===== Design System ===== */
:root {
  /* Stage colors */
  --empathize: #E85D4A;
  --define: #3B82F6;
  --ideate: #F59E0B;
  --prototype: #8B5CF6;
  --test: #10B981;

  /* Core palette */
  --primary: #1B2A4A;
  --primary-dark: #0F1D36;
  --primary-light: #E8ECF2;
  --accent: #3B82F6;
  --accent-light: #EBF2FF;

  /* Neutrals */
  --text: #1A1A2E;
  --text-secondary: #4B5563;
  --text-light: #9CA3AF;
  --bg: #F5F6F8;
  --bg-white: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06);
  --shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08);
  --shadow-lg: 0 8px 30px rgba(27, 42, 74, 0.10);
  --shadow-xl: 0 16px 50px rgba(27, 42, 74, 0.12);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Fonts */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.logo-accent {
  color: var(--accent);
}

.usage-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--border-light);
  padding: 6px 14px;
  border-radius: 20px;
}

/* ===== Main ===== */
.main {
  flex: 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ===== Screens ===== */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Hero / Landing ===== */
.hero {
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--empathize), var(--define), var(--ideate), var(--prototype), var(--test));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

/* ===== Stages Visual ===== */
.stages-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
  flex-wrap: wrap;
  row-gap: 12px;
}

.stage-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--stage-color) 10%, white);
  border: 1.5px solid color-mix(in srgb, var(--stage-color) 30%, white);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--stage-color);
  white-space: nowrap;
}

.stage-icon {
  font-size: 15px;
}

.stage-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

/* ===== Input Card ===== */
.input-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: left;
  box-shadow: var(--shadow-md);
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.idea-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.idea-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.idea-textarea::placeholder {
  color: var(--text-light);
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 16px;
}

.char-count {
  font-size: 13px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-white);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-light);
  border-color: var(--text-light);
}

.btn-arrow {
  font-size: 18px;
  transition: transform 0.2s;
}

.btn-primary:hover:not(:disabled) .btn-arrow {
  transform: translateX(3px);
}

.btn-icon {
  font-size: 16px;
}

/* ===== Loading Screen ===== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
}

.loading-visual {
  position: relative;
  margin-bottom: 24px;
}

.loading-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--border-light);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

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

.loading-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-stage {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-light);
  transition: color 0.3s, opacity 0.3s;
  display: none;
}

.loading-stage.active {
  display: block;
  color: var(--text);
  animation: fadeIn 0.3s ease;
}

.loading-timer {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
}

.loading-tip {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  margin-top: 20px;
  font-style: italic;
  min-height: 42px;
}

/* ===== Results Screen ===== */
.results-header {
  text-align: center;
  margin-bottom: 32px;
}

.results-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.results-idea {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ===== Accordion ===== */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.accordion-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.accordion-section:hover {
  box-shadow: var(--shadow-md);
}

.accordion-row {
  display: flex;
  align-items: center;
  padding: 12px 16px 12px 20px;
  gap: 12px;
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  padding: 0;
}

.stage-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: var(--stage-color);
  flex-shrink: 0;
}

.accordion-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.accordion-chevron {
  font-size: 12px;
  color: var(--text-light);
  transition: transform 0.3s ease;
}

.accordion-header[aria-expanded="false"] .accordion-chevron {
  transform: rotate(-90deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}

.accordion-body.open {
  max-height: 5000px;
  padding: 0 20px 20px;
}

/* ===== Tooltip Trigger ===== */
.tooltip-trigger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
}

.info-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  color: white;
  background: var(--primary);
  border: none;
  transition: all 0.2s;
}

.tooltip-trigger:hover .info-icon {
  background: var(--accent);
}

/* ===== Tooltip Overlay ===== */
.tooltip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeInOverlay 0.2s ease;
  padding: 20px;
}

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

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tooltip-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: tooltipIn 0.25s ease;
}

@keyframes tooltipIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tooltip-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.tooltip-close:hover {
  color: var(--text);
}

.tooltip-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-right: 24px;
}

.tooltip-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== Rendered Markdown Content ===== */
.accordion-body h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.accordion-body h2:first-child {
  margin-top: 0;
}

.accordion-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
}

.accordion-body p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.7;
}

.accordion-body ul,
.accordion-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.accordion-body li {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

.accordion-body li strong {
  color: var(--text);
}

.accordion-body strong {
  font-weight: 600;
  color: var(--text);
}

.accordion-body em {
  font-style: italic;
}

.accordion-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

.accordion-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* MVP highlight cards */
.accordion-body h3:has(+ ul),
.accordion-body h3:has(+ p) {
  padding: 12px 16px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

/* ===== Results Actions ===== */
.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ===== Disclaimer ===== */
.disclaimer {
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
  padding: 16px;
  border-top: 1px solid var(--border-light);
  line-height: 1.5;
}

.disclaimer strong {
  color: var(--text-secondary);
}

/* ===== Error Screen ===== */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
}

.error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #EF4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

.error-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.error-message {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 400px;
  line-height: 1.5;
}

/* ===== Footer ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  font-size: 13px;
  color: var(--text-light);
}

.footer-link {
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .hero-title {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .stages-visual {
    gap: 0;
  }

  .stage-pill {
    padding: 6px 10px;
    font-size: 11px;
  }

  .stage-connector {
    width: 12px;
  }

  .input-card {
    padding: 20px;
  }

  .input-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .char-count {
    text-align: right;
  }

  .main {
    padding: 20px 16px;
  }

  .accordion-header {
    padding: 14px 16px;
  }

  .accordion-body.open {
    padding: 0 16px 16px;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .stages-visual {
    flex-direction: column;
    align-items: stretch;
  }

  .stage-connector {
    width: 2px;
    height: 12px;
    align-self: center;
  }

  .stage-pill {
    justify-content: center;
  }
}
