/* ============================================================
   東京散步手帖 · App 版
   沿用 ../styles.css 的繪本 tokens 與元件，
   這裡只做「電話 App」外殼、分頁、底部導覽與少量覆寫。
   ============================================================ */

html, body {
  height: 100%;
  scroll-behavior: auto;
}

body {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #F3EDE2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='2' cy='2' r='1.1' fill='%233E3A39' fill-opacity='0.07'/%3E%3C/svg%3E");
}

/* 手機外殼：真手機全屏，桌面變一台繪本風手機 */
.phone {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
  isolation: isolate;
}

@media (min-width: 640px) {
  body { padding: 24px; }
  body::before,
  body::after {
    content: "";
    position: fixed;
    z-index: 0;
    border: var(--line);
    border-radius: 50%;
    pointer-events: none;
  }
  body::before {
    width: 168px;
    height: 168px;
    left: 7vw;
    top: 12vh;
    background: var(--aqua-soft);
  }
  body::after {
    width: 116px;
    height: 116px;
    right: 9vw;
    bottom: 11vh;
    background: var(--coral-soft);
  }
  .phone {
    z-index: 1;
    width: 414px;
    height: min(860px, calc(100dvh - 48px));
    border: var(--line);
    border-radius: 40px;
    box-shadow: 10px 10px 0 var(--ink);
  }
}

/* ---------- 頂部 App Bar ---------- */
.appbar {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(9px + env(safe-area-inset-top)) 13px 9px;
  border-bottom: var(--line);
  background: var(--paper);
}
.appbar__mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: var(--line);
  border-radius: 10px;
  background: var(--coral);
  box-shadow: var(--shadow-sm);
  transform: rotate(-4deg);
}
.appbar__mark .icon { width: 17px; height: 17px; }
.appbar__title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: 12.5px;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar__title small {
  font-size: 8.5px;
  letter-spacing: .1em;
  opacity: .78;
  margin-top: 2px;
}
.appbar__install {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  font-size: 10.5px;
  line-height: 1.5;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow-soft);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  cursor: pointer;
}
.appbar__install .icon { width: 12px; height: 12px; }
.appbar__install:active { transform: translate(1px, 1px); box-shadow: none; }
.standalone .appbar__install,
.standalone .install-banner { display: none !important; }

/* ---------- 螢幕容器 ---------- */
.screens {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  position: relative;
  scrollbar-width: none;
}
.screens::-webkit-scrollbar { display: none; }

.screen {
  display: none;
  padding: 14px 14px 30px;
}
.screen.is-active {
  display: block;
  animation: screen-in .38s var(--ease-bounce) both;
}
.sheet-open .screens { overflow: hidden; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 首頁 ---------- */
.app-hero {
  margin-bottom: 14px;
  overflow: hidden;
}
.app-hero__art {
  background: var(--paper);
  border-bottom: var(--line);
}
.app-hero__art svg {
  display: block;
  width: 100%;
  height: auto;
}
.app-hero__body { padding: 15px 15px 14px; }
.app-hero .eyebrow { margin-bottom: 6px; }
.app-hero h1 {
  font-size: 30px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: .02em;
  margin: 0 0 8px;
}
.app-hero__lead {
  font-size: 12px;
  line-height: 1.85;
  opacity: .8;
  margin-bottom: 11px;
}

.countdown { margin-bottom: 14px; }

.shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}
.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 3px 8px;
  background: #fff;
  border: var(--line);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: center;
  cursor: pointer;
  transition: transform .12s var(--ease-bounce), box-shadow .12s;
}
.shortcut:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.shortcut__icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 9px;
  margin-bottom: 2px;
}
.shortcut__icon .icon { width: 15px; height: 15px; }
.shortcut__icon--coral { background: var(--coral); }
.shortcut__icon--yellow { background: var(--yellow); }
.shortcut__icon--green { background: var(--green); }
.shortcut__icon--aqua { background: var(--aqua); }
.shortcut__label {
  font-size: 10.5px;
  line-height: 1.45;
  white-space: nowrap;
}
.shortcut small { display: none; }

