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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #2d3748;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.screen {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: block;
  opacity: 1;
}

/* ===== WELCOME SCREEN ===== */
#welcome-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: #1a365d;
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

#welcome-screen.active {
  display: flex;
}

.welcome-content {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.welcome-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 32px;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 24px;
  line-height: 1.5;
}

.welcome-body {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.85;
  line-height: 1.7;
  margin-bottom: 40px;
}

.btn-start {
  display: inline-block;
  background: #319795;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  padding: 16px 48px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.btn-start:hover {
  background: #2c8c8a;
}

.btn-start:active {
  transform: scale(0.97);
}

/* ===== QUESTIONS SCREEN ===== */
#questions-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: #ffffff;
  padding: 0;
}

.questions-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 24px;
}

.progress-wrapper {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
  padding: 16px 24px 0;
  max-width: 600px;
  margin: 0 auto;
}

.progress-track {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #319795;
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.85rem;
  color: #718096;
  margin-top: 8px;
  font-weight: 500;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #718096;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 4px;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  transition: color 0.2s ease;
}

.back-button:hover {
  color: #4a5568;
}

.back-button svg {
  width: 16px;
  height: 16px;
}

.question-viewport {
  position: relative;
  overflow: hidden;
  min-height: 400px;
  padding-top: 16px;
  padding-bottom: 40px;
}

.question-slide {
  width: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.question-slide.slide-out-left {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  transform: translateX(-30px);
  opacity: 0;
  pointer-events: none;
}

.question-slide.slide-out-right {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  transform: translateX(30px);
  opacity: 0;
  pointer-events: none;
}

.question-slide.slide-in {
  transform: translateX(0);
  opacity: 1;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  line-height: 1.5;
  margin-bottom: 24px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  width: 100%;
  min-height: 56px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: #2d3748;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

.option-card:hover {
  background: #e6fffa;
  border-color: #319795;
}

.option-card.selected {
  background: #319795;
  border-color: #319795;
  color: #ffffff;
}

/* ===== RESULTS SCREEN ===== */
#results-screen {
  background: #ffffff;
  padding-bottom: 60px;
}

.results-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 24px;
}

.results-logo {
  width: 36px;
  height: 36px;
  margin: 0 auto 24px;
  display: block;
}

.results-heading {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 16px;
}

.results-category {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}

.results-score-text {
  text-align: center;
  font-size: 1rem;
  color: #718096;
  margin-bottom: 24px;
}

.score-bar-container {
  width: 100%;
  margin-bottom: 32px;
}

.score-bar-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  position: relative;
  overflow: visible;
}

.score-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease;
  position: relative;
}

.score-bar-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.score-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #a0aec0;
}

.results-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #4a5568;
  margin-bottom: 48px;
}

/* ===== BREAKDOWN ===== */
.breakdown-section {
  margin-bottom: 48px;
}

.breakdown-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 4px;
}

.breakdown-subtext {
  font-size: 0.95rem;
  color: #718096;
  margin-bottom: 24px;
  line-height: 1.5;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.breakdown-label {
  width: 110px;
  min-width: 110px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4a5568;
  text-align: right;
}

.breakdown-bar-track {
  flex: 1;
  height: 14px;
  background: #f7fafc;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.8s ease;
}

/* ===== CTA SECTION ===== */
.cta-section {
  margin-bottom: 48px;
}

.cta-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 4px;
}

.cta-subtext {
  font-size: 0.95rem;
  color: #718096;
  margin-bottom: 24px;
  line-height: 1.5;
}

.cta-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-decoration: none;
  display: block;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.cta-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #cbd5e0;
}

.cta-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.cta-card-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
}

.cta-card-subtext {
  font-size: 0.9rem;
  color: #718096;
  line-height: 1.5;
}

/* ===== INLINE FORM ===== */
.form-area {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin-top 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.form-area.expanded {
  max-height: 300px;
  opacity: 1;
  margin-top: 16px;
}

.form-area input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #2d3748;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 48px;
}

.form-area input:focus {
  border-color: #319795;
}

.form-area input::placeholder {
  color: #a0aec0;
}

.btn-submit {
  width: 100%;
  padding: 14px 24px;
  background: #319795;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

.btn-submit:hover:not(:disabled) {
  background: #2c8c8a;
}

.btn-submit:disabled {
  background: #cbd5e0;
  color: #a0aec0;
  cursor: not-allowed;
}

.form-success {
  padding: 16px 0 4px;
  font-size: 1rem;
  font-weight: 500;
  color: #319795;
  line-height: 1.5;
}

.form-error {
  padding: 16px 0 4px;
  font-size: 0.9rem;
  color: #e53e3e;
  line-height: 1.5;
}

.form-error a {
  color: #e53e3e;
  text-decoration: underline;
}

/* ===== RETAKE ===== */
.retake-link {
  display: block;
  text-align: center;
  color: #319795;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  padding: 16px;
  margin-bottom: 48px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  min-height: 48px;
}

.retake-link:hover {
  color: #2c8c8a;
}

/* ===== POWERED BY FOOTER ===== */
.powered-by-footer {
  text-align: center;
  padding: 24px 20px 16px;
  opacity: 0.6;
}
.powered-by-footer a {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #718096;
}
.powered-by-footer img {
  width: 24px;
  height: 24px;
}
.powered-by-text {
  font-size: 0.75rem;
  color: #718096;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
  .welcome-title {
    font-size: 1.6rem;
  }
  .welcome-subtitle {
    font-size: 1rem;
  }
  .breakdown-label {
    width: 85px;
    min-width: 85px;
    font-size: 0.8rem;
  }
}