* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0b0d12; color: #e8ecf2;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  user-select: none; -webkit-user-select: none;
}
#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
/* 游標旁的彈藥：左上 / 右上 = 左右手、左下 / 右下 = 左右背；正在用的那把亮起來 */
#reticle { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 6; }
#reticle.hidden { display: none; }
/* 字壓扁（橫的拉寬、直的壓矮）；開火時閃一下（main.js 用 animate） */
#reticle span { position: absolute; white-space: nowrap; font: 700 13px/1 Bahnschrift, 'DIN Alternate', ui-monospace, Consolas, monospace; color: #8a909a;
  text-shadow: 0 0 3px #000, 0 1px 2px #000; transform: scale(1.18, 0.78); transition: color .12s; }
#reticle span.L { right: 30px; text-align: right; transform-origin: right center; } #reticle span.R { left: 30px; transform-origin: left center; }
#reticle span.top { bottom: 5px; } #reticle span.bot { top: 5px; }
#reticle span.act { color: #ffffff; font-size: 15px; }
#reticle span.bad { color: #ff6a50; }
#reticle span.none { color: #5a5f68; }
#game canvas { cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g fill='none' stroke-linecap='round'><g stroke='%23000' stroke-opacity='.65' stroke-width='4'><circle cx='16' cy='16' r='8'/><path d='M16 2v7M16 23v7M2 16h7M23 16h7'/></g><g stroke='%23fff' stroke-width='2'><circle cx='16' cy='16' r='8'/><path d='M16 2v7M16 23v7M2 16h7M23 16h7'/></g></g><circle cx='16' cy='16' r='1.6' fill='%237ff0ff'/></svg>") 16 16, crosshair; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#help { position: absolute; left: 16px; top: 12px; font-size: 12px; line-height: 1.7; opacity: .75; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
#help b { display: block; font-size: 14px; letter-spacing: 3px; color: #7ff0ff; }

#status {
  position: absolute; left: 16px; bottom: 16px; display: flex; gap: 14px; align-items: flex-end;
  padding: 12px 14px; background: rgba(8,10,14,.55); border: 1px solid rgba(255,255,255,.1); border-radius: 10px;
}
#status .col { display: flex; flex-direction: column; gap: 5px; min-width: 150px; font-size: 13px; font-weight: 700; }
#status .gun { font-variant-numeric: tabular-nums; }
#status .bar { height: 7px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; margin-top: 3px; }
#energy { height: 100%; width: 100%; background: #7ff0ff; transition: width .05s linear; }
#status .bar.low #energy { background: #ff7a40; }
#status .move { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }

