/* Mobile first: most visitors arrive by scanning the poster's QR code. */
:root {
  --ink: #0f1b2d;
  --ink-2: #1c2b42;
  --text: #1b2430;
  --muted: #5b6472;
  --paper: #ffffff;
  --paper-alt: #f4f6f9;
  --line: #dfe4ec;
  /* In Taiwan's market red means "up". */
  --up: #d4283c;
  --up-dark: #b01e30;
  --ok: #1b8a5f;
  --warn-bg: #fff6e0;
  --warn-line: #e8c56a;
  --err-bg: #fdecee;
  --radius: 10px;
  --wrap: 68rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--paper);
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--up-dark);
  text-underline-offset: 0.2em;
}

h1,
h2,
h3 {
  line-height: 1.35;
  margin: 0 0 0.6em;
}

h1 {
  font-size: 1.7rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.08rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

:focus-visible {
  outline: 3px solid #2f6fed;
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.1rem;
}

.wrap--narrow {
  max-width: 42rem;
}

/* Header */
.site-header {
  background: var(--ink);
  color: #fff;
}

.site-header__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1.2rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.brand {
  display: flex;
  flex-direction: column;
  color: #fff;
  text-decoration: none;
  line-height: 1.3;
}

.brand__org {
  font-size: 0.78rem;
  opacity: 0.75;
  letter-spacing: 0.06em;
}

.brand__name {
  font-weight: 700;
  font-size: 1.05rem;
}

.nav {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav a[aria-current="page"] {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

/* Hero: a chart-paper grid behind the title. */
.hero {
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 2.5rem,
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 2.5rem 100%,
    linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  padding: 2.6rem 0 2.8rem;
  border-bottom: 4px solid var(--up);
}

.hero__org {
  margin: 0 0 0.3rem;
  letter-spacing: 0.12em;
  font-size: 0.9rem;
  opacity: 0.8;
}

.hero__title {
  font-size: clamp(2rem, 8vw, 3.4rem);
  letter-spacing: 0.04em;
  margin: 0 0 0.9rem;
}

.hero__phase {
  display: inline-block;
  margin: 0 0 1.2rem;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  background: var(--up);
  font-weight: 600;
  font-size: 0.95rem;
}

.facts {
  list-style: none;
  padding: 0;
  margin: 0 0 1.6rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

.facts li {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--up);
  background: rgba(255, 255, 255, 0.06);
}

.facts__label {
  font-size: 0.8rem;
  opacity: 0.75;
}

.facts__value {
  font-weight: 700;
  font-size: 1.1rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  min-height: 2.9rem;
}

.btn--primary {
  background: var(--up);
  color: #fff;
}

.btn--primary:hover {
  background: var(--up-dark);
}

.btn--ghost {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

.btn--block {
  display: block;
  width: 100%;
}

.btn:disabled {
  background: #c5ccd6;
  color: #fff;
  cursor: not-allowed;
}

/* Sections */
.section {
  padding: 2.2rem 0;
}

.section--alt {
  background: var(--paper-alt);
}

.note,
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.hint {
  margin: 0.3rem 0 0;
}

.tag {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: #7a5a00;
}

/* Phase list */
.phases {
  list-style: none;
  margin: 0;
  padding: 0;
}

.phases li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
  color: var(--muted);
}

.phases li::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: -50%;
  height: 100%;
  width: 2px;
  background: var(--line);
}

.phases li:first-child::before {
  display: none;
}

.phases__dot {
  position: relative;
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper);
}

.phases li.is-done {
  color: var(--text);
}

.phases li.is-done::before,
.phases li.is-current::before {
  background: var(--ok);
}

.phases li.is-done .phases__dot {
  background: var(--ok);
  border-color: var(--ok);
}

.phases li.is-current {
  color: var(--text);
  font-weight: 700;
}

.phases li.is-current .phases__dot {
  border-color: var(--up);
  background: var(--up);
  box-shadow: 0 0 0 4px rgba(212, 40, 60, 0.18);
}

.phases li.is-current .phases__label::after {
  content: "目前";
  margin-left: 0.6rem;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--up);
  color: #fff;
  vertical-align: middle;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.table thead th {
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  white-space: nowrap;
}

.table tbody tr:last-child th,
.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody th {
  white-space: nowrap;
}

.table .amount {
  font-weight: 700;
  white-space: nowrap;
  color: var(--up-dark);
}

/* On narrow screens each schedule or prize row becomes a small card, so nothing scrolls sideways. */
@media (max-width: 40rem) {
  .table,
  .table tbody,
  .table tr,
  .table th,
  .table td {
    display: block;
  }

  .table thead {
    position: absolute;
    left: -999rem;
  }

  .table {
    border: none;
    background: transparent;
  }

  .table tr {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.7rem;
  }

  .table th,
  .table td {
    border: none;
    padding: 0.1rem 0;
    white-space: normal;
  }

  .table td:empty {
    display: none;
  }

  .table tbody th {
    font-size: 1.05rem;
  }
}

/* Rules */
.rules {
  display: grid;
  gap: 1rem;
}

.rule {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.4rem;
  background: var(--paper);
}

.rule ul {
  padding-left: 1.2rem;
}

.rule li {
  margin-bottom: 0.35rem;
}

/* Alerts */
.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.alert h2 {
  font-size: 1.2rem;
}

.alert > :last-child {
  margin-bottom: 0;
}

.alert--warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  border-left-color: #c9950a;
}

