/* 10-25 組隊副本（設計稿 Lobby／Room／Battle／Result）：全螢幕橫式、一頁放完不捲動，房間清單用分頁 */
html body dialog.team-panel{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:#fff9ed;color:#21334b;overflow:hidden;z-index:12000}
html body dialog.team-panel::backdrop{background:#0b1324cc}
.team-panel .team-shell{position:relative;display:flex;flex-direction:column;gap:10px;height:100%;box-sizing:border-box;padding:clamp(8px,1.6vw,18px) clamp(10px,2vw,26px);overflow:hidden}
.team-panel button{font:inherit;cursor:pointer}
.team-panel button:disabled{cursor:not-allowed;opacity:.5}
.team-head{display:flex;align-items:center;gap:12px;padding:6px 14px;border:1px solid #d9dee8;border-radius:16px;background:#fff}
.team-head img{width:40px;height:40px;object-fit:contain}
.team-head h2{margin:0;font-size:clamp(16px,2vw,22px);font-weight:900}
.team-head span{margin-left:auto;font-size:13px;color:#4a5a72}
.team-head .btn{width:auto;min-height:38px}
.team-empty{margin:auto;font-size:16px;color:#4a5a72;text-align:center}
.team-note{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);margin:0;padding:8px 18px;border-radius:12px;background:#16213a;color:#ffe08a;font-weight:700;z-index:3}
.team-invite{position:absolute;right:20px;top:70px;display:flex;align-items:center;gap:8px;padding:10px 14px;border:2px solid #c9a14a;border-radius:14px;background:#fffaf0;box-shadow:0 8px 24px #0004;z-index:3}
.team-invite .btn{width:auto;min-height:34px}
.team-gold{background:linear-gradient(#fff3bd,#f4c44f)!important;border:1px solid #a77a2e!important;color:#3a2a08!important;font-weight:900!important}
.team-tap{display:flex;flex-wrap:wrap;gap:5px}
.team-tap button{min-height:32px;padding:0 10px;border:1px solid #cbb486;border-radius:10px;background:#fffaf0;color:#49361f;font-size:13px}
.team-tap button small{margin-left:4px;font-size:10px;opacity:.75}
.team-tap button[aria-pressed="true"]{border-color:#1f4f9c;background:#2f6fd6;color:#fff}

/* 大廳 */
.team-lobby{display:flex;gap:12px;flex:1;min-height:0}
.team-form{display:flex;flex-direction:column;gap:7px;width:min(34%,330px);padding:12px;border:2px solid #c9a14a;border-radius:16px;background:#fff;min-height:0}
.team-form>b{font-size:16px}
.team-form label{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:700}
.team-form .btn{min-height:42px}
.team-form .btn:first-of-type{margin-top:auto}
.team-support-choice{margin-top:auto;min-height:34px;border:1px solid #c79517;border-radius:10px;background:#fff8df;color:#563900;font-weight:800}
.team-support-choice[aria-pressed="true"]{background:#ffe07a;border-color:#a77a2e}
.team-rooms{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;min-height:0}
.team-rooms>nav{display:flex;align-items:center;gap:8px}
.team-pager{margin-left:auto;display:flex;align-items:center;gap:6px;font-size:13px}
.team-pager button{min-width:32px;min-height:30px;border:1px solid #cbb486;border-radius:8px;background:#fffaf0}
.team-room-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:8px;flex:1;min-height:0}
.team-room-card{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid #d9dee8;border-radius:14px;background:#fff;min-height:0}
.team-room-card img{width:52px;height:52px;object-fit:cover;border-radius:10px;background:#f3e6cc}
.team-room-card div{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
.team-room-card small{font-size:12px;color:#4a5a72}
.team-room-card em{font-style:normal;font-size:12px;font-weight:700;color:#8a5a00}
.team-room-card .btn{width:auto;min-height:38px}
.team-online{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:12px;background:#16213a;color:#f4efe2;font-size:13px;flex-wrap:nowrap;overflow:hidden}
.team-online>b{color:#ffe08a;white-space:nowrap}
.team-mate{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.team-mate button{min-height:28px;padding:0 10px;border:1px solid #c9a14a;border-radius:8px;background:#fffaf0;color:#3a2a08;font-weight:700}

/* 房間 */
.team-room{display:flex;flex-direction:column;gap:10px;flex:1;min-height:0;padding:12px;border-radius:16px;background:linear-gradient(#0b1324aa,#0b1324dd),var(--team-bg) center/cover}
.team-slots{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));gap:10px;flex:1;min-height:0}
.team-slot{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:10px;border:2px solid #c9a14a55;border-radius:16px;background:#fffaf0e8;min-height:0}
.team-slot img{flex:1;min-height:0;max-height:170px;width:100%;object-fit:contain}
.team-slot img.team-pet{flex:0 0 auto;width:42px;height:42px}
.team-pet-pack{display:flex;align-items:center;justify-content:center;gap:2px;max-width:100%;flex:none}
.team-slot .team-pet-pack img.team-pet{flex:none;width:clamp(26px,3.2vw,42px);height:clamp(26px,3.2vw,42px);object-fit:contain}
.team-support{display:flex;align-items:center;gap:10px;min-height:42px;padding:5px 10px;border:1px solid #dfc37d;border-radius:12px;background:#fff9e8;color:#27364b}
.team-support>b{white-space:nowrap}.team-support small{flex:1;font-size:12px;line-height:1.25}.team-support .btn{width:auto;min-height:34px;white-space:nowrap}
.team-slot b{font-size:15px}
.team-slot b small{padding:1px 6px;border-radius:999px;background:#ffe08a;font-size:11px}
.team-slot em{font-style:normal;font-weight:800;color:#8a5a00}
.team-slot.is-ready{border-color:#2e9e48;box-shadow:0 0 14px #2e9e4866}
.team-slot.is-ready em{color:#1d6b35}
.team-slot.is-empty{background:#fffaf033;color:#f4efe2;border-style:dashed}
.team-slot .btn{width:auto;min-height:30px;font-size:12px}
.team-room-actions{display:flex;align-items:center;gap:10px}
.team-room-actions .btn{width:auto;min-height:46px;min-width:140px}
.team-room-actions small{color:#f4efe2}

/* 戰鬥 */
.team-battle{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;padding:10px;border-radius:16px;color:#f4efe2;background:linear-gradient(#0b132499,#0b1324cc),var(--team-bg) center/cover}
.team-battle-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.team-battle-top span{padding:5px 12px;border:1px solid #c9a14a;border-radius:999px;background:#16213ae6;font-size:13px;font-weight:700}
.team-battle-top .team-quake{border-color:#ff8a7a;color:#ffb4a8}
.team-battle-top .team-timer{margin-left:auto;background:#e5383b;border-color:#e5383b;color:#fff;font-weight:900}
.team-field{display:flex;gap:12px;flex:1;min-height:0}
.team-enemies{display:flex;align-items:flex-end;justify-content:center;gap:10px;flex:1;min-width:0}
.team-enemy{display:flex;flex-direction:column;align-items:center;gap:4px;width:min(26%,180px)}
.team-enemy.is-boss{width:min(60%,320px)}
.team-enemy img{width:100%;aspect-ratio:1;object-fit:contain}
.team-enemy i{display:block;width:100%;height:10px;border-radius:5px;background:linear-gradient(90deg,#ff6b4a,#e5383b) 0/var(--hp) 100% no-repeat,#3a1414}
.team-enemy small{font-size:11px}
.team-enemy.is-down{opacity:.25;filter:grayscale(1)}
.team-team{display:flex;flex-direction:column;gap:6px;width:min(34%,320px);min-height:0}
.team-member{display:flex;align-items:center;gap:8px;padding:6px 8px;border:2px solid transparent;border-radius:12px;background:#fffaf0;color:#21334b;text-align:left;flex:1;min-height:0}
.team-member img{width:clamp(48px,6vw,84px);height:100%;max-height:100px;object-fit:contain}
.team-member img.team-pet{width:32px;height:32px;flex:none}
.team-member .team-pet-pack{display:grid;grid-template-columns:repeat(2,20px);gap:0 2px}
.team-member .team-pet-pack img.team-pet{width:20px;height:20px;min-width:0;min-height:0;flex:none}
.team-member span{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
.team-member b{font-size:13px}
.team-member em{font-style:normal;font-size:11px;font-weight:800;color:#8a5a00}
.team-member .hp{display:block;height:8px;border-radius:4px;background:linear-gradient(90deg,#5fc46b,#2e9e48) 0/var(--hp) 100% no-repeat,#e5e9f0}
.team-member small{font-size:10px;color:#4a5a72}
.team-member.is-me{border-color:#f2b51d}
.team-member.is-target{border-color:#2e9e48;box-shadow:0 0 10px #2e9e48}
.team-member.is-down{opacity:.6}
.team-log{display:flex;gap:14px;padding:6px 12px;border-radius:10px;background:#0b1324d9;font-size:12px;white-space:nowrap;overflow:hidden}
.team-acts{display:flex;align-items:center;gap:8px}
.team-act{flex:1;min-height:clamp(46px,8vh,62px);border-radius:14px;font-size:clamp(14px,1.6vw,18px);font-weight:900;display:flex;flex-direction:column;align-items:center;justify-content:center}
.team-act small{font-size:11px;font-weight:700}
.team-act-attack{border:1px solid #a77a2e;background:linear-gradient(#fff3bd,#f4c44f);color:#3a2a08}
.team-act-skill{border:1px solid #1f4f9c;background:#2f6fd6;color:#fff}
.team-act-defend{border:1px solid #c9a14a;background:#22304f;color:#f4efe2}
.team-act-heal{border:1px solid #2e9e48;background:#1d6b35;color:#fff}
.team-acts>small{max-width:150px;font-size:11px;color:#f4efe2}

/* 結算 */
.team-result{display:flex;flex-direction:column;gap:10px;flex:1;min-height:0}
.team-result>header{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.team-result h2{margin:0;font-size:clamp(20px,2.6vw,30px);font-weight:900;color:#8a5a00}
.team-stars{font-size:24px;color:#f2b51d;letter-spacing:3px}
.team-result>header small{margin-left:auto;color:#4a5a72}
.team-res-grid{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));gap:10px;flex:1;min-height:0}
.team-res>img{flex:1;min-height:0;width:100%;object-fit:contain}
.team-res>img.team-pet{flex:0 0 auto;width:44px;height:44px}
.team-res>.team-pet-pack img.team-pet{width:34px;height:34px;flex:none;min-height:0}
.team-res{display:flex;flex-direction:column;gap:10px;padding:14px;min-height:0;border:1px solid #d9dee8;border-radius:18px;background:#fff}
.team-res.is-mvp{border:3px solid #f2b51d;box-shadow:0 0 18px #f2b51d66}
.team-res header{display:flex;align-items:center;gap:8px}
.team-res header b{font-size:18px}
.team-res header em{margin-left:auto;padding:3px 10px;border-radius:999px;background:#ffe08a;font-style:normal;font-weight:900;font-size:12px}
.team-res>div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.team-res>div span{display:flex;flex-direction:column;padding:8px;border-radius:10px;background:#f6efe0;font-size:12px}
.team-res>div b{font-size:17px}
.team-got{margin:0;font-weight:700}
.team-res-actions{display:flex;justify-content:flex-end;gap:10px}
.team-res-actions .btn{width:auto;min-height:50px;min-width:180px}

/* 副本頁的「組隊」入口 */
.dg-team-entry{display:inline-flex;align-items:center;gap:6px;width:auto!important;justify-self:start}
.dg-team-entry img{width:28px;height:28px;object-fit:contain}
@media (max-width:760px){.team-head span{display:none}.team-form{width:44%}.team-room-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(6,minmax(0,1fr))}.team-acts>small{display:none}}

/* 全站 v3 樣式對 dialog 裡的按鈕一律刷白（body[data-ui-version="3"] :is(#app,dialog) button…!important），組隊視窗用 #team-panel 雙重 id 蓋回設計稿配色 */
#team-panel#team-panel{background:#fff9ed!important;animation:none!important}
#team-panel#team-panel button{background:#fffaf0!important;color:#49361f!important;border:1px solid #cbb486!important;box-shadow:none!important}
#team-panel#team-panel .team-tap button[aria-pressed="true"]{background:#2f6fd6!important;color:#fff!important;border-color:#1f4f9c!important}
#team-panel#team-panel .btn.primary{background:#2f6fd6!important;color:#fff!important;border-color:#1f4f9c!important;font-weight:800!important}
#team-panel#team-panel .team-gold{background:linear-gradient(#fff3bd,#f4c44f)!important;border-color:#a77a2e!important;color:#3a2a08!important;font-weight:900!important}
#team-panel#team-panel .team-act-attack{background:linear-gradient(#fff3bd,#f4c44f)!important;color:#3a2a08!important;border-color:#a77a2e!important}
#team-panel#team-panel .team-act-skill{background:#2f6fd6!important;color:#fff!important;border-color:#1f4f9c!important}
#team-panel#team-panel .team-act-defend{background:#22304f!important;color:#f4efe2!important;border-color:#c9a14a!important}
#team-panel#team-panel .team-act-heal{background:#1d6b35!important;color:#fff!important;border-color:#2e9e48!important}
#team-panel#team-panel .team-member{background:#fffaf0!important;color:#21334b!important;border:2px solid transparent!important}
#team-panel#team-panel .team-member.is-me{border-color:#f2b51d!important}
#team-panel#team-panel .team-member.is-target{border-color:#2e9e48!important;box-shadow:0 0 10px #2e9e48!important}
#team-panel#team-panel button:disabled{opacity:.5}

/* 10-26 副本按鈕：魔王小圖＋副本名，2 欄 */
#team-panel#team-panel .team-dg-tap{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
#team-panel#team-panel .team-dg-tap button{display:flex;align-items:center;gap:6px;min-height:36px;padding:2px 6px;text-align:left;font-size:12px;line-height:1.15}
#team-panel#team-panel .team-dg-tap img{width:30px;height:30px;flex:none;object-fit:cover;border-radius:7px;background:#f3e6cc}
#team-panel#team-panel .team-dg-tap span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* New server-authoritative spatial battles share the approved dungeon controls. */
html body dialog#team-panel:has(.team-spatial-stage){background:#eef3f6}
html body dialog#team-panel:has(.team-spatial-stage) .team-shell{display:grid;place-items:center;padding:5px;gap:0}
#team-panel .team-spatial-stage{position:relative;isolation:isolate;width:min(100%,calc((100dvh - 12px)*16/9));aspect-ratio:16/9;overflow:hidden;border:2px solid #adc9db;border-radius:18px;background-position:center;background-size:cover;box-sizing:border-box}
#team-panel .team-spatial-top{position:absolute;left:34%;right:29%;top:6px;z-index:6;display:grid;gap:3px;padding:5px;border-radius:12px;background:#f8fcfff0;text-align:center;color:#173d59;font-size:clamp(9px,1.5vw,12px)}
#team-panel .team-spatial-stage .battle-portrait{z-index:6}
#team-panel .team-spatial-stage .battle-wheel,#team-panel .team-spatial-stage .battle-pad,#team-panel .team-spatial-stage .battle-mode{z-index:8}
html body dialog#team-panel .team-spatial-stage .battle-pad button,html body dialog#team-panel .team-spatial-stage .battle-wheel button{min-width:0!important;min-height:0!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
html body dialog#team-panel .team-spatial-stage .battle-wheel button:disabled{opacity:1}
#team-panel .team-spatial-actors,#team-panel .team-spatial-enemies,#team-panel .team-spatial-warnings{position:absolute;inset:0;pointer-events:none}
#team-panel .team-spatial-actors{z-index:3}
html body dialog#team-panel .team-spatial-actor{position:absolute;width:13%;aspect-ratio:1;height:auto;min-height:0!important;min-width:0!important;display:block;box-sizing:border-box;padding:0!important;background:none!important;border:0!important;border-radius:0;box-shadow:none!important;pointer-events:auto;transition:opacity .15s}
#team-panel .team-spatial-actor>img:first-child{display:block;width:100%;height:100%;object-fit:contain}
#team-panel .team-spatial-actor>b{position:absolute;bottom:100%;left:-30%;right:-30%;font-size:clamp(8px,1.1vw,11px);color:#fff;text-shadow:0 1px 3px #000;text-align:center;white-space:nowrap}
#team-panel .team-spatial-actor>i{position:absolute;left:20%;right:20%;bottom:-4%;height:4px;background:#213343;border-radius:5px;overflow:hidden}
#team-panel .team-spatial-actor>i>em{display:block;height:100%;background:#45dc8c}
#team-panel .team-spatial-actor.is-me::after{content:'';position:absolute;left:35%;bottom:0;width:30%;height:6%;border:1px solid #bdf6ff;border-radius:50%;background:#45cde544;pointer-events:none}
#team-panel .team-spatial-actor.is-target{filter:drop-shadow(0 0 5px #ffdf67)}
#team-panel .team-spatial-pet{position:absolute;left:-20%;bottom:-2%;width:40%;height:40%;object-fit:contain}
#team-panel .team-spatial-enemies{z-index:2}
#team-panel .team-spatial-enemy{position:absolute;left:54%;bottom:45%;width:10%;aspect-ratio:1}
#team-panel .team-spatial-enemy:nth-child(2){left:67%}#team-panel .team-spatial-enemy:nth-child(3){left:60%;bottom:25%}
#team-panel .team-spatial-enemy.is-boss{left:54%;bottom:25%;width:19%}
#team-panel .team-spatial-enemy img{width:100%;height:100%;object-fit:contain}
#team-panel .team-spatial-enemy>i{position:absolute;left:0;right:0;top:-12px;height:10px;border-radius:6px;background:#243845;overflow:hidden}
#team-panel .team-spatial-enemy>i>em{display:block;height:100%;background:linear-gradient(#ff8e79,#f03838)}
#team-panel .team-spatial-enemy>i>span{position:absolute;inset:0;text-align:center;font-size:8px;line-height:10px;color:white;text-shadow:0 1px 1px #000}
#team-panel .team-spatial-stage .is-down{opacity:.25;filter:grayscale(1)}
#team-panel .team-spatial-warnings{z-index:1}
#team-panel .team-spatial-warnings .battle-danger::after{animation:none;transform:scale(var(--progress,0))}
#team-panel .team-spatial-stage .battle-hint{z-index:6}
#team-panel .team-spatial-events{position:absolute;left:25%;right:25%;top:28%;z-index:6;pointer-events:none;color:white;font-size:clamp(8px,1.2vw,12px);text-align:center;text-shadow:0 1px 3px #000}
#team-panel#team-panel:has(.team-spatial-stage){background:#eef3f6!important}
#team-panel#team-panel .team-spatial-stage .team-spatial-actor,#team-panel#team-panel .team-spatial-stage .battle-pad button,#team-panel#team-panel .team-spatial-stage .battle-wheel button{background:transparent!important;border:0!important;box-shadow:none!important}
#team-panel#team-panel .team-spatial-stage .battle-wheel button:disabled{opacity:1}
#team-panel#team-panel .team-spatial-stage .battle-mode button{background:#edf7ffed!important;color:#173d59!important;border:1px solid #adc9db!important;border-radius:10px!important}
#team-panel .team-spatial-stage button:focus-visible{outline:2px solid white;outline-offset:2px}
