:root{--paper:#f7f0e3;--box:#fff8ec;--ink:#3a2e24;--muted:#7a6a58;--line:#e2d5bf;--step1:#c98a2b;--step1-text:#79531a;--step2:#5f8a3a;--step2-text:#44632a;--step3:#b4503a;--step3-text:#944230;--step4:#3f6f9a;--step4-text:#365e83;--step5:#7a4f7d;--step5-text:#764c79}
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.line-notice {
  display: none;
}

.from-line .line-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--box);
  font-size: 15px;
  line-height: 1.6;
}

.line-notice p {
  flex: 1;
  margin: 0;
}

.line-notice button {
  flex: none;
}

h1,
h2,
h3,
.time,
.facts {
  font-weight: 900;
}

h1 {
  font-size: 28px;
  line-height: 1.3;
  margin: 24px 0 8px;
}

h2 {
  font-size: 22px;
  line-height: 1.35;
  margin: 32px 0 12px;
}

h3 {
  font-size: 18px;
  line-height: 1.4;
  margin: 0 0 4px;
}

p {
  margin: 0 0 12px;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--step4-text);
}

button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--box);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

button[aria-pressed="true"],
#open-quiz,
#start-live {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

#start-live {
  width: 100%;
  font-weight: 900;
}

#start-live:disabled {
  border-color: var(--line);
  background: var(--box);
  color: var(--muted);
  cursor: default;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--box);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}

summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  font-weight: 700;
}

.share a,
.back a,
.more a,
.box li a,
main > p > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.home-link {
  margin: 4px 0 0;
}

.home-link a {
  color: var(--muted);
  text-underline-offset: 3px;
}

.home-link + .activity-head h1 {
  margin-top: 8px;
}

.tagline,
.lead,
.hint,
.filter-label,
.source,
#match-count {
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--box);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.box {
  margin: 0 0 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--box);
}

.box ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.more ul,
.more ol {
  margin: 0;
  padding-left: 1.2em;
}

.box li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 12px;
}

.box li + li {
  margin-top: 6px;
}

.box li em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
  white-space: nowrap;
}

.todo h4 {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.4;
}

.todo h3 + h4 {
  margin-top: 8px;
}

.todo li {
  display: block;
}

.todo li + li {
  margin-top: 0;
}

.todo li > span,
.todo summary {
  display: flex;
  align-items: baseline;
  min-height: 44px;
  padding: 8px 0;
}

.todo li > span::before,
.todo summary::before {
  content: "・";
  flex: none;
  width: 1em;
  color: var(--muted);
}

.todo li > span > a {
  margin: -8px 0;
}

.todo summary {
  font-weight: 400;
  list-style: none;
}

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

.todo summary::after {
  content: "＋";
  flex: none;
  margin-left: auto;
  padding-left: 12px;
  color: var(--muted);
  font-weight: 900;
}

.todo details[open] > summary::after {
  content: "－";
}

.todo details p {
  margin: 0 0 8px;
  padding-left: 1em;
  color: var(--muted);
  white-space: pre-line;
}

.entry-head h1 {
  margin: 40px 0 8px;
  font-size: 30px;
}

.entry-head h1 span {
  display: inline-block;
}

.entry-head .lead {
  margin: 0;
}

.entry-actions {
  display: flex;
  gap: 10px;
  margin: 24px 0 0;
}

#open-quiz {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 10px;
  min-height: 52px;
  font-size: 18px;
  font-weight: 900;
}

#open-quiz small {
  font-size: 14px;
  font-weight: 400;
}

#toggle-filters {
  flex: none;
  min-height: 52px;
  padding: 8px 18px;
  background: transparent;
}

#toggle-filters .caret {
  display: inline-block;
  margin-left: 2px;
  font-size: 13px;
}

#toggle-filters[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.filters {
  margin: 12px 0 0;
  padding: 16px 16px 4px;
  border-radius: 16px;
  background: var(--box);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-label {
  flex-basis: 100%;
  margin: 0;
  font-size: 14px;
}

#match-count {
  margin: 0 0 12px;
  font-size: 15px;
}

.wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 14px;
  margin: 32px 0 0;
  padding-bottom: 32px;
}

.act {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

.act:nth-child(even) {
  transform: translateY(32px);
}

.act img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: 14px;
  background: var(--box);
  box-shadow: 0 8px 20px -10px var(--ink);
}

