@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&family=Noto+Serif+TC:wght@700;900&display=swap');

:root {
  --primary: #d63031;
  --primary-dark: #a82324;
  --primary-light: #fff0f0;
  --accent: #e67e22;
  --gold: #fdcb6e;
  --teal: #00b894;
  --blue: #0984e3;
  --purple: #6c5ce7;
  --ink: #1a1a2e;
  --ink-2: #4a4a5a;
  --ink-3: #8a8a9a;
  --line: #ececf0;
  --bg: #f6f7fa;
  --card: #ffffff;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --tab-h: 60px;
  --header-h: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --shadow-card: 0 2px 12px rgba(20, 25, 45, 0.05);
  --shadow-pop: 0 8px 32px rgba(20, 25, 45, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 8px);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.serif, h1, h2 { font-family: 'Noto Serif TC', serif; }

/* ===== 頂部 Header ===== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.app-header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
}
.app-header-back {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 1.3rem;
  margin-left: -8px;
}
.app-header-back:active { background: var(--primary-light); }
.app-header-title {
  flex: 1; font-size: 1.05rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header-sub {
  font-size: 0.72rem; color: var(--ink-3); font-weight: 500;
  margin-top: 1px;
}
.app-header-action {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); font-size: 1.1rem;
}
.app-header-countdown {
  background: var(--primary); color: #fff;
  padding: 6px 12px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700;
  white-space: nowrap;
}

/* ===== Hero（首頁專用）===== */
.hero {
  position: relative;
  margin: 12px 14px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #c0392b 0%, #d63031 40%, #e74c3c 100%);
  color: #fff;
  padding: 28px 22px 26px;
  box-shadow: var(--shadow-pop);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 100% 0%, rgba(253,203,110,0.3), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(255,255,255,0.15), transparent 50%);
  pointer-events: none;
}
.hero-tag {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}
.hero-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.65rem; font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.5px;
}
.hero-title span { color: var(--gold); }
.hero-dates {
  margin-top: 10px; font-size: 0.85rem; opacity: 0.92;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.hero-countdown {
  margin-top: 18px;
  background: rgba(0,0,0,0.22);
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  backdrop-filter: blur(8px);
}
.hero-countdown-num {
  font-family: 'Noto Serif TC', serif;
  font-size: 2.4rem; font-weight: 900;
  color: var(--gold); line-height: 1;
}
.hero-countdown-label {
  font-size: 0.72rem; opacity: 0.8;
  text-transform: uppercase; letter-spacing: 1.5px;
}
.hero-countdown-text {
  font-size: 0.92rem; font-weight: 700;
  margin-top: 2px;
}

/* ===== Section ===== */
.section { padding: 22px 14px 8px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding: 0 4px;
}
.section-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.12rem; font-weight: 900;
  display: flex; align-items: center; gap: 6px;
}
.section-title::before {
  content: ''; width: 4px; height: 16px;
  background: var(--primary); border-radius: 2px;
}
.section-more {
  font-size: 0.78rem; color: var(--ink-3); font-weight: 500;
}

