:root {
  --paper: #F7F1E6;
  --card: #FFFDF8;
  --ink: #1B2634;
  --muted: #556170;
  --line: #E2D6C1;
  --navy: #27405E;
  --navy-deep: #1C2E44;
  --red: #B93424;
  --red-soft: #FBE9E4;
  --gold: #8A6A1F;
  --radius: 16px;
  --tabbar-h: 4.4rem;
  font-size: 112.5%; /* 基準 18px，長輩好讀 */
}
:root[data-font="large"] { font-size: 131.25%; }
:root[data-font="xlarge"] { font-size: 150%; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
body.card-open { overflow: hidden; }
[lang="ja"] { font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif; }
[hidden] { display: none !important; }
a { color: var(--navy); }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

#view {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1.5rem);
  outline: none;
}

/* ---------- 底部分頁列 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: var(--tabbar-h);
  color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600;
}
.tabbar svg {
  width: 1.6rem; height: 1.6rem;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.tabbar a.is-on { color: var(--navy); }
.tabbar a.is-on span { box-shadow: 0 2px 0 var(--navy); }
.tabbar a.tab-help { color: var(--red); }
.tabbar a.tab-help.is-on span { box-shadow: 0 2px 0 var(--red); }

/* ---------- 行程 ---------- */
.hero {
  background: var(--navy); color: #fff;
  margin: -1rem -1rem 0; padding: 1.5rem 1.25rem 1.4rem;
  padding-top: calc(1.5rem + env(safe-area-inset-top));
  position: relative; overflow: hidden;
}
.hero::after { /* 紅日 */
  content: ""; position: absolute; right: -2.2rem; top: -2.2rem;
  width: 8rem; height: 8rem; border-radius: 50%; background: var(--red); opacity: .9;
}
.hero > * { position: relative; z-index: 1; }
.hero-status {
  display: inline-block; font-size: .85rem; font-weight: 700; letter-spacing: .05em;
  background: rgba(255,255,255,.16); padding: .15rem .7rem; border-radius: 99px;
}
.hero-title {
  font-family: "Songti TC", "Noto Serif TC", "PMingLiU", serif;
  font-size: 1.7rem; line-height: 1.3; margin-top: .6rem; letter-spacing: .03em; text-wrap: balance;
}
.nowrap { white-space: nowrap; }
.hero-sub { opacity: .85; font-size: .95rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }

