:root {
  --ink: #2b2420;
  --muted: #6e625b;
  --paper: #ffffff;
  --peach: #fdf3ed;
  --peach-deep: #f9e3d6;
  --orange: #f26b2a;
  --orange-ink: #c94d12;
  --salmon: #ee8e76;
  --teal: #1f8f9d;
  --teal-soft: #e3f4f6;
  --line: #eadfd7;
  --radius: 14px;
  --display: "Baloo 2", "Noto Sans TC", system-ui, sans-serif;
  --body: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(2.5rem, 6vw, 4.25rem); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip:focus { top: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 15px/1 var(--body);
  padding: 12px 18px; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-ink); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-outline { border-color: var(--orange); color: var(--orange-ink); background: transparent; }
.btn-outline:hover { background: var(--orange); color: #fff; }
.btn-kofi { background: var(--teal); color: #fff; }
.btn-kofi:hover { background: #17707b; color: #fff; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 14px var(--body); color: var(--teal); text-decoration: underline; text-underline-offset: 3px;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  font: 700 1.2rem/1 var(--display);
}
.brand img { width: 48px; height: 48px; }
.brand-caret { display: none; }
.filters-head { display: none; }
.filters-entry { display: none; }
.filters-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filters-foot .btn { display: none; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--ink); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 500;
}
.nav a:hover { background: var(--peach); color: var(--orange-ink); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  font: 500 14px var(--body); color: var(--ink); background: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.lang-toggle:hover { border-color: var(--ink); }
select.lang-toggle {
  appearance: none; -webkit-appearance: none; padding-right: 30px; width: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232b2420' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center / 10px 7px;
}
.header-actions .btn-kofi { padding: 9px 14px; font-size: 14px; }

/* Hero + level route */
.hero { background: var(--peach); padding: clamp(48px, 8vw, 96px) 0 56px; }
.hero h1 { max-width: 14ch; }
.hero .wrap { position: relative; }
/* Illustration: a traveller walking towards a windmill. Sits beside the title on wide screens. */
.hero-art { position: absolute; right: 0; top: -24px; width: min(44%, 540px); height: auto; pointer-events: none; }
@media (min-width: 861px) { .hero .lead { max-width: min(62ch, 54%); } }
.lead { font-size: 1.125rem; max-width: 62ch; color: var(--muted); }

.route { border: 0; margin: 40px 0 0; padding: 0; min-width: 0; }
.route legend { font: 700 1.1rem var(--display); margin-bottom: 18px; padding: 0; }
.route-line {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(7, 1fr);
  position: relative;
}
.route-line li { position: relative; }
/* The track: a grey line between stations, orange where it is on your route. */
.route-line li::before {
  content: ""; position: absolute; top: 35px; left: -50%; width: 100%; height: 8px;
  background: var(--peach-deep); z-index: 0;
}
.route-line li:first-child::before { display: none; }
.route-line li.on-route::before { background: var(--orange); }

.station {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 0 4px 4px; background: none; border: 0; cursor: pointer;
  color: var(--ink); font-family: var(--body); text-align: center;
}
.station .flag {
  height: 18px; font: 700 12px/18px var(--body); color: var(--orange-ink);
}
.station .dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--paper); border: 5px solid var(--peach-deep);
  transition: transform .15s ease, border-color .15s ease;
}
.station:hover .dot { border-color: var(--salmon); transform: scale(1.12); }
.station .code { font: 800 1.6rem/1 var(--display); margin-top: 4px; }
.station .desc { font-size: 13px; line-height: 1.3; color: var(--muted); max-width: 13ch; }

.on-route .station .dot { border-color: var(--orange); }
.is-current .station .dot { background: var(--orange); border-color: var(--orange); }
.is-target .station .dot {
  background: var(--paper); border-color: var(--orange);
  box-shadow: 0 0 0 5px var(--peach), 0 0 0 8px var(--orange);
}
.is-current .station .code, .is-target .station .code { color: var(--orange-ink); }
.route-line li:not(.on-route):not(.is-current) .station .code { color: #b3a49b; }
.route-line.picking li:not(.on-route):not(.is-current) .station .code { color: var(--ink); }
.route-line.picking li:not(.is-current) .station .dot { border-color: var(--salmon); }
.route-line li.goal-option .station .dot { animation: goal-blink 1s ease-in-out 5; }
@keyframes goal-blink {
  0%, 100% { border-color: var(--salmon); background: var(--paper); transform: scale(1); }
  50% { border-color: var(--orange); background: var(--peach-deep); transform: scale(1.2); }
}

.route-hint { margin: 18px 0 0; font-weight: 500; }

/* First-visit demo: a finger slides between A0 and B1 for 5 seconds, then rests on A0. */
.route-track { position: relative; }
.tap-hint {
  position: absolute; top: -14px; left: calc(100% * .5 / 7); z-index: 2;
  font-size: 30px; line-height: 1; margin-left: -15px; pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(43, 36, 32, .25));
  animation: tap-demo 2.5s ease-in-out 2 forwards;
}
@keyframes tap-demo {
  0%, 100% { left: calc(100% * .5 / 7); }
  50% { left: calc(100% * 3.5 / 7); }
}


/* Finder */
.finder { padding: 48px 0 72px; }
.finder-grid {
  display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: start;
}
.filters-toggle { display: none; }
.filters {
  position: sticky; top: 96px;
  max-height: calc(100vh - 112px); overflow: auto;
  padding-right: 8px;
}
.field { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.field > label, .field > legend {
  display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; padding: 0;
}
input:not([type="checkbox"]), select, textarea {
  width: 100%; font: 400 15px/1.4 var(--body); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e625b' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Segmented scale: budget and time read as a ladder from small to large. */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#hours { grid-template-columns: repeat(3, 1fr); }
#hours button { padding-inline: 2px; }
.seg button, .chips button {
  font: 500 14px/1.2 var(--body); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); cursor: pointer;
}
.seg button { padding: 9px 6px; border-radius: 10px; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 12px; border-radius: 999px; }
.chips button[aria-pressed="true"] { background: var(--teal-soft); border-color: var(--teal); color: #11606a; }
.multi-chip { display: inline-flex; align-items: center; gap: 7px; }
.multi-chip .box {
  flex: none; width: 15px; height: 15px; border: 1.5px solid #b3a49b; border-radius: 4px; background: var(--paper);
}
.multi-chip[aria-pressed="true"] .box {
  border-color: var(--teal); background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.seg button:hover, .chips button:hover { border-color: var(--muted); }

.results { min-width: 0; }
.route-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--peach); border-left: 4px solid var(--orange);
}
.route-banner[hidden] { display: none; }
.results-foot { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 12px; padding: 24px 0 8px; }
.results-foot[hidden] { display: none; }
.route-banner p { margin: 0; font-weight: 500; }
.route-banner .btn { padding: 9px 16px; font-size: 14px; }
.results-bar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink); padding-bottom: 12px;
}
.results-bar h2 { margin: 0; font-size: 1.5rem; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sort select { width: auto; padding-block: 6px; }

.result-list { list-style: none; margin: 0; padding: 0; }
.result {
  display: grid; grid-template-columns: 132px 1fr; gap: 24px;
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.price { font-family: var(--display); }
.price .amount { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.05; }
.price .amount.free { color: var(--teal); }
.price .amount.unknown { font-size: 1.15rem; color: var(--muted); }
.price .per { font-size: 13px; color: var(--muted); font-family: var(--body); }
.result h3 { font-size: 1.35rem; margin: 0; }
.result-head { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; }
.logo {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; background: var(--peach-deep); color: #7a4a33;
  font: 800 15px/1 var(--display);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; background: var(--paper); opacity: 0; }
.logo.has-img { box-shadow: inset 0 0 0 1px var(--line); }
.logo.has-img img { opacity: 1; }
.logo.has-img .logo-initials { visibility: hidden; }
.logo-creator { background: #fde0d2; color: #b2441a; }
.logo-school, .logo-university { background: var(--teal-soft); color: #11606a; }
.logo-government, .logo-library { background: #e8eef7; color: #2f4f7f; }
.logo-app, .logo-course, .logo-podcast, .logo-tutors, .logo-dictionary { background: #efe9f7; color: #5b3f8a; }
.logo-media, .logo-ai { background: #f3ece7; color: #6e625b; }
.logo-community { background: #e6f2e4; color: #3d6b36; }
.result h3 a { color: var(--ink); text-decoration: none; }
.result h3 a:hover { color: var(--orange-ink); text-decoration: underline; }
.meta { font-size: 14px; color: var(--muted); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.result .note { margin: 0 0 12px; max-width: 68ch; }
.result .price-note { font-size: 14px; color: var(--muted); margin: -6px 0 12px; }

.levelbar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.levelbar ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 26px); gap: 3px; }
.levelbar li {
  height: 22px; border-radius: 5px; background: #f3ece7; color: #b3a49b;
  font: 700 10px/22px var(--body); text-align: center;
}
.levelbar li.has { background: var(--salmon); color: #fff; }
.levelbar li.has.mine { background: var(--orange); }
.levelbar li.mine:not(.has) { box-shadow: inset 0 0 0 1.5px var(--orange); color: var(--orange-ink); }
.levelbar .reach { font-size: 14px; font-weight: 700; color: var(--orange-ink); }
.levelbar .reach.partial { color: var(--muted); font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.tags li { font-size: 13px; padding: 3px 10px; border-radius: 6px; background: var(--peach); color: #7a4a33; }
.tags li.fmt { background: var(--teal-soft); color: #11606a; }
.tags li.variant { background: #fff3c4; color: #6b5300; }

.links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 15px; font-weight: 500; }
.unreviewed { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.unreviewed::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); }

.empty { padding: 48px 0; max-width: 52ch; }

/* Suggest */
.suggest { background: var(--peach); padding: 72px 0; }
.suggest-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 56px; align-items: start; }
.suggest-grid > div:first-child { position: sticky; top: 112px; }
.suggest-form { background: var(--paper); border-radius: 20px; padding: clamp(20px, 4vw, 36px); }
.suggest-form .field { margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 18px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.form-note { font-size: 14px; color: var(--muted); }
.form-status { margin: 14px 0 0; font-weight: 500; }
.form-status.ok { color: #11606a; }
.form-status.err { color: #b3261e; }

/* About */
.about { padding: 80px 0; }
.about-grid { display: grid; grid-template-columns: 200px 1fr 320px; gap: 48px; align-items: start; }
.about-text p { max-width: 60ch; }
.about-links { display: flex; gap: 20px; flex-wrap: wrap; font-weight: 500; }
.support {
  border: 2px solid var(--teal); border-radius: 20px; padding: 24px;
}
.support h3 { margin-bottom: .5em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; flex-direction: column; gap: 8px; }
.footer-inner p { margin: 0; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 4px 0; }
.footer-meta > * + *::before { content: "·"; margin: 0 8px; }
.footer-meta span:empty { display: none; }
.footer-meta a { color: var(--teal); font-weight: 500; }
@media (max-width: 600px) {
  .footer-meta { flex-direction: column; gap: 6px; }
  .footer-meta > * + *::before { content: none; }
}

/* Responsive */
@media (max-width: 1000px) {
  .about-grid { grid-template-columns: 140px 1fr; }
  .support { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .hero-art { position: static; display: block; width: 100%; max-width: 420px; margin: 8px auto 0; }
  .brand-caret { display: block; width: 14px; height: 9px; color: var(--ink); transition: transform .15s ease; }
  .brand[aria-expanded="true"] .brand-caret { transform: rotate(180deg); }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; margin: 0; padding: 8px 16px 16px;
    background: var(--paper); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(43, 36, 32, .08);
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 12px; border-radius: 10px; font-size: 17px; }
  .header-actions { margin-left: auto; gap: 8px; }
  .header-actions > * { white-space: nowrap; }
  .lang-toggle { padding: 8px 12px; }
  select.lang-toggle { padding-right: 26px; background-position: right 10px center; }
  .header-actions .btn-kofi { padding: 9px 12px; }
  .brand { gap: 6px; }
  .finder-grid { grid-template-columns: 1fr; gap: 20px; }
  /* Inline filter section right under the level route. */
  .filters-entry {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper);
  }
  .filters-entry h2 { margin: 0 0 2px; font-size: 1.3rem; }
  .filters-entry p { margin: 0; font-size: 14px; color: var(--muted); }
  .filters-entry .btn { flex: none; }
  /* Floating filter button, shown once the filter section has scrolled away. */
  .filters-toggle {
    display: none; align-items: center; gap: 8px;
    position: fixed; z-index: 30; bottom: 16px; left: 50%; transform: translateX(-50%);
    font: 700 15px var(--body); color: #fff; background: var(--ink);
    border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer;
    box-shadow: 0 8px 24px rgba(43, 36, 32, .25);
  }
  .filters-toggle::before {
    content: ""; width: 16px; height: 16px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3h14M4 8h8M6.5 13h3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3h14M4 8h8M6.5 13h3' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  body.sheet-open { overflow: hidden; }
  .filters-toggle.show { display: inline-flex; }
  body.sheet-open .filters-toggle { display: none; }
  .site-footer { padding-bottom: 96px; }
  .badge { background: var(--orange); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; }
  /* Filters open as a full-screen sheet. */
  .filters { display: none; }
  .filters.open {
    display: block; position: fixed; inset: 0; z-index: 40;
    max-height: none; overflow: auto; padding: 0 16px;
    background: var(--peach);
  }
  /* Show-results button sits in the bottom-right corner of the sheet. */
  .filters-foot {
    position: sticky; bottom: 0; margin: 8px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--peach); border-top: 1px solid var(--line);
  }
  .filters-foot .btn { display: inline-flex; }
  .filters-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 1; margin: 0 -16px 20px; padding: 14px 16px;
    background: var(--peach); border-bottom: 1px solid var(--line);
  }
  .filters-head h2 { margin: 0; font-size: 1.5rem; }
  .suggest-grid { grid-template-columns: 1fr; gap: 24px; }
  .suggest-grid > div:first-child { position: static; }
}

@media (max-width: 640px) {
  .brand span { display: none; }
  .station .desc { display: none; }
  .station .code { font-size: 1.15rem; }
  .station .dot { width: 24px; height: 24px; border-width: 4px; }
  .route-line li::before { top: 33px; height: 6px; }
  .station .flag { font-size: 11px; }
  .result { grid-template-columns: 1fr; gap: 6px; }
  .price { display: flex; align-items: baseline; gap: 8px; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .about-logo { width: 120px; height: 120px; }
}

.js-protect { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