/* 部位示意：上排 背 / 頭 / 背，中排 手 / 軀幹 / 手，下排 腳；底色 = 血量、外框 = 裝甲種類 */
.doll { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.doll .row { display: flex; gap: 3px; align-items: flex-end; }
.doll [data-p] { background: #3a3f48; border-radius: 3px; width: 10px; height: 10px; outline: 2px solid transparent; outline-offset: 1px; }
.doll .head { width: 16px; height: 12px; }
.doll .torso { width: 30px; height: 34px; }
.doll .arm { width: 12px; height: 30px; }
.doll .legs { width: 30px; height: 26px; }
.doll .none { visibility: hidden; }
.doll .broken { background: #1a1b1f !important; box-shadow: inset 0 0 0 1px #ff4040; }
.doll .hit { filter: brightness(2.2); }
#guns { display: flex; flex-direction: column; gap: 3px; }
#status .gun { display: flex; align-items: center; gap: 6px; font-size: 12px; }
#status .gun kbd { min-width: 30px; text-align: center; font: 700 10px system-ui; padding: 1px 4px; border-radius: 4px; background: rgba(255,255,255,.12); }
#status .gun i { width: 8px; height: 8px; border-radius: 2px; }
#status .gun em { margin-left: auto; font-style: normal; font-variant-numeric: tabular-nums; opacity: .85; padding-left: 10px; }
#status .gun .dim { opacity: .4; }
#status .gun.idle { opacity: .45; }
#status .gun.act kbd { background: rgba(127,240,255,.35); color: #fff; }
#status .bad { color: #ff7a60; }
#warn { font-size: 11px; color: #ffb060; min-height: 0; }
#warn:empty { display: none; }
#lockInfo { color: #ffb040; }

#target {
  position: absolute; right: 16px; bottom: 16px; padding: 10px 14px; text-align: center;
  background: rgba(8,10,14,.55); border: 1px solid rgba(255,140,60,.35); border-radius: 10px;
}
#target .label { font-size: 11px; letter-spacing: 3px; color: #ffa060; margin-bottom: 6px; }
#target.hidden, #passive.hidden, #help.hidden, #hud.hidden, #endless.hidden { display: none; }
#endless { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); text-align: center; text-shadow: 0 1px 3px #000; max-width: min(92vw, 640px); }
#enTime { font-size: 28px; font-weight: 900; letter-spacing: 2px; color: #fff; }
#enInfo { font-size: 12px; color: #c8d0dc; margin-top: 2px; }
#minimap { position: absolute; right: 12px; top: 12px; border: 2px solid rgba(160,180,210,.4); border-radius: 50%; background: #07080b; opacity: .92; image-rendering: pixelated; }
#minimap.hidden { display: none; }
#boss { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); width: min(70vw, 420px); text-align: center; text-shadow: 0 1px 3px #000; }
#boss b { color: #ff7060; font-size: 14px; }
#boss .bbar { height: 8px; margin-top: 3px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,110,90,.5); border-radius: 3px; overflow: hidden; }
#boss .bbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #c02818, #ff6040); transition: width .15s; }
#prompt { position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%); padding: 6px 14px; background: rgba(10,12,16,.75); border: 1px solid rgba(160,180,210,.35); border-radius: 4px; font-size: 14px; white-space: nowrap; }
#boss.hidden, #prompt.hidden, #warning.hidden, #bossIntro.hidden, #warpFade.hidden, #hopFade.hidden { display: none; }
/* 演出覆蓋層：出現時淡入、收起時淡出（.fadeout，JS 等淡完再藏） */
@keyframes fxin { from { opacity: 0; } to { opacity: 1; } }
#warning.fadeout { opacity: 0; transition: opacity .22s ease-in; }
#bossIntro.fadeout { opacity: 0; transform: translateX(-24px); transition: opacity .2s ease-in, transform .2s ease-in; }
/* 傳送：畫面白掉（淡入 0.3 秒）、換地圖後淡掉（0.6 秒） */
#warpFade { position: fixed; inset: 0; z-index: 30; pointer-events: none; background: radial-gradient(circle, #ffffff 0%, #d8fbff 55%, #a0eaff 100%); animation: fxin .3s ease-out; }
#warpFade.fadeout { opacity: 0; transition: opacity .6s ease-out; }
/* 換層（地下入口）：很短的一下黑 */
#hopFade { position: fixed; inset: 0; z-index: 30; pointer-events: none; background: #040507; animation: fxin .2s ease-in; }
#hopFade.fadeout { opacity: 0; transition: opacity .3s ease-out; }
/* 頭目登場：全畫面警告 */
#warning { position: absolute; inset: 0; pointer-events: none; z-index: 5; animation: fxin .18s ease-out, wflash .4s steps(2) infinite; box-shadow: inset 0 0 18vh rgba(255,20,10,.55); }
@keyframes wflash { 0% { background: rgba(255,0,0,.10); } 100% { background: rgba(255,0,0,0); } }
#warning .wband { position: absolute; left: 0; right: 0; height: 44px; overflow: hidden; background: repeating-linear-gradient(-45deg, rgba(255,40,20,.85) 0 18px, rgba(20,0,0,.85) 18px 36px); border-top: 2px solid #ff4030; border-bottom: 2px solid #ff4030; }
#warning .wband.top { top: 16%; } #warning .wband.bot { bottom: 16%; }
#warning .wtrack { position: absolute; top: 0; white-space: nowrap; line-height: 44px; font: 900 26px/44px system-ui, sans-serif; letter-spacing: .12em; color: #fff; text-shadow: 0 0 8px #ff2010, 0 2px 0 #000; animation: wscroll 6s linear infinite; }
#warning .wband.bot .wtrack { animation-direction: reverse; animation-duration: 7s; }
@keyframes wscroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
#warning .wcenter { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; background: rgba(20,0,0,.6); border-top: 2px solid #ff4030; border-bottom: 2px solid #ff4030; padding: 10px 0 12px; }
#warning .wbig { font: 900 64px/1 system-ui, sans-serif; color: #ff3020; letter-spacing: .3em; text-shadow: 0 0 18px #ff2010; animation: wblink .5s steps(2) infinite; }
#warning .wsub { font: 800 26px/1.4 system-ui, sans-serif; color: #fff; letter-spacing: .25em; margin-top: 6px; }
#warning .wen { font: 700 12px/1.6 system-ui, sans-serif; color: #ff9080; letter-spacing: .35em; }
@keyframes wblink { 0% { opacity: 1; } 100% { opacity: .35; } }
/* 頭目著陸定格：名牌從左邊斜切進來 */
#bossIntro { position: absolute; left: 6%; bottom: 18%; z-index: 5; pointer-events: none; padding: 10px 28px 12px 18px; background: linear-gradient(90deg, rgba(150,10,0,.9), rgba(40,0,0,.75) 80%, transparent); border-left: 6px solid #ff4030; clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%); animation: bislide .25s ease-out; }
#bossIntro .bitag { font: 900 13px/1 system-ui, sans-serif; letter-spacing: .5em; color: #ffb0a0; }
#biName { font: 900 34px/1.25 system-ui, sans-serif; color: #fff; text-shadow: 0 2px 0 #000; letter-spacing: .08em; }
#biGuns { justify-content: flex-start; margin-top: 4px; }
@keyframes bislide { from { transform: translateX(-60px); opacity: 0; } to { transform: none; opacity: 1; } }
#enMods { justify-content: center; margin-top: 4px; max-width: none; }
#passive { position: absolute; right: 16px; top: 14px; font-size: 13px; font-weight: 800; color: #ffd060; }

#toast {
  position: fixed; left: 0; right: 0; top: 24%; text-align: center; z-index: 7; pointer-events: none;
  font-weight: 900; font-size: 34px; letter-spacing: 6px; opacity: 0; text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
#toast.show { animation: toast 1.2s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: scale(1.5); } 12% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; } }
/* 主選單、對戰設定：畫面右邊，左邊留給機體 */
#menu, #duel { position: fixed; inset: 0; z-index: 9; display: flex; justify-content: flex-end; pointer-events: none; }
#menu.hidden, #duel.hidden, #panel.hidden, #mMain.hidden, #mSub.hidden { display: none; }
#mSub h2 { margin: 4px 0 10px; }
#mMain, #mSub, #mSubList { display: flex; flex-direction: column; gap: 10px; }
.mpanel {
  pointer-events: auto; width: min(560px, 50vw); height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; justify-content: center;
  padding: 24px 32px 24px 56px; background: linear-gradient(90deg, rgba(8,10,14,0), rgba(8,10,14,.88) 16%);
}
.mpanel.wide { justify-content: flex-start; }
.mpanel h1 { font-size: 46px; letter-spacing: 6px; font-weight: 900; line-height: 1; }
.mpanel h1 span { display: block; color: #7ff0ff; font-size: 30px; letter-spacing: 14px; margin-top: 4px; }
.mpanel .sub { opacity: .6; font-size: 13px; margin-bottom: 14px; }
.mpanel h2 { font-size: 15px; letter-spacing: 4px; color: #7ff0ff; margin-top: 8px; }
.btn {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); color: #e8ecf2; font: 800 16px system-ui, sans-serif;
}
.btn small { font-weight: 500; font-size: 12px; opacity: .65; }
.btn:hover { background: rgba(255,255,255,.1); }
.btn.primary { border-color: #7ff0ff; background: rgba(127,240,255,.14); }
.mpanel .row { display: flex; gap: 10px; margin-top: 10px; }
.mpanel .row .btn { flex: 1; text-align: center; align-items: center; }
#dCards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card {
  text-align: left; padding: 10px 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  color: #e8ecf2; cursor: pointer; display: flex; flex-direction: column; gap: 5px; font: inherit;
}
.card b { font-size: 15px; }
.card small { font-size: 12px; opacity: .65; }
.card div { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11px; align-items: center; }
.card.on { border-color: #ffa060; background: rgba(255,160,96,.12); }
.wt { padding: 0 5px; border-radius: 4px; border: 1px solid var(--c); color: var(--c); font-size: 11px; font-weight: 800; }
#dDiff { display: flex; gap: 8px; }
#dDiff button { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); color: #e8ecf2; font: 800 14px system-ui; cursor: pointer; }
#dDiff button.on { border-color: #ffa060; background: rgba(255,160,96,.14); }

/* 暫停、結果、說明 */
#panel { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); }
.pbox { width: min(520px, 90vw); padding: 24px; border-radius: 14px; background: rgba(12,14,20,.95); border: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 14px; }
.pbox h2 { font-size: 30px; letter-spacing: 8px; text-align: center; }
#pBody { text-align: center; opacity: .8; font-size: 14px; }
#pBody .help { text-align: left; font-size: 13px; line-height: 1.8; }
#pBody .help b { display: block; color: #7ff0ff; margin-top: 6px; }
#pButtons { display: flex; flex-direction: column; gap: 8px; }
#pButtons .btn { text-align: center; align-items: center; }

/* 整備 */
#garage { position: fixed; inset: 0; z-index: 9; display: flex; justify-content: flex-end; pointer-events: none; }
#garage.hidden { display: none; }
.gpanel {
  pointer-events: auto; width: min(820px, 66vw); height: 100%; display: flex; flex-direction: column;
  background: linear-gradient(90deg, rgba(8,10,14,.55), rgba(8,10,14,.92) 12%); padding: 18px 20px 18px 40px;
}
.ghead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.ghead b { font-size: 20px; letter-spacing: 6px; color: #7ff0ff; }
.ghead span { font-size: 12px; opacity: .6; }
.ghead button { margin-left: auto; padding: 8px 18px; border-radius: 8px; border: 1px solid #7ff0ff; background: rgba(127,240,255,.12); color: #e8ecf2; font-weight: 800; cursor: pointer; }
.gbody { flex: 1; display: grid; grid-template-columns: 170px 1fr 220px; gap: 12px; min-height: 0; }
#gCats, #gOpts { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
#gCats button, #gOpts button {
  text-align: left; padding: 7px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); color: #e8ecf2; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit;
}
#gCats button span { font-size: 13px; font-weight: 700; }
#gCats button small { font-size: 11px; opacity: .6; }
#gOpts button b { font-size: 14px; }
#gOpts button small { font-size: 12px; opacity: .8; line-height: 1.6; }
#gOpts button.locked { opacity: .45; cursor: default; border-style: dashed; }
#gCats button:hover, #gOpts button:hover { background: rgba(255,255,255,.09); }
#gCats button.on, #gOpts button.on { border-color: #7ff0ff; background: rgba(127,240,255,.12); }
.tag { display: inline-block; padding: 0 5px; border-radius: 4px; border: 1px solid var(--c); color: var(--c); font-size: 11px; font-weight: 800; }
#gStats { display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
#gStats .stat { display: grid; grid-template-columns: 1fr auto; gap: 3px; }
#gStats .stat i { grid-column: 1 / -1; height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
#gStats .stat u { display: block; height: 100%; background: #7ff0ff; }
#gStats .warn { color: #ff8a50; }
#gStats u.warn { background: #ff7a40; }
#gStats .line b { color: #7ff0ff; }
#gStats .note { font-weight: 700; }

/* 觀戰 */
#watch { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#watch.hidden { display: none; }
.wtop { position: absolute; left: 0; right: 0; top: 12px; text-align: center; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
#wRound { font-size: 12px; letter-spacing: 4px; opacity: .7; }
#wScore { font-size: 30px; font-weight: 900; letter-spacing: 6px; }
#wScore .blue { color: #6aaaff; } #wScore .red { color: #ff7a40; }
#wNext { font-size: 12px; color: #ffd060; min-height: 16px; }
/* 據點戰的階段進度條（螢幕上緣，像血條）：藍在左、往左長；紅在右、往右長 */
#wTier { display: flex; justify-content: center; gap: 28px; margin: -6px 0 4px; pointer-events: none; }
#wTier:empty { display: none; }
#wTier .tb { width: min(280px, 34vw); }
#wTier .lab { font-size: 11px; letter-spacing: 1px; opacity: .85; margin-bottom: 2px; }
#wTier .bar { position: relative; height: 10px; background: rgba(10,14,20,.6); border: 1px solid rgba(255,255,255,.25); border-radius: 3px; overflow: hidden; }
#wTier .fill { position: absolute; top: 0; bottom: 0; transition: width .3s; }
#wTier .blue .lab { text-align: right; color: #6aaaff; } #wTier .blue .fill { right: 0; background: linear-gradient(90deg, #2a6ad8, #8ac0ff); }
#wTier .red .lab { text-align: left; color: #ff7a40; } #wTier .red .fill { left: 0; background: linear-gradient(90deg, #ff9a60, #d8401a); }
@media (max-width: 700px) { #wTier { gap: 12px; } }
.wside { position: absolute; bottom: 16px; display: flex; gap: 12px; align-items: flex-end; padding: 10px 14px; border-radius: 10px; background: rgba(8,10,14,.55); }
.wside.blue { left: 16px; border: 1px solid rgba(106,170,255,.45); }
.wside.red { right: 16px; border: 1px solid rgba(255,122,64,.45); text-align: right; }
.wside b { font-size: 15px; }
.wside.blue b { color: #6aaaff; } .wside.red b { color: #ff7a40; }
.wguns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; max-width: 220px; }
.wside.red .wguns { justify-content: flex-end; }
.whint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 11px; opacity: .45; }

/* 擊墜特寫：上下黑邊 */
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 40; pointer-events: none; transition: height .25s ease-out; }
body::before { top: 0; } body::after { bottom: 0; }
body.killcam::before, body.killcam::after { height: 9vh; transition: height .12s ease-out; }

/* 關卡之間的重組畫面（reasm.js）：右邊的面板，左邊是傳送隧道裡的機體 */
#reasm { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: flex; justify-content: flex-end; }
#reasm.hidden { display: none; }
#reasm .rpanel { pointer-events: auto; width: min(560px, 52vw); height: 100%; overflow-y: auto; padding: 22px 26px 22px 48px; display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(90deg, rgba(4,6,12,0), rgba(4,6,12,.86) 14%); animation: fxin .4s ease-out; }
#reasm h2 { font-size: 26px; letter-spacing: 8px; color: #7ff0ff; }
#reasm .sub { font-size: 12px; opacity: .7; margin-bottom: 4px; }
#reasm h3 { font-size: 13px; letter-spacing: 2px; color: #9fb4c8; margin-top: 8px; }
#reasm .ropts { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
#reasm .ropts button { text-align: left; padding: 7px 11px; border-radius: 7px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #e8ecf2; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
#reasm .ropts button.on { border-color: #7ff0ff; background: rgba(127,240,255,.12); }
#reasm .ropts button b { font-size: 13px; } #reasm .ropts button small { font-size: 11px; opacity: .72; line-height: 1.5; }
#reasm .new { margin-left: 8px; font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #60e0ff; color: #04121a; vertical-align: middle; }
#reasm #rGo { margin-top: 12px; }

/* 設定 */
#settings { position: fixed; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
#settings.hidden { display: none; }
.sbox { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 14px; background: rgba(12,14,20,.96); border: 1px solid rgba(255,255,255,.12); }
.shead { display: flex; align-items: center; gap: 18px; padding: 16px 20px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.shead > b { font-size: 20px; letter-spacing: 6px; padding-bottom: 12px; }
.stabs { display: flex; gap: 4px; align-self: flex-end; }
.stabs button { padding: 8px 16px; border: 0; border-bottom: 2px solid transparent; background: none; color: #e8ecf2; opacity: .6; font: 800 14px system-ui, sans-serif; cursor: pointer; }
.stabs button.on { opacity: 1; border-bottom-color: #7ff0ff; color: #7ff0ff; }
.sbody { overflow-y: auto; padding: 8px 20px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; }
.sl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sl b { font-size: 14px; }
.sl small { font-size: 11px; opacity: .55; }
.seg { display: flex; flex-shrink: 0; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; overflow: hidden; }
.seg button { padding: 7px 12px; min-width: 52px; border: 0; border-left: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: #e8ecf2; font: 800 13px system-ui, sans-serif; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: rgba(255,255,255,.1); }
.seg button.on { background: rgba(127,240,255,.2); color: #7ff0ff; }
.ssep { height: 1px; margin: 6px 0; background: rgba(255,255,255,.08); }
.sfoot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; }
@media (max-width: 560px) { .srow { flex-direction: column; align-items: stretch; } .seg button { flex: 1; min-width: 0; } }
/* 效能面板 */
#perf { position: fixed; left: 8px; top: 8px; z-index: 13; pointer-events: none; display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; border-radius: 6px; background: rgba(0,0,0,.62); font: 600 11px/1.35 ui-monospace, Consolas, monospace; color: #cfd6e0; }
#perf.hidden { display: none; }
#perf b { font-size: 14px; }
#perf i { font-style: normal; }
#perf .ok { color: #7fe08a; } #perf .warn { color: #ffd060; } #perf .bad { color: #ff7060; }
#perf .dim { opacity: .5; }

/* 零件工坊 */
#workshop { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
#workshop.hidden { display: none; }
.wpanel { pointer-events: auto; position: absolute; left: 0; top: 0; bottom: 0; width: min(340px, 40vw); overflow-y: auto; background: rgba(10,12,16,.94); border-right: 1px solid rgba(255,255,255,.1); padding: 14px 14px 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.whead { display: flex; align-items: center; justify-content: space-between; }
.whead b { font-size: 18px; letter-spacing: 4px; }
.whead button, .wbtn { padding: 6px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: #e8ecf2; font: 700 12px system-ui, sans-serif; cursor: pointer; }
.whead button { border-color: #7ff0ff; color: #7ff0ff; }
.wbtn:hover { background: rgba(255,255,255,.12); }
.wrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wrow.col { flex-direction: column; align-items: stretch; }
.wrow > span { opacity: .7; font-size: 12px; }
#wsKey { width: 100%; padding: 6px; border-radius: 7px; background: #161a22; color: #e8ecf2; border: 1px solid rgba(255,255,255,.16); font: 13px system-ui, sans-serif; }
.wpanel .seg { flex-wrap: wrap; flex-shrink: 1; }
.wpanel .seg button { padding: 6px 8px; min-width: 0; font-size: 12px; }
.wpanel { overflow-x: hidden; }
.wsw { display: flex; flex-wrap: wrap; gap: 4px; }
.wsw button { display: flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 6px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #e8ecf2; font: 700 11px system-ui, sans-serif; cursor: pointer; }
.wsw button i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); border: 1px solid rgba(255,255,255,.3); }
.wsw button.on { border-color: #7ff0ff; background: rgba(127,240,255,.16); }
.wchk { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.wchk label, .wtry { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.wpt { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; }
.wpt.on { border-color: #7ff0ff; background: rgba(127,240,255,.1); }
.wpt i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.wpt b { flex: 1; font-size: 12px; }
.wpt input { width: 46px; padding: 2px 3px; background: #161a22; color: #e8ecf2; border: 1px solid rgba(255,255,255,.16); border-radius: 4px; font: 11px ui-monospace, monospace; }
.wbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wnote { font-size: 11px; color: #ffb070; }
.whint { position: absolute; left: min(340px, 40vw); right: 0; bottom: 10px; text-align: center; font-size: 12px; opacity: .55; pointer-events: none; }
#wsStatus { position: absolute; right: 12px; top: 10px; font: 600 12px ui-monospace, Consolas, monospace; opacity: .7; pointer-events: none; }
/* 滑鼠轉向模式：游標還沒鎖住時的提示 */
#lockHint { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); padding: 6px 14px; background: rgba(8,10,14,.75); border: 1px solid rgba(160,180,210,.35); border-radius: 4px; color: #cfe0f0; font-size: 13px; pointer-events: none; z-index: 40; }
#lockHint.hidden { display: none; }
/* 小地圖的指北針：貼在框上、跟著鏡頭轉到北邊的位置 */
#northMark { position: absolute; width: 14px; height: 16px; line-height: 16px; text-align: center; font: bold 11px sans-serif; color: #ff7060; background: #07080b; border: 1px solid rgba(255,112,96,.6); border-radius: 3px; pointer-events: none; z-index: 6; }
#northMark.hidden { display: none; }
/* 手把在選單裡的焦點 */
.padfocus { outline: 2px solid #7ff0ff !important; outline-offset: 2px; box-shadow: 0 0 10px rgba(127,240,255,.55) !important; }
/* 被鎖定警示（src/lockwarn.js）：上方一條 + 玩家周圍的方向箭頭 */
#lockWarn { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 7; pointer-events: none; padding: 4px 14px 6px; border-radius: 4px; text-align: center; font: bold 14px sans-serif; letter-spacing: .12em; }
#lockWarn.hidden { display: none; }
#lockWarn i { display: block; height: 3px; margin-top: 4px; background: rgba(255,255,255,.15); }
#lockWarn s { display: block; height: 100%; background: currentColor; text-decoration: none; }
#lockWarn.lw-locking { color: #ffd040; background: rgba(40,30,0,.6); border: 1px solid rgba(255,208,64,.6); }
#lockWarn.lw-locked { color: #ff5040; background: rgba(50,8,4,.7); border: 1px solid rgba(255,80,64,.8); animation: lwBlink .4s steps(2) infinite; }
#lockWarn.lw-missile { color: #ff3020; background: rgba(70,6,2,.8); border: 1px solid #ff3020; animation: lwBlink .2s steps(2) infinite; }
@keyframes lwBlink { 50% { opacity: .35; } }
#lockRing { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.lockArrow { position: absolute; left: -7px; top: -6px; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 14px solid #ffd040; display: none; filter: drop-shadow(0 0 3px rgba(0,0,0,.8)); }
.lockArrow.la-l { border-left-color: #ff5040; }
.lockArrow.la-m { border-left-color: #ff2a10; border-top-width: 8px; border-bottom-width: 8px; border-left-width: 18px; animation: lwBlink .2s steps(2) infinite; }

/* 據點戰：Tab 總覽（地圖 + 戰績） */
#cqOver { position: absolute; inset: 0; display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; background: rgba(6,8,12,.72); z-index: 30; padding: 16px; box-sizing: border-box; overflow: auto; }
#cqOver.hidden { display: none; }
#cqMap { width: min(62vw, 640px); max-width: 100%; height: auto; border: 1px solid #556; border-radius: 6px; cursor: crosshair; image-rendering: pixelated; }
#cqStats { color: #dde; font-size: 13px; min-width: 300px; max-width: 520px; }
#cqStats table { border-collapse: collapse; width: 100%; }
#cqStats td { padding: 3px 6px; border-bottom: 1px solid #2a2f3a; white-space: nowrap; }
#cqStats tr.hd td { color: #8a96a6; font-size: 11px; }
#cqStats tr.th td { padding-top: 10px; white-space: normal; }
#cqStats .cqlog { margin-top: 10px; color: #9aa4b4; font-size: 12px; line-height: 1.6; }
#cqOver .cqhint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #8a96a6; font-size: 12px; }
#cqCamBar { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; pointer-events: auto; background: rgba(10,12,18,.6); padding: 4px 8px; border-radius: 8px; }
#cqCamBar.hidden { display: none; }
#cqCamBar button { background: #1c2230; color: #dde; border: 1px solid #3a4458; border-radius: 5px; padding: 3px 9px; font-size: 13px; cursor: pointer; }
#cqCamBar button:hover { background: #2a3448; }
#cqFocus { min-width: 150px; text-align: center; font-size: 13px; font-weight: 700; }

/* ---------- 據點戰・參戰（2026-11-28） ---------- */
/* 選機體畫面：跟對戰選對手同一種卡片；右邊一整片 */
#cqPick { position: fixed; inset: 0; z-index: 9; display: flex; justify-content: flex-end; pointer-events: none; }
#cqPick.hidden { display: none; }
#cqPick .mpanel { width: min(760px, 64vw); }
#cqPickCards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
#cqPickCards .card.lock { opacity: .38; cursor: not-allowed; }
#cqGo:disabled { opacity: .45; cursor: default; }
@media (max-width: 900px) { #cqPickCards { grid-template-columns: 1fr 1fr; } #cqPick .mpanel { width: 100vw; padding-left: 20px; } }
/* 給玩家的指令：分數下面一條 */
#cqOrder { display: inline-flex; gap: 10px; align-items: center; margin-top: 6px; padding: 5px 14px; border-radius: 8px; background: rgba(8,10,14,.6); border: 1px solid rgba(255,208,64,.6); color: #ffe080; font-size: 14px; font-weight: 800; }
#cqOrder.hidden { display: none; }
#cqOrder b { font-size: 11px; letter-spacing: 3px; color: #10141a; background: #ffd040; padding: 1px 6px; border-radius: 4px; }
#cqOrder span { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
/* 參戰時：觀戰的鏡頭列、提示、兩邊的機體圖收起來；兩隊名單搬到上面兩側（下面是玩家自己的狀態和目標） */
.cqplay #cqCamBar, .cqplay #watch .whint, .cqplay #watch .wside .doll { display: none !important; }
.cqplay #watch .wside { top: 12px; bottom: auto; max-width: 25vw; padding: 6px 10px; }
.cqplay #watch .wside b { font-size: 12px; }
.cqplay #cqOver .cqhint { display: none; }

/* 線上據點戰的大廳（座位） */
#lobby { position: fixed; inset: 0; z-index: 9; display: flex; justify-content: flex-end; pointer-events: none; }
#lobby.hidden { display: none; }
#lobby .mpanel { width: min(640px, 60vw); }
#lbSeats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
#lbSeats .card.blue { border-color: rgba(106,170,255,.45); } #lbSeats .card.red { border-color: rgba(255,122,64,.45); }
#lbSeats .card.taken { opacity: .45; cursor: not-allowed; } #lbSeats .card.mine { border-color: #7fe08a; background: rgba(127,224,138,.12); }
.lbname { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.lbname input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.35); color: #e8ecf2; font: inherit; }
@media (max-width: 900px) { #lobby .mpanel { width: 100vw; padding-left: 20px; } #lbSeats { grid-template-columns: 1fr 1fr; } }
#lbPw.hidden, #mLogin.hidden, #mMain .btn.locked { display: none; }