.panel {
  padding: 12px 14px 11px;
  margin-bottom: 14px;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.panel__head h2 {
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: .05em;
}
.panel__tag {
  font-size: 7.5px;
  letter-spacing: .14em;
  line-height: 1.7;
  padding: 0 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow-soft);
}
.summary li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 0;
  font-size: 11.5px;
  line-height: 1.65;
  border-bottom: 2px dashed color-mix(in srgb, var(--ink) 16%, var(--paper));
}
.summary li:last-child { border-bottom: 0; padding-bottom: 1px; }
.summary .icon { width: 13px; height: 13px; margin-top: 3px; }
.summary b { font-weight: 400; }
.summary em {
  margin-left: auto;
  max-width: 62%;
  text-align: right;
  font-style: normal;
  opacity: .85;
}

.install-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  margin-bottom: 14px;
  border: var(--line);
  border-radius: 16px;
  background: var(--aqua-soft);
  box-shadow: 3px 3px 0 var(--ink);
  text-align: left;
  cursor: pointer;
}
.install-banner:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.install-banner__icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--aqua);
}
.install-banner__icon .icon { width: 15px; height: 15px; }
.install-banner__text { display: flex; flex-direction: column; line-height: 1.4; }
.install-banner__text strong { font-size: 12px; font-weight: 400; }
.install-banner__text small { font-size: 9.5px; opacity: .78; }
.install-banner__arrow { width: 16px; height: 16px; margin-left: auto; }

.app-foot {
  text-align: center;
  font-size: 9.5px;
  line-height: 1.8;
  opacity: .72;
  padding: 2px 0 4px;
}
.app-foot a {
  color: inherit;
  text-underline-offset: 2px;
}

/* ---------- 共用螢幕標題 ---------- */
.screen-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 13px;
}
.screen-head .sec-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-3deg);
}
.screen-head .sec-mark .icon { width: 19px; height: 19px; }
.screen-head .sec-kicker {
  font-size: 8px;
  letter-spacing: .2em;
  margin-bottom: 0;
}
.screen-head h2 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: .02em;
}
.screen-head__count {
  margin-left: auto;
  font-size: 9.5px;
  line-height: 1.7;
  padding: 1px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  white-space: nowrap;
}

/* ---------- 行程 ---------- */
.daytabs {
  gap: 5px;
  margin-inline: 0;
  padding: 2px 2px 12px;
  max-width: none;
}
.daytab {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px 7px;
  border-radius: 13px;
  box-shadow: 2.5px 2.5px 0 var(--ink);
}
.daytab__label { font-size: 7.5px; letter-spacing: .08em; }
.daytab__date { font-size: 14.5px; }
.daytab__week { font-size: 9px; }
.daytab[aria-selected="true"] { box-shadow: 3px 4px 0 var(--ink); }
.day-panel { min-height: 0; }

.dayhead h3 { font-size: 17px; }
.dayhead__area { font-size: 9.5px; }
.tl-card { padding: 11px 12px 12px; }
.tl-head h4 { font-size: 14px; }
.tl-desc { font-size: 12px; }
.tl-time { font-size: 11px; }
.swipe-hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 9.5px;
  line-height: 1.7;
  letter-spacing: .06em;
  opacity: .75;
}

/* ---------- 航班 ---------- */
.flights {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 13px;
}
.flight { border-radius: 20px; }
.mini-tip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 9px 11px;
  font-size: 10.5px;
  line-height: 1.7;
  background: var(--yellow-soft);
  border-style: dashed;
  box-shadow: none;
}
.mini-tip .icon { width: 13px; height: 13px; margin-top: 3px; }

