:root {
  --cream: #F4EEE3;
  --paper: #FBF8F2;
  --sand: #E7DCCB;
  --line: #D9CBB5;
  --espresso: #2E2019;
  --coffee: #4A3427;
  --mocha: #7A5E4B;
  --muted: #9A8574;
  --gold: #A9814F;

  --serif-en: "Cormorant Garamond", "Times New Roman", serif;
  --serif-tc: "Noto Serif TC", "Songti TC", serif;
  --sans-tc: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;

  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 1px 2px rgba(46, 32, 25, .04), 0 8px 24px rgba(46, 32, 25, .06);
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--espresso);
  font-family: var(--sans-tc);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}
button { font: inherit; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}

/* ---------- Masthead ---------- */
.masthead { padding: 8px 22px 18px; text-align: center; }
.masthead-top {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px; margin-bottom: 22px;
}
.kicker {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--mocha);
}
.share-btn {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 14px; font-size: 12px; letter-spacing: .15em; color: var(--coffee);
  cursor: pointer;
}
.share-btn:active { background: var(--sand); }
.trip-title {
  font-family: var(--serif-tc);
  font-weight: 600;
  font-size: 32px;
  letter-spacing: .12em;
  margin: 0;
  color: var(--espresso);
}
.trip-sub {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: .35em;
  color: var(--mocha);
}
.trip-dates {
  margin: 4px 0 0;
  font-family: var(--serif-en); font-size: 17px; letter-spacing: .14em; color: var(--coffee);
}
.demo-note {
  display: inline-block;
  margin: 14px 0 0;
  padding: 3px 12px;
  border: 1px dashed var(--gold);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gold);
}

/* ---------- Date strip ---------- */
.date-strip {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: 10px 8px;
  background: rgba(244, 238, 227, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.strip-arrow {
  flex: none; width: 30px; height: 52px;
  border: none; background: none; cursor: pointer;
  font-family: var(--serif-en); font-size: 28px; color: var(--mocha);
}
.strip-arrow:disabled { opacity: .25; cursor: default; }
.date-scroller {
  flex: 1;
  display: flex; gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px;
}
.date-scroller::-webkit-scrollbar { display: none; }
.date-chip {
  flex: none;
  scroll-snap-align: center;
  width: 52px;
  padding: 8px 0 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.15;
  transition: background .2s, color .2s, border-color .2s;
}
.date-chip .wk { display: block; font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.date-chip .dd { display: block; font-family: var(--serif-en); font-size: 24px; font-weight: 500; margin: 2px 0; }
.date-chip.is-today { border-color: var(--gold); }
.date-chip.is-active { background: var(--coffee); color: var(--paper); }
.date-chip.is-active .wk { color: var(--sand); }

/* ---------- Day view ---------- */
.day-view { padding: 22px 16px 0; touch-action: pan-y; }
.day-view.is-entering { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 22px 22px;
  overflow: hidden;
}
.hero::after {
  content: attr(data-num);
  position: absolute; right: 14px; top: -14px;
  font-family: var(--serif-en); font-style: italic; font-weight: 400;
  font-size: 120px; line-height: 1;
  color: var(--sand); opacity: .7;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow {
  display: flex; gap: 10px; align-items: center;
  font-family: var(--serif-en); font-size: 14px; letter-spacing: .14em;
  color: var(--gold); text-transform: uppercase;
}
.hero-eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold); }
.hero-date {
  margin: 10px 0 2px;
  font-family: var(--serif-tc); font-size: 15px; color: var(--mocha); letter-spacing: .08em;
}
.hero-city {
  margin: 0;
  font-family: var(--serif-tc); font-weight: 700; font-size: 34px; letter-spacing: .1em;
}
.hero-theme {
  margin: 4px 0 0;
  font-family: var(--serif-tc); font-size: 16px; color: var(--coffee);
}
.hero-route {
  margin: 18px 0 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px; letter-spacing: .06em; color: var(--mocha);
}

.facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.fact { padding: 14px 8px; text-align: center; }
.fact + .fact { border-left: 1px solid var(--sand); }
.fact-label { font-size: 10px; letter-spacing: .2em; color: var(--muted); }
.fact-value {
  margin-top: 2px;
  font-family: var(--serif-tc); font-size: 14px; font-weight: 500; color: var(--coffee);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fact-value .num { font-family: var(--serif-en); font-size: 22px; font-weight: 500; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 30px 6px 12px;
}
.section-title {
  margin: 0;
  font-family: var(--serif-tc); font-size: 18px; font-weight: 600; letter-spacing: .12em;
}
.section-title em {
  font-family: var(--serif-en); font-weight: 400; font-size: 15px;
  color: var(--muted); margin-left: 8px; letter-spacing: .04em;
}
.link-more {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12px; letter-spacing: .1em; color: var(--gold);
}

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.stop {
  display: grid; grid-template-columns: 54px 1fr; gap: 0 12px;
  position: relative;
}
.stop-time {
  padding-top: 16px;
  font-family: var(--serif-en); font-size: 18px; font-weight: 500;
  text-align: right; color: var(--coffee);
}
.stop-card {
  position: relative;
  margin: 0 0 10px 14px;
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stop-card::before { /* timeline rail */
  content: ""; position: absolute; left: -15px; top: 0; bottom: -10px;
  width: 1px; background: var(--line);
}
.stop:last-child .stop-card::before { bottom: 50%; }
.stop:first-child .stop-card::before { top: 22px; }
.stop-card::after { /* node */
  content: ""; position: absolute; left: -19px; top: 22px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cream); border: 1px solid var(--gold);
}
.stop[data-type="景點"] .stop-card::after { background: var(--gold); }
.stop-type {
  font-size: 10px; letter-spacing: .25em; color: var(--gold);
}
.stop-title {
  margin: 2px 0 8px;
  font-family: var(--serif-tc); font-size: 17px; font-weight: 600; letter-spacing: .04em;
}
.stop-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 11px; color: var(--mocha);
  background: var(--cream); border-radius: 999px; padding: 2px 10px;
}
.stop-note {
  margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--sand);
  font-size: 12px; color: var(--mocha);
}

.stay-card {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--coffee); color: var(--paper);
}
.stay-label { font-size: 10px; letter-spacing: .25em; color: var(--sand); }
.stay-name { font-family: var(--serif-tc); font-size: 15px; margin-top: 2px; }
.stay-ico { font-family: var(--serif-en); font-style: italic; font-size: 22px; color: var(--sand); }