/* ===== Quick Grid (九宮格快速入口) ===== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 6px;
  box-shadow: var(--shadow-card);
}
.quick-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 8px 4px;
  border-radius: 12px;
  transition: background 0.15s;
}
.quick-item:active { background: var(--primary-light); }
.quick-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.quick-icon.blue { background: #e8f3ff; color: var(--blue); }
.quick-icon.teal { background: #e0f8f1; color: var(--teal); }
.quick-icon.gold { background: #fff5e0; color: #b8860b; }
.quick-icon.purple { background: #efeaff; color: var(--purple); }
.quick-icon.accent { background: #fff0e3; color: var(--accent); }
.quick-label { font-size: 0.72rem; color: var(--ink-2); font-weight: 500; }

/* ===== Day swipe (橫向卡片) ===== */
.day-swipe {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px 14px 14px;
  margin: 0 -14px;
  scrollbar-width: none;
}
.day-swipe::-webkit-scrollbar { display: none; }
.day-card {
  flex: 0 0 75%;
  scroll-snap-align: start;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  box-shadow: var(--shadow-card);
  position: relative;
  border-top: 3px solid var(--primary);
}
.day-card.d1 { border-top-color: #6c5ce7; }
.day-card.d2 { border-top-color: #0984e3; }
.day-card.d3 { border-top-color: #00b894; }
.day-card.d4 { border-top-color: #fdcb6e; }
.day-card.d5 { border-top-color: #e67e22; }
.day-card.d6 { border-top-color: #d63031; }
.day-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.day-card-num {
  font-family: 'Noto Serif TC', serif;
  font-size: 0.78rem; font-weight: 900;
  color: var(--primary); letter-spacing: 1px;
}
.day-card-emoji { font-size: 1.4rem; }
.day-card-date {
  font-size: 0.7rem; color: var(--ink-3); font-weight: 500;
  margin-bottom: 6px;
}
.day-card-title {
  font-size: 0.95rem; font-weight: 700;
  line-height: 1.4; margin-bottom: 4px;
}
.day-card-route {
  font-size: 0.76rem; color: var(--ink-2);
  line-height: 1.5;
}

/* ===== Info Stat Cards ===== */
.info-stack {
  display: grid; gap: 10px;
}
.info-row {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-card);
}
.info-row-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.info-row-icon.blue { background: #e8f3ff; color: var(--blue); }
.info-row-icon.teal { background: #e0f8f1; color: var(--teal); }
.info-row-icon.gold { background: #fff5e0; color: #b8860b; }
.info-row-icon.purple { background: #efeaff; color: var(--purple); }
.info-row-body { flex: 1; min-width: 0; }
.info-row-label { font-size: 0.7rem; color: var(--ink-3); font-weight: 600; letter-spacing: 0.5px; }
.info-row-value { font-size: 0.92rem; font-weight: 700; margin-top: 2px; }
.info-row-note { font-size: 0.76rem; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

/* ===== Notice Card (行前必讀) ===== */
.notice-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--primary);
}
.notice-card + .notice-card { margin-top: 10px; }
.notice-card.blue { border-left-color: var(--blue); }
.notice-card.teal { border-left-color: var(--teal); }
.notice-card.gold { border-left-color: var(--gold); }
.notice-card.purple { border-left-color: var(--purple); }
.notice-card.accent { border-left-color: var(--accent); }
.notice-card-lbl { font-size: 0.72rem; font-weight: 700; color: var(--ink-3); letter-spacing: 1px; }
.notice-card-val { font-size: 0.95rem; font-weight: 700; margin-top: 4px; }
.notice-card-note { font-size: 0.78rem; color: var(--ink-2); margin-top: 6px; line-height: 1.55; }

/* ===== Tool Card (好用工具) ===== */
.tool-grid {
  display: grid; gap: 10px;
}
.tool-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.tool-card:active { background: #f8f9fc; }
.tool-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 0.95rem; font-weight: 700; }
.tool-desc { font-size: 0.78rem; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.tool-links {
  display: flex; gap: 6px; flex-shrink: 0;
}
.tool-pill {
  font-size: 0.7rem; font-weight: 600;
  padding: 6px 10px; border-radius: 16px;
  background: var(--primary-light); color: var(--primary);
  white-space: nowrap;
}
.tool-pill.android { background: #e0f8f1; color: var(--teal); }
.tool-pill.web { background: #e8f3ff; color: var(--blue); }

.tool-section-title {
  font-size: 0.78rem; color: var(--ink-3);
  font-weight: 700; letter-spacing: 1px;
  margin: 18px 4px 8px;
  text-transform: uppercase;
}

/* ===== Day Page: Segmented Control ===== */
.day-tabs-wrap {
  position: sticky; top: var(--header-h);
  background: var(--bg);
  z-index: 50;
  padding: 8px 14px 4px;
  margin: 0 -14px;
}
.day-tabs {
  display: flex; gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border-radius: 14px;
  padding: 4px;
  box-shadow: var(--shadow-card);
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex: 1 0 auto;
  min-width: 56px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.78rem; font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all 0.18s;
}
.day-tab .num { font-size: 0.65rem; display: block; color: var(--ink-3); font-weight: 600; }
.day-tab.active {
  background: var(--primary); color: #fff;
}
.day-tab.active .num { color: rgba(255,255,255,0.8); }

/* ===== Day Hero ===== */
.day-hero {
  margin: 12px 14px 0;
  border-radius: var(--radius-lg);
  padding: 22px 20px 24px;
  color: #fff;
  background: linear-gradient(135deg, #2d1b69 0%, #6c5ce7 50%, #1a1a2e 100%);
  box-shadow: var(--shadow-pop);
  position: relative; overflow: hidden;
}
.day-hero.d1 { background: linear-gradient(135deg, #2d1b69, #6c5ce7, #1a1a2e); }
.day-hero.d2 { background: linear-gradient(135deg, #0a3d62, #0984e3, #001a33); }
.day-hero.d3 { background: linear-gradient(135deg, #006266, #00b894, #001f1f); }
.day-hero.d4 { background: linear-gradient(135deg, #b8860b, #fdcb6e, #5d4400); }
.day-hero.d5 { background: linear-gradient(135deg, #a04000, #e67e22, #4a2000); }
.day-hero.d6 { background: linear-gradient(135deg, #a82324, #d63031, #4d0e0f); }
.day-hero-tag {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px; border-radius: 16px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 1px; margin-bottom: 10px;
}
.day-hero-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.5rem; font-weight: 900;
  line-height: 1.3;
}
.day-hero-sub {
  margin-top: 8px; font-size: 0.82rem;
  opacity: 0.9; line-height: 1.6;
}
.day-meta-chips {
  margin-top: 14px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.day-meta-chip {
  background: rgba(255,255,255,0.15);
  padding: 5px 10px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 600;
  backdrop-filter: blur(8px);
}

/* ===== Hotel Banner ===== */
.hotel-bar {
  margin: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--gold);
}
.hotel-bar-icon {
  font-size: 1.6rem; flex-shrink: 0;
}
.hotel-bar-info { flex: 1; min-width: 0; }
.hotel-bar-title { font-size: 0.88rem; font-weight: 700; }
.hotel-bar-sub { font-size: 0.74rem; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.hotel-bar-link {
  font-size: 0.74rem; color: var(--primary);
  font-weight: 700; flex-shrink: 0;
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding: 6px 14px 14px 14px;
}
.timeline-item {
  position: relative;
  padding-left: 100px;
  padding-bottom: 14px;
}
.timeline-item::before {
  content: ''; position: absolute;
  left: 88px; top: 22px; bottom: -2px;
  width: 2px; background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-time {
  position: absolute; left: 0; top: 12px;
  width: 76px; text-align: right;
  font-size: 0.72rem; font-weight: 800;
  color: var(--primary); line-height: 1.25;
  white-space: normal; word-break: keep-all;
}
.timeline-dot {
  position: absolute; left: 83px; top: 14px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
  z-index: 1;
}
.timeline-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  font-size: 0.84rem;
  line-height: 1.6;
}
.timeline-card strong { color: var(--ink); }
.timeline-card small { display: block; color: var(--ink-2); font-size: 0.76rem; margin-top: 2px; }
.tag-ticket {
  display: inline-block;
  background: #fff5e0; color: #8b6914;
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
  margin-left: 4px;
}
.tag-free {
  display: inline-block;
  background: #e0f8f1; color: var(--teal);
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
  margin-left: 4px;
}
.r-link {
  display: inline-flex; align-items: center;
  font-size: 0.72rem; font-weight: 600;
  color: var(--blue);
  padding: 2px 6px; border-radius: 6px;
  background: #f0f5fa;
  margin: 2px 4px 2px 0;
}
.r-link.web { color: var(--primary); background: var(--primary-light); }

/* ===== Attraction Card (景點) ===== */
.attr-list { padding: 4px 14px 12px; display: grid; gap: 14px; }
.attr-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.attr-img {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #ddd, #eee);
  overflow: hidden;
}
.attr-img img { width: 100%; height: 100%; object-fit: cover; }
.attr-img-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
}
.attr-cat {
  display: inline-block;
  background: rgba(255,255,255,0.22);
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.68rem; font-weight: 700;
  backdrop-filter: blur(6px);
  margin-bottom: 4px;
}
.attr-img-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.05rem; font-weight: 900;
  line-height: 1.3;
}
.attr-time-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--primary); color: #fff;
  padding: 4px 10px; border-radius: 12px;
  font-size: 0.7rem; font-weight: 700;
}
.attr-body { padding: 14px 16px 16px; }
.attr-jp { font-size: 0.74rem; color: var(--ink-3); margin-bottom: 8px; }
.attr-desc { font-size: 0.84rem; color: var(--ink-2); line-height: 1.65; }
.attr-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.attr-tag {
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 9px; border-radius: 10px;
  background: #f0f1f5; color: var(--ink-2);
}
.attr-tag.free { background: #e0f8f1; color: var(--teal); }
.attr-tag.must { background: #ffe0e0; color: var(--primary); }
.attr-info-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-size: 0.82rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.attr-info-btn:active { background: #ffd7d7; }

/* ===== Tip Box ===== */
.tip-box {
  margin: 16px 14px;
  background: linear-gradient(135deg, #fff8e1, #fff3d0);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.tip-box-title {
  font-size: 0.92rem; font-weight: 800;
  color: var(--ink); margin-bottom: 6px;
}

/* ===== Food Section ===== */
.food-block {
  margin: 16px 14px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.food-header {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff;
  padding: 14px 16px;
  font-size: 0.95rem; font-weight: 800;
}
.meal-card {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.meal-card:first-of-type { border-top: none; }
.meal-h {
  font-size: 0.85rem; font-weight: 800;
  color: var(--primary);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.meal-where {
  font-size: 0.74rem; color: var(--ink-3);
  margin-bottom: 8px;
}
.meal-list { list-style: none; }
.meal-list li {
  font-size: 0.8rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  line-height: 1.6;
}
.meal-list li:last-child { border-bottom: none; }
.meal-tag {
  display: inline-block;
  font-size: 0.66rem; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
  margin-left: 2px;
  background: #f0f1f5; color: var(--ink-2);
}
.meal-tag.must { background: var(--primary); color: #fff; }
.meal-tag.local { background: #fff5e0; color: #8b6914; }
.meal-tag.budget { background: #e0f8f1; color: var(--teal); }

/* ===== Bottom Nav (D1 → D2) ===== */
.day-nav {
  margin: 16px 14px;
  display: flex; gap: 10px;
}
.day-nav a {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
  text-align: center;
}
.day-nav-lbl { font-size: 0.7rem; color: var(--ink-3); }
.day-nav-val { font-size: 0.9rem; font-weight: 700; color: var(--primary); margin-top: 2px; }

/* ===== Bottom Tab Bar ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--tab-h);
}
.tabbar-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-size: 0.66rem; font-weight: 600;
  color: var(--ink-3);
  position: relative;
}
.tabbar-icon { font-size: 1.4rem; line-height: 1; }
.tabbar-item.active { color: var(--primary); }
.tabbar-item.active::before {
  content: ''; position: absolute; top: 0;
  width: 24px; height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* ===== PWA Install Banner ===== */
.install-banner {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  display: none;
  align-items: center; gap: 12px;
  box-shadow: var(--shadow-pop);
  z-index: 199;
  font-size: 0.84rem;
}
.install-banner.show { display: flex; }
.install-banner-text { flex: 1; line-height: 1.4; }
.install-banner-text small { display: block; opacity: 0.7; font-size: 0.72rem; margin-top: 2px; }
.install-banner button {
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 0.78rem; font-weight: 700;
  white-space: nowrap;
}
.install-banner .close {
  background: transparent; padding: 4px 6px;
  color: rgba(255,255,255,0.6); font-size: 1rem;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.55);
  display: none; align-items: flex-end;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 100%;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 20px calc(28px + var(--safe-bottom));
  position: relative;
  animation: modalSlide 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes modalSlide { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 4px;
  background: var(--line); border-radius: 2px;
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px;
  background: #f0f1f5; border-radius: 50%;
  font-size: 1rem; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.modal-cat {
  font-size: 0.74rem; color: var(--primary);
  font-weight: 700; margin-top: 10px;
}
.modal-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.25rem; font-weight: 900;
  margin-top: 4px;
}
.modal-title-jp { font-size: 0.78rem; color: var(--ink-3); margin-top: 2px; }
.modal-section-lbl {
  font-size: 0.74rem; color: var(--ink-3);
  font-weight: 700; letter-spacing: 0.5px;
  margin: 16px 0 6px;
  display: flex; align-items: center; gap: 4px;
}
.modal-section-lbl::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
  margin-left: 4px;
}
.modal-hl { padding-left: 18px; }
.modal-hl li { font-size: 0.84rem; padding: 4px 0; line-height: 1.6; color: var(--ink-2); }
.modal-desc { font-size: 0.84rem; line-height: 1.75; color: var(--ink-2); white-space: pre-line; }
.modal-ref {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary);
  padding: 8px 14px; border-radius: 10px;
  font-size: 0.8rem; font-weight: 700;
  margin-top: 4px;
}

/* ===== Footer ===== */
.app-footer {
  padding: 24px 14px 16px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--ink-3);
  line-height: 1.7;
}
.app-footer strong { color: var(--ink-2); font-weight: 700; }

/* ===== Coming Soon Stub ===== */
.stub-wrap {
  padding: 40px 24px 24px;
  text-align: center;
}
.stub-icon { font-size: 4rem; margin-bottom: 14px; }
.stub-title { font-size: 1.15rem; font-weight: 800; }
.stub-text { font-size: 0.86rem; color: var(--ink-2); margin-top: 8px; line-height: 1.7; }

/* ===== Edit Modal ===== */
.edit-modal .edit-box { padding-top: 30px; }
.edit-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.2rem; font-weight: 900;
  margin-bottom: 6px;
}
.edit-label {
  display: block;
  font-size: 0.76rem; font-weight: 700;
  color: var(--ink-2);
  margin: 14px 0 6px;
}
.edit-label .req { color: var(--primary); margin-left: 2px; }
.edit-input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fafbfc;
  color: var(--ink);
  -webkit-appearance: none;
}
.edit-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.edit-input.small { font-size: 0.82rem; padding: 9px 11px; margin-top: 8px; }
textarea.edit-input { resize: vertical; line-height: 1.5; }

.edit-photo-wrap {
  background: #fafbfc;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
}
.edit-photo-preview {
  display: none;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #ddd;
}
.edit-photo-actions { display: flex; gap: 8px; }
.edit-pill {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem; font-weight: 700;
  text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.edit-pill.ghost {
  background: #f0f1f5; color: var(--ink-2);
}
.edit-pill:active { transform: scale(0.96); }
.edit-status {
  font-size: 0.76rem;
  color: var(--ink-3);
  margin-top: 8px;
  min-height: 1.2em;
}

.edit-details {
  margin-top: 16px;
  background: #fafbfc;
  border-radius: 10px;
  padding: 4px 12px 12px;
}
.edit-details summary {
  font-size: 0.84rem; font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
}
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details summary::before { content: '▸ '; }
.edit-details[open] summary::before { content: '▾ '; }

.edit-actions {
  display: flex; gap: 10px;
  margin-top: 22px;
}
.edit-btn {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  font-size: 0.92rem; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.edit-btn.primary { background: var(--primary); color: #fff; }
.edit-btn.ghost { background: #f0f1f5; color: var(--ink-2); }
.edit-btn:active { transform: scale(0.97); }
.edit-btn:disabled { opacity: 0.5; cursor: wait; }
.edit-error {
  font-size: 0.82rem;
  color: var(--primary);
  margin-top: 10px;
  min-height: 1.2em;
  text-align: center;
}

/* ===== Attraction card extras ===== */
.attr-edit-btn {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 50%;
  font-size: 0.95rem;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 2;
  cursor: pointer;
  border: none;
}
.attr-edit-btn:active { transform: scale(0.92); }

.attr-maps-btn {
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: #4285F4;
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.82rem; font-weight: 700;
}
.attr-maps-btn:active { transform: scale(0.97); }

.attr-add-btn {
  width: calc(100% - 28px);
  margin: 4px 14px 16px;
  padding: 14px;
  background: var(--card);
  color: var(--primary);
  border-radius: 14px;
  font-size: 0.9rem; font-weight: 700;
  border: 2px dashed var(--primary);
  cursor: pointer;
  font-family: inherit;
}
.attr-add-btn:active { background: var(--primary-light); }

.api-banner {
  margin: 10px 14px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff5e0;
  border-left: 4px solid var(--gold);
  font-size: 0.78rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.api-banner.ok {
  background: #e0f8f1;
  border-left-color: var(--teal);
}
.api-banner small { display: block; color: var(--ink-3); font-size: 0.72rem; margin-top: 2px; }

.attr-loading {
  padding: 30px 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.86rem;
}

/* ===== Edit modal hint text ===== */
.edit-hint {
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.6;
}
.edit-hint code {
  background: #f0f1f5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: 'SFMono-Regular', Menlo, monospace;
  color: var(--primary);
}

/* ===== Timeline edit pencil ===== */
.timeline-card { position: relative; }
.timeline-edit-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #f0f1f5; color: var(--ink-2);
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 2;
}
.timeline-edit-btn:active { transform: scale(0.92); background: var(--primary-light); }

.timeline-card.has-edit { padding-right: 40px; }

/* Markdown link rendered in content */
.timeline-card a.md-link {
  display: inline-flex; align-items: center;
  font-size: 0.78rem; font-weight: 600;
  color: var(--blue);
  padding: 1px 6px; border-radius: 6px;
  background: #f0f5fa;
  margin: 0 2px;
}

/* Timeline Premium Layout (Photo on right, Map link at bottom) */
.timeline-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}
.timeline-card-body {
  flex: 1;
  min-width: 0;
}
.timeline-photo-wrap {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  background: var(--line);
}
.timeline-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}
.timeline-photo-wrap img:active {
  transform: scale(0.95);
}
.timeline-maps {
  margin-top: 6px;
}
.timeline-maps-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  background: #e8f3ff;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
}
.timeline-maps-link:active {
  background: #d0e7ff;
}

/* ===== Tablet / Desktop fallback ===== */
@media (min-width: 768px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 40px rgba(0,0,0,0.08); min-height: 100vh; background: var(--bg); }
  .tabbar, .install-banner { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .install-banner { left: calc(50% - 228px); transform: none; right: auto; width: 456px; }
}