.act h2 {
  margin: 12px 2px 0;
  font-size: 17px;
  line-height: 1.4;
}

.act .interests {
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.act.is-dim {
  opacity: 0.35;
}

.act:focus-visible {
  outline: 3px solid var(--step4);
  outline-offset: 4px;
  border-radius: 16px;
}

.wall-empty {
  margin: 32px 0 0;
  padding: 24px 16px;
  border-radius: 16px;
  background: var(--box);
  color: var(--muted);
  text-align: center;
}

.preparing {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 4px;
  margin: 40px 0 0;
  font-size: 15px;
}

.preparing h2 {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 44px;
}

.preparing h2::after {
  content: "：";
}

.preparing ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preparing li {
  display: flex;
  align-items: center;
}

.preparing li:not(:last-child)::after {
  content: "・";
  color: var(--muted);
}

.preparing a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-underline-offset: 3px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.facts li {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--box);
  border: 1px solid var(--line);
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  padding: 0 0 20px 28px;
  border-left: 2px solid var(--line);
  margin-left: 7px;
}

.step:last-child {
  border-left-color: transparent;
}

.step::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--dot);
}

.step:nth-child(5n + 1) {
  --dot: var(--step1);
  --dot-text: var(--step1-text);
}

.step:nth-child(5n + 2) {
  --dot: var(--step2);
  --dot-text: var(--step2-text);
}

.step:nth-child(5n + 3) {
  --dot: var(--step3);
  --dot-text: var(--step3-text);
}

.step:nth-child(5n + 4) {
  --dot: var(--step4);
  --dot-text: var(--step4-text);
}

.step:nth-child(5n + 5) {
  --dot: var(--step5);
  --dot-text: var(--step5-text);
}

.step .time {
  color: var(--dot-text);
}

.say {
  margin: 4px 0 0;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.thumbs img {
  display: block;
  width: 88px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--box);
}

.start {
  margin: 32px 0 16px;
}

.hint {
  margin: 8px 0 0;
  font-size: 15px;
}

p.rain,
.quiz-note {
  padding: 12px 16px;
  border-left: 4px solid var(--step4);
  background: var(--box);
}

.more {
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
}

.more details {
  border-bottom: 1px solid var(--line);
}

.more details > :not(summary) {
  margin-bottom: 12px;
}

.story-card {
  margin: 16px 0;
}

.card-front {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: var(--box);
}

.story-card p {
  white-space: pre-line;
  line-height: 1.9;
}

.source {
  margin: 16px 0;
  font-size: 15px;
}

#live,
#quiz {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  padding: 16px 0;
  background: var(--paper);
}

#live[hidden],
#quiz[hidden] {
  display: none;
}

.quiz-body,
.live-body {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.quiz-close {
  display: block;
  margin-left: auto;
}

#quiz h2 {
  margin: 8px 0 12px;
}

#quiz [tabindex="-1"]:focus,
#live [tabindex="-1"]:focus {
  outline: none;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.quiz-options button {
  width: 100%;
  border-radius: 12px;
  text-align: left;
}

.picks {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.pick a {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--box);
  color: inherit;
  text-decoration: none;
}

.pick .why {
  margin: 0;
  color: var(--muted);
}

.see-all {
  width: 100%;
  margin-top: 24px;
}

.district {
  margin: 32px 0 0;
}

.district select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--box);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.route-summary {
  margin: 12px 0 0;
}

.route-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 8px 0 12px;
}

.route-facts dt {
  font-weight: 700;
}

.route-facts dd {
  margin: 0;
}

.resume {
  margin: 16px 0 0;
  padding: 16px;
  border: 2px solid var(--step2);
  border-radius: 12px;
  background: var(--box);
}

.resume p {
  font-weight: 700;
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resume-actions button {
  flex: 1 1 120px;
}

#live h2 {
  margin: 4px 0 12px;
  font-size: 26px;
}

.live-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  color: var(--muted);
  font-size: 15px;
}

.live-timer {
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.live-timer.is-over {
  flex-basis: 100%;
  color: var(--muted);
  font-weight: 700;
}

.live-progress {
  display: flex;
  gap: 4px;
  margin: 8px 0 16px;
}

.live-progress i {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}

.live-progress i.is-done {
  background: var(--dot);
}

.live-time {
  margin: 0;
  color: var(--dot-text);
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
}

.live-say,
.read-aloud {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--dot);
  border-radius: 0 8px 8px 0;
  background: var(--box);
}

