@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-subset.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --coral: #FF7B6B;
  --orange: #F2701D;
  --cream: #FAF0DC;
  --ink: #0E171E;
  --aqua: #8FD8E0;
  --grey: #4B545A;
  --line: #E2D6BD;
  --white: #FFFFFF;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
}

h1, h2, h3, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
strong { font-weight: 900; }
a { color: inherit; text-underline-offset: 3px; }
.nowrap { white-space: nowrap; }
.tag { white-space: nowrap; }

/* 各階段顯示切換（預設關閉，由 app.js 依日期設定 data-phase） */
.only-closed { display: none; }
html[data-phase="voteday"] .only-closed,
html[data-phase="after"] .only-closed { display: block; }
html[data-phase="voteday"] .hide-closed,
html[data-phase="after"] .hide-closed,
html[data-phase="voteday"] .hide-voteday { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
}
.brand { font-weight: 900; font-size: 15px; letter-spacing: .04em; }
.badge {
  flex: none;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 13px;
  font-weight: 700;
}

main { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }

.hero { padding: 36px 0 12px; text-align: center; }
.hero-boat { width: min(52vw, 220px); height: auto; }
h1 { margin-top: 8px; font-size: clamp(34px, 9vw, 54px); font-weight: 900; line-height: 1.25; letter-spacing: .02em; }
.lead { max-width: 30em; margin: 16px auto 0; font-size: 18px; }
.lead .tag { color: var(--orange); }
.when {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  font-weight: 700;
  font-size: 15px;
}
.status {
  margin: 18px auto 0;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  text-align: left;
}
.status:empty { display: none; }

.block { margin-top: 44px; }
h2 {
  display: inline-block;
  margin-bottom: 16px;
  padding: 2px 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--aqua);
  font-size: 20px;
  font-weight: 900;
}
h3 { font-size: 18px; font-weight: 900; }

.steps { display: grid; gap: 12px; counter-reset: step; }
.steps li {
  position: relative;
  padding: 16px 18px 16px 64px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--white);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid var(--ink);
  font-weight: 900;
  line-height: 28px;
  text-align: center;
}
.steps .tag { color: var(--orange); }

.panel {
  margin-top: 16px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: var(--white);
}
.field { margin-top: 14px; }
label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 15px; }
select, textarea, input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; min-height: 5.4em; }
select:focus-visible, textarea:focus-visible, input:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.row.between { justify-content: space-between; }
.count { font-size: 14px; color: var(--grey); font-variant-numeric: tabular-nums; }
.count.over { color: #B3261E; font-weight: 700; }

.btn {
  padding: 10px 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--orange);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.btn.alt { background: var(--coral); }
.btn.ghost { padding: 6px 14px; background: var(--white); font-size: 14px; font-weight: 700; }
.btn:disabled { background: var(--line); color: var(--grey); border-color: var(--grey); cursor: not-allowed; }

.preview {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 18px auto 0;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--cream);
}
.preview:not([src]) { visibility: hidden; height: 0; margin: 0; border: 0; }
.panel .row:last-of-type { justify-content: center; }

.hint { margin-top: 8px; font-size: 14px; color: var(--grey); }
.hint .tag { color: var(--ink); }
.privacy { margin-top: 16px; }
.notice {
  margin-top: 4px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--aqua);
  font-weight: 700;
  font-size: 15px;
}
.notice.warn { margin-top: 10px; background: var(--coral); }

.menu { display: grid; gap: 8px; margin-top: 12px; counter-reset: day; }
.menu li {
  display: grid;
  grid-template-columns: 2.2em 6.2em 1fr;
  align-items: baseline;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--white);
  counter-increment: day;
}
.menu li::before { content: counter(day); font-weight: 900; color: var(--orange); text-align: center; }
.menu .date { font-size: 14px; color: var(--grey); }
.menu li.today { outline: 3px solid var(--ink); }
.menu li.today::after {
  content: "今天";
  grid-column: 3;
  justify-self: start;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  font-weight: 700;
}

.rules { display: grid; gap: 8px; counter-reset: rule; }
.rules li {
  position: relative;
  padding: 10px 14px 10px 50px;
  border-radius: 14px;
  background: var(--white);
  counter-increment: rule;
}
.rules li::before {
  content: counter(rule);
  position: absolute;
  left: 14px;
  top: 10px;
  width: 26px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.records { display: grid; gap: 8px; margin-top: 12px; }
.records li {
  display: grid;
  grid-template-columns: 7.6em 1fr;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--white);
}
.records .when-day { font-size: 14px; color: var(--grey); }
.records .empty { color: var(--grey); }
.records .text { overflow-wrap: anywhere; }

#about p + p { margin-top: 10px; }

.foot { margin-top: 24px; background: var(--orange); color: var(--white); text-align: center; }
.foot-wave { display: block; width: 100%; height: 40px; background: var(--cream); }
.foot p { margin-top: -1px; padding: 6px 16px 22px; font-size: 14px; font-weight: 900; color: var(--ink); }

@media (max-width: 420px) {
  body { font-size: 16px; }
  .brand { font-size: 13px; }
  .badge { font-size: 12px; padding: 3px 10px; }
  .menu li { grid-template-columns: 1.8em 1fr; }
  .menu .date { grid-column: 2; }
  .menu .topic { grid-column: 2; }
  .menu li.today::after { grid-column: 2; }
  .records li { grid-template-columns: 1fr; gap: 0; }
}

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