/* UI v7 "2027": 플랫·깔끔. 그림자·유리·그라데이션 없이 종이색 판, 먹색 글자, 1px 선, 4px 모서리, 신호 주황 하나.
   시안: assets/ui7/concepts/{lobby,hud,kit}.png (GPT) → tools/slice-ui7.py 로 로고·세력 타일 그림·문장·자원 아이콘을 잘라 쓰고,
   짜임은 시안대로 다시 조립했다: 로비 = 왼쪽 위 로고 · 왼쪽 메뉴 · 오른쪽 위 설정 띠 · 아래 세력 타일 3장,
   인게임 = 위 가로 띠(로고·자원·시간·메뉴) · 아래 한 줄 도크(미니맵 | 선택 정보 | 3×3 명령).
   세력 색(--ac)은 칩·띠·선택 표시에만 쓴다. src3d/frames.js applyTheme() 가 <html> 에 넣는다. */
:root {
  --ac: #2f6bff; --hi: #2657d1; --soft: #eaf0ff; --line: #9db8ff; --ink: #111318; --dim: #6a6f78; --warn: #e5372b;
  --sig: #ff5a1f; --sig-hi: #e84a12;
  --paper: #f4f3ef; --paper2: #ebe9e3; --rule: #11131824; --rule2: #11131814; --r: 4px;
  --top: 52px; --dock: 196px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --num: "Oxanium", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; /* 자원·시간·수치 */
}
* { box-sizing: border-box; }
html, body { word-break: keep-all; margin: 0; height: 100%; overflow: hidden; color: var(--ink); font-family: var(--font); user-select: none; background: var(--paper); }
button { font-family: var(--font); color: inherit; }
.hidden { display: none !important; }
#gl, #ov { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#ov { pointer-events: none; }
#boot { position: fixed; inset: 0; display: grid; place-items: center; font: 600 14px var(--font); color: var(--dim); background: var(--paper); z-index: 50; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 2px; }