.swipe-hint {
  margin: 18px 0 0; text-align: center;
  font-family: var(--serif-en); font-style: italic; font-size: 13px; color: var(--muted);
}

.colophon {
  margin: 30px 22px 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--serif-en); font-style: italic; font-size: 13px; color: var(--muted);
  letter-spacing: .08em;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom);
  background: rgba(251, 248, 242, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: 11px; letter-spacing: .12em; line-height: 1;
  color: var(--muted); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s;
}
.tab-ico {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 30px; border-radius: 999px;
  transition: background .2s;
}
.tab-ico svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.tab.is-active { color: var(--espresso); font-weight: 500; }
.tab.is-active .tab-ico { background: var(--sand); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  transform: translate(-50%, 10px);
  background: var(--espresso); color: var(--paper);
  padding: 8px 18px; border-radius: 999px;
  font-size: 13px; letter-spacing: .06em;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 20; white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .day-view.is-entering { animation: none; }
}

/* =========================================================
   Phase 1 · 結構化頁面與編輯功能
   ========================================================= */
.page.is-entering { animation: fadeUp .3s ease both; }
body.is-locked { overflow: hidden; }
a { color: inherit; }

/* Cover facts */
.facts-cover { margin: 0 16px 16px; }

/* Segmented control */
.seg {
  display: flex; gap: 4px;
  margin: 0 16px 14px; padding: 4px;
  background: var(--sand); border-radius: 999px;
}
.seg-btn, .seg-opt span {
  flex: 1; display: block;
  border: none; background: none; cursor: pointer;
  padding: 7px 0; border-radius: 999px;
  font-size: 13px; letter-spacing: .12em; text-align: center; color: var(--mocha);
  transition: background .2s, color .2s;
}
.seg-btn.is-active, .seg-opt input:checked + span {
  background: var(--paper); color: var(--espresso); font-weight: 500;
  box-shadow: 0 1px 3px rgba(46, 32, 25, .1);
}
.seg-opt { flex: 1; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--gold); }
.seg-sm { margin: 0; }
.seg-sm .seg-btn, .seg-sm .seg-opt span { padding: 6px 14px; font-size: 12px; white-space: nowrap; }