/* ---------- 住宿 ---------- */
.hotel {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}
.hotel__art {
  display: block;
  border-right: 0;
  border-bottom: var(--line);
  padding: 12px;
}
.hotel__body { padding: 16px 15px 15px; }
.hotel__body h3 { font-size: 21px; }
.hotel__facts { margin: 12px 0 10px; }
.stay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}
.stay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.5;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.stay-btn .icon { width: 13px; height: 13px; }
.stay-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- 清單 ---------- */
.segmented {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px 0 9px;
  margin-bottom: 2px;
  background: var(--paper);
}
.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  font-size: 11px;
  line-height: 1.5;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.seg[data-list-tab="todo"] { --seg: var(--coral); }
.seg[data-list-tab="pre"] { --seg: var(--aqua); }
.seg[data-list-tab="pack"] { --seg: var(--green); }
.seg[aria-selected="true"] {
  background: var(--seg);
  transform: translateY(-1px);
}
.seg__badge {
  font-size: 8px;
  line-height: 1.6;
  padding: 0 4px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
.list-pane .panel { margin-bottom: 0; padding: 13px 13px 12px; }
.list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.list-top h3 {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.list-top__count {
  font-size: 9.5px;
  opacity: .8;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.list-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}
.list-done { font-size: 9.5px; }
.pack-groups {
  grid-template-columns: 1fr;
  gap: 10px;
}
.pack-group { padding: 8px 10px 5px; }
.pack-group__head h4 { font-size: 11.5px; }
.pack-group .check { font-size: 11.5px; }
.footnote { font-size: 10px; }

/* ---------- 底部導覽 ---------- */
.tabbar {
  flex: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  border-top: var(--line);
  background: var(--paper);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 0 1px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
}
.tab__icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 10px;
  transition: background-color .15s, border-color .15s, transform .15s var(--ease-bounce);
}
.tab__icon .icon { width: 19px; height: 19px; }
.tab[data-tab="home"] { --accent: var(--coral); }
.tab[data-tab="itinerary"] { --accent: var(--aqua); }
.tab[data-tab="flights"] { --accent: var(--yellow); }
.tab[data-tab="stay"] { --accent: var(--green); }
.tab[data-tab="lists"] { --accent: var(--coral); }
.tab[aria-current="page"] .tab__icon {
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transform: translateY(-1px);
}
.tab:active .tab__icon { transform: scale(.9); }

/* ---------- 安裝說明 / Toast ---------- */
.sheet {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
}
.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  animation: fade-in .22s ease both;
}
.sheet__panel {
  position: relative;
  width: 100%;
  max-height: 82%;
  overflow-y: auto;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: var(--line);
  border-radius: 24px 24px 0 0;
  animation: sheet-up .32s var(--ease-bounce) both;
}
.sheet__handle {
  display: block;
  width: 38px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: var(--ink);
  opacity: .22;
}
.sheet__panel h2 {
  font-size: 18px;
  font-weight: 400;
  letter-spacing: .02em;
  margin-bottom: 3px;
}
.sheet__panel p {
  font-size: 11.5px;
  line-height: 1.75;
  opacity: .8;
  margin-bottom: 9px;
}
.sheet__panel ol {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.sheet__panel li {
  font-size: 11px;
  line-height: 1.7;
  padding: 7px 9px;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: #fff;
}
.sheet__panel strong { font-weight: 400; }
.sheet__close {
  width: 100%;
  padding: 9px;
  border: var(--line);
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  cursor: pointer;
}
.sheet__close:active { transform: translate(2px, 2px); box-shadow: none; }

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 90;
  transform: translate(-50%, 8px);
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease-bounce);
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 很窄的手機 ---------- */
@media (max-width: 359px) {
  .appbar__install span { display: none; }
  .appbar__install { padding: 4px 6px; }
  .app-hero h1 { font-size: 27px; }
  .daytab__date { font-size: 13.5px; }
  .shortcut__label { font-size: 12px; }
}

/* 減少動態效果：沿用 styles.css 的全域規則，這裡再關掉分頁切換 */
@media (prefers-reduced-motion: reduce) {
  .screen.is-active,
  .sheet__panel,
  .sheet__backdrop {
    animation: none !important;
  }
  .toast,
  .tab__icon,
  .shortcut,
  .stay-btn,
  .seg {
    transition: none !important;
  }
}
