/* 蔡玉乖孫團：各頁共用導覽列（樣式沿用裏佐陳氏族譜） */
.lz-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  background: #6c4f3a;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.lz-nav a { color: #fff; text-decoration: none; }
.lz-home { font-size: 18px; letter-spacing: 3px; white-space: nowrap; }
.lz-modes { display: flex; gap: 4px; }
.lz-modes a {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 15px;
  white-space: nowrap;
}
.lz-modes a:hover { background: rgba(255, 255, 255, .15); }
.lz-modes a.active { background: #f3e3c3; color: #4d3d34; }

body.lz-tree, body.lz-table { padding-top: 48px; }
body.lz-tree { overflow: hidden; height: 100vh; }
.lz-tree .section-genealogy-tree { height: calc(100vh - 48px); overflow: hidden; }
.lz-tree .tools, .lz-table .tools { top: 72px; z-index: 6; }
.lz-table .ga-book-table thead { top: 48px; z-index: 5; }
.ga-book-img { position: absolute; display: none; z-index: 9; max-width: 240px; pointer-events: none; }
.lz-table tr.lz-hit td { background: #fff3c4 !important; transition: background .3s; }

/* 導覽列不夠寬時：模式按鈕永遠完整，左邊站名自動縮成「蔡玉乖…」 */
.lz-nav { max-width: 100vw; box-sizing: border-box; overflow: hidden; }
.lz-home { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
/* 只設在 html：設在 body 會讓 body 變成捲動容器，導致切換列 sticky 位置多偏 48px */
@media (max-width: 767px) { html { overflow-x: hidden; } }
.lz-modes { flex: 0 0 auto; }
@media (max-width: 600px) {
  .lz-nav { padding: 0 10px; gap: 6px; }
  .lz-home { font-size: 15px; letter-spacing: 1px; }
  .lz-modes { gap: 2px; }
  .lz-modes a { padding: 6px 6px; font-size: 13px; }
  .lz-modes a i { display: none; }
}
@media (max-width: 380px) {
  .lz-home { font-size: 14px; letter-spacing: 0; }
  .lz-modes a { padding: 6px 5px; }
}
/* 世系錄：〔列表｜樹狀目錄〕切換列 */
.lz-viewbar {
  position: sticky; top: 48px; z-index: 6;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 76px 8px 14px; background: #fbf8f0; border-bottom: 1px solid #e6dcc6;
  font-family: "Noto Serif TC", "PMingLiU", serif;
}
.lz-viewbar button {
  padding: 5px 14px; border: 1px solid #e6dcc6; border-radius: 16px; background: #fff;
  color: #3b2a1e; font: inherit; font-size: 15px; cursor: pointer;
}
.lz-viewbar button.on { background: #6c4f3a; border-color: #6c4f3a; color: #fff; }
.lz-viewbar .hint { margin-left: auto; font-size: 13px; color: #8a7766; }
.lz-table .ga-book-table thead { top: 97px; }
/* 電腦版：第一欄離畫面左緣留一點空間 */
@media (min-width: 768px) { .lz-table .ga-book-table table .th-serial, .lz-table .ga-book-table table .td-serial { padding-left: 16px; } }
.lz-tv { padding: 12px 16px 80px; font-size: 17px; white-space: nowrap; overflow-x: auto; font-family: "Noto Serif TC", "PMingLiU", serif; color: #3b2a1e; }
.lz-tv ul { list-style: none; margin: 0; padding: 0; }
.lz-tv ul ul { margin-left: 10px; padding-left: 14px; border-left: 1px dotted #b8976a; }
.lz-tv .tv-row { display: flex; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: rgba(216, 206, 137, .4); }
.lz-tv .tv-row:hover { background: #fef8e2; }
.lz-tv .tv-row.hit { background: #fff3c4; box-shadow: inset 0 0 0 2px #fbba00; }
/* ⊞⊟ 外觀不變，可點範圍往右延伸到第一個數字、上下也加大，手機好點 */
.lz-tv .tv-tog {
  position: relative; z-index: 1; flex: none; width: 20px; text-align: center; box-sizing: content-box;
  padding: 9px 14px 9px 8px; margin: -9px -14px -9px -8px;
  color: #a89a86; cursor: pointer; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: rgba(216, 206, 137, .5);
}
.lz-tv .tv-tog.has { color: #3b2a1e; }
.lz-tv .tv-name { color: #3b2a1e; text-decoration: none; }
.lz-tv .tv-name:hover { color: #6c4f3a; text-decoration: underline; }
.lz-tv .tv-sub { font-size: 13px; color: #8a7766; }

/* 同頁彈出《世系錄》 */
html.lz-noscroll, html.lz-noscroll body { overflow: hidden; }
.lz-sheet { position: fixed; inset: 0; z-index: 20000; display: flex; align-items: center; justify-content: center; }
.lz-sheet[hidden] { display: none; }
.lz-sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.lz-sheet-box {
  position: relative; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 96px); overflow: auto;
  padding: 18px 22px 22px; background: #fffdf6; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  color: #3b2a1e; font-family: "Noto Serif TC", "PMingLiU", serif; -webkit-overflow-scrolling: touch;
}
.lz-sheet-x { position: sticky; top: 0; float: right; margin: -6px -10px 0 8px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eee6d6; color: #6c4f3a; font-size: 24px; line-height: 38px; cursor: pointer; }
.lz-sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-bottom: 10px; border-bottom: 1px solid #e6dcc6; }
.lz-sheet-head b { font-size: 22px; }
.lz-sheet-head .sn { font-weight: 700; color: #6c4f3a; }
.lz-sheet-head .ag, .lz-sheet-head .rk, .lz-sheet-head .fa { color: #8a7766; }
.lz-sheet-mate { margin-top: 8px; color: #6b5442; }
.lz-sheet-load { padding: 30px 8px; text-align: center; color: #8a7766; }
.lz-sheet-rec { margin-top: 12px; font-size: 17px; line-height: 1.9; }
.lz-sheet-rec .mb-sm { margin-bottom: 12px; }
.lz-sheet-rec .mb-xs { margin-bottom: 6px; }
@media (max-width: 767px) {
  .lz-sheet { align-items: flex-end; }
  .lz-sheet-box { width: 100%; max-height: 86vh; border-radius: 14px 14px 0 0; padding: 16px 16px 28px; }
}

/* 世系錄：手機只顯示編號、世代、姓名、父親、排行；點一列另開《世系錄》 */
@media (max-width: 767px) {
  .lz-table .ga-book-table .th-record, .lz-table .ga-book-table .td-record { display: none; }
  /* 手機：姓名、父親同寬且不換行；表格比螢幕寬時在表格內左右滑動 */
  .lz-table .ga-book-table .table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lz-table .ga-book-table table { width: auto; min-width: 100%; table-layout: auto; }
  .lz-table .ga-book-table thead { position: static; }
  .lz-table .ga-book-table table [class^="th-"], .lz-table .ga-book-table table [class^="td-"] { padding: 9px 7px; font-size: 15px; white-space: nowrap; }
  .lz-table .ga-book-table .td-fullname { font-size: 16px; }
  .lz-table .ga-book-table .td-father { font-size: 15px; color: #6b5442; }
  .lz-table .ga-book-table .td-father .white-nowrap { white-space: nowrap; }
  .lz-table .ga-book-table .td-fullname .mate { display: none; }
  .lz-table .ga-book-table tbody tr { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: rgba(216, 206, 137, .4); }
  .lz-table .ga-book-table tbody tr:active { background: #fef8e2 !important; }
  .lz-table .ga-book-table .td-rank { position: relative; padding-right: 16px !important; }
  .lz-table .ga-book-table tbody .td-rank::after {
    content: "›"; position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
    font-size: 18px; color: #b8976a;
  }
  .lz-viewbar .hint { display: none; }
  .lz-tv { font-size: 16px; padding: 10px 10px 80px; }
  .lz-tv ul ul { margin-left: 7px; padding-left: 8px; }
  .lz-tv .tv-row { padding: 4px 4px; gap: 4px; }
  .lz-tv .tv-tog { width: 16px; }
}

@media print {
  .lz-nav, .tools { display: none !important; }
  body.lz-table { padding-top: 0; }
}

/* 改版提示：站名右邊 */
.lz-home { flex: 0 1 auto; }
.cy-wip {
  flex: 0 1 auto; min-width: 0; margin-left: 24px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #fff; font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif; font-size: 22px; font-weight: 700; letter-spacing: 1px;
}
.cy-welcome {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #f3e3c3; font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 16px; font-weight: 600; letter-spacing: .04em;
}
@media (max-width: 767px) { .cy-wip { margin-left: 10px; font-size: 15px; letter-spacing: 0; } }
@media (max-width: 767px) { .cy-welcome { font-size: 12px; letter-spacing: 0; } }
/* 手機：導覽列放不下，改成站名下方的一行小字 */
@media (max-width: 600px) {
  .lz-home { padding-bottom: 13px; line-height: 1.2; }
  .cy-wip { display: none; }
  .cy-welcome { position: absolute; left: 10px; bottom: 5px; max-width: calc(100vw - 20px); font-size: 11px; line-height: 1; font-weight: 400; }
}

/* 手機：選單項目多（含登入、後台），改成可左右滑動的一列；站名保留；歡迎語不顯示以免和選單重疊 */
@media (max-width: 767px) {
  .cy-welcome { display: none; }
  .lz-home { flex: 0 0 auto; padding-bottom: 0; }
  .lz-modes {
    flex: 1 1 auto; min-width: 0; justify-content: flex-start;
    overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
  }
  .lz-modes::-webkit-scrollbar { display: none; }
  .lz-modes a { flex: none; }
}
