:root {
  color-scheme: light;
  --page: #f7f4ff;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --ink: #202437;
  --muted: #5f6477;
  --line: #e7e2f0;
  --primary: #6652c7;
  --primary-dark: #493796;
  --primary-pale: #eee9ff;
  --coral: #ee806e;
  --coral-pale: #fff0eb;
  --mint: #bfe8dc;
  --mint-dark: #246d61;
  --yellow: #ffd678;
  --yellow-pale: #fff6d9;
  --blue-pale: #eaf4ff;
  --shadow: 0 24px 70px rgba(65, 48, 124, 0.16);
  --shadow-soft: 0 12px 30px rgba(40, 37, 64, 0.08);
  --radius-large: 30px;
  --radius-medium: 20px;
  --radius-small: 13px;
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 4% 4%, rgba(255, 214, 120, 0.52), transparent 26rem),
    radial-gradient(circle at 95% 10%, rgba(191, 232, 220, 0.68), transparent 29rem),
    linear-gradient(145deg, #f3efff, #fffdf7 52%, #effaf7);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  padding: clamp(0.6rem, 2vw, 1.5rem);
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: 0.9rem clamp(1rem, 3vw, 1.8rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  color: var(--primary-dark);
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration: none;
}

.study-mark {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.study-mark__symbol {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(102, 82, 199, 0.3);
  color: white;
  font-size: 1.3rem;
  font-weight: 900;
}

.study-mark small,
.study-mark strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-mark small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.study-mark strong {
  font-size: 0.96rem;
  line-height: 1.45;
}

.language-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 0.35rem;
}

.language-button {
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
}

.language-button.is-active {
  border-color: #b8adf1;
  background: var(--primary-pale);
  color: var(--primary-dark);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem clamp(1.2rem, 5vw, 4.5rem) 0;
}

.progress-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e3dc;
}

.progress-fill {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--coral));
  transition: width 0.28s ease;
}

.progress-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.stage {
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1.2rem, 6vw, 5rem) clamp(1.4rem, 4vw, 3rem);
}

.screen {
  display: none;
  min-height: 570px;
}

.screen.is-active {
  display: block;
  animation: screen-enter 0.34s ease both;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

h1 {
  max-width: 720px;
  margin-bottom: 1.15rem;
  font-size: clamp(2rem, 4.6vw, 3.65rem);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

h1 span,
h2 span {
  color: var(--primary-dark);
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.7rem, 3.5vw, 2.65rem);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1.08rem;
  line-height: 1.4;
}

p {
  color: var(--muted);
}

.kicker {
  display: inline-flex;
  margin-bottom: 0.9rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: var(--yellow-pale);
  color: #745719;
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(300px, 0.84fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.hero-lead {
  margin-bottom: 0.85rem;
  color: #393e52;
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  line-height: 1.55;
}

.hero-summary,
.section-lead,
.thanks-lead {
  max-width: 760px;
  font-size: 1.03rem;
}

.fact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.25rem 0 1.7rem;
}

.fact-row span {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: white;
  color: #4d5266;
  font-size: 0.82rem;
  font-weight: 800;
}

.math-visual {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 4vw, 2.3rem);
  border: 1px solid #e2dcff;
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 214, 120, 0.85), transparent 42%),
    radial-gradient(circle at 0% 100%, rgba(191, 232, 220, 0.85), transparent 38%),
    linear-gradient(145deg, #f0ecff, #fff8f4);
  box-shadow: var(--shadow-soft);
}

.visual-label {
  margin-bottom: 1.2rem;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: center;
}

.research-video-frame {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  background: #17171c;
  box-shadow: 0 16px 32px rgba(68, 49, 134, 0.14);
}

.research-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #17171c;
  object-fit: contain;
}

.research-video-caption {
  margin: 1rem 0 0;
  color: #4d5266;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 1rem;
  margin: 1.8rem 0;
}

.answer-card {
  position: relative;
  display: grid;
  min-height: 250px;
  grid-template-rows: auto minmax(4.6rem, auto) 1fr;
  align-content: start;
  justify-items: start;
  padding: 1.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: white;
  box-shadow: var(--shadow-soft);
}

.answer-card:nth-child(2) {
  background: #fbf9ff;
}

.answer-card:nth-child(3) {
  background: #f5fbf9;
}

.answer-number {
  display: inline-block;
  margin-bottom: 1.3rem;
  color: var(--coral);
  font-size: 0.9rem;
  font-weight: 900;
}

.answer-card p {
  margin-bottom: 0;
  font-size: 0.93rem;
  line-height: 1.65;
}

.why-join {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.3rem 1.45rem;
  border: 1px solid #eadcac;
  border-radius: var(--radius-medium);
  background: var(--yellow-pale);
}

.why-join__label {
  color: #735619;
  font-weight: 900;
}

.why-join p {
  max-width: 700px;
  margin: 0.35rem 0 0;
  color: #615331;
  font-size: 0.93rem;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 1rem;
  margin: 1.7rem 0;
}