.alert--error {
  background: var(--err-bg);
  border-color: #f0b8bf;
  border-left-color: var(--up);
}

/* Registration */
.steps {
  list-style: none;
  display: flex;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 1.4rem;
  counter-reset: step;
  font-size: 0.9rem;
}

.steps li {
  flex: 1;
  counter-increment: step;
  padding: 0.45rem 0.3rem;
  text-align: center;
  border-bottom: 3px solid var(--line);
  color: var(--muted);
}

.steps li::before {
  content: counter(step) ". ";
}

.steps li.is-done {
  border-color: var(--ok);
  color: var(--text);
}

.steps li.is-current {
  border-color: var(--up);
  color: var(--text);
  font-weight: 700;
}

.quota {
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  background: var(--paper-alt);
  border-radius: var(--radius);
}

.field {
  margin-bottom: 1.2rem;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.field input,
.field select {
  width: 100%;
  font: inherit;
  /* 16px or more keeps iOS from zooming in on focus. */
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid #9aa4b2;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  min-height: 2.9rem;
}

.field [aria-invalid="true"] {
  border-color: var(--up);
  background: var(--err-bg);
}

.error {
  color: var(--up-dark);
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0.3rem 0 0;
}

.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
}

.summary dt {
  color: var(--muted);
  white-space: nowrap;
}

.summary dd {
  margin: 0;
  font-weight: 700;
}

.rulesbox {
  max-height: 22rem;
  overflow-y: auto;
  border: 1.5px solid #9aa4b2;
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 1rem;
  background: var(--paper-alt);
  display: grid;
  gap: 0.8rem;
}

.rulesbox__end {
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  font-weight: 600;
}

.check input {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.2rem;
}

.check input:disabled + span {
  color: var(--muted);
}

.turnstile {
  margin-bottom: 1rem;
  min-height: 4.1rem;
}

/* Tutorials */
.videos {
  display: grid;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.video {
  margin: 0;
}

.video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}

.video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video figcaption {
  margin-top: 0.4rem;
  font-weight: 600;
}

.cards {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.3rem;
}

.card ul {
  padding-left: 1.2rem;
}

/* Footer */
.site-footer {
  background: var(--ink);
  color: #d6dbe4;
  padding: 1.4rem 0;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.1rem 0;
}

.site-footer a {
  color: #fff;
}

@media (min-width: 40rem) {
  h1 {
    font-size: 2rem;
  }

  .facts {
    grid-template-columns: repeat(3, 1fr);
  }

  .rules,
  .cards {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    padding: 4rem 0;
  }

  /* The phases run left to right on wide screens. */
  .phases {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
  }

  .phases li {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 0 0.3rem;
    font-size: 0.9rem;
  }

  .phases li::before {
    left: -50%;
    top: 0.55rem;
    width: 100%;
    height: 2px;
  }

  .phases li.is-current .phases__label::after {
    display: block;
    width: fit-content;
    margin: 0.3rem auto 0;
  }
}
