*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%; width: 100%; margin: 0; overflow: hidden; background: #f2f2f7;
  overscroll-behavior: none; touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
body { position: fixed; inset: 0; }
#app { position: relative; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
#app.pt-full { position: fixed; inset: 0; z-index: 40; padding-bottom: 0; background: #f2f2f7; }
#app.pt-full .pt-tabbar, #app.pt-full #ink-bar { display: none !important; }
#chart-full-back { color: #007aff; }
#birth-page, #app .pt-backdrop, #app .pt-sheet, #app .pt-page, #app .hm-list, #app .ln-root, #app .ln-shade, #app .pt-tabbar { position: absolute; }
#lineage-page { z-index: 6; }
#lineage-page.over { z-index: 20; }
#sky-page { z-index: 8; }
#sky-top { display: contents; }
#sky-vein { width: 100%; height: 100%; }
#sky-own .ln-found-ring { display: none; }
#sky-own.found .ln-found-ring { display: inline; }
#chat-list { position: absolute; inset: 0 0 50px; z-index: 1; display: flex; flex-direction: column; padding-bottom: 0; background: #fff; }
#library-root { position: absolute; inset: 0 0 50px; z-index: 1; display: flex; flex-direction: column; padding-bottom: 0; background: #f2f2f7; }
#library-root .lb-ledger { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
#chat-thread { z-index: 8; height: auto; }
#chat-board { z-index: 9; height: auto; background: #f2f2f7; }
#chat-class { z-index: 10; height: auto; background: #f2f2f7; }
#chat-hw-ask, #chat-clash { z-index: 11; }
#chat-viewer { z-index: 12; }
.ex-bazi .ex-pillar b { display: block; font-size: 22px; font-weight: 600; line-height: 1.15; }
#chat-friends, #chat-group, #chat-requests, #chat-soon, #chat-notices { z-index: 9; }
#badge-sheet, #natal-sheet, #natal-charts { z-index: 50; }
#share-page { z-index: 41; background: #f2f2f7; }
.pt-root.sh-guest { padding-bottom: 0; }
.pt-root .sh-share-banner { flex: none; text-align: center; }
.pt-root .sh-share-banner p { margin: 0; }
.pt-root a.sh-share-go,
.pt-root a.sh-share-quiet {
  display: block; margin: 8px auto 0; padding: 8px 12px; font-size: 15px; text-decoration: none;
}
.pt-root a.sh-share-go { color: #007aff; }
.pt-root a.sh-share-quiet { color: #8e8e93; }
.pt-root .lb-revoke { color: #ff3b30; font-size: 17px; }
#share-page .pt-set-check { visibility: hidden; }
#share-page .pt-set-row.on .pt-set-check { visibility: visible; }
#school-page, #bazi-page, #bazi-facts, #bazi-dayun, #plan-page, #default-kind-page, #logins-page, #handoff-page, #qr-page, #person-page, #blocked-page, #hidden-page, #lineage-sent-page { z-index: 42; background: #f2f2f7; }
#method-page, #bazi-method { z-index: 43; background: #f2f2f7; }
#transform-page { z-index: 44; background: #f2f2f7; }
#transform-page select { font: inherit; color: #8e8e93; background: transparent; border: 0; }
#method-page .pt-set-row.is-soon { color: #8e8e93; }
#qr-page { background: #1c1c1e; }
#block-ask, #unfriend-ask, #report-ask { z-index: 60; }
a.hm-handoff-go { display: flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
.hm-real-name { display: block; margin-top: 2px; font-size: 13px; color: var(--label2); }
#person-nick::placeholder { color: #c7c7cc; }
#chat-reply { flex: none; }
.hm-root a.pt-set-row { text-decoration: none; color: inherit; }
.hm-my-qr-card img { width: 196px; height: 196px; }
[data-person] { cursor: pointer; }
#school-page .pt-set-check, #bazi-page .pt-set-check, #bazi-method .pt-set-check, #plan-page .pt-set-check, #default-kind-page .pt-set-check, #method-page .pt-set-check { visibility: hidden; }
#school-page .pt-set-row.on .pt-set-check, #bazi-page .pt-set-row.on .pt-set-check, #bazi-method .pt-set-row.on .pt-set-check, #plan-page .pt-set-row.on .pt-set-check, #default-kind-page .pt-set-row.on .pt-set-check, #method-page .pt-set-row.on .pt-set-check { visibility: visible; }
#school-page .pt-set-row > span:first-child, #method-page .pt-set-row > span:first-child { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
#school-page .pt-set-row small, #method-page .pt-set-row small { font-size: 13px; color: #8e8e93; }
#delete-ask { z-index: 60; }
.hm-handoff-input::placeholder { color: #c7c7cc; }
#terms-page, #privacy-page, #about-page { z-index: 43; background: #f2f2f7; }
.ap-legal { padding-bottom: 28px; }
.ap-legal-date { margin: 8px 32px 0; font-size: 12px; color: var(--label3, #8e8e93); }
.ap-legal-body { padding: 14px 16px 4px; font-size: 15px; line-height: 1.8; color: var(--label, #000); }
.ap-legal-body p { margin: 0 0 10px; }
.ap-legal-body ul, .ap-legal-body ol { margin: 0 0 10px; padding-left: 22px; }
.ap-legal-body ul { list-style: disc; }
.ap-legal-body ol { list-style: decimal; }
.ap-legal-body li + li { margin-top: 6px; }
.ap-legal-sub { margin: 14px 0 6px; font-size: 15px; font-weight: 600; }
.ap-about { display: flex; flex-direction: column; padding-bottom: 32px; }
.ap-about > .pt-brand { align-self: center; margin-top: 32px; }
.ap-about-tag { margin: 36px 24px 8px; text-align: center; font-size: 15px; color: var(--label3, #8e8e93); }
.ap-about-link { display: block; margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: #007aff; word-break: break-all; }
.ap-about-mail { color: #007aff; text-decoration: none; }
.ap-about-copy { margin: 28px 16px 8px; text-align: center; font-size: 12px; color: var(--label3, #8e8e93); }
.lb-agree { position: relative; display: flex; align-items: center; gap: 12px; margin: 0; font-size: 15px; color: #0A0A0A; min-height: 32px; cursor: pointer; }
.lb-shared { display: none; margin: 0 0 10px; }
@media (min-width: 900px) {
    .lb-shared { display: flex; }
}
.lb-agree input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.lb-agree-box {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; box-shadow: inset 0 0 0 1.5px #AEAEB2;
}
.lb-agree-box img { display: none; width: 15px; height: 15px; }
.lb-agree input:checked + .lb-agree-box {
  background: #0A0A0A; box-shadow: none;
}
.lb-agree input:checked + .lb-agree-box img { display: block; }
.lb-agree-text { flex: 1; min-width: 0; line-height: 1.4; }
.lb-agree button { position: relative; z-index: 1; padding: 0; border: 0; background: none; color: #007AFF; font: inherit; cursor: pointer; }
.lb-agree-block {
  border-radius: 12px; padding: 8px 10px; margin: 0 -10px 10px; background: transparent;
}
.lb-agree-block.is-warn {
  background: #FBEDEB; box-shadow: inset 0 0 0 1px #E8B9B4;
}
.lb-agree-block.is-warn .lb-agree-box {
  box-shadow: inset 0 0 0 1.5px #B8322A;
}
.lb-agree-hint {
  display: flex; align-items: center; gap: 6px;
  margin: 6px 0 0 44px; font-size: 13px; color: #B8322A;
}
.lb-agree-hint img { flex: none; display: block; }
.lb-agree-hint[hidden] { display: none !important; }
a.ch-row, .pt-root .ch-menu-top a, .pt-root .ch-start a {
  color: inherit; text-decoration: none;
}
.pt-root .ch-menu-top a {
  height: 72px; padding: 0; border-radius: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 400; color: #000;
  box-shadow: inset 0.5px 0 0 rgba(60, 60, 67, 0.29);
}
.pt-root .ch-start a {
  min-width: 200px; height: 44px; padding: 0 20px; border-radius: 22px; background: var(--tap, #007aff); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600;
}
.ch-menu form { display: block; margin: 0; }
.pt-root .ex-faces > div > span {
  flex: none; width: 48px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
#chat-list .ch-list > a.ch-row:not(:last-child)::after {
  content: ''; position: absolute; left: 76px; right: 0; bottom: 0; height: 0.5px; background: var(--sep);
}
[hidden] { display: none !important; }

.pt-scroll { flex: 1; min-height: 0; overflow: auto; }
.pt-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: #8e8e93; font-size: 10px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.pt-tabbar a.on { color: #1c1c1e; }
.pt-tabbar a.reserved { opacity: 0.4; }
.ch-tab-icon { position: relative; display: inline-flex; }
.pt-tabbar svg { display: block; }

.pt-root.lb-login {
  height: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  background: #F2F2F7; color: #0A0A0A;
  font-family: "Noto Sans TC", "PingFang TC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.lb-login-brand {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: calc(64px + env(safe-area-inset-top)) 24px 36px;
}
.lb-login-mark { display: block; width: 56px; height: 56px; }
.lb-login-title {
  margin: 0; font-family: "Noto Serif TC", "Songti TC", serif; font-weight: 900;
  font-size: 26px; letter-spacing: 0.32em; margin-right: -0.32em; color: #0A0A0A;
}
.lb-login-title span { color: #B8322A; }
.lb-login-tag {
  font-size: 13px; letter-spacing: 0.2em; margin-right: -0.2em; color: #6B6B70;
}
.lb-signup { flex: 1; display: flex; flex-direction: column; padding: 0 20px 12px; }
.lb-account-notice {
  margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #fff4d6; color: #6f4d00;
  box-shadow: inset 0 0 0 1px rgba(180, 124, 0, 0.18);
}
.lb-account-notice b { display: block; margin-bottom: 4px; font-size: 15px; }
.lb-account-notice p { margin: 0; font-size: 13px; line-height: 1.5; }
.lb-signup h2 { margin: 8px 0 4px; font-size: 22px; font-weight: 700; color: var(--label); }
.lb-signup-sub { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: #6B6B70; }
.lb-signup-error { margin: 8px 0 0; text-align: center; font-size: 13px; color: #B8322A; }
.lb-login-social { display: flex; flex-direction: column; gap: 10px; }
.lb-login-social form { margin: 0; }
.lb-login-email { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.lb-signup-field {
  height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: #FFFFFF; border-radius: 12px; box-shadow: inset 0 0 0 1px #E4E4E7;
}
.lb-signup-field:focus-within { box-shadow: inset 0 0 0 1.5px #007AFF; }
.lb-signup-field img { flex: none; display: block; }
.lb-signup-input {
  box-sizing: border-box; flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
  border: 0; background: transparent; font: inherit; font-size: 16px; color: #0A0A0A; outline: none;
}
.lb-signup-input::placeholder { color: #8E8E93; }
.lb-signup-input.lb-code {
  width: 100%; height: 50px; margin-bottom: 12px; padding: 0 14px;
  border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px #E4E4E7;
  font-size: 28px; letter-spacing: 12px; text-align: center;
}
.pt-root .lb-signup-go {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 50px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 600;
  background: #0A0A0A; color: #fff; cursor: pointer;
}
.pt-root .lb-signup-go:disabled {
  background: #E4E4E7; color: #8E8E93; cursor: default; opacity: 1;
}
.pt-root .lb-signup-go.lb-line { background: #06C755; color: #fff; }
.pt-root .lb-signup-go.lb-line img { flex: none; display: block; }
.pt-root .lb-signup-go.lb-google {
  background: #FFFFFF; color: #0A0A0A; box-shadow: inset 0 0 0 1px #D1D1D6;
}
.pt-root .lb-signup-go.lb-apple { background: #000; color: #fff; }
.pt-root .lb-google-g { flex: none; display: block; }
.lb-signup-or {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px; font-size: 13px; color: #8E8E93; font-style: normal;
}
.lb-signup-or i { flex: 1; height: 1px; background: #D1D1D6; }
.lb-signup-note { margin: 0; font-size: 13px; color: #6B6B70; text-align: center; }
.lb-device {
  margin-top: 26px; min-height: 56px; padding: 0 14px; border: 0; border-radius: 12px;
  background: #FFFFFF; display: flex; align-items: center; gap: 12px;
  color: #0A0A0A; font: inherit; font-size: 16px; text-align: left; cursor: pointer;
}
.lb-device > span { flex: 1; min-width: 0; }
.lb-device img { flex: none; display: block; }
.lb-device-chev { opacity: 1; }
.lb-device-panel { margin-top: 12px; }
.lb-device-code {
  margin: 8px 0; font-size: 32px; letter-spacing: 4px; text-align: center;
  font-variant-numeric: tabular-nums; color: #0A0A0A;
}
.lb-login-foot {
  flex: none; display: flex; justify-content: center;
  padding: 8px 0 calc(30px + env(safe-area-inset-bottom));
}
.pt-root .lb-signup-link {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; margin: 0; padding: 0 16px;
  font-size: 14px; color: #6B6B70; background: none; border: 0; cursor: pointer;
}

@media (max-width: 401.98px) {
  #app {
    box-sizing: border-box;
    width: calc(402px + env(safe-area-inset-left) + env(safe-area-inset-right));
    height: calc(100dvh * (402px + env(safe-area-inset-left) + env(safe-area-inset-right)) / 100vw);
    zoom: calc(100vw / (402px + env(safe-area-inset-left) + env(safe-area-inset-right)));
  }
  #app.pt-root { height: 100%; min-height: 0; }
  /* 縮放後 100dvh 會照縮放前算，子頁要跟 #app 一樣高，不然分頁列上方露出一條灰底。 */
  #app > .pt-root:not(.pt-page) { height: 100%; min-height: 100%; }
}
