:root {
  color-scheme: light;
  --color-primary: #235789;
  --color-primary-dark: #1b456c;
  --color-accent: #f2a541;
  --color-background: #f7f9fc;
  --color-surface: #ffffff;
  --color-border: #d5deef;
  --color-text: #1d2733;
  --color-muted: #5f7085;
  --shadow: 0 10px 30px rgba(25, 50, 80, 0.08);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --background: #f6f7fb;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #047857;
  --warning: #d97706;
  --danger: #b91c1c;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

.app {
  flex: 1;
  max-width: 880px;
  width: min(95%, 880px);
  margin: 2.5rem auto 2rem;
  background: var(--color-surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 2vw + 1rem, 3rem);
}

.app__header h1 {
  margin-top: 0;
  font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem);
}

.app__header p {
  margin-bottom: 1.5rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.progress {
  margin-bottom: 1.75rem;
}

.progress__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.progress__bar {
  width: 100%;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.progress__bar-fill {
  height: 100%;
  width: 4%;
  background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
  transition: width 0.3s ease;
}

.question h2 {
  margin-top: 0;
  font-size: clamp(1.4rem, 1.5vw + 1rem, 1.8rem);
}

.question__options {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.question__options--error {
  position: relative;
}

.question__options--error::after {
  content: attr(data-error);
  color: #b42318;
  font-size: 0.95rem;
  margin-top: 0.75rem;
  border-left: 4px solid #b42318;
  padding-left: 0.65rem;
  display: block;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.option:hover,
.option:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(35, 87, 137, 0.1);
}

.option input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
}

.option__text {
  font-size: 1.05rem;
}

.navigation,
.actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 150px;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  background: var(--color-border);
  color: var(--color-text);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(25, 50, 80, 0.15);
}

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

.btn--accent {
  background: var(--color-accent);
  color: #1f1408;
}

.results {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.results__intro {
  color: var(--color-muted);
  margin-bottom: 2rem;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.app {
  width: min(850px, 100%);
}

.metadata {
  background: var(--surface);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
  margin-bottom: 2rem;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metadata__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metadata__field--full {
  grid-column: 1 / -1;
}

.metadata label {
  font-weight: 600;
  color: var(--primary-dark);
}

.metadata input,
.metadata select {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.metadata input:focus,
.metadata select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.app__header {
  text-align: center;
  margin-bottom: 2rem;
}

.app__header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.4vw + 1rem, 2.6rem);
  color: var(--primary-dark);
}

.app__intro {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.75rem;
}

.question-card {
  background: var(--surface);
  border-radius: 1.25rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

.question-card__progress {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

#progressIndicator {
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #38bdf8 100%);
  transition: width 250ms ease;
}

.question-card__body h2 {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  margin-top: 0;
}

.response-options {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.response-option {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.response-option:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
}

.response-option input[type="radio"] {
  accent-color: var(--primary);
  width: 1.2rem;
  height: 1.2rem;
}

.question-card__actions {
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.75rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  background: var(--primary);
  color: white;
  min-width: 120px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.25);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.button--ghost {
  background: transparent;
  color: var(--primary);
  border: 2px solid rgba(37, 99, 235, 0.4);
}

.button--ghost:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.08);
  box-shadow: none;
}

.button--outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.results {
  background: var(--surface);
  border-radius: 1.5rem;
  padding: clamp(1.75rem, 3vw, 2.75rem);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  margin-top: 2rem;
}

.results__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.result-card {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.25rem;
  background: #fff;
  box-shadow: 0 5px 16px rgba(25, 50, 80, 0.08);
}

.result-card__title {
  margin: 0 0 0.3rem;
}

.result-card__score {
  margin: 0;
  font-weight: 700;
  color: var(--color-primary);
}

.result-card__band {
  font-weight: 600;
  margin-top: 0.75rem;
}

.result-card__description {
  color: var(--color-muted);
  line-height: 1.5;
}

.results__analysis {
  margin-top: 2.5rem;
  border-radius: 14px;
  padding: 1.5rem;
  background: rgba(35, 87, 137, 0.08);
  color: #13263b;
  line-height: 1.6;
}

.app__footer {
  text-align: center;
  padding: 1.5rem 1rem 3rem;
  color: var(--color-muted);
}

@media (max-width: 600px) {
  .app {
    margin: 1.5rem auto;
    padding: 1.5rem;
  }

  .btn {
    flex: 1 1 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app,
  .app__footer {
    box-shadow: none;
    margin: 0;
    width: 100%;
  }

  .navigation,
  .actions,
  .progress,
  .question {
    display: none !important;
  }

  .results {
    margin-top: 1rem;
    border: none;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.score-card {
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.25rem;
  background: rgba(249, 250, 251, 0.7);
}

.score-card__title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.score-card__value {
  font-size: 1.75rem;
  font-weight: 700;
}

.score-card__tag {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.score-card__tag--normal {
  background: rgba(4, 120, 87, 0.12);
  color: var(--success);
}

.score-card__tag--borderline {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.score-card__tag--abnormal {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.results__summary {
  font-size: 1.05rem;
  line-height: 1.6;
}

.results__details {
  display: grid;
  gap: 0.5rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.5rem;
}

.results__details dt {
  font-weight: 600;
  color: var(--muted);
}

.results__details dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.results__note {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 1.5rem;
}

.results__actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  body {
    padding: 1.5rem 0.75rem;
  }

  .metadata {
    padding: 1.25rem;
  }

  .question-card__actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}
