:root {
  --navy: #0b2f4f;
  --blue: #1769e0;
  --blue-soft: #edf5ff;
  --green: #157a55;
  --green-soft: #e9f8f1;
  --amber: #a96400;
  --amber-soft: #fff7e7;
  --ink-muted: #5d7188;
  --line: #cddbea;
  --paper: #ffffff;
  --page: #f4f8fc;
}

.research-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.education-entry {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  color: var(--navy);
  border: 1.5px solid #7fb0e8;
  border-radius: 1rem;
  background: linear-gradient(110deg, #f3f8ff, #eaf4ff);
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.education-entry:hover,
.education-entry:focus-visible {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 12px 30px rgba(11, 47, 79, 0.12);
}

.education-entry > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--blue);
  font-size: 1.35rem;
  font-weight: 900;
}

.education-entry small,
.education-entry strong,
.education-entry p {
  display: block;
}

.education-entry small {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
}

.education-entry strong {
  margin-top: 0.12rem;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.45;
}

.education-entry p {
  margin: 0.2rem 0 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.education-entry > b {
  color: var(--blue);
  white-space: nowrap;
  font-size: 0.84rem;
}

.education-entry i {
  font-style: normal;
}

.resources-screen {
  grid-template-rows: none !important;
  grid-auto-rows: max-content;
  padding-bottom: 2rem !important;
}

.resources-screen .resource-card,
.resources-screen .law-card,
.resources-screen .research-link,
.resources-screen .education-entry {
  min-width: 0;
}

.resources-screen .resource-card strong,
.resources-screen .resource-card p,
.resources-screen .law-card p,
.resources-screen .research-link strong,
.resources-screen .research-link p {
  overflow-wrap: anywhere;
}

.resources-screen .law-card {
  min-height: max-content;
  align-items: start;
}

.resources-screen .law-card p {
  font-size: clamp(0.82rem, 1.1vw, 0.98rem);
  line-height: 1.6;
}

.resources-screen .law-card > span {
  font-size: clamp(0.92rem, 1.2vw, 1.05rem);
}

.research-link {
  display: flex;
  min-height: 9rem;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  color: var(--navy);
  text-decoration: none;
  border: 1.5px solid #91b9ec;
  border-radius: 1.25rem;
  background: var(--blue-soft);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.research-link.mars {
  border-color: #9bcbb8;
  background: var(--green-soft);
}

.research-link:hover,
.research-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 12px 30px rgba(11, 47, 79, 0.12);
}

.research-link.mars:hover,
.research-link.mars:focus-visible {
  border-color: var(--green);
}

.research-link > span {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 3rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 1.35rem;
}

.research-link.mars > span {
  background: var(--green);
}

.research-link small,
.research-link strong,
.research-link p,
.research-link b {
  display: block;
}

.research-link small {
  color: var(--ink-muted);
  font-weight: 700;
}

.research-link strong {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.2rem;
}

.research-link p {
  margin: 0;
  color: var(--ink-muted);
  line-height: 1.55;
}

.research-link b {
  margin-top: 0.65rem;
  color: var(--blue);
}

.research-link.mars b {
  color: var(--green);
}

.survey-page {
  min-height: 100vh;
  margin: 0;
  color: var(--navy);
  background: var(--page);
  font-family:
    Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

.survey-shell {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.survey-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.survey-topbar a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.survey-topbar img {
  width: min(235px, 52vw);
  height: auto;
}

.survey-card {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--paper);
  box-shadow: 0 18px 45px rgba(11, 47, 79, 0.08);
}

.survey-card h1 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.04em;
}

.survey-card h2 {
  margin: 0.3rem 0 0.6rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.survey-card p {
  line-height: 1.7;
}

.survey-kicker {
  margin: 0;
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.privacy-note,
.info-note {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--blue);
  border-radius: 0.75rem;
  color: #3d566f;
  background: var(--blue-soft);
  line-height: 1.65;
}

.info-note.green {
  border-color: var(--green);
  background: var(--green-soft);
}

.field {
  display: grid;
  gap: 0.45rem;
  margin: 1.15rem 0;
}

.field > span {
  font-weight: 800;
}

.field input[type="email"],
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.9rem 1rem;
  color: var(--navy);
  border: 1.5px solid #9db6cf;
  border-radius: 0.8rem;
  background: #fff;
  font: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: 3px solid rgba(23, 105, 224, 0.18);
  border-color: var(--blue);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 1rem 0;
  color: #304c67;
  line-height: 1.55;
}

.check-row input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.action-button {
  min-height: 3rem;
  padding: 0.75rem 1.2rem;
  border: 1.5px solid var(--blue);
  border-radius: 0.8rem;
  color: #fff;
  background: var(--blue);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.action-button.secondary {
  color: var(--blue);
  background: #fff;
}

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

.form-status {
  min-height: 1.5rem;
  margin-top: 1rem;
  font-weight: 750;
}

.form-status.error {
  color: #a12621;
}

.form-status.success {
  color: var(--green);
}

.progress-wrap {
  margin-bottom: 1.5rem;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--ink-muted);
  font-weight: 750;
}

.progress-track {
  height: 0.65rem;
  overflow: hidden;
  border-radius: 99px;
  background: #dbe7f3;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.question-block {
  margin: 1.3rem 0;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fbfdff;
}

.question-block legend {
  width: 100%;
  padding: 0;
  font-weight: 850;
  line-height: 1.55;
}

.question-help {
  margin: 0.45rem 0 0.8rem;
  color: var(--ink-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

.rating-options.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rating-option {
  display: grid;
  min-height: 4.8rem;
  place-items: center;
  padding: 0.6rem 0.35rem;
  text-align: center;
  border: 1.5px solid #aabfd4;
  border-radius: 0.75rem;
  cursor: pointer;
}

.rating-option:has(input:checked) {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.rating-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/*
 * Mobile long-page scrolling
 *
 * The original screening shell intentionally locks desktop flows to one
 * viewport. On phones, however, content such as the completed safety plan can
 * be taller than the viewport. Let the document own vertical scrolling there
 * instead of trapping the page inside nested overflow-hidden containers.
 */
@media (max-width: 820px) {
  html {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
  }

  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .screen-region {
    min-height: 0;
    overflow: visible;
  }

  .page-frame {
    height: auto;
    min-height: 100%;
  }

  .flow-card,
  .question-layout,
  .frames-panel,
  .resources-screen {
    height: auto;
    overflow: visible;
  }

  .resources-screen {
    scrollbar-gutter: auto;
  }

  .bottom-bar {
    min-height: 36px;
  }
}

.rating-option b,
.rating-option small {
  display: block;
}

.rating-option b {
  font-size: 1.15rem;
}

.rating-option small {
  margin-top: 0.25rem;
  line-height: 1.3;
}

.survey-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.survey-summary article {
  padding: 1rem;
  border-radius: 0.85rem;
  background: var(--blue-soft);
}

.survey-summary small,
.survey-summary strong {
  display: block;
}

.survey-summary strong {
  margin-top: 0.25rem;
  font-size: 1.35rem;
}

.footer-note {
  margin-top: 1.2rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .research-actions,
  .survey-summary {
    grid-template-columns: 1fr;
  }

  .research-link {
    min-height: auto;
  }

  .education-entry {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .education-entry > b {
    grid-column: 2;
    white-space: normal;
  }

  .resources-screen .law-card {
    grid-template-columns: 1fr;
  }

  .resources-screen .law-card a {
    width: max-content;
    max-width: 100%;
    white-space: normal;
  }

  .rating-options {
    grid-template-columns: 1fr;
  }

  .rating-options.three {
    grid-template-columns: 1fr;
  }

  .rating-option {
    min-height: 3.5rem;
    grid-template-columns: 2rem 1fr;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .education-entry {
    padding: 0.85rem;
  }

  .education-entry p {
    display: none;
  }

  .resources-screen .resource-grid {
    grid-template-columns: 1fr;
  }

  .resources-screen .resource-card {
    min-height: auto;
  }
}
.load-error-notice {
  position: relative;
  z-index: 20;
  max-width: 760px;
  margin: 1rem auto;
  padding: 1.25rem;
  border: 2px solid #b45309;
  border-radius: 1rem;
  background: #fff7ed;
  color: #431407;
  box-shadow: 0 12px 32px rgb(15 23 42 / 12%);
}

.load-error-notice h1 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.load-error-notice p {
  margin: 0 0 1rem;
  line-height: 1.7;
}

.load-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.load-error-actions button,
.load-error-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid #9a3412;
  border-radius: 0.75rem;
  background: #fff;
  color: #7c2d12;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.load-error-actions button {
  background: #9a3412;
  color: #fff;
}
