/* 裏佐陳氏族譜：三種模式共用導覽列 */
.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-photo { float: right; width: 110px; max-height: 150px; object-fit: cover; margin: 0 0 8px 12px; border: 3px solid #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
/* 電腦滑鼠懸停：照片／照片＋世系錄小卡 */
.lz-tip { position: fixed; z-index: 19000; pointer-events: none; background: #fffdf6; border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.28); color: #3b2a1e; font-family: "Noto Serif TC", "PMingLiU", serif; }
.lz-tip[hidden] { display: none; }
.lz-tip.photo { padding: 5px; }
.lz-tip.photo img { display: block; max-width: 240px; max-height: 300px; border-radius: 6px; }
.lz-tip.card { width: min(420px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: hidden; padding: 14px 16px; font-size: 15px; line-height: 1.75; }
.lz-tip.card .lz-sheet-photo { width: 96px; }
.lz-tip.card .lz-sheet-head b { font-size: 19px; }
.lz-tip.card .lz-sheet-rec { font-size: 15px; line-height: 1.75; }
.lz-cam { font-size: .8em; margin-left: 3px; opacity: .75; }
.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-sheet-retry { margin-top: 14px; padding: 8px 22px; border: 0; border-radius: 20px; background: #6c4f3a; color: #fff; font: inherit; font-size: 16px; cursor: pointer; }

/* 世系錄視窗：照片影片 */
.lz-media { clear: both; margin-top: 16px; padding-top: 12px; border-top: 1px solid #e6dcc6; }
.lz-media h4 { margin: 0 0 10px; font-size: 16px; color: #6c4f3a; }
.lz-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.lz-tile { position: relative; padding: 0; border: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 1; background: #eee6d6; cursor: pointer; touch-action: manipulation; }
.lz-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lz-tile .noth { display: flex; align-items: center; justify-content: center; height: 100%; color: #8a7766; font-size: 14px; }
.lz-tile .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 38px; text-align: center; }
.lz-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lz-lb { position: fixed; inset: 0; z-index: 21000; background: rgba(20, 16, 12, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lz-lb[hidden] { display: none; }
.lz-lb-stage { flex: 1 1 auto; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 56px 12px 8px; box-sizing: border-box; }
.lz-lb-stage img, .lz-lb-stage video { max-width: 100%; max-height: 100%; border-radius: 4px; background: #000; }
.lz-lb-cap { flex: none; padding: 8px 16px 18px; color: #eee; font-size: 15px; text-align: center; font-family: "Noto Serif TC", "PMingLiU", serif; }
.lz-lb-cap span { color: #aaa; font-size: 13px; }
.lz-lb button { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; }
.lz-lb-x { right: 12px; top: 10px; width: 42px; height: 42px; border-radius: 50%; font-size: 26px; line-height: 42px; }
.lz-lb-prev, .lz-lb-next { top: 50%; transform: translateY(-50%); width: 46px; height: 64px; font-size: 34px; display: none; }
.lz-lb.multi .lz-lb-prev, .lz-lb.multi .lz-lb-next { display: block; }
.lz-lb-prev { left: 8px; border-radius: 0 10px 10px 0; }
.lz-lb-next { right: 8px; border-radius: 10px 0 0 10px; }
.lz-lb-cap a { color: #f3d48a; font-size: 14px; }