/* ── 공통 부품 ─────────────────────────────────────────── */
.card, .fr { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); }
.btn { height: 48px; padding: 0 18px; border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 14px; transition: background 0.1s, color 0.1s; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.cta { height: 64px; border-color: var(--sig); background: var(--sig); color: #fff; font-size: 19px; font-weight: 800; letter-spacing: -0.2px; justify-content: space-between; padding: 0 22px; }
.btn.cta:hover { background: var(--sig-hi); border-color: var(--sig-hi); color: #fff; }
.btn.cta .mi { order: 2; width: 26px; height: 26px; flex-basis: 26px; }
.btn kbd { margin-left: auto; }
.mi { width: 20px; height: 20px; flex: 0 0 20px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.mi.play { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='square'><path d='M3 12h17M13 5l7 7-7 7'/></svg>"); }
.mi.keys { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'><rect x='2.5' y='6' width='19' height='12' rx='1'/><path d='M6.5 10h1M10.5 10h1M14.5 10h1M8 14h8'/></svg>"); }
.mi.snd { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9h4l5-4v14l-5-4H4z'/><path d='M16 9a4 4 0 0 1 0 6M18.5 6.5a7.5 7.5 0 0 1 0 11' fill='none' stroke='black' stroke-width='1.8'/></svg>"); }
.mi.snd.off { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M4 9h4l5-4v14l-5-4H4z'/><path d='M16 9.5l5 5M21 9.5l-5 5' fill='none' stroke='black' stroke-width='1.8'/></svg>"); }
.mi.foe { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'><circle cx='12' cy='12' r='7.5'/><circle cx='12' cy='12' r='2.2'/><path d='M12 1.5v4M12 18.5v4M1.5 12h4M18.5 12h4'/></svg>"); }
.mi.lvl { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 14h4.5v7H3zM9.75 9h4.5v12h-4.5zM16.5 3H21v18h-4.5z'/></svg>"); }
.mi.map { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M3 6l6-2.5 6 2.5 6-2.5v14.5l-6 2.5-6-2.5-6 2.5z'/><path d='M9 3.5v14.5M15 6v14.5'/></svg>"); }
.mi.menu { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'><path d='M3 7h18M3 12h18M3 17h18'/><circle cx='8' cy='7' r='2' fill='white'/><circle cx='16' cy='12' r='2' fill='white'/><circle cx='10' cy='17' r='2' fill='white'/></svg>"); }
.mi.clock { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='12' cy='12' r='9'/><path d='M12 7v5h4'/></svg>"); }
.lbl { font: 700 12px var(--font); letter-spacing: 0.2px; color: var(--dim); }
kbd { font: 700 11px var(--mono); color: var(--ink); background: var(--paper2); border: 1px solid var(--rule); border-radius: 3px; padding: 1px 5px; }

/* 세그먼트 (상대·난이도·지도): 칸을 1px 선으로 나눈 한 줄 */
.chips { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.chips.three { grid-template-columns: repeat(3, 1fr); } .chips.four { grid-template-columns: repeat(4, 1fr); } .chips.one { grid-template-columns: 1fr; }
.chip { height: 34px; padding: 0 10px; border: 0; border-left: 1px solid var(--rule2); border-radius: 0; background: none; font-size: 13px; font-weight: 600; color: var(--dim); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.chip:first-child { border-left: 0; }
.chip:hover { color: var(--ink); background: var(--paper2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ── 로비 ─────────────────────────────────────────────── */
#lobby { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
/* 행성 뒤 하늘: 행성 자리(오른쪽 아래)에서 번지는 옅은 하늘빛 */
body:has(#lobby:not(.hidden)) { background: radial-gradient(ellipse 70% 80% at 60% 78%, #dfeaf8 0%, #e9eef3 38%, var(--paper) 72%); }
#lobby > * { pointer-events: auto; transition: opacity 0.4s, transform 0.4s; }
#lobby.leaving > * { opacity: 0; pointer-events: none; }
#lobby.leaving .lb-cards { transform: translate(-50%, 30px); }
#lobby.leaving .lb-hero { animation: none; opacity: 0; }
.lb-title { position: absolute; left: 48px; top: 40px; pointer-events: none; }
.lb-title .logo { display: block; height: clamp(84px, 11vh, 128px); }
.lb-title p { margin: 14px 0 0; max-width: 26em; font-size: 14px; line-height: 1.55; color: var(--dim); }
.lb-title .lbl { display: block; margin-top: 18px; }
.lb-menu { position: absolute; left: 48px; top: calc(40px + clamp(84px, 11vh, 128px) + 130px); width: 300px; display: flex; flex-direction: column; gap: 10px; }
.lb-opts { position: absolute; right: 40px; top: 40px; display: flex; border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); }
.lb-opts section { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 14px; border-left: 1px solid var(--rule); min-width: 220px; }
.lb-opts section:first-child { border-left: 0; min-width: 300px; }
.lb-opts h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.lb-opts h2 .mi { width: 15px; height: 15px; flex-basis: 15px; color: var(--ink); }
/* 회전 무대 이름표: 정면에 잡힌 세력 (캐릭터 오른쪽) */
.lb-hero { position: absolute; right: 40px; top: 50%; transform: translateY(-58%); width: 320px; padding: 20px 22px 18px; border: 1px solid var(--ink); border-radius: var(--r); background: color-mix(in srgb, var(--paper) 94%, transparent); box-shadow: 0 18px 40px -24px #11131866; display: flex; flex-direction: column; gap: 8px; animation: heroIn 0.5s cubic-bezier(.2,.9,.3,1.2) both; pointer-events: auto; }
@keyframes heroIn { from { opacity: 0; transform: translate(26px, -58%); } to { opacity: 1; transform: translate(0, -58%); } }
.lb-hero::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 5px; border-radius: var(--r) 0 0 var(--r); background: var(--ac); }
.lb-hero .hn { display: flex; align-items: baseline; gap: 6px; font: 700 34px var(--num); color: var(--ac); letter-spacing: 1px; }
.lb-hero .hn .of { font-size: 14px; color: var(--dim); }
.lb-hero h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 40px; font-weight: 900; letter-spacing: -1px; line-height: 1.05; color: var(--ink); }
.lb-hero h2 i { width: 16px; height: 16px; flex: 0 0 16px; background: var(--ac); }
.lb-hero em { font-style: normal; font-weight: 700; font-size: 14px; color: var(--ac); }
.lb-hero .unit { font-size: 12px; color: var(--dim); } .lb-hero .unit b { color: var(--ink); font-weight: 700; }
.lb-hero p { margin: 4px 0 6px; font-size: 14px; line-height: 1.6; color: var(--dim); }
.lb-hero .arw { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.lb-hero .nav { width: 48px; height: 48px; border: 1px solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: transform 0.15s, background 0.15s, color 0.15s; }
.lb-hero .nav span { margin-top: -3px; }
.lb-hero .nav:hover { background: var(--ink); color: var(--paper); transform: scale(1.06); }
.lb-hero .nav:active { transform: scale(0.94); }
.lb-hero .dots { display: flex; gap: 6px; } .lb-hero .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--rule); transition: width 0.25s, background 0.25s; }
.lb-hero .dots i.on { width: 24px; border-radius: 4px; background: var(--ac); }
/* 아래 세력 띠: 그림 + 번호·이름·갈래만 짧게. 고른 칸은 위로 뜨고 세력 색 띠 */
.lb-cards { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 248px); gap: 12px; }
.fcard { position: relative; height: 84px; padding: 8px 14px 8px 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); text-align: left; cursor: pointer; display: flex; gap: 12px; align-items: center; transition: transform 0.2s cubic-bezier(.2,.9,.3,1.3), border-color 0.15s, box-shadow 0.2s; }
.fcard .art { flex: 0 0 68px; height: 68px; background: var(--paper2) center / contain no-repeat; border-radius: 2px; transition: transform 0.25s; }
.fcard .tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fcard .no { font: 600 11px var(--mono); color: var(--dim); }
.fcard .hd { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.fcard .hd i { width: 10px; height: 10px; background: var(--ac); flex: 0 0 10px; }
.fcard b { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; } .fcard em { font-style: normal; font: 600 12px var(--font); color: var(--dim); }
.fcard:hover { border-color: var(--ink); transform: translateY(-2px); } .fcard:hover .art { transform: scale(1.06); }
.fcard[aria-pressed="true"] { border-color: var(--ink); transform: translateY(-8px); box-shadow: 0 10px 24px -12px #11131866; }
.fcard[aria-pressed="true"]::after { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 4px; border-radius: var(--r) var(--r) 0 0; background: var(--ac); pointer-events: none; }
.fcard[aria-pressed="true"] em { color: var(--ac); }
.lb-foot { position: absolute; right: 40px; bottom: 36px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: var(--dim); pointer-events: none; }
.lb-foot span { display: flex; gap: 6px; align-items: center; }

/* ── 인게임 HUD ───────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
/* 위 가로 띠 */
#cap { position: absolute; left: 0; right: 0; top: 0; height: var(--top); padding: 0 8px 0 20px; display: flex; align-items: center; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; font-size: 15px; }
#cap .em { width: 74px; height: 26px; flex: 0 0 74px; background: var(--logo) left center / contain no-repeat; margin-right: 18px; }
#cap .r, #clk { display: inline-flex; gap: 10px; align-items: center; height: 100%; padding: 0 22px; border-left: 1px solid var(--rule2); }
#cap b, #clkv { font: 600 19px var(--num); letter-spacing: 0.3px; font-variant-numeric: tabular-nums; min-width: 3ch; }
#cap .r i { width: 20px; height: 20px; flex: 0 0 20px; background: center / contain no-repeat; }
#cap i.m { background-image: url("../assets/ui7/res-m.png"); } #cap i.g { background-image: url("../assets/ui7/res-g.png"); } #cap i.s { background-image: url("../assets/ui7/res-s.png"); }
#clk { color: var(--dim); } #clk .mi { width: 18px; height: 18px; flex-basis: 18px; }
#mnu { margin-left: auto; width: 38px; height: 38px; padding: 0; justify-content: center; border-color: var(--rule); }
#mnu .mi { width: 20px; height: 20px; }
#dbgres { margin-left: auto; height: 32px; padding: 0 12px; border: 1px dashed var(--warn); color: var(--warn); font: 600 14px var(--num); }
#dbgres + #mnu { margin-left: 10px; }
#cap .full b { color: var(--warn); animation: bl 0.8s steps(2) infinite; } @keyframes bl { 50% { opacity: 0.35; } }
#cap b.up { animation: rup 0.5s ease-out; } #cap b.dn { animation: rdn 0.5s ease-out; }
@keyframes rup { 0% { color: var(--sig); } 100% { color: var(--ink); } }
@keyframes rdn { 0% { color: var(--warn); } 100% { color: var(--ink); } }

#toasts { position: absolute; left: 50%; bottom: calc(var(--dock) + 14px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { height: 34px; padding: 0 14px 0 0; border-radius: var(--r); background: var(--paper); border: 1px solid var(--rule); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 12px; transition: opacity 0.6s; white-space: nowrap; overflow: hidden; }
.toast::before { content: ""; width: 4px; align-self: stretch; background: var(--ac); }
.toast.warn { background: var(--ink); color: var(--paper); border-color: var(--ink); } .toast.warn::before { background: var(--sig); }
.toast.out { opacity: 0; }

/* 아래 도크: 한 판을 1px 선으로 셋으로 나눈다 */
#hud::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--dock); background: var(--paper); border-top: 1px solid var(--rule); pointer-events: none; z-index: -1; }
#mmw { position: absolute; left: 0; bottom: 0; width: var(--dock); height: var(--dock); padding: 14px; border-right: 1px solid var(--rule); }
#mm { width: 100%; height: 100%; border: 1px solid var(--ink); border-radius: 2px; cursor: pointer; display: block; background: var(--paper2); }
#sel { position: absolute; left: var(--dock); right: calc(3 * 60px + 2 * 6px + 28px); bottom: 0; height: var(--dock); padding: 16px 22px; display: flex; gap: 20px; align-items: stretch; border: 0; border-radius: 0; background: none; overflow: hidden; }
.orn::before, .orn::after { display: none; }
.pring { flex: 0 0 auto; aspect-ratio: 1; height: 100%; position: relative; display: grid; place-items: center; border-radius: 2px; background: var(--paper2); overflow: hidden; }
.pring::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--ac); }
.pring img { position: relative; width: 92%; height: 92%; object-fit: contain; }
.pring canvas.p3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sinfo { flex: 1; min-width: 0; max-width: 560px; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; font-size: 13px; overflow: hidden; }
.sinfo .nm { font-size: 20px; line-height: 1.15; font-weight: 800; white-space: nowrap; display: flex; align-items: center; gap: 12px; letter-spacing: -0.4px; }
.sinfo .nm small { margin-left: auto; font: 700 12px var(--font); color: var(--ink); padding: 4px 8px; border: 1px solid var(--rule); border-radius: 2px; }
.sinfo .who { font: 700 12px var(--font); margin-top: -4px; }
.bars { display: flex; flex-direction: column; gap: 8px; margin: 2px 0; }
.bars .bar { display: flex; align-items: center; gap: 10px; } .bars .bar i { flex: 1; }
.bars i { display: block; height: 8px; background: var(--paper2); border: 1px solid var(--rule2); overflow: hidden; }
.bars i s { display: block; height: 100%; transition: width 0.2s; }
.bars small { min-width: 64px; font: 600 13px var(--num); color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.bi { flex: 0 0 13px; width: 13px; height: 13px; display: inline-block; background: var(--ink); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.bi.hp { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 1h4v5h5v4h-5v5H6v-5H1V6h5z'/></svg>"); }
.bi.sh { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1L14 3.5V8C14 11.5 11.5 13.8 8 15C4.5 13.8 2 11.5 2 8V3.5Z'/></svg>"); }
.bi.en { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M9.5 1L3 9H7.5L6.5 15L13 7H8.5Z'/></svg>"); }
.bi.ar { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1L14 3.5V8C14 11.5 11.5 13.8 8 15C4.5 13.8 2 11.5 2 8V3.5ZM8 4L5 5.3V8C5 10 6.2 11.3 8 12Z' fill-rule='evenodd'/></svg>"); }
.bi.gw { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M12.5 1.5H14.5V3.5L7 11L5 9ZM4 9.5L6.5 12L5.5 13L4.5 12.5L2.5 14.5L1.5 13.5L3.5 11.5L3 10.5Z'/></svg>"); }
.bi.aw { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1L9.5 6L15 8.5V10L9.5 8.8L9 12.5L11 14V15L8 14.2L5 15V14L7 12.5L6.5 8.8L1 10V8.5L6.5 6Z'/></svg>"); }
.bi.kl { --m: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1L10 6H15L11 9L12.5 14.5L8 11.3L3.5 14.5L5 9L1 6H6Z'/></svg>"); }
/* 능력치: 1px 선으로 나눈 한 줄 */
.stats { display: flex; margin-top: 2px; border-top: 1px solid var(--rule2); }
.stats span { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 18px 0 0; margin-right: 18px; font: 600 15px var(--num); font-variant-numeric: tabular-nums; border-right: 1px solid var(--rule2); }
.stats span:last-child { border-right: 0; } .stats .bi { width: 15px; height: 15px; flex-basis: 15px; }
.sinfo .st { color: var(--dim); font: 700 12px var(--font); }
.prog { height: 6px; background: var(--paper2); overflow: hidden; } .prog s { display: block; height: 100%; background: var(--sig); }
/* 설명 칸 (생산 칸 자리): 한 줄 설명 + 수치 네 칸 */
.sdesc p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sdesc dl { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 14px; }
.sdesc dl div { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule2); padding: 2px 0; }
.sdesc dt { font: 600 12px var(--font); color: var(--dim); } .sdesc dd { margin: 0; font: 600 14px var(--num); }
/* 생산 칸: 선택 정보 오른쪽, 1px 선으로 나눈다 */
.sprod { flex: 0 1 260px; min-width: 200px; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding-left: 20px; border-left: 1px solid var(--rule2); overflow: hidden; }
.sprod .ph { display: flex; align-items: baseline; gap: 10px; font: 700 13px var(--font); white-space: nowrap; }
.sprod .ph span { overflow: hidden; text-overflow: ellipsis; min-width: 0; } .sprod .ph b { margin-left: auto; font: 600 15px var(--num); color: var(--sig); }
.q { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.q button, .q .qe { aspect-ratio: 1; border: 1px solid var(--rule); border-radius: 2px; background: var(--paper); padding: 0; cursor: pointer; display: grid; place-items: center; }
.q .qe { border: 1px dashed var(--rule2); background: none; cursor: default; }
.q button.now { border-color: var(--sig); box-shadow: inset 0 -3px 0 var(--sig); }
.q button:hover { border-color: var(--warn); background: #fdecea; } .q img { width: 80%; height: 80%; object-fit: contain; }
.mwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.mh { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font: 700 12px var(--font); color: var(--dim); } .mh b { font-size: 15px; color: var(--ink); }
.mh span { padding-left: 14px; border-left: 1px solid var(--rule2); }
.multi { display: grid; grid-template-columns: repeat(auto-fill, 54px); gap: 5px; align-content: start; }
.multi button { width: 54px; height: 54px; border: 1px solid var(--rule2); border-radius: 2px; background: var(--paper2); position: relative; padding: 0; cursor: pointer; display: grid; place-items: center; overflow: hidden; }
.multi button:hover { border-color: var(--ink); } .multi img { width: 42px; height: 42px; }
.multi s { position: absolute; left: 0; bottom: 0; height: 4px; }
.idle { flex: 1; display: flex; gap: 20px; align-items: center; color: var(--dim); font-size: 13px; line-height: 1.7; }
.idle .em { flex: 0 0 72px; height: 72px; background: var(--emblem) center / contain no-repeat; }
.idle b { display: block; color: var(--ink); font-size: 17px; font-weight: 800; }

/* 명령 칸 3×3: 네모 버튼, 먹색 선 아이콘. 올리면 신호 주황으로 채운다 */
#grid { position: absolute; right: 0; bottom: 0; height: var(--dock); padding: 14px; display: grid; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(3, minmax(0, calc((var(--dock) - 28px - 12px) / 3))); grid-auto-rows: 0; gap: 6px; align-content: center; border: 0; border-left: 1px solid var(--rule); border-radius: 0; background: none; }
.ab { position: relative; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); padding: 0; cursor: pointer; display: grid; place-items: center; transition: background 0.08s, border-color 0.08s; }
.ab:hover, .ab:focus-visible { background: var(--sig); border-color: var(--sig); }
.ab:active { background: var(--sig-hi); }
.ab img { width: 80%; height: 86%; object-fit: contain; }
.ab kbd { position: absolute; right: 3px; top: 2px; font: 700 9px var(--mono); color: var(--dim); background: none; border: 0; padding: 0; }
.ab:hover kbd, .ab:focus-visible kbd { color: #fff; }
.ab .ico { width: 44%; height: 50%; background: var(--ink); -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ab:hover .ico, .ab:focus-visible .ico { background: #fff; }
.ab.off img { filter: grayscale(1) opacity(0.4); } .ab.off .ico { opacity: 0.3; } .ab.off kbd { color: #b0b3b8; }
.ab.empty { background: none; border: 1px dashed var(--rule2); pointer-events: none; }

#tip { position: fixed; display: none; z-index: 40; max-width: 290px; padding: 10px 12px; font-size: 12px; line-height: 1.55; pointer-events: none; color: var(--paper); background: var(--ink); border: 0; border-radius: var(--r); }
#tip b { display: block; color: #fff; margin-bottom: 3px; font-size: 13px; font-weight: 800; }
#tip div { color: #c8cad0; }
#modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #f4f3efcc; }
.mpanel { min-width: 440px; max-width: min(860px, 92vw); padding: 28px 30px 26px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); }
.mpanel .em { width: 56px; height: 20px; background: var(--logo) left center / contain no-repeat; margin-bottom: 4px; }
.mpanel h2 { margin: 0 0 6px; font-size: 26px; font-weight: 900; letter-spacing: -0.6px; }
.mpanel h2.win, .mpanel h2.lose { font-size: 54px; letter-spacing: -1.5px; line-height: 1; }
.mpanel h2.win { color: var(--sig); } .mpanel h2.lose { color: var(--ink); }
.mpanel .btn { min-width: 260px; }
.mpanel .btn.cta { height: 56px; font-size: 17px; }
.mpanel table { border-collapse: collapse; font-size: 14px; margin: 6px 0 8px; } .mpanel td, .mpanel th { padding: 8px 14px; border-bottom: 1px solid var(--rule2); text-align: right; font: 600 15px var(--num); }
.mpanel td:first-child, .mpanel th:first-child { text-align: left; color: var(--dim); font: 500 13px var(--font); }
.help { columns: 2; column-gap: 28px; font-size: 13px; line-height: 1.8; color: #3b3f46; } .help p { margin: 0 0 8px; break-inside: avoid; }
.mpanel h3 { margin: 8px 0 0; } .mpanel .chips { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
#idlew { position: absolute; left: 14px; bottom: calc(var(--dock) + 12px); height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font: 700 12px var(--font); cursor: pointer; }
#idlew:hover { background: var(--sig); border-color: var(--sig); color: #fff; }

@media (max-width: 1280px) {
  :root { --dock: 168px; }
  .lb-cards { grid-template-columns: repeat(3, 220px); } .fcard .art { flex-basis: 60px; height: 60px; } .lb-opts section, .lb-opts section:first-child { min-width: 0; }
}
@media (max-width: 1120px) {
  .lb-title { left: 24px; max-width: 350px; }
  .lb-menu { left: 24px; }
  /* 좁은 화면: 설정 띠는 한 줄 그대로 두고 칸만 좁힌다(세로로 길어져 이름표를 덮지 않게), 이름표는 아래 카드 위로 */
  .lb-opts { right: 24px; left: 400px; }
  .lb-opts section { padding: 8px 10px; min-width: 0; } .lb-opts section:first-child { min-width: 0; }
  .lb-opts .chip { padding: 0 6px; font-size: 12px; }
  .lb-hero { right: 24px; top: auto; bottom: 120px; transform: none; width: 280px; padding: 14px 16px 12px; animation-name: heroInLow; }
  @keyframes heroInLow { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
  .lb-hero h2 { font-size: 30px; } .lb-hero .hn { font-size: 26px; } .lb-hero p { font-size: 13px; }
  .lb-cards { gap: 8px; grid-template-columns: repeat(3, 190px); bottom: 20px; }
  .fcard { gap: 8px; height: 72px; } .fcard .art { flex-basis: 52px; height: 52px; }
  .fcard b { font-size: 15px; } .fcard em { font-size: 11px; }
  .lb-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #cap b.up { color: var(--sig); } #cap b.dn { color: var(--warn); } #cap .full b { color: var(--warn); }
}

/* 보급소 (src3d/store.js): 상품 목록 · 작전 기록 단계표 · 꾸미기 장착 */
.shop-panel { width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; }
.shop-panel .btn { min-width: 0; }
.shop-panel > .btn[data-a="x"] { align-self: flex-start; min-width: 200px; }
.shop-tabs .chip { height: 38px; font-size: 14px; }
.season { display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; font-size: 13px; color: var(--dim); }
.season b { color: var(--ink); }
.season .bar { height: 8px; border-radius: 4px; background: var(--paper2); overflow: hidden; border: 1px solid var(--rule2); }
.season .bar i { display: block; height: 100%; background: var(--ac); }
.shop { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.shop .item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule2); }
.shop .nm { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.shop .nm small { color: var(--dim); font-size: 12px; line-height: 1.5; }
.shop .item .btn { width: 120px; height: 40px; font: 700 15px var(--num); }
.sw { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #0003; flex: none; margin-right: 6px; vertical-align: -3px; }
.shop .item > .sw { width: 28px; height: 28px; margin: 0; }
.fine { margin: 2px 0; font-size: 12px; line-height: 1.6; color: var(--dim); }
.note { margin: 0; padding: 8px 12px; border-radius: var(--r); background: var(--soft); color: var(--ink); font-size: 13px; font-weight: 600; }
.track { display: flex; flex-direction: column; font-size: 13px; }
.track .tr { display: grid; grid-template-columns: 56px 1fr 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule2); align-items: center; }
.track .tr.hd { color: var(--dim); font-size: 12px; font-weight: 700; }
.track .tr > span:first-child { font: 700 14px var(--num); color: var(--dim); }
.track .tr.done > span:first-child { color: var(--ac); }
.track .rw { color: var(--dim); } .track .rw.got { color: var(--ink); font-weight: 700; } .track .rw.got::after { content: " ✓"; color: var(--ac); }
.track .rw.empty { color: var(--rule); }
.mpanel .chips.look { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.chips.look .chip { justify-content: flex-start; border-top: 1px solid var(--rule2); }
.chips.look .chip.locked { opacity: 0.4; cursor: not-allowed; }
.mpanel .xp { margin: 0 0 6px; font-size: 14px; font-weight: 700; } .mpanel .xp small { color: var(--dim); font-weight: 500; }
@media (max-width: 560px) { .mpanel { min-width: 0; padding: 20px 16px; } .season { grid-template-columns: 1fr auto; } .season .bar { grid-column: 1 / -1; } .shop .item .btn { width: 96px; } }
