/* 天賦樹分頁（talent_ui.js；docs/12 第 7 節）。分支色：爆破紅橙、護盾青藍、探索金紫 */
.tal{--c-atk:#ff7a3a;--c-def:#35b8f0;--c-util:#b98cff;--c-root:#ffc83a;position:relative;display:flex;flex-direction:column;gap:8px;min-width:0}
.tal [data-branch="atk"]{--bc:var(--c-atk)}.tal [data-branch="def"]{--bc:var(--c-def)}.tal [data-branch="util"]{--bc:var(--c-util)}.tal [data-branch="root"]{--bc:var(--c-root)}

/* 桌面：整棵樹用整個大廳寬度，左欄的格子移到畫面外（做法同商店） */
#lobby:has(.lb-panel > .tal.wide) .lb-stage{position:absolute;left:-10000px;top:0;bottom:0;width:420px;visibility:hidden;pointer-events:none}

/* ---------- 上方資訊列 ---------- */
.tt-top{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px}
.tt-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:14px;background:#fff;border:2px solid #cfe6ff;font-size:13px;font-weight:800;color:var(--lb-ink,#123a73);white-space:nowrap}
.tt-chip b{color:#1462c8}
.tt-chip img,.tt-chip canvas,.tt-chip .bg-ic{width:20px;height:20px;object-fit:contain;image-rendering:pixelated}
.tt-coin{width:18px;height:18px;object-fit:contain}
.tt-top .tt-sum{margin-left:auto}
.tt-reset small{margin-left:5px;font-size:11px;font-weight:800;opacity:.9}
.tt-top .lb-btn:disabled{filter:grayscale(.8) opacity(.6);cursor:default}

/* ---------- 版面 ---------- */
.tt-body{display:grid;grid-template-columns:minmax(0,68fr) minmax(240px,32fr);gap:12px;align-items:start}
.tt-side{position:sticky;top:0}

/* ---------- 樹 ---------- */
.tt-tree{position:relative;border-radius:16px;border:3px solid #cfe6ff;background:linear-gradient(180deg,#f4faff,#e3f1ff);overflow:hidden;min-width:0}
.tal.wide .tt-tree{background:linear-gradient(180deg,#f8fcff,#e6f2ff)}
.tt-bcol{position:absolute;top:0;bottom:0;background:var(--bc);opacity:.1;pointer-events:none}
.tal.narrow .tt-tree{background:linear-gradient(180deg,#f8fcff,#e6f2ff)}
.tt-band{position:absolute;left:0;right:0;border-top:1px dashed rgba(60,110,180,.22);pointer-events:none}
.tt-band.stone{background:rgba(255,111,181,.05)}
.tt-band span{position:absolute;left:6px;top:3px;display:flex;flex-direction:column;font-size:10px;font-weight:800;color:rgba(40,80,140,.65);white-space:nowrap;line-height:1.3}
.tt-band span small{font-size:9px;font-weight:800;color:#d2478f}
.tt-band.far span{color:rgba(190,60,60,.6)}
.tt-bhead{position:absolute;top:6px;transform:translateX(-50%);padding:1px 10px;border-radius:10px;background:var(--bc);color:#fff;font-size:12px;font-weight:900;white-space:nowrap;text-shadow:0 1px 0 rgba(0,0,0,.25);pointer-events:none;z-index:1;margin-left:16%}
.tal.wide .tt-bhead{margin-left:0;top:auto;bottom:8px}
.tt-bhead small{margin-left:6px;font-size:10px;font-weight:800;opacity:.9;color:#fff}
.tt-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.tt-lines path{fill:none;stroke-width:3;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.tt-lines path.off{stroke:#b9c6d6;stroke-width:2;stroke-dasharray:5 5}
.tt-lines path.ready{stroke:var(--bc);opacity:.55}
.tt-lines path.on{stroke:var(--bc);stroke-width:4;filter:drop-shadow(0 0 3px var(--bc))}

/* ---------- 節點 ---------- */
.tt-node{--sz:52px;position:absolute;transform:translate(-50%,-50%);width:calc(var(--sz) + 28px);padding:0;border:0;background:none;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:2px;
  font-family:inherit;-webkit-tap-highlight-color:transparent;z-index:2}
.tt-node.key{--sz:62px}
.tal.narrow .tt-node{--sz:64px}
.tal.narrow .tt-node.key{--sz:76px}
.tt-face{position:relative;display:flex;align-items:center;justify-content:center;width:var(--sz,56px);height:var(--sz,56px);border-radius:50%;box-sizing:border-box;
  background:radial-gradient(circle at 40% 32%,#fff,#dcefff 72%);border:3px solid var(--bc,#8fb7e6);box-shadow:0 3px 0 rgba(20,60,120,.25);transition:transform .12s}
.tt-face .tt-ic{width:66%;height:66%;object-fit:contain;image-rendering:pixelated;pointer-events:none}
/* 關鍵節點：六角形框（外層當邊框色、裡面再切一層） */
.tt-node.key .tt-face,.tt-face.key{border:0;border-radius:0;background:var(--bc,#8fb7e6);clip-path:polygon(50% 0,95% 25%,95% 75%,50% 100%,5% 75%,5% 25%);box-shadow:none}
.tt-node.key .tt-face::before,.tt-face.key::before{content:"";position:absolute;inset:4px;background:radial-gradient(circle at 40% 30%,#fff,#e2f0ff 75%);clip-path:polygon(50% 0,95% 25%,95% 75%,50% 100%,5% 75%,5% 25%)}
.tt-node.key .tt-face .tt-ic,.tt-face.key .tt-ic{position:relative}
.tt-node:hover .tt-face{transform:scale(1.06)}
.tt-node.sel .tt-face{outline:3px solid #1462c8;outline-offset:2px}
.tt-node.key.sel .tt-face{outline:0;filter:drop-shadow(0 0 0 #1462c8) drop-shadow(0 0 4px #1462c8)}
.tt-lv{position:relative;min-width:38px;padding:0 6px;border-radius:9px;background:#fff;border:1px solid #b5cde6;font-size:11px;font-weight:900;color:#1462c8;line-height:16px;white-space:nowrap;overflow:hidden;margin-top:-8px;z-index:1}
.tt-lv::before{content:"";position:absolute;left:0;top:0;bottom:0;width:var(--p,0%);background:linear-gradient(180deg,#ffe36b,#ffc23a);opacity:.55;z-index:-1}
.tt-nm{max-width:100%;font-size:11px;font-weight:800;color:#123a73;line-height:1.15;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tt-node .tt-lock,.tt-node .tt-dot,.tt-node .tt-max{position:absolute;right:8px;top:-3px;z-index:3;font-style:normal}
.tt-lock{width:18px;height:18px;border-radius:50%;background:#6c7a8c;border:2px solid #fff}
.tt-lock::before{content:"";position:absolute;left:5px;top:1px;width:6px;height:6px;border:2px solid #fff;border-bottom:0;border-radius:4px 4px 0 0;box-sizing:content-box}
.tt-lock::after{content:"";position:absolute;left:3px;top:8px;width:12px;height:7px;border-radius:2px;background:#fff}
.tt-dot{width:12px;height:12px;border-radius:50%;background:#35c95a;border:2px solid #fff;box-shadow:0 0 0 0 rgba(53,201,90,.6);animation:ttDot 1.6s infinite}
.tt-max{padding:0 5px;border-radius:8px;background:linear-gradient(180deg,#ffe86b,#ffae1f);border:1px solid #c46a00;font-size:9px;font-weight:900;color:#7a3d00;line-height:14px;right:0}
/* 四種狀態 */
.tt-node[data-st="locked"] .tt-face{filter:grayscale(1) brightness(.92);opacity:.75}
.tt-node[data-st="locked"] .tt-nm,.tt-node[data-st="locked"] .tt-lv{color:#7b8898}
.tt-node[data-st="open"][data-can] .tt-face{animation:ttGlow 1.8s ease-in-out infinite}
.tt-node[data-st="prog"] .tt-face{box-shadow:0 3px 0 rgba(20,60,120,.25),0 0 0 2px #fff,0 0 8px var(--bc)}
.tt-node[data-st="max"] .tt-face{border-color:#ffb81f;box-shadow:0 3px 0 #c46a00,0 0 10px rgba(255,190,40,.9)}
.tt-node.key[data-st="max"] .tt-face{background:linear-gradient(180deg,#ffe86b,#ffa81f);filter:drop-shadow(0 0 5px rgba(255,190,40,.95))}
.tt-node[data-st="max"] .tt-lv{background:#fff6cf;border-color:#d98a00;color:#8a4a00}
.tt-node.flash .tt-face{animation:ttFlash .6s}
@keyframes ttGlow{0%,100%{box-shadow:0 3px 0 rgba(20,60,120,.25),0 0 0 0 var(--bc)}50%{box-shadow:0 3px 0 rgba(20,60,120,.25),0 0 10px 2px var(--bc)}}
@keyframes ttDot{0%{box-shadow:0 0 0 0 rgba(53,201,90,.6)}70%,100%{box-shadow:0 0 0 6px rgba(53,201,90,0)}}
@keyframes ttFlash{0%{transform:scale(1)}40%{transform:scale(1.25);filter:brightness(1.6)}100%{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){.tt-node .tt-face,.tt-dot{animation:none!important}}

/* ---------- 詳情 ---------- */
.tt-detail{display:flex;flex-direction:column;gap:7px;padding:12px;border-radius:16px;background:#fff;border:3px solid var(--bc,#cfe6ff);box-shadow:0 3px 0 rgba(20,60,120,.18);font-size:13px;color:#123a73;min-width:0}
.tt-dh{display:flex;align-items:center;gap:10px}
.tt-dh .tt-face{--sz:60px;flex:none}
.tt-dt{display:flex;flex-direction:column;min-width:0;gap:1px}
.tt-dt b{font-size:17px;font-weight:900;color:#1462c8}
.tt-dt small{font-size:11px;font-weight:800;color:#4a6b9a}
.tt-dlv{align-self:flex-start;padding:0 8px;border-radius:9px;background:#e8f3ff;font-size:12px;font-weight:900;color:#1462c8}
.tt-eff p{margin:2px 0;font-weight:800}
.tt-eff .now{color:#1f7a34}
.tt-eff .next{color:#123a73}
.tt-eff .next b{color:#0f9a3c;background:#e3f9e8;padding:0 4px;border-radius:5px}
.tt-eff .full{font-size:11px;color:#6a82a6}
.tt-eff .tt-kd{color:#123a73;line-height:1.5}
.tt-cap{font-size:12px;font-weight:800;color:#2a5a9a}
.tt-cap.cut{color:#b06a00}
.tt-capwarn{padding:4px 8px;border-radius:8px;background:#fff3c4;border:1px solid #e0a800;font-size:12px;font-weight:900;color:#8a5a00}
.tt-capwarn::before{content:"！";display:inline-block;width:16px;height:16px;margin-right:5px;border-radius:50%;background:#e0a800;color:#fff;text-align:center;line-height:16px;font-size:11px}
.tt-capnote{font-size:11px;font-weight:700;color:#6a82a6}
.tt-req{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:1px}
.tt-req li{font-size:12px;font-weight:800}
.tt-req li.ok{color:#1f8a3a}.tt-req li.no{color:#c8402f}
.tt-foot{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin-top:2px;padding-top:8px;border-top:2px dashed #cfe6ff}
.tt-cost{display:flex;flex-wrap:wrap;gap:4px 10px;font-weight:900;color:#123a73}
.tt-cost span{display:inline-flex;align-items:center;gap:4px}
.tt-cost span.lack{color:#d0392b}
.tt-cost img,.tt-cost canvas,.tt-cost .bg-ic{width:18px;height:18px;object-fit:contain;image-rendering:pixelated}
.tt-up{margin-left:auto;min-width:96px;min-height:40px;font-size:15px}
.tt-up:disabled{filter:grayscale(.85) opacity(.6);cursor:default}
.tt-why{flex-basis:100%;font-size:12px;font-weight:800;color:#d0392b}
.tt-done{font-weight:900;color:#b06a00}

/* ---------- 手機直向／窄畫面：分支頁籤＋底部抽屜 ---------- */
.tt-btabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.tt-btab{position:relative;display:flex;flex-direction:column;align-items:center;min-height:44px;padding:4px 2px;border-radius:12px;border:2px solid var(--bc);background:#fff;color:#123a73;font-family:inherit;font-size:13px;font-weight:900;cursor:pointer;white-space:nowrap}
.tt-btab small{font-size:10px;font-weight:800;color:#4a6b9a}
.tt-btab.on{background:var(--bc);color:#fff;text-shadow:0 1px 0 rgba(0,0,0,.25)}
.tt-btab.on small{color:#fff}
.tt-btab .tt-dot{position:absolute;right:4px;top:3px;background:#ff4b4b;animation:none}
.tal.narrow .tt-bhead{display:none}
.tal.narrow.has-drawer .tt-tree{margin-bottom:0}
.tt-drawer{position:fixed;left:0;bottom:0;box-sizing:border-box;padding:0 4px;z-index:40;animation:ttUp .18s ease-out}
.tt-drawer .tt-detail{border-radius:16px 16px 0 0;box-shadow:0 -6px 18px rgba(0,30,90,.28);max-height:52vh;overflow:auto;padding-right:34px}
.tt-drawer .tt-up{min-height:44px;min-width:110px}
.tt-x{position:absolute;right:6px;top:6px;z-index:2;width:30px;height:30px;border-radius:50%;border:2px solid #cfe6ff;background:#fff;color:#4a6b9a;font-size:18px;font-weight:900;line-height:1;cursor:pointer}
@keyframes ttUp{from{transform:translateY(30px);opacity:0}to{transform:none;opacity:1}}
@media (max-width:380px){.tal.narrow .tt-node{--sz:58px}.tal.narrow .tt-node.key{--sz:68px}.tt-chip{padding:2px 7px;font-size:12px}}

/* ---------- 重置確認 ---------- */
.tt-dlg{position:absolute;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;background:rgba(6,20,60,.55)}
.tt-dbox{min-width:260px;max-width:min(420px,calc(100vw - 40px));padding:16px 18px;border-radius:18px;background:#f3faff;border:3px solid #fff;box-shadow:0 8px 24px rgba(0,30,90,.4);color:#123a73}
.tt-dbox h4{margin:0 0 8px;font-size:17px;font-weight:900;color:#1462c8}
.tt-dbox p{margin:4px 0;font-size:13px;font-weight:800;line-height:1.5}
.tt-drow{display:flex;justify-content:flex-end;gap:10px;margin-top:12px}
.tt-drow .lb-btn{min-height:40px;min-width:84px}
.tt-capwarn.floor{background:#e3f1ff;border-color:#4a9be8;color:#1d4f8a}
.tt-capwarn.floor::before{content:"i";background:#4a9be8}
