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

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

body {
  overflow-x: hidden;
}

.screen {
  display: none;
}

.screen.active {
  display: flex;
}

/* WELCOME SCREEN */
#welcome {
  min-height: 100vh;
  min-height: 100dvh;
  background: #1a365d;
  color: #ffffff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

#welcome .welcome-inner {
  max-width: 600px;
  width: 100%;
}

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

#welcome h1 {
  font-size: 1.75rem;
  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-text {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.8;
  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: #38b2ac;
}

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

/* QUESTIONS SCREEN */
#questions {
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #ffffff;
}

.progress-wrap {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
  padding: 0;
}

.progress-track {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
}

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

.progress-meta {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-text {
  font-size: 0.875rem;
  color: #718096;
  font-weight: 500;
}

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

.btn-back:hover {
  color: #2d3748;
}

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

.btn-back.hidden {
  visibility: hidden;
  pointer-events: none;
}

.question-viewport {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 40px;
  position: relative;
  overflow: hidden;
}

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

.question-card.slide-out-left {
  opacity: 0;
  transform: translateX(-40px);
  position: absolute;
  pointer-events: none;
}

.question-card.slide-out-right {
  opacity: 0;
  transform: translateX(40px);
  position: absolute;
  pointer-events: none;
}

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

.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-btn {
  display: block;
  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-btn:hover {
  background: #e6fffa;
  border-color: #319795;
}

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

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

/* RESULTS SCREEN */
#results {
  flex-direction: column;
  background: #ffffff;
}

.results-inner {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.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;
  margin-bottom: 8px;
}

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

.score-bar-wrap {
  margin-bottom: 32px;
}

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

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

.score-bar-marker {
  position: absolute;
  right: -7px;
  top: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.results-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #2d3748;
  margin-bottom: 48px;
  text-align: center;
}

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

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

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

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

.breakdown-label {
  min-width: 120px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2d3748;
  flex-shrink: 0;
  text-align: right;
}

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

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

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

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

.cta-subtext {
  font-size: 0.9rem;
  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;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  display: block;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

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

/* FORM INSIDE CARD 1 */
.form-area {
  margin-top: 16px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.form-area.open {
  max-height: 300px;
  opacity: 1;
}

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

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

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

.btn-submit:hover:not(:disabled) {
  background: #38b2ac;
}

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

.form-success {
  text-align: center;
  color: #319795;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 0;
  line-height: 1.5;
}

.form-error {
  text-align: center;
  color: #e53e3e;
  font-size: 0.9rem;
  padding: 8px 0;
  line-height: 1.5;
}

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

/* RETAKE LINK */
.retake-link {
  display: block;
  text-align: center;
  color: #319795;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  padding: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
  margin-bottom: 48px;
  background: none;
  border: none;
  width: 100%;
  font-family: 'Inter', sans-serif;
}

.retake-link:hover {
  opacity: 0.7;
}

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

/* SCREEN TRANSITIONS */
.screen-fade-in {
  animation: fadeIn 0.4s ease;
}

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

/* RESPONSIVE */
@media (min-width: 768px) {
  #welcome h1 {
    font-size: 2.25rem;
  }
  #welcome .subtitle {
    font-size: 1.2rem;
  }
  .question-text {
    font-size: 1.35rem;
  }
  .results-category {
    font-size: 2rem;
  }
  .breakdown-label {
    min-width: 140px;
  }
}