/* style-s5-ui3-build：構築區（技能拼圖、天賦、試煉、構築預設、寶石倉庫）2026-10-18 改版。
   對應 js/s5/phase3-ui.js，所有選擇器使用 b3- 前綴並加上 .aw-shell，覆蓋 style-s5-aw.css 的舊樣式。
   主動寶石暖橙、輔助寶石青綠（--gc），重點狀態用金框＋角標，與背包同一套 token。 */

/* ---------- 共用元件 ---------- */
.aw-shell .b3-status{margin:0 0 8px;padding:6px 12px;min-height:0;border-radius:8px;font-size:13px;line-height:1.5;color:#ffe29a;background:#3a2a1055;box-shadow:inset 0 0 0 1px #d6b26a44;}
.aw-shell .b3-status:empty{display:none;}
.aw-shell .b3-card{min-width:0;padding:12px;border-radius:10px;background:linear-gradient(180deg,#1d1d4a,#121232);box-shadow:inset 0 0 0 1px #8a714055;}
.aw-shell .aw-body .b3-page h3{margin:0;font-size:15px;color:var(--ui-gold2);}
.aw-shell .aw-body .b3-page h3 small{font-size:12px;font-weight:400;color:var(--ui-muted);font-variant-numeric:tabular-nums;}
.aw-shell .b3-hint{margin:0;font-size:12px;line-height:1.5;color:var(--ui-muted);}
.aw-shell .b3-empty{grid-column:1/-1;margin:0;padding:24px 8px;text-align:center;font-size:13px;color:var(--ui-muted);}
.aw-shell .b3-good{color:var(--ui-good);}
.aw-shell .b3-red{color:var(--ui-bad);}
.aw-shell .b3-bar{display:block;height:6px;border-radius:3px;background:#0b0b20;box-shadow:inset 0 0 0 1px #2e2b58;overflow:hidden;}
.aw-shell .b3-bar i{display:block;height:100%;background:linear-gradient(90deg,#c69a45,#ffe2a0);}
.aw-shell .b3-chips{display:flex;flex-wrap:wrap;gap:4px;}
.aw-shell .b3-chips i{font-style:normal;font-size:11px;line-height:1.6;padding:0 8px;border-radius:999px;color:#d9d3f2;background:#14143a;box-shadow:inset 0 0 0 1px #3a3770;}
.aw-shell .b3-badge{position:absolute;top:8px;right:8px;z-index:2;font-style:normal;font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;color:#1c1404;background:linear-gradient(180deg,#ffe9a8,#c69a45);box-shadow:0 0 8px #d6b26a88;}
.aw-shell .b3-pill{display:inline-flex;align-items:baseline;gap:3px;padding:2px 9px;border-radius:999px;font-size:12px;color:var(--ui-muted);background:#0c0c24;box-shadow:inset 0 0 0 1px #3a3770;font-variant-numeric:tabular-nums;white-space:nowrap;}
.aw-shell .b3-pill b{font-size:13px;color:var(--ui-gold2);}
.aw-shell .b3-pill.full b{color:var(--ui-good);}
/* 頁首摘要列：大數字膠囊＋一行提示＋主要動作 */
.aw-shell .b3-top{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:12px;}
.aw-shell .b3-top .b3-hint{flex:1 1 240px;}
.aw-shell .b3-pillbig{display:flex;flex-direction:column;align-items:center;gap:2px;min-width:84px;padding:6px 12px;border-radius:8px;background:#0c0c24;box-shadow:inset 0 0 0 1px #8a714066;}
.aw-shell .b3-pillbig b{font-size:20px;line-height:1.2;color:var(--ui-gold2);font-variant-numeric:tabular-nums;}
.aw-shell .b3-pillbig b small{font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-pillbig b.b3-mainname{font-size:15px;line-height:1.6;}
.aw-shell .b3-pillbig b.b3-good{color:var(--ui-good);font-size:15px;line-height:1.6;}
.aw-shell .b3-pillbig b.b3-red{color:#ffb38a;font-size:15px;line-height:1.6;}
.aw-shell .b3-pillbig span{font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-pillbig .b3-bar{width:100%;min-width:72px;margin-top:2px;}
.aw-shell .aw-body .b3-top button{min-height:38px;padding:6px 12px;font-size:13px;}
/* 能力格（同背包 .bag-stats） */
.aw-shell .b3-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:0;}
.aw-shell .b3-stats div{min-width:0;padding:5px 7px;border-radius:6px;background:#0c0c24;box-shadow:inset 0 0 0 1px #2e2b58;}
.aw-shell .b3-stats .b3-wide{grid-column:1/-1;}
.aw-shell .b3-stats dt{font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-stats dd{margin:0;font-size:14px;font-weight:700;color:#fff;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.aw-shell .b3-stats .b3-wide dd{font-size:12px;font-weight:400;color:var(--ui-muted);}
/* 寶石圖示框：--gc 由主動／輔助決定 */
.aw-shell .b3-ico{--gc:#e8a65a;display:grid;place-items:center;flex:0 0 auto;width:38px;height:38px;border-radius:8px;background:radial-gradient(circle at 50% 40%,color-mix(in srgb,var(--gc) 32%,#1a1a40),#0b0b20 75%);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--gc) 65%,transparent);}
.aw-shell .b3-ico img{width:78%;height:78%;object-fit:contain;image-rendering:pixelated;pointer-events:none;filter:drop-shadow(0 2px 2px #000);}
.aw-shell .b3-ico b{font-size:16px;color:var(--gc);}
.aw-shell .support>.b3-ico,.aw-shell .support .b3-gd-head .b3-ico,.aw-shell .b3-ico.sup{--gc:#5fd0c4;}
.aw-shell .b3-ico.sm{width:22px;height:22px;border-radius:5px;}
.aw-shell .b3-ico.lg{width:56px;height:56px;border-radius:10px;}
/* 形狀小預覽 */
.aw-shell .b3-shape{--gc:#e8a65a;--s:6px;display:grid;grid-template-columns:repeat(var(--w),var(--s));grid-template-rows:repeat(var(--h),var(--s));gap:1px;flex:0 0 auto;}
.aw-shell .support .b3-shape{--gc:#5fd0c4;}
.aw-shell .b3-shape i{border-radius:1px;background:var(--gc);box-shadow:0 0 3px color-mix(in srgb,var(--gc) 60%,transparent);}
.aw-shell .b3-shape.lg{--s:11px;gap:2px;margin-left:auto;padding:5px;border-radius:6px;background:#0a0a1e;box-shadow:inset 0 0 0 1px #2e2b58;}

/* ---------- 技能拼圖 ---------- */
.aw-shell .b3-puzzle{--b3c:50px;display:flex;flex-direction:column;gap:12px;}
.aw-shell .b3-cols{display:grid;grid-template-columns:minmax(210px,1fr) auto minmax(250px,1.15fr);gap:12px;align-items:start;}
.aw-shell .b3-cols>*{grid-column:auto;grid-row:auto;min-width:0;}
/* 寶石盒 */
.aw-shell .aw-gem-box.b3-box{position:sticky;top:0;display:flex;flex-direction:column;gap:8px;max-height:none;overflow:visible;}
.aw-shell .b3-box-head{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.aw-shell .aw-body .b3-box-head select{min-height:32px;padding:3px 8px;border-radius:6px;font-size:13px;background:#0c0c24;border:1px solid #3a3770;color:var(--ui-text);}
.aw-shell .b3-box-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(156px,1fr));gap:6px;max-height:min(520px,calc(95vh - 250px));overflow-y:auto;overscroll-behavior:contain;padding:2px 4px 2px 2px;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:#4a4580 transparent;}
.aw-shell .aw-body .b3-gem{--gc:#e8a65a;position:relative;display:grid;grid-template-columns:38px minmax(0,1fr) auto 26px;grid-template-rows:auto auto;column-gap:7px;align-items:center;min-height:52px;min-width:0;padding:5px 0 5px 6px;text-align:left;border-radius:8px;border:1px solid #34316a;border-left:3px solid var(--gc);background:radial-gradient(circle at 0 50%,color-mix(in srgb,var(--gc) 20%,transparent),transparent 62%),linear-gradient(180deg,#1b1b44,#111130);color:var(--ui-text);touch-action:pan-y;transition:transform .08s,box-shadow .12s;}
.aw-shell .aw-body .b3-gem.support{--gc:#5fd0c4;}
.aw-shell .aw-body .b3-gem:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 0 10px color-mix(in srgb,var(--gc) 45%,transparent);}
.aw-shell .b3-gem>.b3-ico{grid-row:1/3;}
.aw-shell .b3-gem>b{grid-column:2;align-self:end;font-size:13px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.aw-shell .b3-gem>small{grid-column:2;align-self:start;font-size:11px;color:var(--ui-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.aw-shell .b3-gem>.b3-shape{grid-column:3;grid-row:1/3;}
.aw-shell .b3-gem .b3-on,.aw-shell .b3-gem .b3-lk{position:absolute;left:4px;font-style:normal;font-size:9px;line-height:13px;padding:0 3px;border-radius:3px;background:#000b;pointer-events:none;}
.aw-shell .b3-gem .b3-on{top:3px;color:var(--ui-gold2);box-shadow:0 0 0 1px #d6b26a88;}
.aw-shell .b3-gem .b3-lk{bottom:3px;color:#ffd27a;}
.aw-shell .aw-body .b3-gem .aw-gem-drag{grid-column:4;grid-row:1/3;align-self:stretch;display:grid;place-items:center;min-width:0;min-height:0;width:26px;font-size:17px;color:#ffe19c;opacity:.7;border-left:1px solid #ffffff12;cursor:grab;touch-action:none;}
.aw-shell .aw-body .b3-gem:hover .aw-gem-drag{opacity:1;}
.aw-shell .aw-body .b3-gem.placed{background:radial-gradient(circle at 0 50%,color-mix(in srgb,var(--gc) 30%,transparent),transparent 62%),linear-gradient(180deg,#25224e,#141336);}
.aw-shell .aw-body .b3-gem.selected{outline:2px solid var(--ui-gold2);outline-offset:1px;border-color:var(--ui-gold);box-shadow:0 0 12px #f4dea055;}
/* 盤面：外框鑲金、格子為凹槽，寶石為帶高光的色塊，同一顆寶石的格子相連 */
.aw-shell .aw-board-column.b3-boardcol{display:flex;flex-direction:column;gap:8px;width:calc(6*var(--b3c) + 16px);}
.aw-shell .b3-strip{display:flex;flex-wrap:wrap;align-items:center;gap:5px;}
.aw-shell .b3-strip small{flex-basis:100%;font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-board{position:relative;padding:8px;border-radius:12px;background:radial-gradient(ellipse at 50% 40%,#232262,#0a0a1e 80%);box-shadow:0 0 0 1px #000,0 0 0 2px #8a7140,0 0 0 4px #2a2140,0 0 0 5px #d6b26a44,inset 0 4px 18px #000c,0 8px 22px #0009;}
.aw-shell .b3-grid.aw-gem-board{display:grid;grid-template-columns:repeat(6,var(--b3c));grid-template-rows:repeat(5,var(--b3c));gap:0;width:calc(6*var(--b3c));height:calc(5*var(--b3c));border:0;touch-action:none;}
.aw-shell .aw-body .b3-cell{position:relative;isolation:isolate;display:grid;place-items:center;width:var(--b3c);height:var(--b3c);min-width:0;min-height:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;outline:none;opacity:1;color:#fff;font-size:12px;touch-action:none;}
.aw-shell .aw-body .b3-cell:disabled{opacity:1;cursor:default;}
.aw-shell .b3-cell::before{content:"";position:absolute;inset:2px;z-index:-1;border:1px solid #2e2b58;border-radius:7px;background:linear-gradient(180deg,#14143a,#0d0d26);box-shadow:inset 0 2px 5px #000a;transition:background .12s,border-color .12s;}
.aw-shell .b3-cell.active{--gc:#e8a65a;--gd:#6e3f16;}
.aw-shell .b3-cell.support{--gc:#5fd0c4;--gd:#174f52;}
.aw-shell .b3-cell.active::before,.aw-shell .b3-cell.support::before{border-color:color-mix(in srgb,var(--gc) 85%,#fff);background:radial-gradient(circle at 28% 22%,#ffffff40,transparent 50%),linear-gradient(160deg,color-mix(in srgb,var(--gc) 78%,#000),var(--gd));box-shadow:inset 0 -3px 6px #0005;}
.aw-shell .b3-cell.selected::before{border-color:var(--ui-gold2);box-shadow:inset 0 0 10px #fff7d6aa,inset 0 -3px 6px #0005;}
.aw-shell .b3-cell.peer::before{border-color:#ffe9a8;animation:b3Peer 1.6s ease-in-out infinite;}
/* 同一顆寶石相連的邊：色塊延伸到格線並隱藏該邊框 */
.aw-shell .b3-cell.jr::before{right:0;border-right-color:transparent;border-top-right-radius:0;border-bottom-right-radius:0;}
.aw-shell .b3-cell.jl::before{left:0;border-left-color:transparent;border-top-left-radius:0;border-bottom-left-radius:0;}
.aw-shell .b3-cell.jb::before{bottom:0;border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0;}
.aw-shell .b3-cell.jt::before{top:0;border-top-color:transparent;border-top-left-radius:0;border-top-right-radius:0;}
.aw-shell .b3-cell img{width:72%;height:72%;object-fit:contain;image-rendering:pixelated;pointer-events:none;filter:drop-shadow(0 2px 2px #000);}
.aw-shell .b3-cell>b{font-size:12px;color:#fff;text-shadow:0 1px 2px #000;pointer-events:none;}
.aw-shell .b3-cell>em{position:absolute;top:1px;left:2px;min-width:14px;height:14px;font-style:normal;font-size:10px;font-weight:700;line-height:14px;text-align:center;border-radius:50%;color:#2a1d05;background:radial-gradient(circle at 35% 30%,#ffe9a8,#c69a45);box-shadow:0 0 4px #000;pointer-events:none;}
.aw-shell .b3-cell.closed::before{border-color:#1f1c3a;background:repeating-linear-gradient(45deg,#0b0b1a 0 5px,#15132a 5px 8px);box-shadow:none;}
.aw-shell .b3-cell.closed::after{content:"鎖";font-size:10px;color:#4a4670;}
.aw-shell .b3-puzzle.picking .b3-cell.empty:hover::before,.aw-shell .aw-dragging .b3-cell.empty:hover::before{border-color:var(--ui-gold);background:#d6b26a26;}
.aw-shell .aw-dragging .b3-cell.empty::before{border-color:#d6b26a55;}
/* 連結標記：主動與輔助共邊處的菱形 */
.aw-shell .b3-marks{position:absolute;inset:8px;pointer-events:none;}
.aw-shell .b3-mark{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:2px;transform:rotate(45deg);}
.aw-shell .b3-mark.ok{background:radial-gradient(circle,#fffbe6,#e9b955 70%);box-shadow:0 0 0 1px #3a2a08,0 0 8px #ffd76a;animation:b3Glow 2.4s ease-in-out infinite;}
.aw-shell .b3-mark.bad{width:8px;height:8px;margin:-4px 0 0 -4px;background:#6a2434;box-shadow:0 0 0 1px #ff8f8faa;}
.aw-shell .b3-tools{display:flex;align-items:center;gap:6px;}
.aw-shell .b3-pick{display:flex;flex-direction:column;flex:1;min-width:0;line-height:1.3;}
.aw-shell .b3-pick b{font-size:13px;color:var(--ui-gold2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.aw-shell .b3-pick small{font-size:11px;color:var(--ui-muted);}
.aw-shell .aw-body .b3-tools button{min-height:38px;min-width:0;padding:4px 10px;font-size:13px;}
.aw-shell .b3-legend{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-legend i{display:inline-block;width:10px;height:10px;margin-right:4px;vertical-align:-1px;border-radius:2px;}
.aw-shell .b3-legend .lg-a{background:#e8a65a;}.aw-shell .b3-legend .lg-s{background:#5fd0c4;}
.aw-shell .b3-legend .lg-ok{background:#ffd76a;transform:rotate(45deg) scale(.8);box-shadow:0 0 5px #ffd76a;}
.aw-shell .b3-legend .lg-bad{background:#ff8f8f;transform:rotate(45deg) scale(.6);}
.aw-shell .b3-legend .lg-x{background:repeating-linear-gradient(45deg,#0b0b1a 0 3px,#2e2a50 3px 5px);box-shadow:inset 0 0 0 1px #2e2b58;}
/* 側欄：寶石詳情卡＋連結清單 */
.aw-shell .aw-gem-detail.b3-side{display:flex;flex-direction:column;gap:10px;max-height:none;overflow:visible;}
.aw-shell .b3-gd-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:120px;text-align:center;box-shadow:inset 0 0 0 1px #3a377088;background:repeating-linear-gradient(135deg,#15153a 0 10px,#131334 10px 20px);}
.aw-shell .b3-gd-empty b{font-size:15px;color:var(--ui-gold2);}
.aw-shell .b3-gd-empty span{font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-gd{--gc:#e8a65a;position:relative;display:flex;flex-direction:column;gap:9px;overflow-wrap:anywhere;background:linear-gradient(180deg,#1f1d4c,#121230);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--gc) 65%,transparent),0 0 16px color-mix(in srgb,var(--gc) 18%,transparent);}
.aw-shell .b3-gd.support{--gc:#5fd0c4;}
.aw-shell .b3-gd-head{display:flex;align-items:center;gap:10px;}
.aw-shell .b3-gd-head>div{min-width:0;}
.aw-shell .aw-body .b3-gd h3{font-size:17px;color:#fff;text-shadow:0 0 10px color-mix(in srgb,var(--gc) 55%,transparent);}
.aw-shell .b3-gd-head small{font-size:12px;color:var(--gc);}
.aw-shell .b3-gd-head small b{font-weight:400;}
.aw-shell .b3-rank{display:flex;align-items:center;gap:8px;}
.aw-shell .b3-rank>b{font-size:18px;color:var(--ui-gold2);font-variant-numeric:tabular-nums;}
.aw-shell .b3-rank>b small{font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-rank .b3-bar{flex:1;}
.aw-shell .b3-rank>small{font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-frag{display:grid;gap:4px;padding:7px 9px;border-radius:6px;background:#0c0c24;box-shadow:inset 0 0 0 1px #2e2b58;font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-frag b{color:#fff;font-variant-numeric:tabular-nums;}
.aw-shell .b3-frag small{font-size:11px;}
.aw-shell .b3-desc{margin:0;padding:8px 10px;border-radius:6px;font-size:13px;line-height:1.55;color:#d6fff8;background:#0f3a3a55;box-shadow:inset 0 0 0 1px #5fd0c455;}
.aw-shell .b3-src{font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-gd-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;}
.aw-shell .aw-body .b3-gd-actions button{width:auto;min-height:40px;min-width:0;margin:0;padding:4px 8px;font-size:13px;text-align:center;}
.aw-shell .b3-more summary{cursor:pointer;font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-more summary:hover{color:var(--ui-gold2);}
.aw-shell .b3-more p{margin:6px 0 0;font-size:12px;line-height:1.55;color:#cfc8ee;}
.aw-shell .b3-morph>div{display:flex;gap:6px;margin-top:6px;}
.aw-shell .aw-body .b3-morph select{flex:1;min-width:0;min-height:38px;padding:3px 8px;border-radius:6px;font-size:13px;background:#0c0c24;border:1px solid #3a3770;color:var(--ui-text);}
.aw-shell .aw-body .b3-morph button{min-height:38px;min-width:0;padding:4px 10px;font-size:13px;}
.aw-shell .aw-body .b3-close{position:absolute;top:8px;right:8px;z-index:2;min-width:30px;min-height:30px;width:30px;height:30px;padding:0;border-radius:50%;font-size:13px;}
.aw-shell .b3-links{display:flex;flex-direction:column;gap:6px;}
.aw-shell .b3-link{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;row-gap:2px;align-items:center;padding:6px 8px;border-radius:8px;background:#0c0c24;box-shadow:inset 0 0 0 1px #2e2b58;border-left:3px solid var(--ui-good);}
.aw-shell .b3-link.invalid{border-left-color:#ff9f7a;opacity:.85;}
.aw-shell .b3-link-pair{display:flex;align-items:center;gap:4px;min-width:0;font-size:12px;}
.aw-shell .b3-link-pair b{min-width:0;font-weight:400;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.aw-shell .b3-link-pair em{font-style:normal;color:var(--ui-gold);}
.aw-shell .b3-st{grid-column:1;font-style:normal;font-size:11px;color:var(--ui-good);}
.aw-shell .b3-link.invalid .b3-st{color:#ffb38a;}
.aw-shell .aw-body .b3-link button{grid-column:2;grid-row:1/3;min-height:32px;min-width:0;padding:2px 9px;font-size:12px;}
/* 動作列：固定在內容區底部，套用為 primary */
.aw-shell .b3-actbar{position:sticky;bottom:0;z-index:4;display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;background:linear-gradient(180deg,#26245a,#16163a);box-shadow:inset 0 0 0 1px #8a714077,0 -8px 18px #0d0e22;}
.aw-shell .b3-state{display:flex;align-items:center;gap:8px;flex:1;min-width:0;margin:0;font-size:13px;line-height:1.4;color:#e9e4ff;}
.aw-shell .b3-state i{flex:0 0 10px;height:10px;border-radius:50%;}
.aw-shell .b3-state.ok i{background:var(--ui-good);box-shadow:0 0 8px var(--ui-good);}
.aw-shell .b3-state.dirty i{background:#ffd27a;box-shadow:0 0 8px #ffd27a;animation:b3Glow 1.6s ease-in-out infinite;}
.aw-shell .b3-state.err{color:var(--ui-bad);}
.aw-shell .b3-state.err i{background:var(--ui-bad);box-shadow:0 0 8px var(--ui-bad);}
.aw-shell .aw-body .b3-actbar button{min-height:40px;min-width:0;padding:4px 14px;font-size:14px;white-space:nowrap;}
.aw-shell .aw-body .b3-actbar #awGemApply{min-width:116px;}
.aw-shell .b3-actbar .b3-mob{display:none;}

/* ---------- 天賦：三欄技能樹 ---------- */
.aw-shell .aw-talents.b3-tal{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.aw-shell .b3-tal .b3-branch{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;padding:12px;border:0;border-radius:10px;background:linear-gradient(180deg,#1d1d4a,#121232);box-shadow:inset 0 0 0 1px #8a714055;}
.aw-shell .b3-tal .b3-branch.main{background:linear-gradient(180deg,#3d3018,#16153a 55%);box-shadow:inset 0 0 0 1px var(--ui-gold),0 0 16px #d6b26a44;}
.aw-shell .b3-tal .b3-branch.side{background:linear-gradient(180deg,#191940,#10102c);}
.aw-shell .b3-branch-head{display:flex;align-items:baseline;gap:8px;padding-right:64px;}
.aw-shell .b3-nodes{position:relative;display:flex;flex-direction:column;gap:14px;margin:4px 0 0;padding:0;list-style:none;}
.aw-shell .b3-node{position:relative;}
/* 節點之間的連線；前一節點已學則亮金 */
.aw-shell .b3-node+.b3-node::before{content:"";position:absolute;left:23px;top:-15px;width:2px;height:16px;background:#3a3770;}
.aw-shell .b3-node.learned+.b3-node::before{background:linear-gradient(#f4dea0,#c69a45);box-shadow:0 0 6px #d6b26a;}
.aw-shell .aw-body .b3-node button{display:grid;grid-template-columns:34px minmax(0,1fr);grid-template-rows:auto auto;column-gap:10px;align-items:center;width:100%;min-height:56px;margin:0;padding:7px 10px 7px 6px;text-align:left;border-radius:10px;border:1px solid #33305e;background:#0f0f2a;color:var(--ui-text);}
.aw-shell .b3-node button>i{grid-row:1/3;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;font-style:normal;font-size:14px;font-weight:700;color:#8e88b8;background:radial-gradient(circle at 35% 30%,#2a2860,#121234);box-shadow:inset 0 0 0 1px #4a4680;}
.aw-shell .b3-node button>span{font-size:13px;line-height:1.4;color:#e9e4ff;}
.aw-shell .b3-node button>small{font-size:11px;color:var(--ui-muted);}
.aw-shell .b3-node.cap button>i{border-radius:9px;box-shadow:inset 0 0 0 1px #4a4680,0 0 0 2px #8a714088;}
.aw-shell .aw-body .b3-node.learned button{opacity:1;cursor:default;border-color:#d6b26a;background:linear-gradient(90deg,#4d3c18,#1c1a3e);}
.aw-shell .b3-node.learned button>i{color:#2a1d05;background:radial-gradient(circle at 35% 30%,#ffe9a8,#c69a45);box-shadow:0 0 10px #d6b26a99;}
.aw-shell .b3-node.learned button>span{color:#fff6dc;}
.aw-shell .b3-node.learned button>small{color:var(--ui-gold);}
.aw-shell .aw-body .b3-node.can button{border-color:#d6b26a99;background:linear-gradient(90deg,#26234f,#14143a);}
.aw-shell .b3-node.can button>i{color:var(--ui-gold2);box-shadow:inset 0 0 0 1px #d6b26a,0 0 0 2px #d6b26a44;animation:b3Ring 2s ease-in-out infinite;}
.aw-shell .b3-node.can button>small{color:var(--ui-gold2);}
.aw-shell .aw-body .b3-node.can button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 0 12px #d6b26a55;}
.aw-shell .b3-node.lock button{filter:grayscale(.7);}
.aw-shell .b3-node.lock button>span{color:#9a94bb;}

/* ---------- 試煉：四張關卡卡 ---------- */
.aw-shell .aw-trials.b3-trials{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.aw-shell .b3-trials .b3-trial{position:relative;isolation:isolate;overflow:hidden;display:flex;flex-direction:column;gap:6px;min-width:0;min-height:270px;padding:12px;border-radius:12px;border:1px solid #3a3770;background:#0d0d24;}
.aw-shell .b3-trial-thumb{position:absolute;top:0;left:0;z-index:-2;width:100%;height:130px;object-fit:cover;opacity:.5;-webkit-mask-image:linear-gradient(#000 35%,transparent);mask-image:linear-gradient(#000 35%,transparent);transition:opacity .15s,transform .3s;}
.aw-shell .b3-trial::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,#0d0d2400 10%,#0d0d24cc 45%,#121232 100%);}
.aw-shell .b3-trial:hover .b3-trial-thumb{opacity:.68;transform:scale(1.04);}
.aw-shell .b3-trial-lv{display:flex;flex-direction:column;align-items:center;justify-content:center;width:66px;height:66px;margin:42px 0 4px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#3c3a7a,#14143a);box-shadow:inset 0 0 0 1px #8a7140,0 0 0 3px #0d0d24,0 0 0 4px #8a714066,0 4px 12px #000a;}
.aw-shell .b3-trial-lv small{font-size:10px;color:var(--ui-muted);}
.aw-shell .b3-trial-lv b{font-size:17px;line-height:1.1;color:var(--ui-gold2);font-variant-numeric:tabular-nums;}
.aw-shell .aw-body .b3-trial h3{font-size:16px;color:#fff;text-shadow:0 1px 3px #000;}
.aw-shell .b3-trial-map{margin:0;font-size:12px;line-height:1.4;color:#d9d3f2;}
.aw-shell .b3-reward{margin:auto 0 0;font-size:12px;color:var(--ui-gold);}
.aw-shell .aw-body .b3-trial button{width:100%;min-height:40px;min-width:0;padding:4px 8px;font-size:13px;}
.aw-shell .b3-trial.open{border-color:#d6b26a77;box-shadow:0 0 14px #d6b26a22;}
.aw-shell .b3-trial.open .b3-trial-lv{background:radial-gradient(circle at 35% 30%,#ffe9a8,#a8792e);box-shadow:inset 0 0 0 1px #fff3c4,0 0 0 3px #0d0d24,0 0 0 4px #d6b26a,0 0 14px #d6b26a88;}
.aw-shell .b3-trial.open .b3-trial-lv small{color:#3a2a08;}
.aw-shell .b3-trial.open .b3-trial-lv b{color:#1c1404;}
.aw-shell .b3-trial.done{border-color:#7fe0a066;}
.aw-shell .b3-trial.done .b3-badge{background:linear-gradient(180deg,#c4f7d2,#4fae72);box-shadow:0 0 8px #7fe0a066;}
.aw-shell .b3-trial.done .b3-trial-lv{box-shadow:inset 0 0 0 1px #7fe0a0,0 0 0 3px #0d0d24,0 0 0 4px #7fe0a066;}
.aw-shell .b3-trial.done .b3-reward{color:var(--ui-good);}
.aw-shell .b3-trial.cool .b3-badge{background:linear-gradient(180deg,#ffd6a8,#c47a3a);}
.aw-shell .b3-trial.lock .b3-trial-thumb{filter:grayscale(1);opacity:.2;}
.aw-shell .b3-trial.lock .b3-badge{color:var(--ui-muted);background:#22204a;box-shadow:inset 0 0 0 1px #3a3770;}
.aw-shell .b3-trial.lock .b3-trial-lv b,.aw-shell .aw-body .b3-trial.lock h3{color:#8f89b4;}
.aw-shell .b3-trial.lock .b3-chips{opacity:.6;}

/* ---------- 構築預設：三張卡 ---------- */
.aw-shell .aw-presets.b3-presets{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.aw-shell .b3-presets .b3-preset{position:relative;display:flex;flex-direction:column;gap:10px;min-width:0;padding:14px;border-radius:12px;border:1px solid #3a3770;background:linear-gradient(180deg,#1d1d4a,#121232);}
.aw-shell .b3-presets .b3-preset.active{border-color:var(--ui-gold);background:linear-gradient(160deg,#4a3a18,#1d1a3a 62%);box-shadow:0 0 16px #d6b26a55;}
.aw-shell .b3-presets .b3-preset.blank{background:linear-gradient(180deg,#18183e,#10102c);}
.aw-shell .b3-presets .b3-preset.lock{filter:grayscale(.85);opacity:.6;}
.aw-shell .b3-preset-head{display:flex;align-items:center;gap:10px;padding-right:62px;}
.aw-shell .b3-preset-head>div{min-width:0;}
.aw-shell .b3-preset-head small{font-size:12px;color:var(--ui-muted);}
.aw-shell .b3-num{display:grid;place-items:center;flex:0 0 40px;height:40px;border-radius:50%;font-size:18px;font-weight:700;color:#d9cfa8;background:radial-gradient(circle at 35% 30%,#3c3a7a,#1a1a40);box-shadow:inset 0 0 0 1px #8a714099;}
.aw-shell .b3-preset.active .b3-num{color:#2a1d05;background:radial-gradient(circle at 35% 30%,#ffe9a8,#c69a45);box-shadow:0 0 10px #d6b26a88;}
.aw-shell .aw-body .b3-preset input[type=text]{width:100%;height:auto;min-height:38px;box-sizing:border-box;padding:4px 10px;border-radius:6px;font:inherit;font-size:14px;background:#0c0c24;border:1px solid #3a3770;color:var(--ui-text);}
.aw-shell .aw-body .b3-preset input[type=text]:focus{outline:none;border-color:var(--ui-gold);box-shadow:0 0 0 2px #d6b26a33;}
.aw-shell .b3-preset .b3-gd-actions{margin-top:auto;}

/* ---------- 寶石倉庫：方格＋詳情 ---------- */
.aw-shell .b3-stash{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:14px;align-items:start;}
.aw-shell .b3-stash-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:8px;align-content:start;min-height:220px;padding:10px;border-radius:10px;background:#0a0a1e;box-shadow:inset 0 0 0 1px #2a2752,inset 0 4px 16px #000a;}
.aw-shell .aw-body .b3-gem.tile{display:flex;flex-direction:column;align-items:center;gap:3px;min-height:96px;padding:10px 4px 6px;text-align:center;border:1px solid color-mix(in srgb,var(--gc) 70%,transparent);border-left-width:1px;background:radial-gradient(circle at 50% 30%,color-mix(in srgb,var(--gc) 26%,#1a1a40),#0c0c22 72%);}
.aw-shell .b3-gem.tile>b,.aw-shell .b3-gem.tile>small{align-self:center;max-width:100%;}
.aw-shell .b3-gem.tile>b{font-size:12px;}
.aw-shell .b3-gem.tile>small{font-size:10px;}
.aw-shell .b3-gem.tile>.b3-shape{position:absolute;top:4px;right:4px;--s:5px;}
.aw-shell .aw-body .b3-gem.tile.dim{filter:grayscale(.8);opacity:.6;}
.aw-shell .b3-stash-detail{position:sticky;top:0;min-width:0;}
.aw-shell .b3-stash-detail .b3-gd-head{padding-right:34px;}
.aw-shell .aw-body .b3-gd .b3-wide{width:100%;min-height:42px;}

/* ---------- 動畫 ---------- */
@keyframes b3Glow{50%{filter:brightness(1.35);}}
@keyframes b3Peer{50%{border-color:#fff6d0;filter:brightness(1.15);}}
@keyframes b3Ring{50%{box-shadow:inset 0 0 0 1px #ffe9a8,0 0 0 3px #d6b26a55,0 0 12px #ffd76a88;}}
@media (prefers-reduced-motion:reduce){.aw-shell .b3-mark.ok,.aw-shell .b3-cell.peer::before,.aw-shell .b3-state.dirty i,.aw-shell .b3-node.can button>i{animation:none;}}

/* ---------- 窄桌面 ---------- */
@media (max-width:1100px){
  .aw-shell .b3-cols{grid-template-columns:minmax(180px,1fr) auto minmax(220px,1fr);gap:10px;}
  .aw-shell .b3-puzzle{--b3c:46px;}
  .aw-shell .aw-trials.b3-trials{grid-template-columns:repeat(2,minmax(0,1fr));}
  .aw-shell .b3-trials .b3-trial{min-height:230px;}
}
/* ---------- 手機橫向 844×390（內容約 760×330）：三欄縮小、盤格 44px、動作列精簡 ---------- */
@media (max-height:460px),(max-width:820px){
  .aw-shell .b3-status{margin-bottom:5px;padding:2px 10px;font-size:12px;}
  .aw-shell .b3-top{gap:6px;margin-bottom:8px;}
  .aw-shell .b3-top .b3-hint{flex-basis:200px;font-size:11px;line-height:1.4;}
  .aw-shell .b3-pillbig{min-width:64px;padding:3px 8px;}
  .aw-shell .b3-pillbig b{font-size:16px;}
  .aw-shell .b3-pillbig b.b3-mainname,.aw-shell .b3-pillbig b.b3-good,.aw-shell .b3-pillbig b.b3-red{font-size:13px;}
  .aw-shell .aw-body .b3-top button{min-height:34px;padding:4px 10px;font-size:12px;}
  .aw-shell .b3-card{padding:8px;}
  /* 拼圖 */
  .aw-shell .b3-puzzle{--b3c:44px;gap:6px;}
  .aw-shell .b3-cols{grid-template-columns:minmax(0,1fr) auto minmax(0,1.1fr);gap:8px;}
  .aw-shell .aw-gem-box.b3-box{position:static;gap:5px;}
  .aw-shell .b3-box-head h3{font-size:13px;}
  .aw-shell .aw-body .b3-box-head select{min-height:30px;font-size:12px;}
  .aw-shell .b3-box-list{grid-template-columns:minmax(0,1fr);gap:5px;max-height:calc(100dvh - 150px);}
  .aw-shell .aw-body .b3-gem{grid-template-columns:32px minmax(0,1fr) auto 32px;column-gap:6px;min-height:46px;padding:3px 0 3px 5px;}
  .aw-shell .b3-gem>.b3-ico{width:32px;height:32px;}
  .aw-shell .b3-gem>b{font-size:12px;}
  .aw-shell .b3-gem>small{font-size:10px;}
  .aw-shell .aw-body .b3-gem .aw-gem-drag{width:32px;font-size:16px;}
  .aw-shell .b3-box>.b3-hint{display:none;}
  .aw-shell .aw-board-column.b3-boardcol{gap:5px;width:calc(6*var(--b3c) + 8px);}
  .aw-shell .b3-strip,.aw-shell .b3-legend{display:none;}
  .aw-shell .b3-board{padding:4px;border-radius:8px;}
  .aw-shell .b3-marks{inset:4px;}
  .aw-shell .b3-mark{width:10px;height:10px;margin:-5px 0 0 -5px;}
  .aw-shell .aw-body .b3-tools button{min-height:34px;padding:3px 8px;font-size:12px;}
  .aw-shell .b3-pick b{font-size:12px;}
  .aw-shell .b3-pick small{font-size:10px;}
  .aw-shell .b3-side{gap:6px;}
  .aw-shell .b3-gd{gap:6px;}
  .aw-shell .b3-ico.lg{width:42px;height:42px;}
  .aw-shell .aw-body .b3-gd h3{font-size:14px;}
  .aw-shell .b3-shape.lg{--s:8px;padding:3px;}
  .aw-shell .b3-stats{gap:4px;}
  .aw-shell .b3-stats div{padding:3px 5px;}
  .aw-shell .b3-stats dt{font-size:10px;}
  .aw-shell .b3-stats dd{font-size:12px;}
  .aw-shell .b3-frag{padding:5px 7px;font-size:11px;}
  .aw-shell .b3-desc{padding:6px 8px;font-size:12px;}
  .aw-shell .aw-body .b3-gd-actions button,.aw-shell .aw-body .b3-morph button,.aw-shell .aw-body .b3-morph select{min-height:34px;font-size:12px;}
  .aw-shell .b3-link{padding:4px 6px;}
  .aw-shell .aw-body .b3-link button{min-height:30px;padding:2px 6px;font-size:11px;}
  .aw-shell .b3-actbar{gap:6px;padding:4px 6px;border-radius:8px;}
  .aw-shell .b3-actbar .b3-mob{display:inline-flex;}
  .aw-shell .b3-state{font-size:11px;gap:5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
  .aw-shell .b3-state i{display:inline-block;width:8px;height:8px;margin-right:4px;vertical-align:0;}
  .aw-shell .aw-body .b3-actbar button{min-height:34px;padding:3px 9px;font-size:12px;}
  .aw-shell .aw-body .b3-actbar #awGemApply{min-width:84px;}
  /* 天賦 */
  .aw-shell .aw-talents.b3-tal{gap:8px;}
  .aw-shell .b3-tal .b3-branch{padding:8px;gap:6px;}
  .aw-shell .aw-body .b3-tal-page h3{font-size:14px;}
  .aw-shell .b3-nodes{gap:10px;}
  .aw-shell .b3-node+.b3-node::before{left:19px;top:-11px;height:12px;}
  .aw-shell .aw-body .b3-node button{grid-template-columns:28px minmax(0,1fr);column-gap:7px;min-height:44px;padding:5px 7px 5px 5px;}
  .aw-shell .b3-node button>i{width:28px;height:28px;font-size:12px;}
  .aw-shell .b3-node button>span{font-size:12px;line-height:1.35;}
  .aw-shell .b3-node button>small{font-size:10px;}
  /* 試煉：維持四欄、縮短卡高 */
  .aw-shell .aw-trials.b3-trials{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;}
  .aw-shell .b3-trials .b3-trial{min-height:0;padding:8px;gap:4px;}
  .aw-shell .b3-trial-thumb{height:90px;}
  .aw-shell .b3-trial-lv{width:50px;height:50px;margin:26px 0 2px;}
  .aw-shell .b3-trial-lv b{font-size:14px;}
  .aw-shell .aw-body .b3-trial h3{font-size:14px;}
  .aw-shell .b3-trial-map,.aw-shell .b3-reward{font-size:11px;}
  .aw-shell .b3-chips i{font-size:10px;padding:0 6px;}
  .aw-shell .b3-badge{top:6px;right:6px;font-size:10px;padding:1px 6px;}
  .aw-shell .aw-body .b3-trial button{min-height:34px;font-size:12px;}
  /* 預設 */
  .aw-shell .aw-presets.b3-presets{gap:8px;}
  .aw-shell .b3-presets .b3-preset{padding:9px;gap:6px;}
  .aw-shell .b3-num{flex-basis:32px;height:32px;font-size:15px;}
  .aw-shell .aw-body .b3-preset input[type=text]{min-height:34px;font-size:13px;}
  /* 倉庫 */
  .aw-shell .b3-stash{grid-template-columns:minmax(0,1fr) min(250px,40vw);gap:8px;}
  .aw-shell .b3-stash-grid{grid-template-columns:repeat(auto-fill,minmax(68px,1fr));gap:5px;padding:6px;min-height:160px;}
  .aw-shell .aw-body .b3-gem.tile{min-height:80px;padding:8px 3px 4px;}
  .aw-shell .b3-gem.tile>.b3-ico{width:32px;height:32px;}
}
/* ---------- 直向窄螢幕：單欄堆疊 ---------- */
@media (max-width:699px){
  .aw-shell .b3-cols{grid-template-columns:minmax(0,1fr);}
  .aw-shell .aw-board-column.b3-boardcol{order:-1;justify-self:center;}
  .aw-shell .b3-strip,.aw-shell .b3-legend{display:flex;}
  .aw-shell .b3-box-list{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));max-height:260px;}
  .aw-shell .aw-talents.b3-tal,.aw-shell .aw-presets.b3-presets{grid-template-columns:minmax(0,1fr);}
  .aw-shell .aw-trials.b3-trials{grid-template-columns:repeat(2,minmax(0,1fr));}
  .aw-shell .b3-stash{grid-template-columns:minmax(0,1fr);}
  .aw-shell .b3-stash-detail{position:static;}
  .aw-shell .b3-actbar{flex-wrap:wrap;}
  .aw-shell .b3-state{flex-basis:100%;}
}