/* Hero as link */
.hero-link { display: block; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.hero-link:active { transform: scale(.995); }
.hero-city.is-empty { color: var(--muted); font-weight: 500; }
.hero-route { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hero-go { flex: none; font-size: 12px; letter-spacing: .1em; color: var(--gold); }
.link-more { text-decoration: none; }

/* Quick links */
.quick-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.home-section { padding: 0 16px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 6px 14px;
  background: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow);
  text-decoration: none; color: var(--espresso);
  -webkit-tap-highlight-color: transparent;
}
.quick:active { background: var(--sand); }
.quick-ico { font-size: 20px; color: var(--gold); line-height: 1.2; }
.quick-name { font-family: var(--serif-tc); font-size: 14px; font-weight: 600; letter-spacing: .08em; }
.quick-en { font-family: var(--serif-en); font-style: italic; font-size: 12px; color: var(--muted); }

/* Status badges */
.badge {
  flex: none;
  font-size: 10px; letter-spacing: .12em; line-height: 1;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.badge-confirmed { background: var(--coffee); color: var(--paper); }
.badge-tentative { border: 1px solid var(--gold); color: var(--gold); }
.badge-tbd { border: 1px dashed var(--muted); color: var(--muted); }

.stop-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stop-card.is-tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stop-card.is-tappable:active { background: #F7F1E7; }
.reorder { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.more-row {
  display: block; margin: 2px 0 0 80px; padding: 10px 0;
  font-size: 12px; letter-spacing: .1em; color: var(--gold); text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; letter-spacing: .08em; cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--coffee); color: var(--paper); }
.btn-primary:active { background: var(--espresso); }
.btn-ghost { background: var(--paper); border-color: var(--line); color: var(--coffee); }
.btn-ghost.is-on { background: var(--sand); }
.btn-danger { background: #8C3B2E; color: #FBF8F2; }
.btn-danger-ghost { background: none; border-color: #C9A39A; color: #8C3B2E; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--coffee);
  font-size: 15px; cursor: pointer;
}
.icon-btn:disabled { opacity: .3; cursor: default; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 14px; }

/* Empty / hint */
.empty {
  margin: 4px 0 0; padding: 28px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius-md);
  text-align: center; color: var(--mocha); font-size: 14px;
}
.empty p { margin: 0 0 14px; }
.empty p:last-child { margin: 0; }
.empty-inline { margin: 0 16px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 12px; }

/* View header */
.view-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 8px 22px 16px;
}
.view-title {
  margin: 0; font-family: var(--serif-tc); font-size: 26px; font-weight: 600; letter-spacing: .1em;
}
.view-title em {
  font-family: var(--serif-en); font-weight: 400; font-size: 16px;
  color: var(--muted); margin-left: 10px; letter-spacing: .04em;
}
.back { flex-basis: 100%; font-size: 13px; color: var(--gold); text-decoration: none; letter-spacing: .08em; }

/* Region view */
.filter-row {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 0 16px 10px;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 13px; letter-spacing: .08em; color: var(--mocha); cursor: pointer;
}
.chip-sm { padding: 4px 12px; font-size: 12px; }
.chip.is-active { background: var(--coffee); border-color: var(--coffee); color: var(--paper); }
.region { margin-bottom: 26px; }
.region-country {
  margin: 0 0 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-family: var(--serif-tc); font-size: 20px; letter-spacing: .12em;
}
.region-country em { font-family: var(--serif-en); font-weight: 400; font-size: 15px; color: var(--muted); margin-left: 8px; }
.region-city {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 16px 4px 8px; font-family: var(--serif-tc); font-size: 15px; color: var(--coffee); letter-spacing: .08em;
}
.region-city span { font-family: var(--sans-tc); font-size: 11px; color: var(--muted); }
.region-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.region-list li + li { border-top: 1px solid var(--sand); }
.region-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; }
.region-date { flex: none; width: 64px; font-size: 12px; color: var(--mocha); line-height: 1.3; }
.region-date small { display: block; font-family: var(--serif-en); font-size: 14px; color: var(--muted); }
.region-title { flex: 1; font-family: var(--serif-tc); font-size: 15px; }

/* More menu */
.account-card {
  padding: 18px 20px; border-radius: var(--radius-md);
  background: var(--coffee); color: var(--paper);
}
.account-name { font-family: var(--serif-tc); font-size: 18px; letter-spacing: .1em; }
.account-note { font-size: 12px; color: var(--sand); margin-top: 2px; }
.menu-head { margin: 26px 6px 10px; font-family: var(--serif-tc); font-size: 15px; letter-spacing: .14em; color: var(--mocha); }
.menu {
  list-style: none; margin: 14px 0 0; padding: 0;
  background: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.menu li + li { border-top: 1px solid var(--sand); }
.menu-item {
  display: flex; flex-direction: column; width: 100%;
  padding: 14px 40px 14px 18px; position: relative;
  border: none; background: none; text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item::after { content: "›"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-family: var(--serif-en); font-size: 22px; color: var(--muted); }
.menu-item span { font-family: var(--serif-tc); font-size: 15px; letter-spacing: .06em; }
.menu-item small { font-size: 12px; color: var(--muted); }

/* Log / trash */
.log { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.log-item { padding: 12px 16px; }
.log-item + .log-item { border-top: 1px solid var(--sand); }
.log-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.log-top { display: flex; justify-content: space-between; align-items: center; }
.log-action { font-size: 10px; letter-spacing: .2em; color: var(--gold); }
.log-delete { color: #8C3B2E; }
.log-time { font-family: var(--serif-en); font-size: 14px; color: var(--muted); }
.log-summary { font-family: var(--serif-tc); font-size: 14px; margin-top: 2px; }
.log-user { font-size: 11px; color: var(--muted); }

/* Placeholder */
.soon-card {
  padding: 34px 24px; text-align: center;
  background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.soon-phase { font-size: 11px; letter-spacing: .25em; color: var(--gold); }
.soon-card h2 { margin: 6px 0 8px; font-family: var(--serif-tc); font-size: 22px; letter-spacing: .14em; }
.soon-card p { margin: 0; font-size: 13px; color: var(--mocha); }

/* Bottom sheet */
.sheet-root { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(46, 32, 25, .35); opacity: 0; transition: opacity .22s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--cream); border-radius: 24px 24px 0 0;
  transform: translateY(100%); transition: transform .22s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-root.is-open .sheet-backdrop { opacity: 1; }
.sheet-root.is-open .sheet { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px 8px; }
.sheet-title { margin: 0; font-family: var(--serif-tc); font-size: 19px; letter-spacing: .1em; }
.sheet-body { overflow-y: auto; padding: 6px 20px 20px; -webkit-overflow-scrolling: touch; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.field-row { display: flex; gap: 10px; }
.label { font-size: 11px; letter-spacing: .18em; color: var(--mocha); }
.form input:not([type=radio]):not([type=checkbox]), .form select, .form textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  font: inherit; font-size: 16px; color: var(--espresso); /* 16px 避免 iOS 自動放大 */
  -webkit-appearance: none; appearance: none;
}
.form select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mocha) 50%), linear-gradient(135deg, var(--mocha) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169, 129, 79, .15); }
.form :disabled { opacity: .75; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--coffee); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--coffee); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.form-actions .btn-primary { flex: 1; }

/* Dialog */
.dialog-root { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog-root[hidden] { display: none; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(46, 32, 25, .45); }
.dialog {
  position: relative; width: 100%; max-width: 340px;
  background: var(--paper); border-radius: var(--radius-lg); padding: 22px 20px 16px;
  box-shadow: 0 20px 50px rgba(46, 32, 25, .25);
}
.dialog-msg { margin: 0 0 18px; white-space: pre-line; font-size: 15px; line-height: 1.7; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

/* =========================================================
   Phase 2 · 登入畫面與帳號
   ========================================================= */
body.is-auth .tabbar { display: none; }
body.is-auth { background: #E9DCC4; }
body.is-auth .app { padding: 0; }

/* ---------- 登入畫面：復古旅行手札（背景圖 img/login-bg.webp） ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: #EFE5D3 url("../img/login-bg.webp") center top / cover no-repeat;
}
.auth-hero {
  flex: 1;
  display: flex; align-items: flex-start;
  min-height: 300px;
  padding: calc(env(safe-area-inset-top) + 27vh) 0 18px; /* 實際上方距離由 fitTitle() 依背景比例計算 */
}
.auth-cover {
  width: 100%;
  padding: 0 20px;
  text-align: center;
}
.auth-title {
  margin: 0;
  font-family: var(--serif-en); font-weight: 500;
  font-size: 58px; line-height: .95; letter-spacing: -.005em;
  color: var(--espresso);
}
.auth-sub {
  margin: 14px 0 0;
  font-family: var(--serif-en); font-size: 16px; letter-spacing: .05em; color: var(--coffee);
  white-space: nowrap;
}
.auth-dates {
  margin: 4px 0 0;
  font-family: var(--serif-en); font-size: 15px; letter-spacing: .12em; color: var(--coffee);
  white-space: nowrap;
}

.auth-card {
  position: relative; z-index: 3;
  flex: none;
  margin: 0 12px;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(251, 248, 242, .92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 30px rgba(46, 32, 25, .14);
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-card-title {
  margin: 2px 0 0; font-family: var(--serif-tc); font-size: 20px; font-weight: 600; letter-spacing: .14em;
}
.auth-note { margin: 0 0 4px; font-size: 13px; line-height: 1.7; color: var(--mocha); }

.jfield {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px 10px 16px;
  background: #F6EFE3;
  border: 1px solid var(--line); border-radius: 18px;
  transition: border-color .2s, box-shadow .2s;
}
.jfield:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169, 129, 79, .14); }
.jfield-ico { flex: none; display: flex; color: var(--coffee); }
.jfield-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jfield-label { font-size: 13px; letter-spacing: .08em; color: var(--coffee); }
.jfield input {
  width: 100%; border: none; background: none; padding: 2px 0 0; outline: none;
  font: inherit; font-size: 16px; color: var(--espresso);
}
.jfield input::placeholder { color: var(--muted); font-size: 14px; }
.jfield-btn {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none; background: none; border-radius: 50%;
  color: var(--mocha); cursor: pointer;
}
.jfield-btn:active { background: var(--sand); }
.lucide {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.auth-submit { min-height: 54px; margin-top: 4px; font-size: 16px; letter-spacing: .14em; }
.auth-row { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 0; }
.jcheck { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--coffee); cursor: pointer; }
.jcheck input { position: absolute; opacity: 0; pointer-events: none; }
.jcheck-box {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: 1.5px solid var(--coffee); border-radius: 5px;
  color: transparent; transition: background .15s, color .15s;
}
.jcheck-box .lucide { width: 14px; height: 14px; stroke-width: 2.4; }
.jcheck input:checked + .jcheck-box { background: var(--coffee); color: var(--paper); }
.jcheck input:focus-visible + .jcheck-box { outline: 2px solid var(--gold); outline-offset: 2px; }
.auth-link {
  background: none; border: none; padding: 8px 4px; cursor: pointer;
  font-size: 14px; letter-spacing: .06em; color: var(--mocha);
}
.auth-link-center { align-self: center; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 40px 6px; color: var(--gold); }
.auth-divider span { flex: 1; height: 1px; background: var(--line); }
.auth-divider i { font-style: normal; font-size: 10px; }
.auth-foot { margin: 0; text-align: center; font-size: 12px; letter-spacing: .2em; color: var(--muted); }

.auth-msg { margin: -2px 4px 0; font-size: 13px; color: #8C3B2E; }
.auth-msg:empty { display: none; }

@media (min-width: 481px) {
  .auth { max-width: 480px; margin: 0 auto; box-shadow: 0 0 40px rgba(46, 32, 25, .12); }
}
@media (max-width: 350px) {
  .auth-title { font-size: 48px; }
  .auth-cover { padding: 0 12px; }
  .auth-sub { font-size: 14px; }
}
@media (max-height: 700px) {
  .auth-hero { padding-bottom: 16px; }
  .auth-title { font-size: 48px; }
}
.pw-wrap { position: relative; display: block; }
.form .pw-wrap input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: none; padding: 8px 10px; cursor: pointer;
  font-size: 12px; letter-spacing: .1em; color: var(--gold);
}

.account-role {
  margin-left: 10px; padding: 2px 10px; vertical-align: 3px;
  border: 1px solid rgba(231, 220, 203, .5); border-radius: 999px;
  font-family: var(--sans-tc); font-size: 11px; letter-spacing: .14em; color: var(--sand);
}
.menu-item-quiet span { color: #8C3B2E; }
