:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --page: #f5f7fa;
  --card: #ffffff;
  --ink: #111318;
  --muted: #5f6875;
  --blue: #0056fd;
  --blue-soft: #e8f0fe;
  --line: #e6ebf2;
  --shadow: 0 12px 32px rgb(27 48 78 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100% - 36px, 520px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  margin-bottom: 36px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-name span {
  color: var(--blue);
}

.state-card,
.progress-card,
.course-screen {
  border: 1px solid rgb(223 231 243 / 80%);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.state-card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.state-card[hidden],
.dashboard[hidden],
.consent-card[hidden] {
  display: none;
}

.state-card p {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.consent-card {
  align-items: stretch;
  gap: 14px;
  text-align: left;
}

.consent-card .eyebrow,
.consent-card h1,
.consent-card p {
  margin: 0;
}

.consent-card h1 {
  font-size: clamp(27px, 7vw, 34px);
  letter-spacing: -0.05em;
}

.consent-copy {
  color: #3f4855;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
}

.consent-card .button {
  margin-top: 4px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d9e5fa;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dashboard {
  animation: appear 180ms ease-out both;
}

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

.eyebrow,
.card-label {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.eyebrow {
  margin: 0 0 9px;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

.dashboard h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 40px);
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.intro {
  margin: 13px 0 27px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.progress-card {
  padding: 23px;
}

.course-screen {
  margin-top: 18px;
  padding: 23px;
}

.course-screen[hidden] {
  display: none;
}

.course-screen .card-label {
  margin: 0 0 10px;
}

.course-screen h2 {
  margin: 0;
  font-size: clamp(23px, 6vw, 29px);
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.screen-content {
  margin: 16px 0 0;
  color: #3f4855;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-line;
}

.read-only-badge {
  display: inline-flex;
  margin-top: 20px;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1758c7;
  font-size: 12px;
  font-weight: 700;
}

.screen-controls {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.screen-controls[hidden],
.screen-controls [hidden] {
  display: none;
}

.button-primary {
  background: var(--blue);
  color: #ffffff;
}

.action-form,
.action-review {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.action-form label {
  color: #3f4855;
  font-size: 14px;
  font-weight: 650;
}

.action-form input,
.action-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #d6deeb;
  border-radius: 13px;
  background: #fbfcfe;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.action-form textarea {
  resize: vertical;
}

.action-form input:focus,
.action-form textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgb(0 86 253 / 14%);
}

.action-review p {
  margin: 0 0 4px;
  color: #3f4855;
  line-height: 1.6;
  white-space: pre-line;
}

.action-status {
  margin: 0;
  color: #a23e32;
  font-size: 13px;
  line-height: 1.45;
}

.card-topline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #49617d;
  font-size: 13px;
  font-weight: 650;
}

.status-check {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.card-label {
  margin: 30px 0 8px;
  color: #8290a2;
  font-size: 10px;
}

.progress-card h2 {
  margin: 0;
  font-size: clamp(25px, 7vw, 32px);
  letter-spacing: -0.045em;
}

.day-label {
  display: inline-flex;
  margin: 16px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1758c7;
  font-size: 13px;
  font-weight: 700;
}

.pilot-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dce9ff;
  border-radius: 18px;
  background: #f0f6ff;
  color: #3d5b86;
}

.pilot-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.note-icon,
.error-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
}

.note-icon {
  width: 21px;
  height: 21px;
  background: #dce8ff;
  color: var(--blue);
  font-size: 13px;
}

.footer-note {
  margin-top: auto;
  padding-top: 32px;
  color: #8a97a8;
  font-size: 12px;
  text-align: center;
}

.error-card {
  align-items: stretch;
  text-align: left;
}

.error-mark {
  width: 35px;
  height: 35px;
  margin-bottom: 18px;
  background: #fff2e4;
  color: #b85c00;
}

.error-card h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.04em;
}

.error-card p {
  margin: 10px 0 22px;
}

.button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
}

.button-secondary {
  background: var(--blue-soft);
  color: #1758c7;
}

.button:focus-visible {
  outline: 3px solid #8cb7ff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
