:root {
  color-scheme: dark;
  --bg: #171b1a;
  --panel: #202725;
  --panel-2: #252f2b;
  --border: rgba(205, 222, 214, 0.16);
  --text: #eff7f2;
  --muted: #aebdb5;
  --accent: #72c6a3;
  --accent-strong: #3f9676;
  --danger: #ec9b82;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.portal-screen {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.portal-shell {
  width: min(880px, 100%);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand img {
  width: min(240px, 56vw);
  height: auto;
  display: block;
}

.brand-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 28px);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 1.25rem + 1vw, 2.15rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.18rem, 1rem + 0.6vw, 1.45rem);
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field span,
.consent {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #111614;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

.input:focus,
.textarea:focus {
  border-color: rgba(114, 198, 163, 0.72);
  box-shadow: 0 0 0 3px rgba(114, 198, 163, 0.14);
}

.textarea {
  min-height: 94px;
  resize: vertical;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  line-height: 1.45;
}

.consent input {
  margin-top: 3px;
  accent-color: var(--accent-strong);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button {
  min-height: 44px;
  border: 1px solid rgba(114, 198, 163, 0.32);
  border-radius: 7px;
  background: var(--accent-strong);
  color: #06120e;
  padding: 10px 15px;
  font-weight: 850;
  cursor: pointer;
}

.button.secondary {
  background: var(--panel-2);
  color: var(--text);
}

.button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.message {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  padding: 12px 13px;
  margin: 12px 0;
}

.message.error {
  border-color: rgba(236, 155, 130, 0.48);
  color: #ffd7c9;
}

.progress-panel {
  margin-bottom: 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
  margin-bottom: 8px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: var(--accent);
}

.instruction {
  margin: 0;
  color: var(--muted);
  font-weight: 720;
}

.item-card {
  display: grid;
  gap: 16px;
}

.portal-question-panel {
  min-height: clamp(250px, 42vh, 430px);
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
}

.portal-question-meta {
  margin: 2px 0 clamp(12px, 3vh, 28px);
}

.portal-question-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: center;
}

.item-label {
  color: var(--accent);
  font-weight: 850;
  letter-spacing: 0;
}

.item-text {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.55rem);
  line-height: 1.38;
  font-weight: 760;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.stacked {
  grid-template-columns: 1fr;
}

.choice-button {
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121816;
  color: var(--text);
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
}

.choice-button strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
}

.choice-button span {
  display: block;
}

.choice-button.selected {
  border-color: var(--accent);
  background: rgba(63, 150, 118, 0.22);
}

.portal-response-panel {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.portal-response-panel .choice-button {
  min-height: 64px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 850;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
}

.complete-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(114, 198, 163, 0.16);
  color: var(--accent);
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 14px;
}

@media (max-width: 700px) {
  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .choice-grid.two {
    grid-template-columns: 1fr;
  }

  .portal-screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .portal-question-panel {
    min-height: clamp(220px, 38vh, 340px);
  }

  .button,
  .button-row .button,
  .nav-row .button {
    width: 100%;
  }

  .nav-row {
    flex-direction: column-reverse;
  }
}