.live-say {
  font-size: 19px;
  font-weight: 700;
}

.read-aloud h3 {
  color: var(--dot-text);
}

.read-aloud p {
  margin: 0;
  white-space: pre-line;
}

.story-text {
  margin: 24px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  font-size: 18px;
  line-height: 1.9;
}

.story-text h3 {
  color: var(--dot-text);
}

.story-text p {
  white-space: pre-line;
}

.story-text .hint {
  margin: 0 0 12px;
}

.live-card-image {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 16px auto 0;
  border-radius: 12px;
}

.card-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 5 / 7;
  padding: 16px;
  border: 2px dashed var(--line);
  background: var(--box);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.story-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 16px 0 8px;
}

.share-buttons {
  display: flex;
  flex: 1 1 160px;
  flex-direction: column;
  gap: 8px;
}

.live-qr {
  margin: 0 auto;
  text-align: center;
}

.live-qr svg {
  display: block;
  width: 160px;
  margin: 0 auto;
}

.live-qr figcaption {
  font-weight: 700;
}

.copy-text {
  margin: 0;
  -webkit-user-select: all;
  user-select: all;
}

.copy-field {
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
  font-size: 16px;
}

.story-switch-title,
.topic-groups-title {
  margin: 20px 0 8px;
  color: var(--dot-text);
}

.topic-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.topic-group {
  padding: 8px 6px;
  border: 2px solid var(--dot-text);
  border-radius: 12px;
  background: var(--box);
  color: var(--dot-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.topic-group-count {
  font-weight: 400;
}

.topic-group[aria-pressed="true"] {
  border-color: var(--dot-text);
  background: var(--dot-text);
  box-shadow: 0 0 0 2px var(--box), 0 0 0 4px var(--dot-text);
  color: var(--box);
}

.topic-group[aria-pressed="true"]::before {
  content: "✓";
  margin-right: 4px;
  font-weight: 900;
}

.story-switch {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.story-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 6px 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--box);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

.story-tile-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  opacity: 0.55;
}

.story-tile .card-missing {
  display: flex;
  padding: 6px;
  color: inherit;
  font-size: 13px;
  opacity: 1;
}

.story-tile[aria-pressed="true"] {
  border-color: var(--dot-text);
  background: var(--box);
  box-shadow: 0 0 0 2px var(--dot-text);
  color: var(--ink);
  font-weight: 700;
}

.story-tile[aria-pressed="true"] .story-tile-image {
  opacity: 1;
}

.story-tile[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 0 8px 0 12px;
  background: var(--dot-text);
  color: var(--box);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.story-live .live-card-image,
.topic-card .live-card-image {
  width: auto;
  max-width: min(100%, 360px);
  max-height: 40vh;
}

.live-draw {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 16px 0 0;
  border: 2px solid var(--dot-text);
  background: var(--dot-text);
  color: var(--box);
  font-size: 19px;
  font-weight: 900;
}

.live-maps {
  display: flex;
  margin: 16px 0 0;
  font-weight: 700;
}

.live-survey {
  margin: 16px 0 0;
  text-align: center;
}

.live-survey a,
.staff-survey a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.thumb-button {
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
}

.live-thumb {
  display: block;
  width: 88px;
  border-radius: 8px;
}

.live-thumbs .card-missing {
  padding: 6px;
  font-size: 13px;
}

.card-viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 0 max(0px, calc(50% - 280px));
  background: var(--paper);
}

.viewer-close {
  align-self: flex-end;
  margin: 16px;
}

.viewer-strip {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.viewer-slide {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 16px 16px;
  scroll-snap-align: center;
}

.viewer-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
}

.viewer-slide .card-missing {
  width: min(100%, 360px);
}

.preflight {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.preflight label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.preflight input {
  flex: none;
  width: 24px;
  height: 24px;
  accent-color: var(--step2);
}

.live-nav {
  display: grid;
  gap: 8px;
  margin: 24px 0 0;
}

.live-next {
  width: 100%;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
}

.live-prev {
  justify-self: start;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--muted);
}
