:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #182735;
  background: #f5f7fa;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 48px 24px;
}

.page {
  width: min(100%, 680px);
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
}

.welcome-page {
  width: min(100%, 920px);
  padding-top: clamp(0px, 6vh, 64px);
}

.welcome-header {
  margin-bottom: 36px;
}

.welcome-header h1 {
  max-width: 650px;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.welcome-header > p:last-child {
  color: #536371;
  font-size: 18px;
  line-height: 1.6;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid #cfdedb;
  border-top: 4px solid #176b63;
  border-radius: 16px;
  background: #fff;
  color: #182735;
  text-decoration: none;
  box-shadow: 0 8px 28px #18273508;
}

.role-card:hover {
  border-color: #176b63;
  box-shadow: 0 12px 32px #18273512;
}

.role-card:focus-visible,
.demo-tools a:focus-visible {
  outline: 3px solid #25837b;
  outline-offset: 5px;
}

.role-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: #e8f4f0;
  color: #176b63;
}

.role-icon svg {
  width: 30px;
  height: 30px;
}

.role-card h2 {
  margin-bottom: 4px;
  font-size: 28px;
}

.role-card > p {
  margin-bottom: 28px;
  color: #536371;
  line-height: 1.6;
}

.role-action {
  margin-top: auto;
  color: #176b63;
  font-weight: 650;
}

.role-card-doctor {
  border-top-color: #172b4d;
}

.role-card-doctor .role-icon {
  background: #edf1f8;
  color: #172b4d;
}

.role-card-doctor .role-action {
  color: #172b4d;
}

.welcome-footer {
  margin-top: 28px;
  color: #697887;
  font-size: 13px;
}

.demo-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  color: #536371;
  font-size: 12px;
}

.demo-tools a {
  padding: 8px 0;
  color: inherit;
}

@media (max-width: 620px) {
  .role-grid {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  margin: 0 0 8px;
  color: #176b63;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 650;
}

.progress {
  margin: 12px 0 0;
  color: #536371;
}

.form-card {
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid #d9e0e6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 28px #1827350a;
}

h2 {
  margin: 0 0 16px;
  font-size: 23px;
  line-height: 1.35;
}

.instruction,
.answer-summary,
.form-card > p {
  color: #465663;
  line-height: 1.6;
}

.answer-summary {
  margin: 0 0 24px;
  white-space: pre-wrap;
}

.review-answer {
  padding: 24px 0;
  border-bottom: 1px solid #d9e0e6;
}

.question-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin-top: 24px;
}

label,
legend {
  font-weight: 600;
}

textarea,
select {
  width: 100%;
  border: 1px solid #aebbc6;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
}

textarea {
  min-height: 144px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.5;
}

select {
  min-height: 48px;
  padding: 10px 12px;
}

textarea:focus-visible,
select:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 3px solid #25837b;
  outline-offset: 3px;
}

fieldset {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 4px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e0e6;
  border-radius: 8px;
  font-weight: 400;
  line-height: 1.45;
}

.option input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #176b63;
}

button {
  align-self: flex-start;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 8px;
  background: #176b63;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: #10564f;
}

.error {
  margin: 0 0 24px;
  padding: 16px 18px;
  border: 1px solid #b42318;
  border-left-width: 5px;
  border-radius: 6px;
  background: #fff1f0;
  color: #7a271a;
}

.loading:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 8px;
  background: #e4f2ef;
  color: #10564f;
  line-height: 1.5;
}

.spinner {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 3px solid #176b6333;
  border-top-color: #176b63;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.error p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.notice {
  padding: 16px 18px;
  border-left: 4px solid #b7791f;
  background: #fff8e8;
  color: #594214;
  line-height: 1.55;
  white-space: pre-wrap;
}

.author-form {
  margin: 12px 0 20px;
}

.author-form button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #536371;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: left;
}

.author-form button span { text-decoration: underline; text-underline-offset: 3px; }
.author-form button:hover { background: transparent; color: #0b6761; }

@media (max-width: 480px) {
  body {
    padding: 28px 16px;
  }

  button {
    width: 100%;
  }
}
