#urukBookDialog{box-sizing:border-box;width:min(960px,calc(100vw - 16px));max-width:calc(100vw - 16px);max-height:94vh;overflow:auto;padding:18px;border:1px solid var(--theme-border,#bb985b);border-radius:16px;background:var(--theme-panel,#fffaf0);color:var(--ink,#254b47)}
#urukBookDialog::backdrop{background:#0008}#urukBookDialog h2{font-size:21px;margin:0 0 10px}#urukBookDialog .ub-note{font-size:13px;line-height:1.55;margin:10px 0}
.ub-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px}.ub-options>label{display:flex;flex-direction:column;gap:5px;font-size:13px;min-width:0}.ub-options input,.ub-options select{box-sizing:border-box;width:100%;min-width:0;max-width:100%;font:inherit}.ub-options .ub-check{flex-direction:row;align-items:center}.ub-check input{width:auto;margin:0 8px 0 0}.ub-options>button{grid-column:1/-1}.ub-actions{display:flex;gap:10px}.ub-actions>button{flex:1;min-width:0}
#urukBookPreview{display:flex;align-items:center;flex-direction:column;gap:16px;max-height:70vh;overflow:auto;background:#dce2de;padding:14px 0;margin-top:16px;border-radius:10px;direction:ltr;min-height:0}
#urukBookPreview:empty{display:none}.ub-preview-frame{position:relative;flex-shrink:0;box-shadow:0 3px 12px #0003;overflow:hidden}.ub-preview-frame>.ub-sheet{position:absolute;inset:0;transform-origin:top left}
#urukBookMeasure{position:fixed;left:-20000px;top:0;visibility:hidden;pointer-events:none;z-index:-1}
.ub-sheet,.ub-sheet *{box-sizing:border-box}.ub-sheet{width:var(--ub-w);height:var(--ub-h);position:relative;overflow:hidden;background:var(--ub-paper);color:#283d39;font:14px/1.55 Georgia,'Noto Naskh Arabic',serif;isolation:isolate;print-color-adjust:exact;-webkit-print-color-adjust:exact}
.ub-sheet[lang="ug-Arab"]{font-family:'Noto Naskh Arabic','Noto Sans Arabic',serif}.ub-sheet h1,.ub-sheet h2,.ub-sheet h3,.ub-sheet p,.ub-sheet small,.ub-sheet strong{margin:0;max-width:100%;color:inherit;line-height:inherit;letter-spacing:normal;overflow-wrap:anywhere;text-overflow:clip;white-space:normal}
.ub-border{position:absolute;inset:6mm;border:1px solid var(--ub-accent);outline:3px double var(--ub-primary);outline-offset:2mm;border-radius:4mm;pointer-events:none;z-index:0}.ub-border::before,.ub-border::after{content:'✧';position:absolute;color:var(--ub-accent);background:var(--ub-paper);font-size:21px;line-height:1;padding:0 3mm;inset-inline-start:calc(50% - 5mm)}.ub-border::before{top:-3mm}.ub-border::after{bottom:-3mm}
.ub-page-head{position:absolute;top:13mm;inset-inline:14mm;height:18mm;overflow:hidden;text-align:center;font:600 12px/1.35 system-ui,sans-serif;color:var(--ub-primary);border-bottom:.3mm solid var(--ub-accent);padding-bottom:3mm;overflow-wrap:anywhere}
.ub-sheet header.ub-page-head{display:block!important;background:transparent!important;color:var(--ub-primary)!important;box-shadow:none!important;padding:0 0 3mm!important;margin:0!important;border-radius:0!important;border:0!important;border-bottom:.3mm solid var(--ub-accent)!important}
.ub-page-body{position:absolute;top:36mm;bottom:22mm;inset-inline:14mm;overflow:visible;display:flow-root}.ub-page-body>*{max-width:100%;margin-bottom:4mm!important}.ub-page-body>:last-child{margin-bottom:0!important}
.ub-page-foot{position:absolute;inset-inline:14mm;bottom:9mm;height:10mm;display:flex;justify-content:center;align-items:center;color:var(--ub-primary)}.ub-stamp{position:relative;height:9mm;width:9mm}.ub-stamp img{display:block;width:9mm;height:9mm;object-fit:contain;border-radius:1.4mm;border:.15mm solid var(--ub-accent)}.ub-stamp::before,.ub-stamp::after{content:'';position:absolute;top:50%;width:20mm;height:1px;background:var(--ub-accent)}.ub-stamp::before{right:calc(100% + 3mm)}.ub-stamp::after{left:calc(100% + 3mm)}.ub-page-number{position:absolute;inset-inline-end:0;font:10px system-ui,sans-serif}
.ub-cover .ub-page-body{text-align:center;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4mm}.ub-cover .ub-page-body>*{margin-bottom:0!important}.ub-cover-title{font-size:30px;font-weight:700;color:var(--ub-primary)!important;line-height:1.25!important}.ub-eyebrow{font:12px system-ui,sans-serif;color:var(--ub-primary)!important}.ub-art{display:block;width:100%;height:54mm;min-height:30mm;border:1px solid var(--ub-accent);border-radius:18mm 18mm 3mm 3mm;overflow:hidden;background:var(--ub-primary)}.ub-cover-subtitle{font-size:16px;line-height:1.4!important}.ub-count{font:12px system-ui,sans-serif}
.ub-cover-title,.ub-cover-subtitle,.ub-eyebrow,.ub-count{flex-shrink:0}
.ub-content-item{padding:5mm;border-bottom:.2mm solid var(--ub-accent);font-size:17px;color:var(--ub-primary)!important}.ub-section-title{font-size:17px;font-weight:700;color:var(--ub-primary)!important;margin-bottom:4mm!important;line-height:1.35!important}
.ub-tree-stage{position:relative;width:100%;direction:ltr;margin-bottom:3mm!important}.ub-sheet .ub-tree-card{position:absolute;min-height:0;padding:2mm;gap:1mm}.ub-tree-card .ub-card-name{font-size:12px}.ub-tree-edges{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}.ub-tree-edges path{fill:none;stroke:var(--ub-primary);stroke-width:1.2}.ub-tree-edges path[data-kind="spouse"]{stroke:var(--ub-accent);stroke-width:2}.ub-tree-links{width:100%;font:10px/1.4 system-ui,sans-serif;color:var(--ub-primary);direction:ltr}.ub-tree-reference{display:block;unicode-bidi:plaintext}.ub-tree-guide{font:11px/1.5 system-ui,sans-serif;color:var(--ub-primary)!important;margin-top:2mm!important}
.ub-family-board{width:100%;padding:0}.ub-parent-row,.ub-child-row{display:flex;justify-content:space-around;gap:3mm;align-items:stretch;direction:ltr}.ub-parent-row{margin-top:5mm}.ub-parent-row>.ub-person-card{flex:0 1 46%}.ub-child-row>.ub-person-card{flex:1;min-width:0}.ub-edges{display:block;width:100%;height:12mm;overflow:visible}.ub-edges path{fill:none;stroke:var(--ub-primary);stroke-width:1.1;vector-effect:non-scaling-stroke}
.ub-family-board[data-kind="partners"] .ub-parent-row{position:relative}.ub-family-board[data-kind="partners"] .ub-parent-row::before{content:'';position:absolute;left:48%;right:48%;top:50%;height:1px;background:var(--ub-primary)}
.ub-person-card{border:.25mm solid var(--ub-accent);border-radius:3mm;background:#ffffffb8;padding:3mm;display:flex;flex-direction:column;align-items:center;text-align:center;min-height:40mm;gap:2mm;color:#283d39;position:relative}.ub-card-text{width:100%;min-width:0}.ub-card-text>*{display:block}.ub-card-name{font-size:13px;font-weight:700;line-height:1.4!important}.ub-role,.ub-ref,.ub-dates{font:10px/1.4 system-ui,sans-serif}.ub-role{font-weight:700;color:var(--ub-primary)!important}.ub-ref{opacity:.8}.ub-portrait{width:18mm;height:20mm;min-width:18mm;display:flex;align-items:center;justify-content:center;border-radius:40% 40% 2mm 2mm;border:1px solid var(--ub-accent);overflow:hidden;background:#ffffffb8;color:#46635e;font:9px/1.3 system-ui,sans-serif;text-align:center;padding:1mm}.ub-portrait img{width:100%;height:100%;object-fit:contain}.ub-sheet[dir="rtl"] .ub-person-card{direction:rtl}
.ub-bio-head{display:grid;grid-template-columns:30mm minmax(0,1fr);gap:2mm 5mm;align-items:start;border-bottom:.3mm solid var(--ub-accent);padding-bottom:4mm}.ub-bio-head .ub-portrait{grid-row:1/3;width:30mm;height:36mm}.ub-person-name{font-size:21px;font-weight:700;line-height:1.3!important;color:var(--ub-primary)!important}.ub-detail{font-size:13px;line-height:1.65!important}.ub-story{font-size:14px;line-height:1.7!important;white-space:pre-wrap!important;overflow-wrap:anywhere}
.ub-archive-image{display:block;max-width:100%;width:auto;max-height:65mm;object-fit:contain;margin-inline:auto}.ub-ending{margin-top:36mm!important;text-align:center;font-size:21px;color:var(--ub-primary)!important;line-height:1.6!important}.ub-credit{margin-top:28mm!important;text-align:center;font-size:13px;color:var(--ub-primary)!important;line-height:1.65!important}
@media(max-width:500px){#urukBookDialog{padding:12px}.ub-options{grid-template-columns:minmax(0,1fr)}.ub-actions{flex-wrap:wrap}.ub-actions>button{flex:1 1 150px}}
@media print{#psPages .ub-sheet{display:block!important;margin:0!important;transform:none!important;position:relative!important;break-after:page;page-break-after:always;break-inside:avoid;page-break-inside:avoid}#psPages .ub-sheet:last-child{break-after:auto;page-break-after:auto}#urukBookMeasure,#urukBookDialog{display:none!important}}
/* Restore the approved illustrated folio: original motifs, not generic cards. */
.ub-sheet{background-image:radial-gradient(ellipse at 50% 35%,#fff8e64d,transparent 70%),repeating-linear-gradient(12deg,#9d793507 0,#9d793507 1px,transparent 1px,transparent 5px)}
.ub-border{inset:5mm;border-radius:0;border:.5mm double var(--ub-accent);outline:1.1mm double var(--ub-primary);outline-offset:1mm}.ub-border::before,.ub-border::after{display:none}
.ub-ornament,.ub-landscape{position:absolute;pointer-events:none;z-index:0;display:block;overflow:hidden}
.ub-ornament-tl,.ub-ornament-tr,.ub-ornament-bl,.ub-ornament-br{width:28mm;height:28mm}
.ub-ornament-tl{top:5mm;left:5mm}.ub-ornament-tr{top:5mm;right:5mm}.ub-ornament-bl{bottom:5mm;left:5mm}.ub-ornament-br{bottom:5mm;right:5mm}
.ub-ornament-left,.ub-ornament-right{top:33mm;bottom:33mm;width:3.5mm;height:calc(100% - 66mm)}.ub-ornament-left{left:5mm}.ub-ornament-right{right:5mm}
.ub-ornament-top,.ub-ornament-bottom{left:33mm;right:33mm;width:calc(100% - 66mm);height:3mm}.ub-ornament-top{top:5mm}.ub-ornament-bottom{bottom:5mm}
.ub-landscape{bottom:14mm;left:13mm;width:calc(100% - 26mm);height:23mm;opacity:.96;mask-image:linear-gradient(to bottom,transparent,#000 35%);-webkit-mask-image:linear-gradient(to bottom,transparent,#000 35%)}
.ub-sheet .ub-page-head{top:15mm;inset-inline:25mm;height:20mm;font:700 18px/1.3 Georgia,'Noto Naskh Arabic',serif!important;border-bottom:0!important;text-shadow:0 1px #fff8}
.ub-page-head::after{content:'❧  ◆  ❧';display:block;color:var(--ub-accent);font-size:14px;letter-spacing:5px;margin-top:1mm}
.ub-page-body{top:40mm;bottom:44mm;inset-inline:16mm;z-index:1}.ub-page-foot{z-index:2;bottom:8mm}.ub-stamp{background:var(--ub-paper);border-radius:50%;box-shadow:0 0 5mm 2mm var(--ub-paper)}
.ub-cover-original{position:absolute;inset:5mm;width:calc(100% - 10mm);height:calc(100% - 10mm);z-index:0;display:block}
.ub-heritage-cover .ub-border{display:none}.ub-sheet.ub-heritage-cover header.ub-page-head{display:none!important}
.ub-heritage-cover .ub-page-body{top:34%;bottom:39%;inset-inline:20%;gap:2mm;justify-content:center;color:#f9e4a5;text-shadow:0 1px 1px #06252c}
.ub-heritage-cover .ub-cover-title{font-size:27px;color:inherit!important;line-height:1.18!important}.ub-heritage-cover .ub-eyebrow{color:inherit!important;font:700 14px Georgia,serif}.ub-heritage-cover .ub-cover-subtitle{font-size:13px;line-height:1.25!important}.ub-heritage-cover .ub-count{font-size:10px}
.ub-heritage-cover:not([data-book-style="kashgar"]) .ub-page-body,.ub-heritage-cover.ub-cover-light .ub-page-body{color:var(--ub-primary);text-shadow:0 1px #fff8}
.ub-heritage-cover .ub-page-foot{bottom:8mm}.ub-heritage-cover .ub-page-number{color:var(--ub-accent)}
.ub-sheet[style*="148mm"] .ub-cover-title{font-size:19px}.ub-sheet[style*="148mm"] .ub-cover-subtitle{font-size:11px}.ub-sheet[style*="148mm"] .ub-eyebrow{font-size:12px}.ub-sheet[style*="148mm"] .ub-count{font-size:9px}
.ub-person-card{border:0;background:transparent;border-radius:0;padding:2mm;gap:1.5mm;color:#3c2c19}
.ub-card-text{background:linear-gradient(90deg,#f2ddb2bb,#fff6dfef 50%,#f2ddb2bb);border:.35mm double var(--ub-accent);border-radius:2mm;padding:1.5mm 1mm;box-shadow:0 .5mm 1mm #6d451020}
.ub-portrait{width:20mm;height:23mm;min-width:20mm;border:1.2mm double var(--ub-accent);outline:.3mm solid #6b441d;border-radius:48% 48% 35% 35%;background:linear-gradient(135deg,#fff4d9,#e2c78f,#fff6df);box-shadow:0 1mm 2mm #55320e30;color:#70522d;padding:1mm}
.ub-portrait img{border-radius:45% 45% 30% 30%;object-fit:cover}.ub-portrait span{font-size:8px;max-width:100%}
.ub-tree-card .ub-portrait{width:17mm;height:20mm;min-width:17mm}.ub-tree-card .ub-card-name{font:700 12px/1.3 Georgia,'Noto Naskh Arabic',serif}.ub-tree-card .ub-ref,.ub-tree-card .ub-dates{font-size:9px}.ub-tree-links{font-size:9px;line-height:1.3}
.ub-tree-edges path{stroke:#a77a37;stroke-width:1.6}.ub-tree-edges path[data-kind="spouse"]{stroke:#a77a37;stroke-width:2.2}
.ub-bio-head{border-bottom:.4mm double var(--ub-accent)}.ub-bio-head .ub-portrait{border-radius:5mm 5mm 2mm 2mm;border:1.2mm double var(--ub-accent)}
.ub-archive-image{padding:1.5mm;border:1mm double var(--ub-accent);box-shadow:0 1mm 2mm #55320e30;background:#fffae8}
.ub-content-item{border-bottom:.4mm double var(--ub-accent);font-family:Georgia,'Noto Naskh Arabic',serif}
.ub-ending{font-style:italic}.ub-credit{padding:5mm;border-top:.5mm double var(--ub-accent);border-bottom:.5mm double var(--ub-accent)}
.ub-heritage-cover .ub-page-body{top:36%;bottom:42%}.ub-heritage-cover .ub-cover-title{font-size:30px}.ub-cover-light .ub-page-body{top:28%;bottom:48%;left:29%;right:9%}
.ub-heritage-cover[data-book-style="mountains"] .ub-page-body{top:65%;bottom:10%;color:#ffe3a4;text-shadow:0 1px 2px #0b2544}
.ub-heritage-cover[data-book-style="silk_road"] .ub-page-body{top:52%;bottom:18%}
.ub-heritage-cover[data-book-style="prosperity"] .ub-page-body,.ub-heritage-cover[data-book-style="miras"] .ub-page-body{top:39%;bottom:30%;color:#ffe3a4;text-shadow:0 1px 2px #39151c}
.ub-heritage-cover[data-book-style="modern"] .ub-page-body{top:26%;bottom:49%}
.ub-heritage-cover[data-book-style="homelands"] .ub-page-body{top:55%;bottom:20%}
.ub-sheet .ub-page-body,.ub-sheet header.ub-page-head{background:transparent!important;box-shadow:none!important}
.ub-ornament-tl{mask-image:linear-gradient(135deg,#000 55%,transparent 94%);-webkit-mask-image:linear-gradient(135deg,#000 55%,transparent 94%)}
.ub-ornament-tr{mask-image:linear-gradient(225deg,#000 55%,transparent 94%);-webkit-mask-image:linear-gradient(225deg,#000 55%,transparent 94%)}
.ub-ornament-bl{mask-image:linear-gradient(45deg,#000 55%,transparent 94%);-webkit-mask-image:linear-gradient(45deg,#000 55%,transparent 94%)}
.ub-ornament-br{mask-image:linear-gradient(315deg,#000 55%,transparent 94%);-webkit-mask-image:linear-gradient(315deg,#000 55%,transparent 94%)}

.ub-landscape{bottom:12mm;height:29mm}