.route-card {
  position: relative;
  display: grid;
  min-height: 205px;
  grid-template-rows: auto minmax(3.7rem, auto) minmax(2.7rem, auto) 1fr;
  align-content: start;
  justify-items: start;
  padding: 1.45rem;
  border: 2px solid transparent;
  border-radius: var(--radius-medium);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.route-card:hover,
.route-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.route-card--existing {
  background: var(--blue-pale);
}

.route-card--code {
  background: var(--primary-pale);
}

.route-card--nocode {
  background: var(--coral-pale);
}

.route-tag {
  align-self: flex-start;
  justify-self: start;
  width: fit-content;
  margin-bottom: 1.3rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #55596b;
  font-size: 0.72rem;
  font-weight: 850;
}

.route-card strong {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.4;
}

.route-card small {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.route-arrow {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  align-self: end;
  justify-self: start;
  margin-top: 0.8rem;
  border-radius: 50%;
  background: white;
  color: var(--primary-dark);
  font-weight: 900;
}

.details-panel {
  margin: 1rem 0 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: white;
}

.details-panel summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.details-panel summary::-webkit-details-marker {
  display: none;
}

.details-panel[open] summary span:last-child {
  transform: rotate(45deg);
}

.details-content {
  padding: 0 1.2rem 1.1rem;
  color: var(--muted);
}

.details-content ul {
  margin: 0;
  padding-left: 1.3rem;
}

.details-content li + li {
  margin-top: 0.45rem;
}

.support-row,
.share-actions,
.return-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 850;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.button[hidden] {
  display: none;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
  transform: translateY(-2px);
}

.button--primary {
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(102, 82, 199, 0.24);
  color: white;
}

.button--primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.button--secondary {
  border-color: #cfc5f4;
  background: white;
  color: var(--primary-dark);
}

.button--quiet {
  border-color: var(--line);
  background: transparent;
  color: #5f6477;
}

.button--share {
  background: var(--mint-dark);
  color: white;
}

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

.button:focus-visible,
.language-button:focus-visible,
.dot:focus-visible,
.home-link:focus-visible,
.route-card:focus-visible,
.details-panel summary:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.thanks-layout {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.thanks-badge {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.thanks-badge span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  background: var(--primary-pale);
  color: var(--primary-dark);
  font-size: 1.4rem;
  font-weight: 900;
}

.thanks-badge span:last-child {
  background: #e5f6f1;
  color: var(--mint-dark);
  transform: translateY(8px);
}

.thanks-lead {
  margin: 0 auto 1.7rem;
}

.snowball-card {
  padding: clamp(1.4rem, 4vw, 2.2rem);
  border: 1px solid #eadcac;
  border-radius: 25px;
  background:
    radial-gradient(circle at 95% 10%, rgba(255, 214, 120, 0.8), transparent 35%),
    linear-gradient(145deg, #fff7df, #fffdfa);
  text-align: left;
}

.snowball-slogan {
  margin-bottom: 0.5rem;
  color: #735619;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.snowball-card h3 {
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
}

.copy-status {
  min-height: 1.6rem;
  margin: 0.7rem 0 0;
  color: var(--mint-dark);
  font-size: 0.85rem;
  font-weight: 800;
}

.return-actions {
  justify-content: center;
  margin-top: 1.4rem;
}

.page-footer {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 1.8rem);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.page-footer > :last-child {
  justify-self: end;
}

.dot-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d6d1cb;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.dot.is-active {
  width: 32px;
  background: var(--primary);
}

.ethics-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
  padding: 0.75rem 1rem 1rem;
  color: #777b89;
  font-size: 0.72rem;
  text-align: center;
}

.noscript-message {
  max-width: 700px;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 1rem;
  background: white;
  color: var(--ink);
}

@media (max-width: 820px) {
  body {
    font-size: 17px;
  }

  .study-mark {
    flex: 1;
  }

  .study-mark__symbol {
    display: none;
  }

  .hero-layout,
  .answer-grid,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .math-visual {
    max-width: 520px;
  }

  .answer-card {
    min-height: 0;
    grid-template-rows: auto;
  }

  .route-card {
    grid-template-rows: auto;
  }

  .why-join {
    align-items: flex-start;
    flex-direction: column;
  }

  .screen {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  body {
    padding: 0;
    background: var(--surface);
    font-size: 16px;
  }

  .page-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    min-height: 68px;
    gap: 0.55rem;
    padding: 0.65rem 0.8rem;
    backdrop-filter: blur(14px);
  }

  .home-link {
    flex: 0 0 auto;
    font-size: 0.92rem;
  }

  .study-mark {
    justify-content: center;
  }

  .study-mark small {
    display: none;
  }

  .study-mark strong {
    max-width: 150px;
    font-size: 0.82rem;
    text-align: center;
  }

  .language-button {
    min-height: 40px;
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
  }

  .progress-wrap {
    padding: 0.75rem 1rem 0;
  }

  .stage {
    padding: 1.35rem 1rem 1.6rem;
  }

  h1 {
    font-size: clamp(1.75rem, 8.5vw, 2.3rem);
  }

  h2 {
    font-size: clamp(1.5rem, 6.8vw, 2rem);
  }

  .hero-lead {
    font-size: 1.04rem;
  }

  .math-visual {
    padding: 1.1rem;
  }

  .answer-grid,
  .route-grid {
    gap: 0.8rem;
  }

  .answer-card,
  .route-card {
    padding: 1.15rem;
  }

  .route-card {
    min-height: 0;
  }

  .support-row,
  .share-actions,
  .return-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .page-footer {
    position: sticky;
    z-index: 9;
    bottom: 0;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding: 0.7rem;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 25px rgba(45, 38, 74, 0.07);
  }

  .dot-navigation {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .page-footer > .back-trigger,
  .page-footer > #footer-next {
    grid-row: 2;
  }

  .ethics-note {
    padding-bottom: 1.5rem;
  }
}

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