:root {
  color-scheme: light;
  --ink: #20332e;
  --muted: #66756f;
  --soft: #eef7f1;
  --line: #d7e5de;
  --paper: #f7fbf8;
  --panel: #ffffff;
  --accent: #4fa36d;
  --accent-dark: #2d7250;
  --gold: #b88a3b;
  --line-green: #06c755;
  --danger: #b84d3c;
  --shadow: 0 22px 58px rgba(45, 114, 80, 0.13);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(79, 163, 109, 0.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.survey-shell {
  width: min(940px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow,
.stage-kicker {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 3px;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-wrap {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #dfe9e3;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.22s ease;
}

.survey-card {
  padding: clamp(22px, 5vw, 52px);
  border: 1px solid rgba(45, 114, 80, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.step {
  animation: rise 0.22s ease;
}

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

.stage-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
}

.guide {
  margin-bottom: 18px;
  color: var(--accent-dark);
  font-weight: 900;
}

.step h2 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 6vw, 4.1rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.lead,
.hint,
.result-copy,
.plan-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
}

.intro-list,
.observe-list {
  display: grid;
  gap: 10px;
  margin: 22px 0 30px;
  padding: 0;
  color: var(--accent-dark);
  font-weight: 900;
  list-style: none;
}

.observe-list.compact {
  margin: 12px 0 0;
}

.intro-list li::before,
.observe-list li::before {
  margin-right: 8px;
  content: "✓";
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.option-grid button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfb;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.5;
  padding: 14px 16px;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.option-grid button:hover {
  border-color: rgba(79, 163, 109, 0.86);
  background: #f1faf4;
  transform: translateY(-1px);
}

.option-grid button.selected {
  border-color: var(--accent-dark);
  background: #eaf7ef;
  box-shadow: inset 0 0 0 2px rgba(45, 114, 80, 0.18);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: #34423e;
  font-weight: 900;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

input:focus {
  outline: 3px solid rgba(79, 163, 109, 0.2);
  border-color: var(--accent);
}

.field-group {
  margin-top: 26px;
}

.field-group-title {
  margin: 0 0 -4px;
  color: var(--accent-dark);
  font-weight: 900;
}

.error-message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--danger);
  font-weight: 900;
}

.survey-nav,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.survey-nav {
  justify-content: space-between;
}

.primary,
.secondary,
.ghost,
.line-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 8px;
  font-weight: 900;
  padding: 0 18px;
  text-decoration: none;
}

.primary {
  border: 0;
  background: var(--accent-dark);
  color: #fff;
}

.secondary {
  border: 0;
  background: var(--gold);
  color: #fff;
}

.line-cta {
  border: 0;
  background: var(--line-green);
  color: #fff;
}

.line-cta.prominent {
  min-height: 58px;
  box-shadow: 0 12px 28px rgba(6, 199, 85, 0.24);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.result-layout {
  display: grid;
  gap: 18px;
}

.type-card,
.domain-card,
.flag-card,
.passcode-card,
.plan-card {
  border: 1px solid rgba(45, 114, 80, 0.16);
  border-radius: 9px;
  background: #fbfdfb;
  padding: 18px;
}

.type-card h3,
.domain-card h3,
.flag-card h3,
.passcode-card h3,
.plan-card h3 {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.passcode-card {
  border-color: rgba(6, 199, 85, 0.26);
  background: #f1fff6;
}

.passcode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 2px 0 12px;
}

.passcode {
  display: inline-flex;
  user-select: all;
  padding: 12px 16px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: clamp(1.65rem, 7vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(6, 199, 85, 0.28);
}

.copy-passcode {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 900;
  padding: 0 18px;
}

.copy-status {
  min-height: 22px;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 900;
}

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

.score-row {
  display: grid;
  gap: 8px;
}

.score-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.score-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #dfe9e3;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.flag-card {
  background: #fffdf7;
  border-color: rgba(184, 138, 59, 0.32);
}

.flag-card.compact h3 {
  margin-bottom: 0;
}

.submit-status {
  min-height: 24px;
  color: var(--accent-dark);
  font-weight: 900;
}

.submit-status.error {
  color: var(--danger);
}

.disclaimer {
  max-width: 860px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

button:disabled {
  cursor: wait;
  opacity: 0.66;
}

@media (max-width: 760px) {
  .survey-shell {
    width: min(100% - 20px, 940px);
    padding: 16px 0 12px;
  }

  .topbar {
    display: grid;
  }

  .progress-wrap {
    min-width: 0;
    text-align: left;
  }

  .survey-card {
    padding: 20px;
    border-radius: 10px;
  }

  .step h2 {
    font-size: clamp(1.9rem, 10vw, 3rem);
  }

  .option-grid,
  .profile-grid,
  .domain-grid,
  .flag-grid {
    grid-template-columns: 1fr;
  }

  .survey-nav,
  .result-actions {
    display: grid;
  }

  .primary,
  .secondary,
  .ghost,
  .line-cta,
  .copy-passcode {
    width: 100%;
  }

  .passcode {
    width: 100%;
    justify-content: center;
  }
}