.daytabs {
  display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none;
  margin: 0 -1rem; padding: .9rem 1rem;
  position: sticky; top: 0; z-index: 5; background: var(--paper);
}
.daytabs::-webkit-scrollbar { display: none; }
.daytab {
  flex: 1 0 2.6rem; min-width: 0; display: flex; flex-direction: column; align-items: center;
  padding: .45rem 0; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
}
.daytab-wd { font-size: .75rem; color: var(--muted); font-weight: 600; }
.daytab-md { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.daytab.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.daytab.is-on .daytab-wd { color: rgba(255,255,255,.8); }

.day, .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.1rem;
}
.day-kicker, .card-kicker { color: var(--gold); font-weight: 700; font-size: .85rem; letter-spacing: .04em; }
.day-title, .card-title { font-size: 1.35rem; line-height: 1.35; margin-top: .1rem; text-wrap: balance; }
.part {
  font-size: .85rem; color: var(--muted); font-weight: 700; letter-spacing: .12em;
  margin: 1.2rem 0 .3rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line);
}
.timeline li {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: .75rem;
  padding: .6rem 0; border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.time {
  grid-column: 1 / -1; font-size: .85rem; font-weight: 700; color: var(--red);
  font-variant-numeric: tabular-nums;
}
.what { font-size: 1.08rem; font-weight: 600; }
.pin {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.4rem; min-height: 2.5rem; padding: 0 .7rem;
  border: 1.5px solid var(--navy); border-radius: 99px;
  font-size: .85rem; font-weight: 700; text-decoration: none; color: var(--navy); background: #fff;
}

.facts { margin-top: 1rem; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 3.2rem 1fr; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-weight: 700; font-size: .9rem; padding-top: .1rem; }
.inline-link { font-weight: 700; white-space: nowrap; display: inline-block; padding: .2rem 0; }

.fold {
  margin-top: .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 1.1rem;
}
.fold summary {
  cursor: pointer; font-weight: 700; padding: 1rem 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "＋"; color: var(--navy); font-size: 1.2rem; }
.fold[open] summary::after { content: "－"; }
.spot-group { font-size: .85rem; color: var(--gold); letter-spacing: .12em; margin-top: .4rem; }
.spots { margin-bottom: 1rem; }
.spot {
  display: grid; grid-template-columns: 1fr auto; column-gap: .75rem; align-items: start;
  padding: .7rem 0; border-bottom: 1px dashed var(--line);
}
.spot-main { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.spot-name { font-weight: 700; }
.tag { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 .4rem; white-space: nowrap; }
.spot .pin { grid-column: 2; grid-row: 1 / span 2; }
.spot-notes { grid-column: 1; font-size: .9rem; color: var(--muted); margin-top: .25rem; }
.spot-notes li { padding-left: .9rem; position: relative; }
.spot-notes li::before { content: "・"; position: absolute; left: -.2rem; }
.spot-tip { font-size: .9rem; background: var(--paper); border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; }

/* ---------- 共用 ---------- */
.page-title {
  font-family: "Songti TC", "Noto Serif TC", "PMingLiU", serif;
  font-size: 1.8rem; margin: .5rem 0 .8rem; padding-top: env(safe-area-inset-top);
}
.section-title { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
.lead { color: var(--muted); margin-bottom: 1rem; }
.notice { background: var(--red-soft); border-radius: 12px; padding: .8rem 1rem; margin: .8rem 0; }
.back { display: inline-block; font-weight: 700; text-decoration: none; padding: .5rem .5rem .5rem 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 3.1rem; padding: .5rem 1.1rem; border-radius: 12px;
  border: 1.5px solid var(--navy); background: #fff; color: var(--navy);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-wide { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1rem 0 .6rem; }

.card { margin-bottom: 1rem; position: relative; }
.card-on { border: 2px solid var(--navy); }
.badge {
  position: absolute; top: -0.8rem; right: 1rem; background: var(--red); color: #fff;
  font-size: .8rem; font-weight: 700; padding: .1rem .7rem; border-radius: 99px;
}
.addr { font-size: 1.05rem; margin-top: .5rem; overflow-wrap: anywhere; }

/* ---------- 求助 ---------- */
.bigbtn {
  display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: left;
  padding: 1.1rem 1.2rem; margin-bottom: .8rem; border-radius: var(--radius);
  border: 0; cursor: pointer; text-decoration: none; color: #fff;
}
.bigbtn strong { font-size: 1.5rem; line-height: 1.3; }
.bigbtn span { font-size: .95rem; opacity: .92; overflow-wrap: anywhere; }
.bigbtn-red { background: var(--red); }
.bigbtn-navy { background: var(--navy); }
.bigbtn-plain { background: var(--card); color: var(--ink); border: 2px solid var(--navy); }

.phones li { border-bottom: 1px solid var(--line); }
.phones a {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .8rem;
  padding: .85rem 0; text-decoration: none; color: var(--ink);
}
.phone-main { display: flex; flex-direction: column; }
.phone-main span { font-size: .88rem; color: var(--muted); }
.phone-num { font-size: 1.15rem; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 日文句子 ---------- */
.phrases li { margin-bottom: .55rem; }
.phrases button {
  display: flex; flex-direction: column; gap: .1rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .8rem 1rem;
}
.phrase-zh { font-weight: 700; font-size: 1.08rem; }
.phrase-ja { color: var(--muted); font-size: .95rem; }

/* ---------- 更多 ---------- */
.menu li { margin-bottom: .6rem; }
.menu a {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: .9rem 1rem; text-decoration: none; color: var(--ink);
}
.menu strong { font-size: 1.12rem; }
.menu span { font-size: .9rem; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.seg button {
  min-height: 3.1rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
  font-weight: 700; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

.field { display: block; margin-bottom: .8rem; }
.field span { display: block; font-weight: 700; margin-bottom: .3rem; }
.field input {
  width: 100%; font: inherit; font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: .6rem .8rem; border: 2px solid var(--navy); border-radius: 12px; background: #fff; color: var(--ink);
}
.field-text input { font-size: 1.3rem; }
.menu button {
  display: flex; flex-direction: column; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem;
}
.field-small { margin-top: 2rem; }
.field-small span { font-weight: 600; color: var(--muted); font-size: .9rem; }
.field-small input { font-size: 1.1rem; border: 1.5px solid var(--line); }
.rate-note { font-size: .9rem; color: var(--muted); margin: -.3rem 0 .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips button {
  min-height: 2.8rem; padding: 0 .9rem; border-radius: 99px; border: 1.5px solid var(--line);
  background: var(--card); font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums;
}
.result { font-size: 1.2rem; margin-top: 1.4rem; }
.result strong { font-size: 2.6rem; color: var(--red); font-variant-numeric: tabular-nums; }

.steps { counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: .5rem 0 .5rem 2.6rem; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: .45rem; width: 1.9rem; height: 1.9rem;
  border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.checks li { border-bottom: 1px solid var(--line); }
.checks label { display: flex; align-items: flex-start; gap: .8rem; padding: .75rem 0; cursor: pointer; }
.checks input { width: 1.5rem; height: 1.5rem; flex: none; margin: .1rem 0 0; accent-color: var(--navy); }
.checks input:checked + span { color: var(--muted); text-decoration: line-through; }
.plain li { padding: .35rem 0 .35rem 1rem; position: relative; }
.plain li::before { content: "・"; position: absolute; left: -.2rem; }

/* ---------- 菜單翻譯：上半照片、下半翻譯 ---------- */
.mt {
  position: fixed; left: 0; right: 0; top: 0; z-index: 4;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; background: var(--paper);
}
.mt-photo {
  flex: 1 1 45%; min-height: 0; overflow: auto; background: #1b1b1b;
  padding-top: env(safe-area-inset-top); -webkit-overflow-scrolling: touch;
}
.mt-canvas { position: relative; width: 100%; overflow: hidden; }
.mt-canvas.is-zoom { width: 180%; }
.mt-canvas img { display: block; width: 100%; }
.mt-box {
  position: absolute; pointer-events: none; border: 3px solid #FFD400; border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
}
.mt-bar {
  flex: none; display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: var(--card); border-block: 1px solid var(--line);
}
.mt-bar .seg-small { margin-right: auto; }
.seg-small { grid-template-columns: repeat(2, auto); gap: 0; }
.seg-small button { min-height: 2.7rem; padding: 0 .9rem; border-radius: 0; }
.seg-small button:first-child { border-radius: 10px 0 0 10px; }
.seg-small button:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.btn-small { min-height: 2.7rem; padding: 0 .9rem; font-size: .95rem; }
.mt-list { flex: 1 1 55%; min-height: 0; overflow: auto; padding: .6rem .75rem 1rem; -webkit-overflow-scrolling: touch; }
.mt-items li { margin-bottom: .5rem; }
.mt-items button {
  display: flex; flex-direction: column; gap: .1rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: .7rem .9rem;
}
.mt-items button.is-on { border-color: var(--navy); background: #EEF3F9; }
.mt-row { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.mt-name { font-weight: 700; font-size: 1.1rem; }
.mt-price { font-weight: 700; color: var(--red); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mt-note { font-size: .92rem; }
.mt-ja { font-size: .85rem; color: var(--muted); }
.mt-status { display: flex; align-items: center; gap: .7rem; padding: 1.2rem .3rem; font-weight: 600; }
.spinner {
  width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--navy);
}
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin .9s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }
label.btn, label.bigbtn { cursor: pointer; }

/* ---------- app 內建相機 ---------- */
.cam {
  position: fixed; inset: 0; z-index: 60; background: #000; color: #fff;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.cam-video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.cam-hint { text-align: center; padding: .6rem 1rem; font-weight: 600; }
.cam-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: .6rem 1rem 1.2rem; }
.cam-bar .btn { justify-self: start; }
.cam-shutter {
  width: 4.8rem; height: 4.8rem; border-radius: 50%; cursor: pointer;
  background: #fff; border: 5px solid #000; box-shadow: 0 0 0 4px #fff;
}
.cam-shutter:disabled { opacity: .4; }
.cam-alt { grid-column: 2 / 4; justify-self: stretch; }

/* ---------- 全螢幕出示卡 ---------- */
.showcard {
  position: fixed; inset: 0; z-index: 50; background: #fff; color: #111;
  display: flex; flex-direction: column;
  padding: calc(1rem + env(safe-area-inset-top)) 1.2rem calc(1rem + env(safe-area-inset-bottom));
}
.showcard-inner { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.showcard-zh { color: #5a5a5a; font-size: 1rem; }
.showcard-ja { font-size: clamp(1.7rem, 7.5vw, 2.6rem); font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.showcard-extra {
  font-size: clamp(1.3rem, 6vw, 1.9rem); font-weight: 700; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
  border: 3px solid var(--red); border-radius: 14px; padding: .8rem 1rem;
}
.showcard-extra.is-phone { font-size: clamp(2rem, 10vw, 3rem); text-align: center; font-variant-numeric: tabular-nums; }
.showcard-actions { display: grid; gap: .6rem; padding-top: 1rem; }
.btn-light { border-color: #111; color: #111; }
.btn-close { background: #111; border-color: #111; color: #fff; }

@media (min-width: 40rem) {
  .hero { border-radius: 0 0 var(--radius) var(--radius); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .pin, .daytab, .bigbtn { transition: transform .08s ease; }
  .btn:active, .pin:active, .daytab:active, .bigbtn:active { transform: scale(.97); }
}
