/* on-RTS 콘솔. 아이콘과 동작 이름을 함께 표시. 패널은 on-Play DESIGN.md 의 다크 표면(헤어라인 1px, 8px). 아이콘만 Kenney. */
:root {
  --fg: #f5f5f7; --muted: #86868b; --surface: rgba(14, 15, 19, 0.9); --hairline: #2a2a2e;
  --accent: #ff3131; --team: #3aa0ff; --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Apple SD Gothic Neo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0e12; color: var(--fg); font: 400 14px/18px var(--font); letter-spacing: -0.224px; user-select: none; }
/* 캔버스는 replaced 요소라 inset 만으론 안 늘어난다 — 버퍼(픽셀비 1.5배)가 CSS px 로 그대로 보여 클릭이 어긋났다 */
/* dvh: 브라우저 바가 떠 있는 동안의 '보이는 높이'. 100vh 는 바가 숨겨진 큰 높이라 아래가 바 뒤로 들어간다 (2026-09-20 사용자, on-Chess 와 같은 수정) */
canvas#game { position: fixed; inset: 0; display: block; width: 100vw !important; height: 100vh !important; height: 100dvh !important; }

#hud { position: fixed; inset: 0; height: 100dvh; pointer-events: none; }
#hud > * { pointer-events: auto; }

.frame {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 8px;
}

/* ── 자원바 ── */
#top { position: absolute; top: 8px; right: 8px; display: flex; gap: 10px; padding: 6px 12px; align-items: center; }
.res { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.res img { width: 26px; height: 26px; }
.res.short b { color: var(--accent); }

/* ── 메시지 ── */
#msg { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); display: grid; gap: 4px; pointer-events: none; }
#msg div { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 6px 12px; color: var(--accent); animation: fade 2.4s forwards; }
@keyframes fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ── 콘솔 ── */
#console { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: min(1180px, calc(100vw - 16px)); height: 152px; display: flex; gap: 8px; }
#minimap { width: 158px; flex: none; padding: 8px; cursor: crosshair; }
#minimap[hidden] { display: none; }
#minimap canvas { width: 140px; height: 140px; display: block; image-rendering: pixelated; }
#portrait { width: 152px; flex: none; position: relative; padding: 8px; }
#portrait canvas { width: 132px; height: 132px; display: block; image-rendering: auto; }
#hp { position: absolute; left: 10px; right: 10px; bottom: 9px; height: 5px; background: #2a2a2e; border-radius: 2px; overflow: hidden; }
#hp i { display: block; height: 100%; background: #4cd964; }
#hp.low i { background: var(--accent); }

#info { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 4px 6px; align-content: flex-start; }
#info .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#info .chip { position: relative; display: inline-flex; align-items: center; gap: 3px; padding: 2px; border: 1px solid var(--hairline); border-radius: 6px; background: rgba(255,255,255,0.03); }
#info .chip img { width: 30px; height: 30px; }
#info .chip img.flat { width: 18px; height: 18px; margin: 6px; }
#info .chip b { font-size: 12px; min-width: 14px; text-align: center; padding-right: 3px; font-variant-numeric: tabular-nums; }
#info .prog { height: 6px; width: 100%; background: #2a2a2e; border-radius: 3px; overflow: hidden; }
#info .prog i { display: block; height: 100%; background: var(--team); }

#card { width: 152px; flex: none; display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); gap: 5px; padding: 8px; align-content: start; justify-content: center; } /* 3×3 고정 = 자판 QWE/ASD/ZXC */
#card:empty { visibility: hidden; }
.cmd { position: relative; width: 42px; height: 42px; padding: 0; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.14), rgba(255,255,255,0.03) 70%); border: 1px solid var(--hairline); border-radius: 6px; cursor: pointer; display: grid; place-items: center; overflow: visible; }
.cmd img { width: 34px; height: 34px; pointer-events: none; }
.cmd .key { position: absolute; left: 2px; top: 1px; font: 800 10px/12px var(--font); color: #fff; text-shadow: 0 0 2px #000, 0 1px 2px #000; pointer-events: none; letter-spacing: 0; }
.cmd:disabled .key { opacity: 0.55; }
.cmd-empty { display: block; }
.cmd img.flat { width: 22px; height: 22px; }
.cmd svg.flat { width: 22px; height: 22px; color: #efe7d5; pointer-events: none; }
.cmd:hover { border-color: var(--accent); background: rgba(255, 49, 49, 0.14); }
.cmd:disabled { cursor: not-allowed; }
.cmd:disabled img { opacity: 0.35; filter: grayscale(1); }
.cmd.active { background: rgba(255, 49, 49, 0.3); }
.cmd img.badge, .chip img.badge { position: absolute; right: -5px; bottom: -5px; width: 16px; height: 16px; padding: 2px; border-radius: 4px; background: var(--accent); pointer-events: none; }
/* 업그레이드 진행 막대: 아이콘 아래 3px. 진행 중인 버튼은 비활성이지만 아이콘은 흐리지 않는다 */
.cmd .cmd-progress { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 3px; background: #34343a; border-radius: 2px; overflow: hidden; pointer-events: none; }
.cmd .cmd-progress i { display: block; height: 100%; width: 0; background: var(--team); }
.cmd.researching[aria-disabled=true] img { opacity: 1; filter: none; }

/* ── 툴팁 ── */
#tooltip { position: fixed; z-index: 20; min-width: 150px; max-width: 260px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); pointer-events: none; display: grid; gap: 4px; }
#tooltip[hidden] { display: none; }
#tooltip h4 { margin: 0; font-size: 14px; line-height: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
#tooltip kbd { margin-left: auto; font: 600 11px/16px var(--font); color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px; }
#tooltip p { margin: 0; color: var(--muted); font-size: 12px; line-height: 16px; }
#tooltip .cost { display: flex; gap: 10px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
#tooltip .cost span { display: inline-flex; align-items: center; gap: 3px; }
#tooltip .cost img { width: 18px; height: 18px; }
#tooltip .cost .no { color: var(--accent); }

#selbox { position: fixed; border: 1px solid var(--team); background: rgba(58, 160, 255, 0.1); pointer-events: none; }

#loading, #pconly { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0b0e12; color: var(--muted); font-size: 17px; text-align: center; padding: 20px; }
#loading[hidden], #pconly[hidden] { display: none; }

/* ── 웨이브 HUD ── */
#wave { position: absolute; top: 8px; left: 8px; display: grid; grid-template-columns: 30px auto; grid-auto-rows: min-content; column-gap: 8px; row-gap: 3px; align-items: center; padding: 6px 12px; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
#wave img { width: 30px; height: 30px; grid-row: 1 / span 2; }
#wave .bar { height: 5px; width: 90px; background: #2a2a2e; border-radius: 2px; overflow: hidden; }
#wave .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
#wave .muted { color: var(--muted); font-size: 12px; grid-column: 2; }
#wave[hidden] { display: none; }
#wave.hot { animation: pulse 0.8s 3; }
@keyframes pulse { 50% { filter: brightness(1.6); } }

/* 자원 좌클릭 미리보기: 선택 정보 위에 한 줄 (2026-09-15) */
.node-peek { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 10px; background: rgba(255, 210, 122, 0.08); border: 1px solid rgba(255, 210, 122, 0.35); border-radius: 6px; font-size: 13px; }
.node-peek img { width: 22px; height: 22px; }.node-peek b { font-weight: 600; }.node-peek span { color: #ffd27a; margin-left: auto; font-variant-numeric: tabular-nums; }
/* Kenney Fantasy UI Borders (CC0): 픽셀 테두리 2배 정수 배율. 금빛 = 시작·결과·승리, 붉은빛 = 패배 (2026-09-14 디자이너의 손) */
.fframe { border: 32px solid transparent; border-image: url('ui/borders/frame-gold.png') 16 / 32px round; image-rendering: pixelated; border-radius: 0; box-shadow: none; }
.fframe.red { border-image-source: url('ui/borders/frame-red.png'); }
.fdivider { height: 36px; margin: 0 auto; width: 368px; max-width: 100%; background: url('ui/borders/divider-gold.png') center / 368px 36px no-repeat; image-rendering: pixelated; opacity: 0.9; }
.fdivider.red { background-image: url('ui/borders/divider-red.png'); }
/* Kenney Future (CC0, kenney.nl/assets/kenney-fonts): 영문 표제어 전용 — VICTORY / DEFEAT · on-RTS 워드마크. 한글은 기본 폰트 */
@font-face { font-family: 'Kenney Future'; src: url('fonts/KenneyFuture.ttf') format('truetype'); font-display: swap; }
/* ── 마지막 장면 위 승패 카드 (결과 화면 전에 잠시 음미, 2026-09-14) ── */
#finale { position: fixed; inset: 0; display: grid; place-items: center; z-index: 14; pointer-events: none; }
#finale[hidden] { display: none; }
#finale[data-outcome="lose"]::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.18), rgba(20, 0, 0, 0.55)); animation: finale-dim 1.2s ease-out both; }
#finale[data-outcome="win"]::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(255, 209, 102, 0.08), rgba(0, 0, 0, 0.35)); animation: finale-dim 1.2s ease-out both; }
#finale .finale-card { position: relative; pointer-events: auto; display: grid; justify-items: center; gap: 12px; padding: 18px 60px 16px; background: rgba(12, 12, 14, 0.78); backdrop-filter: blur(6px); animation: finale-in 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.15) 0.35s both; }
#finale img { width: 128px; height: 128px; }
#finale b { font: 400 76px/84px 'Kenney Future', var(--font); letter-spacing: 10px; margin-left: 10px; }
#finale[data-outcome="win"] b { color: #ffd166; text-shadow: 0 0 24px rgba(255, 209, 102, 0.45); }
#finale[data-outcome="lose"] b { color: #ff6b6b; text-shadow: 0 0 24px rgba(255, 107, 107, 0.35); }
#finale button { margin-top: 10px; padding: 14px 28px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--accent); border-radius: 8px; color: var(--fg); font: 600 18px/20px var(--font); cursor: pointer; }
#finale button:hover { background: rgba(255, 49, 49, 0.18); }
@keyframes finale-in { from { opacity: 0; transform: translateY(-20px) scale(0.88); } }
@keyframes finale-dim { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #finale .finale-card, #finale::before { animation: none; } }

/* ── 결과 / 모드 선택 ── */
#result, #modes { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); z-index: 15; }
#result[hidden], #modes[hidden] { display: none; }
#result .frame, #modes .frame { display: grid; gap: 14px; justify-items: center; padding: 22px 30px; min-width: 260px; }
#result img#result-icon { width: 72px; height: 72px; }
#result b, #modes b { font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: -0.3px; }
#result .cmd { width: 56px; height: 56px; }
#result .cmd img.flat { width: 26px; height: 26px; }
#modes .choices { display: flex; gap: 14px; }
#modes .choices button { width: 150px; height: 150px; display: grid; place-items: center; align-content: center; gap: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--hairline); border-radius: var(--radius); color: var(--fg); font: 600 15px/18px var(--font); cursor: pointer; }
#modes .choices button:hover { border-color: var(--accent); }
#modes .choices button:hover { background: rgba(255, 49, 49, 0.18); }
#modes .choices img { width: 80px; height: 80px; }

/* 기록: 닉네임·순위표 (모드 선택 화면), 내 전적 (결과 화면) */

/* 결과 화면 다시 하기 · 순위표 내 기록 */

/* 빈 선택 요약: 유휴 일꾼 칩 강조 */


/* 치트 입력창 (Enter) */

/* Readable tactical console — DESIGN.md §8. Existing models are retained. */
:root { --surface: rgba(19,19,22,.97); }
[hidden],#hud[hidden] { display: none !important; }
button,a,input,select { -webkit-tap-highlight-color: transparent; }
button { font-family: var(--font); color: var(--fg); }
a { color: var(--fg); }
:focus-visible { outline: 2px solid #ff7474; outline-offset: 3px; }
#game-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; }
#game-tools button,#coach button,#load-retry,#load-back { border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface); color: var(--fg); padding: 10px 14px; font-size: 13px; cursor: pointer; text-decoration: none; }
#game-tools button:hover { border-color: var(--muted); }
#top { top: 12px; right: 12px; gap: 12px; padding: 8px 14px; }
.res { gap: 8px; }.res-value { display: grid; gap: 2px; }.res small { font-size: 11px; line-height: 14px; color: var(--muted); font-weight: 400; }.res b { font-size: 18px; line-height: 20px; }
#wave { top: 64px; left: 12px; max-width: 300px; padding: 10px 12px; row-gap: 6px; }
#wave .bar { width: 100%; }#wave .muted { font-size: 12px; line-height: 17px; font-weight: 400; }

#msg { top: 124px; }#msg div { color: var(--fg); font-size: 13px; }
#console { width: min(960px,calc(100vw - 24px)); height: 196px; bottom: 12px; gap: 8px; }
#portrait { width: 112px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; }
#portrait canvas { width: 96px; height: 96px; }
#portrait-label { font-size: 12px; color: var(--muted); }#hp { left: 12px; right: 12px; bottom: 14px; }
#minimap { width: 180px; display: grid; place-items: center; padding: 8px; }
#minimap canvas { width: 162px; height: 162px; }
#info { padding: 16px; gap: 12px; overflow: auto; min-width: 0; }
.selection-heading h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.selection-heading .heading-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.formation-bar { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 6px; margin: 0; border: 1px solid var(--hairline); border-radius: 6px; background: rgba(255,255,255,0.04); color: var(--muted); font: inherit; cursor: pointer; } /* 한 버튼: SVG 하나 + 현재 포메이션 + F (2026-09-17 사용자) */
.formation-bar[aria-pressed="true"] { border-color: var(--team); background: rgba(58, 160, 255, 0.14); color: var(--fg); }
.formation-bar[aria-pressed="true"] kbd { color: var(--team); border-color: var(--team); }
.formation-bar:hover { border-color: #86868b; color: var(--fg); }
.selection-heading .army-all { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 6px; margin-left: auto; align-self: flex-start; border: 1px solid var(--hairline); border-radius: 6px; background: rgba(255,255,255,0.04); color: var(--fg); font: inherit; cursor: pointer; } /* 군대 전체 선택 — 머리 줄 오른쪽 끝 (2026-09-17 사용자) */
.selection-heading .army-all img { width: 18px; height: 18px; }
.selection-heading .army-all kbd { font: 600 10px/14px var(--font); color: var(--muted); border: 1px solid var(--hairline); border-radius: 4px; padding: 0 4px; }
.selection-heading .army-all:hover { border-color: #86868b; }
.selection-heading .army-all:active { background: rgba(58, 160, 255, 0.14); border-color: var(--team); }
.formation-bar button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 6px; border: 1px solid var(--hairline); border-radius: 6px; background: rgba(255,255,255,0.04); color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer; white-space: nowrap; }
.formation-bar svg { width: 18px; height: 18px; flex: none; }
.formation-bar kbd { font: 600 10px/14px var(--font); color: var(--muted); border: 1px solid var(--hairline); border-radius: 4px; padding: 0 4px; }
.formation-bar button:hover { border-color: #86868b; color: var(--fg); }
.formation-bar button[aria-pressed="true"] { border-color: var(--team); background: rgba(58, 160, 255, 0.14); color: var(--fg); }
.formation-bar button[aria-pressed="true"] kbd { color: var(--team); border-color: var(--team); } /* 진형 5종 (2026-09-16) */
.selection-heading p { color: var(--muted); font-size: 12px; line-height: 18px; margin: 4px 0 0; }
.construction-refund { margin: 0; color: var(--muted); font-size: 12px; line-height: 19px; }
.cmd[data-action="cancelBuilding"] { border-color: #774343; }
#info .row { gap: 8px; }#info .chip { border: 0; background: rgba(255,255,255,.035); padding: 4px 6px; min-height: 36px; border-radius: 6px; }
#info .chip img { width: 26px; height: 26px; }#info .chip img.flat { width: 18px; height: 18px; margin: 4px; }
#card { width: 200px; grid-template-columns: repeat(3,56px); grid-template-rows: repeat(3,56px); gap: 6px; }
.cmd { width: 56px; height: 56px; background: #1c1c1f; border-radius: 6px; gap: 0; align-content: end; padding: 4px 2px 3px; }
.cmd img { width: 28px; height: 28px; }.cmd img.flat { width: 22px; height: 22px; }
.cmd .key { left: auto; right: 4px; top: 2px; font-size: 10px; font-weight: 500; color: #b6b6bc; text-shadow: none; }
/* 업그레이드 단계 (2026-09-17 사용자): 바닥의 3등분 게이지가 한 칸씩 금빛으로 켜지고 단계마다 바탕이 짙어진다. 풀업 = 금테 + 금 바탕 + 체크 배지 */
.cmd[data-action="upgrade"] { align-content: center; padding: 14px 2px 12px; } /* 위 = 필요 자원, 가운데 = 아이콘(이름 없음), 아래 = 게이지 (2026-09-17 사용자) */
.cmd .cmd-cost.wide { left: 4px; right: 4px; justify-content: flex-start; gap: 5px; font-size: 9.5px; }
.cmd[data-action="upgrade"] .key { bottom: 11px; right: 3px; } .cmd[data-action="upgrade"] .cmd-meter { right: 16px; } /* 게이지가 있는 버튼은 단축키를 게이지 옆에 */
.cmd .cmd-cost.wide img { width: 10px; height: 10px; opacity: 1; margin-right: 1px; }
.cmd { align-content: end; padding: 19px 2px 7px; } /* 공통 배치 (2026-09-17 사용자 규칙): 왼쪽 위 = 필요 자원, 그 아래 = 아이콘(글자 없음, 값을 가리지 않게 아래쪽), 오른쪽 아래 = 단축키, 바닥 = 게이지 — 서로 안 겹친다 */
.cmd > img:not(.badge):not(.flat) { width: 28px; height: 28px; margin-right: 10px; } /* 오른쪽 아래 단축키 글자 자리를 비운다 */
.cmd .cmd-cost { position: absolute; left: 4px; top: 3px; display: inline-flex; align-items: center; gap: 2px; font: 600 10px/12px var(--font); color: #d8cfbb; letter-spacing: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.cmd .cmd-cost img { width: 14px; height: 14px; opacity: 1; }
.cmd[aria-disabled=true] .cmd-cost { color: #ff7a7a; } /* 값이 모자라거나 못 만들면 붉게 */
.cmd .cmd-meter { position: absolute; left: 5px; right: 5px; bottom: 5px; display: flex; gap: 2px; height: 5px; pointer-events: none; }
.cmd .cmd-meter i { flex: 1; border-radius: 2px; background: #34343a; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.cmd .cmd-meter i.on { background: linear-gradient(180deg, #f3d47a, #d6b660); box-shadow: 0 0 6px rgba(214,182,96,.55); }
.cmd.lv1 { background: linear-gradient(180deg, rgba(214,182,96,.10), #1c1c1f 60%); }
.cmd.lv2 { background: linear-gradient(180deg, rgba(214,182,96,.22), #1c1c1f 70%); border-color: rgba(214,182,96,.35); }
.cmd.maxed, .cmd.maxed[aria-disabled=true] { background: linear-gradient(180deg, rgba(214,182,96,.38), rgba(214,182,96,.12)); border-color: #d6b660; box-shadow: inset 0 0 0 1px rgba(214,182,96,.55); cursor: default; }
.cmd.maxed[aria-disabled=true] img { opacity: 1; filter: none; }
.cmd.maxed .cmd-name, .cmd.maxed[aria-disabled=true] .cmd-name { color: #f3ead6; }
.cmd.maxed img.badge { background: #d6b660; }
.cmd .cmd-level { position: absolute; left: 4px; top: 2px; font: 600 10px/12px var(--font); color: #d6d6dc; letter-spacing: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.cmd-name { display: block; font-size: 12px; line-height: 14px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.cmd[aria-disabled=true] { background: #17171a; cursor: not-allowed; }.cmd[aria-disabled=true] img { opacity: .55; } /* 색은 그대로, 흐리게만 — 잠긴 버튼도 같은 그림으로 읽힌다 (2026-09-17 사용자) */.cmd[aria-disabled=true] .cmd-name { color: #aaaab0; }
.cmd:hover { background: #29292e; border-color: #86868b; }.cmd.active { border-color: #3aa0ff; background: #1b2b3d; }
.cmd img.badge,.chip img.badge { width: 12px; height: 12px; bottom: 17px; right: 2px; background: #33333a; }
#tooltip { min-width: 210px; max-width: 290px; padding: 14px; gap: 8px; }#tooltip p { line-height: 19px; color: #aaaab0; }#tooltip .reason { color: #ffd2d2; }
#coach { position: absolute; left: 12px; top: 180px; width: 280px; max-height: calc(100vh - 400px); overflow: auto; padding: 16px; }
#coach h2 { margin: 0 0 12px; font-size: 16px; line-height: 22px; }#coach ol { padding-left: 20px; margin: 0; }#coach li { margin-bottom: 12px; padding-left: 4px; }#coach strong { font-size: 13px; }#coach p,#coach small { color: var(--muted); font-size: 12px; line-height: 18px; margin: 3px 0; }#coach li.done strong { color: #8bd6b0; }#coach button { width: 100%; margin-top: 12px; }
/* 시작 화면 (2026-09-14 디자이너의 손): 검은 판 대신 디오라마 위에 반투명 패널. 글자는 한 단계 크게 */
#modes { align-items: flex-end; background: linear-gradient(180deg, rgba(5, 7, 10, 0.1) 0%, rgba(5, 7, 10, 0.6) 100%); overflow: auto; padding: 24px; } /* 아래 여백 40 → 24: 프레임 710 + 48 = 758 이 768 화면에 들어간다 (2026-09-16) */
#modes .frame { width: min(800px,100%); min-width: 0; padding: 8px 20px 12px; gap: 18px; justify-items: stretch; margin: auto auto 0; background: rgba(12, 13, 16, 0.82); backdrop-filter: blur(10px); }
#modes .brand { justify-content: center; }#modes .brand + .fdivider { margin-top: -10px; }
#modes h1 { margin: 0; font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -0.4px; }
#modes .brand { display: flex; align-items: baseline; gap: 12px; }#modes .brand b { font: 400 40px/48px 'Kenney Future', var(--font); letter-spacing: 2px; }

#modes .choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
#modes .choices button { width: 100%; height: auto; min-height: 0; padding: 22px 22px; gap: 18px; display: flex; align-items: center; justify-content: center; text-align: center; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; }
#modes .choices img { width: 88px; height: 88px; flex: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4)); }#modes .choices strong { display: block; font-size: 22px; line-height: 28px; font-weight: 700; }
#modes .pick { display: grid; gap: 10px; }#modes .pick > span { font-size: 14px; font-weight: 600; color: var(--muted); }
#modes .scale { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 8px; }
/* 맵 고르기 (2026-09-16): 난이도 버튼과 같은 상아/금 픽셀 프레임 — 화살표는 Kenney arrowRight 아이콘(왼쪽은 뒤집음), 섬네일은 미니맵 색 */
#modes .maps { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; gap: 8px; align-items: center; }
/* 고정 프레임 하나(금박 = 지금 고른 맵) 안에 카드 한 장 — 넘기면 내용이 제자리에서 바뀐다 (2026-09-16 사용자) */
#modes .map-frame { min-width: 0; padding: 4px; background: none; border: 16px solid transparent; border-image: url('ui/borders/btn-gold.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; }#modes .maps.locked .map-frame { border-image-source: url('ui/borders/btn-ivory.png'); }
/* 카드: 왼쪽 지도 160, 오른쪽은 세로로 이름 / 승률 막대 / 자원 을 위아래로 펼쳐 프레임을 꽉 채운다 (2026-09-16 사용자: 안쪽 여백이 안 느껴지게) */
#modes .map-card { width: 100%; display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 18px; align-items: stretch; padding: 0 6px 0 2px; margin: 0; box-sizing: border-box; background: none; border: 0; color: #efe7d5; text-align: left; cursor: pointer; }
#modes .map-card[aria-pressed=true] { color: #fff; }
#modes .map-card canvas { width: 160px; height: 160px; image-rendering: auto; }
#modes .map-info { display: grid; grid-template-rows: auto 1fr auto; align-content: stretch; min-width: 0; }
#modes .map-head { display: flex; align-items: baseline; gap: 12px; }
#modes .map-card b { font: 400 22px/28px 'Kenney Future', var(--font); letter-spacing: 1px; }#modes .map-card small { font: 400 14px/18px 'Kenney Future', var(--font); letter-spacing: 1px; color: rgba(216, 207, 187, 0.7); }#modes .map-card[aria-pressed=true] small { color: rgba(243, 234, 214, 0.9); }
#modes .map-bars { display: grid; align-content: center; gap: 6px; }
#modes .map-bar { display: flex; align-items: center; gap: 8px; width: 100%; } /* 자리·종족 승률 막대: 글자 대신 색·아이콘 */
#modes .map-bar .dot { width: 10px; height: 10px; margin: 0 3px; border-radius: 50%; border: 1px solid #fff; flex: none; }#modes .map-bar .p0 { background: #4fadff; }#modes .map-bar .p1 { background: #d92626; }
#modes .map-bar svg { width: 16px; height: 16px; flex: none; color: #d8cfbb; } /* 점(10+3·2)과 아이콘(16) 양끝 폭을 맞춰 두 막대 길이가 같다 (2026-09-16 사용자) */
#modes .map-bar .bar { flex: 1; display: flex; height: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(216, 207, 187, 0.25); box-sizing: border-box; }
#modes .map-bar .bar b { display: flex; align-items: center; justify-content: center; overflow: hidden; font: 400 10px/12px 'Kenney Future', var(--font); letter-spacing: 0.5px; color: #fff; }
#modes .map-bar.pos .bar b:first-child { background: #4fadff; }#modes .map-bar.pos .bar b:last-child { background: #d92626; }
#modes .map-bar .fac { width: 18px; height: 18px; flex: none; box-sizing: border-box; border: 2px solid; border-radius: 3px; background: rgba(0, 0, 0, 0.35); object-fit: contain; }#modes .map-bar .fac.p0 { border-color: #4fadff; }#modes .map-bar .fac.p1 { border-color: #d92626; } /* 최근 경기 막대 양끝: 그 자리 종족 (2026-10-05), 둥근 사각형 */
#modes .map-bars:has(.live) { gap: 4px; }
#modes .map-res { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid rgba(216, 207, 187, 0.18); }#modes .map-res i { display: flex; align-items: center; gap: 6px; font-style: normal; line-height: 20px; }
#modes .map-res img { width: 20px; height: 20px; }#modes .map-res em { font: 400 15px/20px 'Kenney Future', var(--font); font-style: normal; letter-spacing: 0.5px; color: rgba(216, 207, 187, 0.85); }#modes .map-card[aria-pressed=true] .map-res em { color: #f3ead6; } /* 자원 세 개를 한 줄로, 숫자는 아이콘 바로 옆 */
#modes .maps.locked .map-card { pointer-events: none; } /* 손님: 방장이 고른 맵을 보기만 */
/* 종족 카드 아래 줄 (2026-09-16): 왼쪽 리본(고른 난이도 이름) · 오른쪽 난이도 10칸을 카드 폭에 맞춰 작게 (프레임 그림도 절반 크기) */
#modes .under { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
#modes .ribbon { display: grid; align-content: center; justify-items: center; gap: 2px; min-height: 0; } /* 라벨은 줄 위에, 그 아래 가는 상아선 + 가운데 장식(divider-ivory) */
#modes .ribbon em { font: 400 13px/16px 'Kenney Future', var(--font); font-style: normal; letter-spacing: 1px; color: rgba(216, 207, 187, 0.85); }
#modes .ribbon::after { content: ''; width: 100%; height: 18px; background: linear-gradient(rgba(216, 207, 187, 0.35), rgba(216, 207, 187, 0.35)) center / 100% 2px no-repeat, url('ui/borders/divider-ivory.png') center / auto 18px no-repeat; image-rendering: pixelated; }
#modes .scale.levels.mini { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 2px; align-items: start; } /* .scale.levels 의 44px 줄 규칙보다 우선. start: 늘려 채우면 1:1 비율이 높이를 따라 칸이 열보다 넓어져 겹친다 — 폭은 열, 높이는 폭 */
#modes .scale.levels.mini button { height: auto; min-height: 0; aspect-ratio: 1 / 1; padding: 0; border-width: 8px; border-image-width: 8px; display: grid; place-items: center; }
#modes .scale.levels.mini button b { display: block; line-height: 1; margin: 0; transform: translate(3px, -1px); } /* 숫자를 칸 정중앙에 — Kenney 틀은 왼쪽·아래 장식이 두꺼워 시각 중심이 오른쪽 위로 3·1px 치우친다 (측정, 2026-09-17 사용자) */
#modes .arrow { height: 64px; padding: 0; background: none; border: 16px solid transparent; border-image: url('ui/borders/btn-ivory.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; cursor: pointer; display: grid; place-items: center; transition: filter .12s; }#modes .arrow:hover { filter: brightness(1.25); }
#modes .arrow img { width: 18px; height: 18px; image-rendering: pixelated; }#modes .arrow[data-maps-scroll="-1"] img { transform: scaleX(-1); }#modes .arrow[disabled] { opacity: 0.35; cursor: default; }#modes .arrow[disabled]:hover { filter: none; }
@media (prefers-reduced-motion: reduce) { #modes .map-card, #modes .arrow { transition: none; } }
#modes .scale button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 76px; padding: 10px 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--hairline); border-radius: 6px; color: var(--fg); font: 600 15px/20px var(--font); cursor: pointer; }
#modes .scale img { width: 44px; height: 44px; }#modes .scale [data-faction] b { font-size: 18px; line-height: 24px; }#modes .scale small { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--muted); }
#modes .choices button:hover, #modes .scale button:hover { background: rgba(255,255,255,0.1); border-color: #86868b; }
#modes .choices button[aria-pressed=true], #modes .scale button[aria-pressed=true] { border-color: #3aa0ff; background: #1b2b3d; }#modes .scale button[aria-pressed=true] small { color: var(--fg); }
#modes .start { justify-self: end; min-width: 200px; padding: 14px 24px; background: var(--team); border: 0; border-radius: 6px; color: #fff; font: 600 17px/22px var(--font); cursor: pointer; }#modes .start:hover { background: #4fadff; }
#modes button:focus-visible { outline: 2px solid #4fadff; outline-offset: 2px; }
#modes .choices button:hover { background: rgba(255, 49, 49, 0.14); border-color: var(--accent); }

#result .frame { width: min(540px,calc(100vw - 32px)); padding: 28px; gap: 16px; justify-items: stretch; }
#result-text { text-align: center; font-size: 28px !important; }
#result-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 20px; text-align: center; }
#result-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }#result-metrics div { display: grid; gap: 8px; }#result-metrics small { font-size: 12px; color: var(--muted); }#result-metrics strong { font-size: 20px; line-height: 24px; font-variant-numeric: tabular-nums; }
#loading { flex-direction: column; gap: 16px; }
#pause-dialog { width: min(380px,calc(100vw - 32px)); padding: 28px; border: 1px solid var(--hairline); border-radius: 8px; background: #131316; color: var(--fg); }
#pause-dialog[open] { display: grid; gap: 20px; }#pause-dialog::backdrop { background: rgba(0,0,0,.7); }#pause-dialog h2 { font-size: 22px; margin: 0; }#pause-dialog button { padding: 12px; background: #d92626; border: 0; border-radius: 8px; color: white; font-size: 14px; cursor: pointer; }#pause-dialog label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; align-items: center; }#direct-volume { width: 100%; accent-color: #d92626; }#direct-speed { width: 100%; accent-color: #d92626; }#direct-speed-value { font-variant-numeric: tabular-nums; }#direct-exit { font-size: 13px; }
@media (max-height: 700px) { #console { height: 172px; }#card { width: 176px; grid-template-columns: repeat(3,48px); grid-template-rows: repeat(3,48px); gap: 5px; }.cmd { width: 48px; height: 48px; }.cmd img { width: 23px; height: 23px; }.cmd-name { font-size: 11px; line-height: 13px; }#minimap { width: 158px; }#minimap canvas { width: 140px; height: 140px; }#modes .frame { padding: 20px; gap: 12px; }#modes .choices button { height: 172px; }#coach { top: 158px; max-height: calc(100vh - 352px); } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; } }

.choices small, #coach p { word-break: keep-all; overflow-wrap: anywhere; }

/* 2026-09-12: 명령 이름·병력 상태를 위한 공간 재배분 */
#console { width: min(780px,calc(100vw - 24px)); height: 232px; bottom: 12px; }
#console:has(#minimap:not([hidden])) { width: min(968px,calc(100vw - 24px)); }
#portrait { width: 96px; }#portrait canvas { width: 78px; height: 112px; object-fit: contain; }
#card { width: 288px; grid-template-columns: repeat(3,84px); grid-template-rows: repeat(3,68px); gap: 6px; }
.cmd { width: 84px; height: 68px; padding: 5px 4px; justify-content: center; }
.cmd-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12px; line-height: 14px; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; text-overflow: clip; min-height: 28px; }
.cmd .key { font-size: 11px; }.cmd img { width: 25px; height: 25px; }
#info { padding: 12px; gap: 10px; }.selection-heading p { font-size: 12px; line-height: 18px; }
.unit-roster { display: grid; grid-template-columns: repeat(auto-fill,minmax(60px,1fr)); gap: 6px; }
.unit-health { position: relative; display: grid; justify-items: center; min-height: 58px; padding: 4px 2px 7px; border: 1px solid var(--hairline); border-radius: 6px; background: #1c1c1f; color: var(--fg); font-size: 11px; cursor: pointer; overflow: hidden; }
.unit-health img { width: 26px; height: 26px; }.roster-hp { width: 100%; height: 3px; background: #33333a; }.unit-health i { display: block; height: 3px; background: #7fc4ff; }.unit-health.hurt { border-color: #9d713f; }.unit-health.hurt i { background: #ffb86b; }
#attack-alert { position: absolute; top: 160px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid #ffb86b; border-radius: 8px; background: #131316; color: #ffd5a5; font-size: 13px; cursor: pointer; }
.attack-arrow { width: 20px; height: 20px; flex: none; }
#placement-hint { position: absolute; bottom: 256px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; color: #b7ddff; font-size: 13px; text-align: center; }
#placement-hint.blocked { color: #ffd5a5; border-color: #9d713f; }
#net-status { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); padding: 8px 14px; color: #ffd5a5; border-color: #9d713f; font-size: 13px; }
/* 1:1 로비 */
#modes .lobby { display: grid; gap: 12px; padding: 16px; background: #1c1c1f; border: 1px solid var(--hairline); border-radius: 6px; }
#modes .lobby .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#modes .lobby input { flex: 1; min-width: 160px; padding: 10px 12px; background: #0f1013; border: 1px solid var(--hairline); border-radius: 6px; color: var(--fg); font: 500 15px/20px var(--font); }
#modes .lobby button { padding: 10px 16px; background: #29292e; border: 1px solid var(--hairline); border-radius: 6px; color: var(--fg); font: 600 14px/18px var(--font); cursor: pointer; }
#modes .lobby button:hover { border-color: #86868b; }#modes .lobby button.primary { background: var(--team); border-color: transparent; color: #fff; }
#modes .row.end { display: flex; justify-content: flex-end; gap: 8px; }#modes .row.between { display: flex; justify-content: space-between; align-items: center; }
#modes .lobby label { min-width: 64px; font-size: 12px; font-weight: 600; color: var(--muted); }
#modes button.ghost { padding: 12px 18px; background: transparent; border: 1px solid var(--hairline); border-radius: 6px; color: var(--fg); font: 600 15px/20px var(--font); cursor: pointer; }#modes button.ghost:hover { border-color: #86868b; }
#modes .rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 280px; overflow: auto; }
#modes .rooms .empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
#modes .rooms button { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 12px; align-items: center; text-align: left; padding: 10px 14px; background: #0f1013; }
#modes .rooms .room-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }#modes .rooms .room-host, #modes .rooms .room-count { font-size: 12px; font-weight: 500; color: var(--muted); }
#modes .lobby.connecting { justify-items: center; }#modes .lobby.connecting canvas { width: min(420px, 100%); height: auto; image-rendering: auto; }
#modes .slots { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
#modes .slot { display: grid; gap: 10px; padding: 14px; background: #0f1013; border: 1px solid var(--hairline); border-radius: 6px; }#modes .slot.mine { border-color: #3aa0ff; }
#modes .slot small { font-size: 11px; font-weight: 600; color: var(--muted); }#modes .slot > b { font-size: 16px; line-height: 20px; }
#modes .slot.empty { justify-items: center; align-content: center; min-height: 160px; }#modes .slot.empty b { color: var(--muted); font-weight: 500; }
#modes .slot .faction { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 60px; padding: 8px; font-size: 15px; }#modes .slot .faction img { width: 30px; height: 30px; }
#modes .slot button[disabled] { opacity: .45; cursor: default; }
/* 대기실 유도: 지금 눌러야 하는 버튼(손님의 준비, 손님이 준비한 뒤 방장의 시작)은 파랗게 채우고 링이 퍼진다. 누르면 초록 '준비 완료' */
#modes .slot > button { min-height: 44px; font-size: 15px; }
#modes .slot button.cta { background: var(--team); border-color: transparent; color: #fff; animation: lobby-cta 1.6s ease-out infinite; }
#modes .slot button.cta:hover { background: #4fadff; }
#modes .slot button.done { background: #1f6b3a; border-color: transparent; color: #d6ffe4; }
@keyframes lobby-cta { 0% { box-shadow: 0 0 0 0 rgba(58,160,255,.75); } 70% { box-shadow: 0 0 0 12px rgba(58,160,255,0); } 100% { box-shadow: 0 0 0 0 rgba(58,160,255,0); } }
@media (prefers-reduced-motion: reduce) { #modes .slot button.cta { animation: none; box-shadow: 0 0 0 3px rgba(58,160,255,.45); } }
#modes .lobby .status { color: var(--muted); font-size: 13px; line-height: 20px; }#modes .lobby .status.err { color: #ffb4a8; }
@media (max-height:700px) { #console { height: 208px; }#card { width: 270px; grid-template-columns: repeat(3,78px); grid-template-rows: repeat(3,60px); }.cmd { width: 78px; height: 60px; }.cmd img { width: 20px; height: 20px; }.cmd-name { font-size: 12px; line-height: 14px; }#placement-hint { bottom: 232px; }#coach { max-height: calc(100vh - 392px); } }
/* 아이콘 배지가 두 줄 라벨 위로 내려오지 않도록 아이콘 영역에 고정 */
.cmd img.badge { top: 17px; right: calc(50% - 20px); bottom: auto; }

/* 건물 정보: 중복 장식 대신 현재 작업만 표시한다. */
#info.building-info { align-self: flex-end; max-height: 100%; padding: 16px; gap: 12px; }
#hud > #console { pointer-events: none; }
#console > .frame { pointer-events: auto; }
.building-heading > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.building-heading h2 { min-width: 0; }
.selection-count { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.selection-count { margin-left: 8px; }
@media (max-height:700px) { #info.building-info { padding: 12px; gap: 8px; } }

/* DESIGN.md §11 — a continuous RTS command deck, with a separate world viewport. */
:root { --hud-height: clamp(168px, 23vh, 208px); --toolbar-height: 44px; }
canvas#game { top: var(--toolbar-height); bottom: var(--hud-height); height: calc(100vh - var(--toolbar-height) - var(--hud-height)) !important; height: calc(100dvh - var(--toolbar-height) - var(--hud-height)) !important; }
#hud::before { content: ''; position: absolute; inset: 0 0 auto; height: var(--toolbar-height); background: #131316; border-bottom: 1px solid #34343a; }
#game-tools { top: 6px; left: 12px; gap: 6px; height: 32px; }
#game-tools button { padding: 4px 12px; border-radius: 6px; background: transparent; font-size: 12px; }
#top { top: 0; right: 16px; height: var(--toolbar-height); gap: 24px; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.res { gap: 6px; min-width: 76px; }.res-value { display: flex; align-items: center; gap: 8px; }.res b { font-size: 16px; line-height: 20px; }.res img { width: 24px; height: 24px; }
#hud > #console, #console:has(#minimap:not([hidden])) { left: 0; right: 0; bottom: 0; transform: none; width: 100%; height: var(--hud-height); display: grid; grid-template-columns: calc(var(--hud-height) - 2px) 116px minmax(0, 1fr) 272px; grid-template-rows: minmax(0,1fr); gap: 0; border-top: 2px solid #414148; background: #131316; pointer-events: auto; box-shadow: 0 -8px 24px #0003; }
#console > * { width: auto; min-width: 0; min-height: 0; height: 100%; margin: 0; border: 0; border-radius: 0; border-right: 1px solid #2a2a2e; background: transparent; box-shadow: none; }
#minimap { padding: 8px; display: flex; align-items: center; justify-content: center; }
#minimap canvas { width: calc(var(--hud-height) - 20px); height: calc(var(--hud-height) - 20px); border: 1px solid #414148; }
/* 상단 가운데: 맵 이름 · 플레이 시간 (2026-09-17 사용자) */
#top-mid { display: flex; align-items: center; gap: 10px; margin-left: 10px; padding: 0; background: none; border: 0; pointer-events: none; } /* 상단바에 빌트인 — 왼쪽 도구 버튼(마우스 잠금) 오른쪽에 이어서 (2026-09-17 사용자) */
#map-name { color: #c5c5cb; font-size: 13px; white-space: nowrap; }
#match-time { color: var(--fg); font: 600 14px/18px var(--font); font-variant-numeric: tabular-nums; }
#portrait { padding: 12px; gap: 0; background: linear-gradient(180deg,#1c1c1f,#131316); }
#portrait canvas { width: 96px; height: calc(var(--hud-height) - 58px); object-fit: contain; }
#portrait-label { padding-top: 4px; color: #c5c5cb; }
#hp { left: 14px; right: 14px; bottom: 12px; height: 4px; }
#portrait.enemy #hp i { background: #ff7474; }
#portrait.has-health-value { gap: 4px; justify-content: flex-end; }
#portrait.has-health-value canvas { flex: 1; min-height: 0; height: 0; }
#portrait.has-health-value #portrait-label { padding-top: 0; }
#portrait.has-health-value #hp { position: static; flex: none; width: 100%; }
#hp-value { flex: none; color: #c5c5cb; font-size: 12px; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#selection-panel { display: flex; flex-direction: column; }
#info, #info.building-info { flex: 1; align-self: stretch; min-height: 0; width: 100%; padding: 14px 20px; gap: 8px; border: 0; overflow: auto; }
.selection-heading h2 { font-size: 18px; line-height: 24px; }
#info .row { gap: 6px; }#info .chip { min-height: 30px; padding: 2px 6px; }
#command-panel { padding: 8px 12px; border-right: 0; }
#command-label { display: block; color: #86868b; font-size: 10px; line-height: 14px; margin-bottom: 4px; }
#card { padding: 0; width: 100%; height: calc(100% - 18px); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-rows: repeat(3,minmax(0,1fr)); gap: 4px; }
.cmd { width: 100%; height: 100%; min-height: 0; padding: 3px 2px 5px; align-content: center; border-radius: 4px; background: #1c1c1f; }
.cmd img { width: 22px; height: 22px; }.cmd img.flat { width: 18px; height: 18px; }
.cmd-name { display: block; font-size: 11px; line-height: 14px; min-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd .key { top: 2px; right: 4px; font-size: 9px; line-height: 10px; }
.cmd .cmd-level { font-size: 9px; line-height: 10px; }
.cmd img.badge { width: 10px; height: 10px; top: 12px; right: calc(50% - 18px); padding: 1px; }
.cmd[aria-disabled=true] .cmd-name { color: #96969d; }
.unit-roster { grid-template-columns: repeat(auto-fill,minmax(54px,1fr)); gap: 4px; }
.unit-health { min-height: 48px; font-size: 10px; }.unit-health img { width: 24px; height: 24px; }
.enemy-heading > span { color: #ff9999; font-size: 11px; }
.enemy-heading h2 { display: inline-block; margin-left: 10px; }
.enemy-state { margin: 0; color: #aaaab0; font-size: 12px; }.enemy-state.hit { color: #ff9999; }
.inspect-note { grid-column: 1/-1; align-self: center; color: #86868b; font-size: 12px; line-height: 20px; text-align: center; margin: 24px 12px; }
#attack-alert { top: 56px; padding: 8px 12px; font-size: 12px; }
#msg { top: 104px; }
#placement-hint { bottom: calc(var(--hud-height) + 12px); }
#coach { top: 54px; max-height: calc(100vh - var(--hud-height) - 70px); }
#result { background: #08090bcc; backdrop-filter: blur(6px); }
#result .frame { width: min(600px,calc(100vw - 48px)); padding: 8px 16px 12px; gap: 0; background: #131316; }
#result .fdivider { margin: 4px auto 14px; }#result .fdivider.bottom { margin: 18px auto 10px; }
#result-metrics { border-top: 0; border-bottom: 0; padding: 6px 0 14px; }
#result-context { margin: 0 0 16px; color: #aaaab0; font-size: 12px; line-height: 18px; }
#result #result-text { text-align: left; font-size: 48px !important; line-height: 1.1; letter-spacing: -1.5px; font-weight: 700; }
#result[data-outcome=win] #result-text { color: #f5f5f7; }
#result-hint { text-align: left; margin: 12px 0 28px; font-size: 14px; line-height: 22px; }#result-hint:empty { display: none; }#result #result-text { margin-bottom: 20px; }
#result-metrics { grid-template-columns: 1fr 1fr; padding: 22px 0; gap: 24px; }
#result-metrics div + div { border-left: 1px solid #2a2a2e; padding-left: 24px; }
#result-metrics strong { font-size: 28px; line-height: 34px; font-weight: 600; }
#result-cheats { margin: -8px 0 12px; font-size: 12px; line-height: 18px; color: #ff7a7a; }
/* 결과 화면 아이콘: 모드·승패·통계 행은 게임 모델, 버튼은 Lucide */
#result-context { display: flex; align-items: center; gap: 8px; }
#result-context img { width: 22px; height: 22px; }
#result-context i { font-style: normal; color: #5f6368; }
#result #result-text { display: flex; align-items: center; gap: 14px; }
#result #result-text img { width: 44px; height: 44px; }
#result .stat-icon { position: relative; display: inline-flex; flex: none; width: 28px; height: 28px; vertical-align: middle; }
#result .stat-icon img { width: 28px; height: 28px; }
#result .stat-icon img.badge { position: absolute; right: -5px; bottom: -5px; width: 14px; height: 14px; }
#result-metrics .with-icon { display: flex; align-items: center; gap: 12px; }
#result-metrics .with-icon .stat-icon { width: 40px; height: 40px; }
#result-metrics .with-icon .stat-icon img { width: 40px; height: 40px; }
#result-metrics .with-icon .stat-icon img.badge { width: 18px; height: 18px; }
#result-analysis th img { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
#result-analysis td:first-child { display: flex; align-items: center; gap: 10px; }
#result-analysis td:first-child small { font-size: 12px; color: #86868b; }
/* 결과 분석표(나 / 해골) · 기록 저장 상태 · 이미지 공유 */
#result-analysis { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
#result-analysis th { padding: 0 0 8px; text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .2px; color: #aaaab0; }
#result-analysis th:first-child { text-align: left; }
#result-analysis td { padding: 4px 0; border-top: 1px solid #2a2a2e; text-align: right; }
#result-analysis td:first-child { text-align: left; color: #aaaab0; }
#result-analysis td.me { color: #f5f5f7; font-weight: 600; }
#result-saved { margin: 0 0 14px; font-size: 12px; line-height: 18px; color: #aaaab0; }
#result-rate { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; margin: -6px 0 12px; font-size: 13px; color: #d8cfbb; } /* 별점 한 줄 (2026-09-16) */
#result-rate .stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; } /* row-reverse: 뒤 형제 선택자로 "이 별까지" 미리 채운다 */
#result-rate .stars button { width: 36px; height: 36px; padding: 6px; background: none; border: 0; border-radius: 6px; color: #d6b660; cursor: pointer; transition: transform .1s; }
#result-rate .stars button svg { width: 24px; height: 24px; }
#result-rate .stars button.on svg, #result-rate .stars button:hover svg, #result-rate .stars button:hover ~ button svg { fill: #d6b660; }
#result-rate .stars button:hover { transform: scale(1.12); }
#result-rate .stars button:disabled { cursor: default; transform: none; }
#result-rate .stars button:focus-visible { outline: 2px solid #4fadff; outline-offset: 1px; }
#result-note { display: block; min-height: 0; margin-top: 6px; font-size: 12px; color: #aaaab0; }#result-note:empty { display: none; }
@media (max-height: 760px) { .cmd img { width: 17px; height: 17px; }.cmd img.flat { width: 16px; height: 16px; }.cmd { padding-top: 1px; }.cmd-name { font-size: 10px; line-height: 12px; min-height: 12px; }#info,#info.building-info { padding: 10px 16px; }.selection-heading h2 { font-size: 16px; } }
#mana { width: 100%; height: 4px; flex: none; border-radius: 2px; background: #2a2a2e; overflow: hidden; }
#mana i { display: block; height: 100%; background: #3aa0ff; }
@media (max-width: 1100px) { #hud > #console, #console:has(#minimap:not([hidden])) { grid-template-columns: calc(var(--hud-height) - 2px) 96px minmax(0,1fr) 252px; }#portrait canvas { width: 78px; }#info,#info.building-info { padding-left: 12px; padding-right: 12px; }.res { min-width: 64px; }#top { gap: 16px; } }

/* DESIGN.md §12 — production is read through unit portraits and a compact queue. */
.building-activity { display: flex; align-items: center; gap: 16px; min-width: 0; flex: none; }
.production-strip { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.production-portrait { position: relative; width: 72px; height: 72px; flex: none; border: 1px solid #3b668b; border-radius: 6px; background: #1c232c; }
.production-portrait > img { display: block; width: 56px; height: 56px; margin: 1px auto 0; object-fit: contain; } /* 64 → 56: 유닛 렌더가 틀을 꽉 채워 발이 진행 막대·남은 시간 칩에 닿아 잘려 보였다 (2026-10-03 사용자) */
.production-time { position: absolute; right: 5px; bottom: 7px; padding: 1px 4px; border-radius: 3px; background: #131316e8; color: #f5f5f7; font-size: 11px; line-height: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.portrait-progress { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; background: #34343a; overflow: hidden; }
.portrait-progress i { display: block; height: 100%; background: var(--team); }
.portrait-cancel { position: absolute; top: 1px; right: 1px; display: grid; place-items: center; width: 24px; height: 24px; padding: 4px; border: 0; border-radius: 4px; background: #131316b8; color: #aaaab0; cursor: pointer; }
.portrait-cancel svg, .queue-remove svg { width: 12px; height: 12px; }
.portrait-cancel:hover { color: #f5f5f7; background: #34343a; }
.queue-direction { width: 16px; height: 16px; color: #86868b; flex: none; }
.production-queue { display: flex; align-items: center; gap: 6px; overflow-x: auto; min-width: 0; padding: 4px; scrollbar-width: thin; scrollbar-color: #414148 transparent; }
.queued-portrait { position: relative; width: 56px; height: 56px; flex: none; padding: 2px; display: grid; place-items: center; background: #1c1c1f; border: 1px solid #34343a; border-radius: 6px; cursor: pointer; }
.queued-portrait > img { width: 48px; height: 48px; object-fit: contain; opacity: .9; }
.queue-position { position: absolute; left: 3px; top: 2px; padding: 0 3px; border-radius: 3px; background: #131316cc; font-size: 10px; line-height: 14px; font-variant-numeric: tabular-nums; color: #aaaab0; }
.queue-remove { position: absolute; top: 3px; right: 3px; display: flex; color: #86868b; }
.queued-portrait:hover { border-color: #86868b; background: #29292e; }.queued-portrait:hover > img { opacity: 1; }.queued-portrait:hover .queue-remove { color: #f5f5f7; }

.production-portrait.blocked { border-color: #9d713f; }.production-portrait.blocked .production-time { color: #ffd5a5; font-size: 10px; }.production-portrait.blocked .portrait-progress i { background: #ffb86b; }
/* 낮은 화면에서는 생산 줄이 선택 정보 패널의 아래 여백을 넘어 바닥에 딱 붙어 잘려 보였다 — 단계를 하나 더 두고 더 줄인다 (2026-10-03 사용자) */
@media (max-height:900px) { .production-portrait { width: 60px; height: 60px; }.production-portrait > img { width: 46px; height: 46px; }.queued-portrait { width: 48px; height: 48px; }.queued-portrait > img { width: 38px; height: 38px; }.building-activity { gap: 12px; }.production-strip { gap: 6px; } }
@media (max-height:780px) { .production-portrait { width: 50px; height: 50px; }.production-portrait > img { width: 38px; height: 38px; }.queued-portrait { width: 40px; height: 40px; }.queued-portrait > img { width: 32px; height: 32px; }.building-activity { gap: 10px; }.production-strip { gap: 4px; }.production-time { font-size: 10px; padding: 0 3px; } }

/* The OS pointer stays locked; this cursor covers both the world and command deck. */
.pointer-locked, .pointer-locked * { cursor: none !important; }
#game-cursor { position: fixed; width: 24px; height: 24px; z-index: 10000; pointer-events: none; transform: translate(-2px, -2px); filter: drop-shadow(0 1px 2px #000); }
#game-cursor[hidden] { display: none; }
#game-cursor .cursor-arrow { fill: #fff; stroke: #0b0e12; stroke-width: 1.5; stroke-linejoin: round; }
#game-cursor.over-control .cursor-arrow { fill: #8dd5ff; }
/* 모드 커서(공격·잡아먹기·수리·집결·채집): 잠금 중엔 .cursor-mode 그룹, 잠금 아닐 땐 캔버스 CSS 커서 (cursors.js) */
#game-cursor .cursor-mode { display: none; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; paint-order: stroke; }
#game-cursor[data-mode] { transform: translate(-12px, -12px); width: 28px; height: 28px; }
#game-cursor[data-mode] .cursor-arrow { display: none; }
#game-cursor[data-mode] .cursor-mode { display: block; }
.pointer-locked button.pointer-hover { border-color: #86868b; background: #29292e; }
#pointer-lock-btn[aria-pressed="true"] { color: #8dd5ff; border-color: #36596b; }
/* 결과 패널 (2026-09-15): 화면보다 길면 패널 안이 아니라 오버레이가 스크롤되고, 짧으면 가운데. 낮은 해상도(≤860px)는 촘촘하게 */
#result { align-items: center; overflow: hidden; padding: 12px; } /* 스크롤 대신 축소(ui.fitResult zoom) — 2026-09-17 사용자 */
#result .frame { margin: auto; }
@media (max-height: 860px) {
  #result .frame { padding: 4px 14px 8px; border-width: 24px; border-image-width: 24px; }
  #result-context { margin: 0 0 6px; }
  #result #result-text { font-size: 34px !important; gap: 10px; }
  #result #result-text img { width: 32px; height: 32px; }
  #result-hint { margin: 4px 0 12px; font-size: 13px; line-height: 18px; }
  #result .fdivider { height: 24px; background-size: 245px 24px; margin: 0 auto 6px; }#result .fdivider.bottom { margin: 8px auto 4px; }
  #result-metrics { padding: 8px 0; gap: 16px; }#result-metrics div { gap: 4px; }#result-metrics div + div { padding-left: 16px; }
  #result-metrics strong { font-size: 22px; line-height: 26px; }
  #result-metrics .with-icon .stat-icon, #result-metrics .with-icon .stat-icon img { width: 30px; height: 30px; }
  #result-analysis { margin: 0 0 6px; font-size: 12px; line-height: 16px; }
  #result-analysis th { padding: 0 0 4px; }#result-analysis td { padding: 1px 0; }#result-analysis td:first-child { gap: 8px; }
  #result .stat-icon, #result .stat-icon img { width: 20px; height: 20px; }#result .stat-icon img.badge { width: 11px; height: 11px; right: -4px; bottom: -4px; }
  #result-saved { margin: 0 0 6px; }
  #result .result-actions button { height: 40px; }
    #finale .finale-card { padding: 12px 40px 12px; gap: 8px; }#finale img { width: 88px; height: 88px; }#finale b { font-size: 52px; line-height: 58px; letter-spacing: 7px; }#finale button { margin-top: 4px; padding: 10px 22px; font-size: 16px; }
}
@media (max-height: 700px) { /* 창모드 낮은 화면: 장식 구분선을 빼고 더 촘촘히 */
  #result .fdivider { display: none; }
  #result-hint { margin: 2px 0 8px; }
  #result-metrics { padding: 6px 0 8px; border-top: 1px solid #2a2a2e; border-bottom: 1px solid #2a2a2e; }#result-metrics strong { font-size: 20px; line-height: 24px; }
  #result-analysis { font-size: 11px; line-height: 14px; margin: 6px 0 4px; }#result-analysis td { padding: 0; }#result .stat-icon, #result .stat-icon img { width: 18px; height: 18px; }
  #result-saved { margin: 0 0 6px; }
}
/* 결과 화면 동작 줄 (2026-09-15): 새 게임·나가기는 폭에 비례해 늘어나고, 나머지는 1:1 아이콘 버튼 + 호버 설명 */
#result .result-actions { display: flex; gap: 8px; align-items: stretch; }
#result .result-actions button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; background: #1c1c1f; border: 1px solid #414148; border-radius: 6px; color: var(--fg); font: 600 13px/18px var(--font); cursor: pointer; }
#result .result-actions button svg { width: 18px; height: 18px; flex: none; }
#result .result-actions button:hover { border-color: #86868b; }
#result .result-actions .wide { flex: 1 1 0; min-width: 0; }#result #result-new { flex: 2 1 0; background: #d92626; border-color: #d92626; }#result #result-new:hover { background: #b92020; }
#result .result-actions .quiet { background: transparent; border-color: #414148; color: #aaaab0; }
#result .result-actions .sq { flex: 0 0 auto; aspect-ratio: 1; padding: 0; }
#result .result-actions .sq::after { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 6px 10px; background: #0f1013; border: 1px solid #414148; border-radius: 6px; color: var(--fg); font: 500 12px/16px var(--font); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 120ms ease-out; z-index: 2; }
#result .result-actions .sq:hover::after, #result .result-actions .sq:focus-visible::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #result .result-actions .sq::after { transition: none; } }
/* 물 저주 (2026-09-15): 자원 띠에 남은 시간 */
.node-peek em { font-style: normal; font-size: 12px; color: #ff9a6a; margin-left: 8px; font-variant-numeric: tabular-nums; }
.node-peek.cursed { border-color: rgba(255, 154, 106, 0.55); }

/* ── 시작 화면 · 대기실을 프레임과 한 세트로 (Kenney Fantasy UI Borders, 2026-09-15 디자이너의 손) ──
   색 셋: 금 #e9c46a (선택·시작) · 상아 #d8cfbb (테두리·라벨) · 짙은 갈색 #151210 (판). 파랑은 팀 색에만 남긴다 */
#modes .frame { position: relative; background: rgba(21, 18, 16, 0.9); padding: 10px 26px 18px; gap: 22px; }
#modes .frame::before { content: ''; position: absolute; inset: -6px; border: 16px solid transparent; border-image: url('ui/borders/inner-ivory.png') 16 / 16px round; image-rendering: pixelated; pointer-events: none; opacity: 0.6; }
#modes h1 { font: 400 28px/36px 'Kenney Future', var(--font); letter-spacing: 1px; color: #f3ead6; padding-bottom: 12px; background: url('ui/borders/label-ivory.png') left bottom / 192px 20px no-repeat; image-rendering: pixelated; }
#modes .pick { gap: 8px; margin-top: 4px; }
#modes .pick > span { display: flex; align-items: center; gap: 10px; font: 400 13px/18px 'Kenney Future', var(--font); letter-spacing: 1px; color: rgba(216, 207, 187, 0.8); }
#modes .pick > span::after { content: ''; flex: 0 0 120px; height: 20px; background: url('ui/borders/label-ivory.png') left center / 192px 20px no-repeat; image-rendering: pixelated; }
#modes .scale { gap: 10px; }
#modes .scale.levels { gap: 6px; }#modes .scale.levels button { min-height: 44px; padding: 6px 0; }#modes .scale.levels b { font-size: 15px; line-height: 20px; } /* 난이도 1~10 한 줄 (2026-09-16) */
#modes .scale button { min-height: 64px; padding: 6px 8px; gap: 2px; background: none; border: 16px solid transparent; border-image: url('ui/borders/btn-ivory.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; color: #efe7d5; transition: filter .12s; }
#modes .scale button:hover { background: none; border-color: transparent; filter: brightness(1.25); }
#modes .scale button[aria-pressed=true] { background: none; border-color: transparent; border-image-source: url('ui/borders/btn-gold.png'); color: #fff; filter: none; }
#modes .scale [data-difficulty] b, #modes .scale [data-map-size] b { font: 400 22px/26px 'Kenney Future', var(--font); }
#modes .scale [data-difficulty][aria-pressed=true] b, #modes .scale [data-map-size][aria-pressed=true] b { color: #e9c46a; }
#modes .scale small { color: rgba(216, 207, 187, 0.7); }#modes .scale button[aria-pressed=true] small { color: #efe7d5; }
#modes .scale [data-faction], #modes .scale [data-my-faction] { min-height: 132px; border-image-source: url('ui/borders/card-ivory.png'); }
#modes .scale [data-faction][aria-pressed=true], #modes .scale [data-my-faction][aria-pressed=true] { border-image-source: url('ui/borders/card-gold.png'); }
#modes .scale [data-faction] img, #modes .scale [data-my-faction] img { width: 56px; height: 56px; padding: 6px; border-radius: 50%; background: radial-gradient(circle, rgba(58, 160, 255, 0.35), rgba(58, 160, 255, 0) 70%); }
#modes .scale [data-faction="skeleton"] img, #modes .scale [data-my-faction="skeleton"] img { background: radial-gradient(circle, rgba(125, 255, 176, 0.3), rgba(125, 255, 176, 0) 70%); }
#modes .scale [data-faction] b, #modes .scale [data-my-faction] b { font: 400 17px/24px 'Kenney Future', var(--font); letter-spacing: 1px; }
#modes .start, #modes .lobby button.primary { min-width: 200px; padding: 8px 16px; background: none; border: 16px solid transparent; border-image: url('ui/borders/fill-gold.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; color: #1a1408; font: 400 17px/24px 'Kenney Future', var(--font); letter-spacing: 1px; }
#modes .start:hover, #modes .lobby button.primary:hover { background: none; border-image-source: url('ui/borders/fill-ivory.png'); border-color: transparent; }
#modes .lobby button.primary { min-width: 0; padding: 4px 10px; font-size: 14px; line-height: 20px; }
#modes button.ghost { background: none; border: 0; padding: 12px 14px; color: rgba(216, 207, 187, 0.7); font: 400 15px/20px 'Kenney Future', var(--font); letter-spacing: 1px; }#modes button.ghost:hover { color: #fff; border: 0; }
#modes button:focus-visible { outline: 2px solid #e9c46a; outline-offset: 2px; }
/* 멀티플레이: 방 목록 · 방 만들기 · 대기실 — 같은 세트 (마크업은 setup.js 그대로, CSS 만) */
#modes .lobby { background: none; border: 16px solid transparent; border-image: url('ui/borders/btn-ivory.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; padding: 6px 10px 10px; gap: 12px; }
#modes .lobby > .row.between > b { font: 400 15px/22px 'Kenney Future', var(--font); letter-spacing: 1px; color: rgba(216, 207, 187, 0.9); }
#modes .lobby input { background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(216, 207, 187, 0.35); border-radius: 0; color: #efe7d5; }#modes .lobby input:focus { outline: 0; border-color: #e9c46a; }
#modes .lobby button { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(216, 207, 187, 0.35); border-radius: 0; color: #efe7d5; }#modes .lobby button:hover { border-color: #e9c46a; }
#modes .lobby label { color: rgba(216, 207, 187, 0.7); }
#modes .rooms button { background: rgba(0, 0, 0, 0.3); }#modes .rooms .room-host, #modes .rooms .room-count { color: rgba(216, 207, 187, 0.6); }
#modes .status { color: rgba(216, 207, 187, 0.8); }#modes .status.err { color: #ff8a80; }
#modes .slot { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(216, 207, 187, 0.3); border-radius: 0; }#modes .slot.mine { border-color: #e9c46a; }
#modes .slot small { color: rgba(216, 207, 187, 0.7); }#modes .slot .faction { color: #efe7d5; }
#modes .choices button { background: none; border: 16px solid transparent; border-image: url('ui/borders/card-ivory.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; padding: 14px 16px; color: #efe7d5; transition: filter .12s; }
#modes .choices button:hover { background: none; border-color: transparent; border-image-source: url('ui/borders/card-gold.png'); filter: none; }
#modes .choices strong { font: 400 20px/28px 'Kenney Future', var(--font); letter-spacing: 1px; }
#modes .pick > span::after { flex-basis: 96px; opacity: 0.55; }
#modes h1 { background-size: 160px 20px; }
/* 종족 카드: [초상화 | 이름] 가로 배치, 초상화 뒤 오로라 진하게 (2026-09-15 사용자) */
#modes .scale [data-faction], #modes .scale [data-my-faction] { flex-direction: row; justify-content: center; gap: 22px; min-height: 124px; padding: 8px 12px; }
#modes .scale [data-faction] img, #modes .scale [data-my-faction] img { width: 96px; height: 96px; padding: 10px; border-radius: 50%; background: radial-gradient(circle, rgba(90, 180, 255, 0.85) 0%, rgba(58, 160, 255, 0.55) 35%, rgba(58, 160, 255, 0.18) 58%, rgba(58, 160, 255, 0) 72%); filter: drop-shadow(0 0 14px rgba(58, 160, 255, 0.55)); }
#modes .scale [data-faction="skeleton"] img, #modes .scale [data-my-faction="skeleton"] img { background: radial-gradient(circle, rgba(140, 255, 190, 0.8) 0%, rgba(125, 255, 176, 0.5) 35%, rgba(125, 255, 176, 0.16) 58%, rgba(125, 255, 176, 0) 72%); filter: drop-shadow(0 0 14px rgba(125, 255, 176, 0.5)); }
#modes .scale [data-faction] b, #modes .scale [data-my-faction] b { font-size: 26px; line-height: 32px; }
/* 종족 선택 연출 (2026-09-15 사용자: 더 드라마틱하게): 고르는 순간 초상화가 튀어 오르고 오로라가 번쩍이며 링이 퍼진다 */
@keyframes pick-pop { 0% { transform: scale(0.9); filter: brightness(1) } 35% { transform: scale(1.32); filter: brightness(2) } 60% { transform: scale(0.96); filter: brightness(1.3) } 100% { transform: scale(1); filter: brightness(1) } }
@keyframes pick-flash { 0% { box-shadow: inset 0 0 0 0 rgba(233, 196, 106, 0), 0 0 0 rgba(233, 196, 106, 0) } 25% { box-shadow: inset 0 0 60px 10px rgba(233, 196, 106, 0.35), 0 0 40px 6px rgba(233, 196, 106, 0.6) } 100% { box-shadow: inset 0 0 0 0 rgba(233, 196, 106, 0), 0 0 0 rgba(233, 196, 106, 0) } }
#modes .scale [data-faction], #modes .scale [data-my-faction] { position: relative; overflow: visible; }
#modes .scale [data-faction][aria-pressed=true], #modes .scale [data-my-faction][aria-pressed=true] { animation: pick-flash 0.9s ease-out; }
#modes .scale [data-faction][aria-pressed=true] img, #modes .scale [data-my-faction][aria-pressed=true] img { animation: pick-pop 0.6s cubic-bezier(.2,1.4,.4,1); }
/* 대기실 (2026-09-15 재구성): 싱글 화면과 같은 판. 위 줄 방장 · 아래 줄 도전자, 상대 줄은 눌리지 않는 카드 */
#modes .pick > span .who { font: 700 15px/18px var(--font); letter-spacing: 0; color: #f3ead6; }
#modes .pick > span .ready-tag { font: 600 12px/18px var(--font); letter-spacing: 0; padding: 0 8px; border: 1px solid rgba(216, 207, 187, 0.4); color: rgba(216, 207, 187, 0.7); }
#modes .pick > span .ready-tag.on { border-color: #e9c46a; color: #e9c46a; }
#modes .scale [data-their-faction] { flex-direction: row; justify-content: center; gap: 22px; min-height: 100px; padding: 8px 12px; border-image-source: url('ui/borders/card-ivory.png'); cursor: default; opacity: 0.8; }
#modes .scale [data-their-faction][aria-pressed=true] { border-image-source: url('ui/borders/card-gold.png'); opacity: 1; }
#modes .scale [data-their-faction]:hover { filter: none; }
#modes .scale [data-their-faction] img { width: 76px; height: 76px; padding: 8px; border-radius: 50%; background: radial-gradient(circle, rgba(90, 180, 255, 0.85) 0%, rgba(58, 160, 255, 0.55) 35%, rgba(58, 160, 255, 0.18) 58%, rgba(58, 160, 255, 0) 72%); filter: drop-shadow(0 0 14px rgba(58, 160, 255, 0.55)); }
#modes .scale [data-their-faction="skeleton"] img { background: radial-gradient(circle, rgba(140, 255, 190, 0.8) 0%, rgba(125, 255, 176, 0.5) 35%, rgba(125, 255, 176, 0.16) 58%, rgba(125, 255, 176, 0) 72%); filter: drop-shadow(0 0 14px rgba(125, 255, 176, 0.5)); }
#modes .scale [data-their-faction] b { font: 400 22px/28px 'Kenney Future', var(--font); letter-spacing: 1px; }
#modes .scale [data-my-faction] { min-height: 100px; }#modes .scale [data-my-faction] img { width: 76px; height: 76px; }#modes .scale [data-my-faction] b { font-size: 22px; line-height: 28px; }
#modes .scale [data-my-faction][disabled] { opacity: 0.8; cursor: default; }#modes .scale [data-my-faction][disabled]:hover { filter: none; }
#modes .scale .waiting { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 100px; border: 1px dashed rgba(216, 207, 187, 0.35); color: rgba(216, 207, 187, 0.6); font: 500 15px/20px var(--font); }
#modes .scale [data-room-map][disabled] { cursor: default; opacity: 0.85; }#modes .scale [data-room-map][disabled]:hover { filter: none; }
#modes .start[disabled] { opacity: 0.4; cursor: default; }#modes .start[disabled]:hover { border-image-source: url('ui/borders/fill-gold.png'); }
#modes .start.done { border-image-source: url('ui/borders/fill-ivory.png'); }
#modes .status:empty { display: none; }#modes .status { margin: -8px 0 0; text-align: right; font-size: 13px; }
@media (max-height: 760px) { #modes .scale [data-faction], #modes .scale [data-my-faction], #modes .scale [data-their-faction], #modes .scale .waiting { min-height: 84px; } #modes .scale [data-faction] img, #modes .scale [data-my-faction] img, #modes .scale [data-their-faction] img { width: 64px; height: 64px; } #modes .frame { gap: 14px; } }
/* 종족 카드 = 살아 있는 유닛 줄 (2026-09-15 사용자): 글자·초상화·번쩍임 없이, 넓은 오로라 위에 유닛들이 서 있고 고르면 오로라가 커지며 유닛이 동작한다 */
#modes .scale [data-faction], #modes .scale [data-my-faction], #modes .scale [data-their-faction] { display: block; position: relative; overflow: hidden; min-height: 0; padding: 0; gap: 0; animation: none; }
#modes .scale [data-faction]::before, #modes .scale [data-my-faction]::before, #modes .scale [data-their-faction]::before { content: ''; position: absolute; left: -10%; right: -10%; top: -30%; bottom: -30%; background: radial-gradient(ellipse at 50% 62%, rgba(90, 180, 255, 0.55) 0%, rgba(58, 160, 255, 0.3) 38%, rgba(58, 160, 255, 0.08) 62%, rgba(58, 160, 255, 0) 78%); transform: scale(0.85); opacity: 0.55; transition: transform 0.55s ease-out, opacity 0.55s ease-out; pointer-events: none; }
#modes .scale [data-faction="skeleton"]::before, #modes .scale [data-my-faction="skeleton"]::before, #modes .scale [data-their-faction="skeleton"]::before { background: radial-gradient(ellipse at 50% 62%, rgba(140, 255, 190, 0.5) 0%, rgba(125, 255, 176, 0.27) 38%, rgba(125, 255, 176, 0.07) 62%, rgba(125, 255, 176, 0) 78%); }
#modes .scale [aria-pressed=true]::before { transform: scale(1.3); opacity: 1; }
#modes .scale canvas.lineup { display: block; position: relative; z-index: 1; width: 100%; height: 112px; }
#modes .scale [data-faction] img, #modes .scale [data-my-faction] img, #modes .scale [data-their-faction] img, #modes .scale [data-faction] b, #modes .scale [data-my-faction] b, #modes .scale [data-their-faction] b { display: none; }
#modes .scale [data-faction][aria-pressed=true], #modes .scale [data-my-faction][aria-pressed=true], #modes .scale [data-their-faction][aria-pressed=true] { animation: none; }
#modes .scale [data-their-faction] { opacity: 0.85; }#modes .scale [data-their-faction][aria-pressed=true] { opacity: 1; }
@media (max-height: 760px) { #modes .scale canvas.lineup { height: 84px; } }

/* 대기실 카드 (2026-09-15 재구성 2): 왼쪽 방장 · 오른쪽 도전자, 싱글 카드와 같은 모양. 내 카드는 누르면 종족이 바뀐다 */
#modes .scale [data-cycle-faction] { display: block; position: relative; overflow: hidden; min-height: 0; padding: 0; background: none; border: 16px solid transparent; border-image: url('ui/borders/card-gold.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; cursor: pointer; }
#modes .scale [data-cycle-faction][disabled] { cursor: default; opacity: 0.85; border-image-source: url('ui/borders/card-ivory.png'); }
#modes .scale [data-cycle-faction]:hover:not([disabled]) { filter: brightness(1.15); }
#modes .scale [data-cycle-faction]::before { content: ''; position: absolute; left: -10%; right: -10%; top: -30%; bottom: -30%; background: radial-gradient(ellipse at 50% 62%, rgba(90, 180, 255, 0.55) 0%, rgba(58, 160, 255, 0.3) 38%, rgba(58, 160, 255, 0.08) 62%, rgba(58, 160, 255, 0) 78%); transform: scale(1.3); pointer-events: none; }
#modes .scale [data-cycle-faction][data-faction="skeleton"]::before { background: radial-gradient(ellipse at 50% 62%, rgba(140, 255, 190, 0.5) 0%, rgba(125, 255, 176, 0.27) 38%, rgba(125, 255, 176, 0.07) 62%, rgba(125, 255, 176, 0) 78%); }
#modes .scale .cap { position: absolute; left: 8px; top: 6px; z-index: 2; font: 400 12px/16px 'Kenney Future', var(--font); letter-spacing: 1px; color: rgba(243, 234, 214, 0.9); text-shadow: 0 1px 2px #000; pointer-events: none; }
#modes .scale .waiting-card { position: relative; display: flex; align-items: center; justify-content: center; min-height: 144px; border: 16px solid transparent; border-image: url('ui/borders/card-ivory.png') 16 fill / 16px round; image-rendering: pixelated; opacity: 0.7; color: rgba(216, 207, 187, 0.7); font: 500 15px/20px var(--font); }
#modes .scale .waiting-card .cap { color: rgba(216, 207, 187, 0.7); }

/* 맵 크기 버튼: 육각 조각 + 가로 × 세로 (2026-09-15) */
#modes .scale [data-map-size], #modes .scale [data-room-map] { gap: 0; padding: 4px 8px 6px; }
#modes .scale svg.hexes { width: 96px; height: 52px; display: block; }#modes .scale svg.hexes polygon { fill: rgba(216, 207, 187, 0.18); stroke: rgba(216, 207, 187, 0.85); stroke-width: 1.6; stroke-linejoin: round; }
#modes .scale [aria-pressed=true] svg.hexes polygon { fill: rgba(233, 196, 106, 0.35); stroke: #e9c46a; }
#modes .scale [data-map-size] small, #modes .scale [data-room-map] small { font: 400 14px/18px 'Kenney Future', var(--font); letter-spacing: 1px; }
#modes .scale [data-map-size] small i, #modes .scale [data-room-map] small i { font: 500 13px/18px var(--font); font-style: normal; margin: 0 6px; color: rgba(216, 207, 187, 0.7); }
#modes .scale svg.hexes { height: 60px; }
/* 높이 통일 (2026-09-15 사용자): 난이도 · 맵 크기 · 시작(준비) 버튼 = 같은 높이 64px, 종족 카드는 더 높게 */
#modes .scale button, #modes .start, #modes .lobby button.primary { height: 64px; min-height: 0; box-sizing: border-box; }
#modes .scale [data-difficulty], #modes .scale [data-map-size], #modes .scale [data-room-map] { padding: 0 8px; justify-content: center; }
#modes .scale [data-difficulty] { height: auto; aspect-ratio: 1 / 1; } /* 난이도 칸은 정사각 (2026-09-16 사용자): 폭이 열 너비를 따르고 높이가 폭을 따른다 */
#modes .scale [data-difficulty] b { font-size: 20px; line-height: 24px; }
#modes .scale svg.hexes { width: 72px; height: 34px; }
#modes .start, #modes .lobby button.primary { padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; }
#modes .scale [data-faction], #modes .scale [data-my-faction], #modes .scale [data-their-faction], #modes .scale [data-cycle-faction], #modes .scale .waiting-card { height: auto; min-height: 0; }
#modes .scale canvas.lineup { height: 140px; }#modes .scale .waiting-card { min-height: 172px; }
@media (max-height: 760px) { #modes .scale canvas.lineup { height: 100px; } #modes .scale .waiting-card { min-height: 132px; } }
#modes .scale canvas.lineup { height: auto; max-height: 104px; aspect-ratio: 352 / 136; object-fit: contain; } /* 캔버스 비율 그대로 (늘어나지 않게). 높이는 어느 화면이든 104 — 화면 높이에 따라 달라지지 않게 (2026-09-16 사용자: 모든 PC 에서 같은 조건) */
/* 주 버튼 크기 통일 (2026-09-15): 게임 시작 · 방 만들기 · 준비 · 시작 = 같은 폭·높이, 항상 프레임 아래 줄에서 뒤로/나가기 옆 */
#modes .start { width: 200px; min-width: 200px; height: 64px; font-size: 17px; }
#modes .row.end { align-items: center; gap: 12px; }
#modes .lobby button.primary { height: 40px; min-width: 0; padding: 0 14px; font-size: 14px; } /* 목록 안 작은 버튼(입장 등)만 작게 */
/* 라벨·제목 옆 구분선 장식 제거 (2026-09-15 사용자) */
#modes .pick > span::after { display: none; }
#modes h1 { background: none; padding-bottom: 0; }

/* 상단바 일꾼 현황 (2026-09-15): 자원 칸 안에 캐는 일꾼 수, 건설·대기는 칩. 하단 병력 현황은 종류별 한 줄 */
.res-workers { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; padding: 2px 6px; border: 1px solid transparent; border-radius: 6px; background: rgba(255,255,255,.06); color: #c5c5cb; font: 600 12px/16px var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.res .res-value small { display: none; } /* [자원 그림][자원량]/[일꾼 수], 글자 없음, 간격 최소 (2026-09-17 사용자) */
.res { gap: 4px; min-width: 0; } .res .res-value { gap: 0; }
.res .res-workers { margin: 0; padding: 2px 2px 2px 0; background: none; border: 0; gap: 0; color: #a2a2a8; font: 600 15px/20px var(--font); }
.res .res-workers i { font-style: normal; color: #5f6368; margin-right: 1px; } .res .res-workers b { font: inherit; color: inherit; }
.res .res-workers:not(:disabled):hover b { color: var(--fg); } .res .res-workers:disabled { opacity: .7; }
#top .res + .res { margin-left: 6px; }
.res-workers img { width: 18px; height: 18px; object-fit: contain; pointer-events: none; }
.res-workers.chip img { width: 22px; height: 22px; }
.res-workers.chip { position: relative; } .res-workers.chip img.badge { position: absolute; left: 16px; bottom: 2px; width: 11px; height: 11px; padding: 1px; border-radius: 3px; background: #33333a; }
.res-workers.total { color: var(--fg); background: rgba(255,255,255,.1); } /* 총 일꾼 (2026-09-17) */
.res-workers.total small { font: 600 11px/14px var(--font); color: var(--muted); margin-right: 1px; }
.res-workers:disabled { opacity: .45; cursor: default; }
.res-workers:not(:disabled):hover { border-color: #86868b; color: var(--fg); }
#workers { display: inline-flex; gap: 6px; align-items: center; }
#army { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 4px; padding: 5px 12px; border-top: 1px solid #2a2a2e; overflow: hidden; }
#army button { flex: 0 1 auto; min-width: 0; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center; justify-content: start; column-gap: 4px; padding: 2px; /* 카드는 내용만큼 — 늘어난 폭이 전부 좌우 빈칸이었다. 좌우 여백 = 위 여백 (2026-10-04 사용자) */ border: 1px solid transparent; border-radius: 4px; background: #1c1c1f; color: var(--fg); cursor: pointer; }
#army button:hover { border-color: #86868b; }
#army button > img { grid-row: 1 / 3; width: clamp(28px, 2.6vw, 38px); height: clamp(28px, 2.6vw, 38px); object-fit: contain; pointer-events: none; } /* 26 → 최대 38: 유닛 얼굴이 알아볼 만큼. 종류가 7 개까지 늘면 좁은 화면에서 줄이 잘려 폭에 따라 줄인다 (2026-10-03 사용자) */
#army button > b { font-size: 15px; line-height: 18px; font-variant-numeric: tabular-nums; text-align: left; }
#army .states { display: flex; gap: 4px; font-size: 11px; line-height: 13px; color: #aaaab0; font-variant-numeric: tabular-nums; }
#army .states i { display: inline-flex; align-items: center; gap: 1px; font-style: normal; }
#army .states i.zero { opacity: .35; }
#army .states img { width: 12px; height: 12px; object-fit: contain; image-rendering: pixelated; }
.army-empty { color: var(--muted); font-size: 12px; line-height: 22px; } /* 빈 줄은 아이콘 높이를 따라갈 필요가 없다 — 42 로 두니 선택 정보 패널을 눌러 생산 카드가 잘렸다 (2026-10-03 사용자) */

/* 패시브 기술 카드 (2026-09-15): 누를 수 없는 설명 카드 — 은은한 금색 테두리 + P 표시 */
.cmd.passive { cursor: default; border-color: rgba(214, 182, 96, .55); background: radial-gradient(circle at 50% 40%, rgba(214, 182, 96, .16), rgba(255,255,255,.03) 70%); }
.cmd.passive .passive-tag { color: #d6b660; }

/* 1:1 채팅 (2026-09-15): 콘솔 바로 위 가운데. 5줄(20px)이 보이고 지난 글은 스크롤. 이름은 팀 색, 내 글은 오른쪽 금색 실선 */
#chat { position: absolute; left: 50%; bottom: calc(var(--hud-height, 168px) + 10px); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 6px 10px; display: grid; gap: 6px; background: rgba(12, 13, 16, 0.86); backdrop-filter: blur(8px); border-color: rgba(214, 182, 96, .35); pointer-events: none; }
#chat[hidden] { display: none; }
#chat.open { pointer-events: auto; }
#chat-log { list-style: none; margin: 0; padding: 2px 4px; max-height: 100px; overflow-y: auto; display: grid; gap: 0; font-size: 13px; line-height: 20px; scrollbar-width: thin; scrollbar-color: rgba(214,182,96,.4) transparent; }
#chat-log li { display: flex; gap: 8px; align-items: baseline; padding: 0 6px; border-left: 2px solid transparent; }
#chat-log li.mine { border-left-color: rgba(214, 182, 96, .7); }
#chat-log li.system { border-left-color: #7ec8ff; } #chat-log li.system b { color: #7ec8ff; } /* 게임 알림 (업그레이드 완료 등) */
#chat-log li b { flex: none; font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat-log li span { color: var(--fg); overflow-wrap: anywhere; }
#chat-input { width: 100%; box-sizing: border-box; padding: 8px 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(214, 182, 96, .45); border-radius: 6px; color: var(--fg); font: 500 14px/20px var(--font); outline: none; }
#chat-input:focus { border-color: #d6b660; box-shadow: 0 0 0 2px rgba(214, 182, 96, .2); }
#chat-input[hidden] { display: none; }
#chat-input::placeholder { color: rgba(216, 207, 187, .45); }


/* 명령 버튼 배치 v2 (2026-09-17 사용자): 필요 자원 = 오른쪽 위(우측 정렬) · 단축키 = 왼쪽 아래(위아래 여백, 세로 가운데) · 메인 이미지 = 정중앙, 보조 배지는 이미지 한가운데 · 게이지 = 바닥. 파일 끝에 두어 앞의 규칙을 이긴다 */
.cmd .key { left: auto; right: 4px; top: auto; bottom: 2px; padding: 2px 0; line-height: 12px; } /* 단축키 = 박스 우측 하단 고정 (사용자 확정) */
.cmd[data-action="upgrade"] .key { bottom: 10px; }
.cmd .cmd-cost { left: auto; right: 4px; top: 3px; }
.cmd .cmd-cost.wide { left: 4px; right: 4px; justify-content: flex-end; }
.cmd[data-action="upgrade"] .cmd-meter { left: 5px; right: 16px; } /* 오른쪽 아래 단축키 자리를 비운다 */
.cmd[data-action="upgrade"] img.badge, .cmd[data-action="upgrade"] svg.flat + img.badge { left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: 12px; height: 12px; }
.cmd > img:not(.badge):not(.flat) { margin-right: 0; }
.cmd[data-action="produce"] { align-content: center; padding: 8px 2px 8px; } /* 유닛은 상자 안 상하 가운데 */
.cmd span.badge { position: absolute; right: 2px; bottom: 17px; width: 12px; height: 12px; border-radius: 4px; background: #33333a; display: grid; place-items: center; pointer-events: none; }
.cmd span.badge svg { width: 9px; height: 9px; color: #fff; }
.cmd[data-action="upgrade"] span.badge { left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); }
.res-workers.chip img.chair { width: 22px; height: 22px; object-fit: contain; }

/* 명령 버튼 배치 v3 (2026-09-17 사용자): 업그레이드 게이지는 왼쪽 세로(위아래 여백, 가운데), 유닛 그림은 값 줄 아래에서 세로 가운데 — 값과 절대 안 겹침 */
.cmd .cmd-meter { left: 4px; right: auto; top: 8px; bottom: 8px; height: auto; width: 5px; flex-direction: column-reverse; gap: 2px; }
.cmd[data-action="upgrade"] .cmd-meter { left: 4px; right: auto; }
.cmd[data-action="upgrade"] { padding: 11px 4px 9px 14px; align-content: center; } /* 그림을 카드 상하 가운데에 (2026-09-17 사용자) — 값 줄은 오른쪽 위라 가운데 그림과 안 겹친다 */
.cmd[data-action="upgrade"] .key { bottom: 2px; }
.cmd[data-action="produce"] { align-content: center; padding: 18px 2px 4px; }
.cmd[data-action="produce"] > img:not(.badge):not(.flat) { width: 26px; height: 26px; }
.cmd[data-action="upgrade"] img.flat, .cmd[data-action="upgrade"] svg.flat { width: 26px; height: 26px; } /* 메인 그림을 키워 가운데 배지 뒤에서도 읽히게 */
.cmd[data-action="upgrade"] img.badge, .cmd[data-action="upgrade"] span.badge { width: 11px; height: 11px; }
.cmd[data-action="upgrade"] > img:not(.badge):not(.flat) { width: 28px; height: 28px; }
.cmd .cmd-cost.wide { left: 13px; right: 4px; gap: 3px; letter-spacing: -0.4px; font-size: 9px; } .cmd .cmd-cost.wide img { margin-right: 0; width: 12px; height: 12px; } /* 왼쪽 세로 게이지(4~9px)와 안 겹치게 왼쪽 13px 부터, 자간 축소 (2026-09-17 사용자) */
.cmd > img.pose:not(.badge):not(.flat) { width: 40px; height: 40px; margin-right: 0; } /* 병사 자세 아이콘(공격이동·정지·홀드)은 크게 (2026-09-17 사용자: 좀 키워줘) */
/* 다중 선택 명단 (2026-09-17 사용자): 상태창을 끌어서(스크롤) 보지 않게 — 카드를 줄여 한 화면에 다 들어가게. 체력은 크기와 상관없이 늘 막대만, 숫자는 툴팁(aria-label) */
#info, #info.building-info { overflow: hidden; }
.unit-roster { --card: 36px; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); grid-auto-rows: var(--card); gap: 3px; align-content: start; }
.unit-roster[style*="--card:1"], .unit-roster[style*="--card:2"] { gap: 2px; } /* 작은 카드(10~29px)는 간격도 좁게 */
.unit-health { min-height: 0; height: 100%; box-sizing: border-box; padding: 6% 4% 8%; gap: 0; align-content: space-between; font-size: 9px; border-radius: 4px; }
.unit-health img { width: calc(var(--card) * 0.6); height: calc(var(--card) * 0.6); }
.roster-hp, .unit-health i { height: max(2px, calc(var(--card) * 0.08)); }
.unit-health > span { display: none; }
/* 건설 메뉴 (2026-09-17 사용자): 건물 버튼에도 필요 자원 — 왼쪽 게이지가 없으니 왼쪽 4px 부터, 그림은 값 줄 아래 가운데 */
.cmd[data-action="place"] { padding: 16px 4px 6px; align-content: center; }
.cmd[data-action="place"] .cmd-cost.wide { left: 4px; }
/* 업그레이드 진행 막대 (2026-09-17 사용자): 왼쪽 게이지(4~9px)와 오른쪽 단축키를 안 가리게 — 그 사이 가운데 */
.cmd .cmd-progress { left: 50%; right: auto; width: 40px; transform: translateX(-50%); bottom: 3px; } /* 모든 진행 막대(업그레이드·연구): 카드 정중앙 기준 폭 40px — 왼쪽 게이지(≤9px)·오른쪽 단축키(≥62px) 어느 것도 안 가린다 (사용자 확인 2026-09-17) */
/* 대기실 (2026-09-17 사용자): 손님이 아직 없을 때의 빈 카드도 들어왔을 때의 종족 카드와 같은 크기(352:136 캔버스 비율·같은 테두리) — 창 크기가 안 바뀐다 */
#modes .scale .waiting-card { position: relative; display: grid; place-items: center; box-sizing: border-box; width: 100%; aspect-ratio: 352 / 136; min-height: 0; padding: 0; background: none; border: 16px solid transparent; border-image: url('ui/borders/card-ivory.png') 16 fill / 16px round; border-radius: 0; image-rendering: pixelated; }
#modes .scale .waiting-card b { font: 600 15px/20px var(--font); color: rgba(216, 207, 187, 0.8); }
#modes .lobby .status { min-height: 20px; } /* 빈 상태 줄도 자리를 지킨다 */
/* 기술 버튼의 마나 표기 (2026-09-17 사용자): 생산 버튼의 물값과 같은 자리 — 그림은 값 줄 아래 가운데 */
.cmd.has-cost { padding: 18px 2px 4px; align-content: center; }
.cmd .cmd-cost.mana { color: #bfe0ff; }
.cmd.has-cost > img.pose:not(.badge):not(.flat) { width: 34px; height: 34px; } /* 값 줄이 있으면 큰 그림은 34px 로 (겹침 방지) */

/* 선택 정보는 전술 화면처럼 한 덩어리로 읽히게 한다. 기존 HUD 순서와 높이는 유지한다. */
#selection-panel { background: #17191d !important; }
#selection-panel { --info-inset: 10px; } /* 정보 상자 바깥 여백 = 병력 줄 안쪽 여백 — 상자 테두리와 첫 병력 카드의 왼쪽 선이 늘 맞는다 (2026-10-06 사용자) */
#info, #info.building-info {
  width: auto; margin: 8px var(--info-inset) 4px; padding: 10px 14px;
  border: 1px solid #343b43; border-radius: 6px;
  background: #090c10; box-shadow: inset 0 1px 0 #ffffff0d;
}
#info .selection-display { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 16px; align-items: center; width: 100%; max-width: 560px; min-width: 0; height: 100%; margin-inline: auto; }
#info .selection-art { width: 92px; height: 92px; display: grid; place-items: center; border: 1px solid #2d3d4b; border-radius: 6px; background: radial-gradient(circle at 50% 65%, #273747 0, #101820 58%, #0a0e13 100%); }
#info .selection-art > img { display: block; width: 92px; height: 92px; object-fit: contain; }
#info .selection-readout { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 0; height: 100%; }
#info .selection-heading h2 { color: var(--fg); font-size: 18px; line-height: 24px; }
#info .selection-heading .heading-row { align-items: flex-start; flex-wrap: nowrap; }
#info .selection-heading .heading-row h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#info .selection-heading .army-all { flex: none; }
#info .selection-state { margin: 5px 0 0; color: #b8c4d0; font-size: 14px; line-height: 20px; }
#info .selection-state:empty { display: none; }
#info .selection-carry { display: flex; }
#info .selection-carry .chip { min-height: 32px; }
#info .selection-readout .prog { width: min(320px,100%); height: 8px; border: 1px solid #263b4d; border-radius: 4px; background: #18232e; }
#info .selection-readout .prog i { background: #3aa0ff; }
#info .selection-readout .construction-refund { font-size: 11px; line-height: 15px; }
#portrait { background: linear-gradient(180deg,#20262c,#14191e) !important; }
#portrait canvas { border: 1px solid #38434e; border-radius: 5px; background: radial-gradient(circle at 50% 60%,#263645,#121a22 65%,#0c1117); }
#command-panel { background: #181b20 !important; }
#command-label { color: #b7c0c9; font-size: 11px; }
#card .cmd, #card .cmd-empty { border: 1px solid #39414a; border-radius: 5px; }
#card .cmd:not(.lv1):not(.lv2):not(.maxed):not(.active):not([aria-disabled=true]) { background: linear-gradient(180deg,#282e35,#1b2026); }
#card .cmd-empty { width: 100%; height: 100%; border-color: #272d34; background: #14191e; }
#card .cmd:hover { border-color: #91a9be; background: #303943; }
#card .cmd.active { border-color: var(--team); background: #1b354b; }
#card .cmd[aria-disabled=true]:not(.maxed) { border-color: #293039; background: #171b20; }
#card .cmd:focus-visible { outline: 2px solid #7fc4ff; outline-offset: -3px; }
@media (max-width: 1100px) {
  #selection-panel { --info-inset: 6px; }
  #info, #info.building-info { padding-inline: 10px; }
  #info .selection-display { grid-template-columns: 72px minmax(0,1fr); gap: 10px; }
  #info .selection-art { width: 72px; height: 72px; }
  #info .selection-art > img { width: 64px; height: 64px; }
}
@media (max-height: 760px) {
  #info .selection-display { grid-template-columns: 76px minmax(0,1fr); gap: 12px; }
  #info .selection-art { width: 76px; height: 76px; }
  #info .selection-art > img { width: 68px; height: 68px; }
  #info .selection-readout { gap: 6px; }
}

/* ───────── 하단 바 · 각진 금속 + 팀 색 발광 (2026-10-03 사용자: B안) ─────────
   상자 크기·여백은 건드리지 않는다 — 표면(배경·테두리·모서리)만 바꾼다. 앞선 규칙이 #card .cmd 처럼
   더 좁은 선택자를 쓰므로 여기서도 같은 수준으로 맞춘다 */
#hud > #console, #console:has(#minimap:not([hidden])) { background: linear-gradient(180deg, #141b26 0%, #0d1219 100%); }
#hud > #console::before, #console:has(#minimap:not([hidden]))::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--team) 18%, #7ec8ff 50%, var(--team) 82%, transparent); opacity: .7;
}
#console > * { border-right-color: #223246; }
#selection-panel { background: #111823 !important; }
#info, #info.building-info { border-color: #2c5f8f; background: #0a1118; box-shadow: inset 0 1px 0 rgba(126,200,255,.16); }
#portrait { background: linear-gradient(180deg, #18212e, #0f151d); }
#minimap canvas { border-color: #2c5f8f; }

/* 안쪽 하이라이트만. 모서리 깎기는 뺐다 — 글자를 잘라먹기만 하고 얻는 게 없었다 (2026-10-03 사용자) */
#card .cmd, .production-portrait, .queued-portrait {
  box-shadow: inset 0 1px 0 rgba(126,200,255,.28), inset 0 -1px 0 rgba(0,0,0,.55);
}
#card .cmd { border-color: #2c5f8f; }
#card .cmd:not(.lv1):not(.lv2):not(.maxed):not(.active):not([aria-disabled=true]) { background: linear-gradient(180deg, rgba(58,160,255,.13), rgba(12,20,30,.88)); }
#card .cmd:hover:not(:disabled):not([aria-disabled=true]) { border-color: #7ec8ff; box-shadow: inset 0 1px 0 rgba(126,200,255,.45), 0 0 10px rgba(58,160,255,.28); }
#card .cmd[aria-disabled=true], #card .cmd:disabled { border-color: #24344a; box-shadow: inset 0 1px 0 rgba(126,200,255,.1); }
#card .cmd-empty { border-color: #1d2a3a; background: #0c131b; }
.production-portrait { border-color: #2c5f8f; background: linear-gradient(180deg, rgba(58,160,255,.12), rgba(10,18,28,.88)); }
.queued-portrait { border-color: #2c5f8f; background: linear-gradient(180deg, rgba(58,160,255,.07), rgba(10,18,28,.82)); }
.queued-portrait:hover { border-color: #7ec8ff; background: linear-gradient(180deg, rgba(58,160,255,.18), rgba(14,24,36,.88)); }
.production-portrait.blocked { border-color: #9d713f; box-shadow: inset 0 1px 0 rgba(255,200,140,.3), inset 0 -1px 0 rgba(0,0,0,.55); }
#army button { border-color: #223246; }
#army button:hover { border-color: #7ec8ff; }

/* ───────── 단차 있는 하단 바 (2026-10-03 사용자: 스타2 식) ─────────
   가운데(초상화·선택 정보)는 그대로 두고 양 끝(미니맵·명령창)만 위로 올린다.
   올린 만큼을 실제로 쓴다 — 미니맵은 그만큼 커지고, 명령 격자는 그만큼 세로로 자라 칸이 정사각형에 가까워진다.
   격자 높이(가운데)는 그대로라 선택 정보 배치는 건드리지 않는다. */
#hud > #console, #console:has(#minimap:not([hidden])) {
  --lift: clamp(20px, 3.4vh, 38px); overflow: visible;
  grid-template-columns: calc(var(--hud-height) + var(--lift) - 2px) 116px minmax(0, 1fr) 272px;
}
#hud > #console > #minimap, #hud > #console > #command-panel,
#console:has(#minimap:not([hidden])) > #minimap, #console:has(#minimap:not([hidden])) > #command-panel {
  height: calc(100% + var(--lift)); margin-top: calc(var(--lift) * -1); align-self: end;
  background: linear-gradient(180deg, #17222f 0%, #0d1219 62%);
  border-top: 1px solid #3f7fb8;
  box-shadow: 0 -8px 20px rgba(0,0,0,.5), inset 0 1px 0 rgba(126,200,255,.3);
}
/* 바깥쪽 위 모서리를 비스듬히 깎아 가운데로 흘려보낸다 */
#hud > #console > #command-panel, #console:has(#minimap:not([hidden])) > #command-panel { border-right: 0; }
/* 올라간 자리를 실제로 쓴다 */
#hud > #console > #minimap canvas, #console:has(#minimap:not([hidden])) > #minimap canvas {
  width: calc(var(--hud-height) + var(--lift) - 20px); height: calc(var(--hud-height) + var(--lift) - 20px); margin-top: 0;
}
/* 가운데는 한 단 낮다는 걸 윗선으로 보여 준다 */
#hud > #console > #portrait, #hud > #console > #selection-panel,
#console:has(#minimap:not([hidden])) > #portrait, #console:has(#minimap:not([hidden])) > #selection-panel {
  border-top: 1px solid #24435f;
}

/* 단차를 부드럽게 (2026-10-03 사용자: 뚝 끊기지 않게).
   사선 덧대기는 모서리가 지저분해 접었다. 올라간 패널의 위 모서리를 둥글리고 윗선 발광을 가운데로 갈수록 흐리게 해
   한 단 낮은 가운데로 자연스럽게 흘러가게 한다. */
#hud > #console > #minimap, #console:has(#minimap:not([hidden])) > #minimap {
  border-top-left-radius: 10px; border-top-right-radius: 16px;
  border-top-color: #3f7fb8;
}
#hud > #console > #command-panel, #console:has(#minimap:not([hidden])) > #command-panel {
  border-top-left-radius: 16px; border-top-right-radius: 10px; border-top-color: #3f7fb8;
}
/* 가운데도 같은 반지름으로 받아 단차가 한 덩어리로 읽히게 */
#hud > #console > #portrait, #console:has(#minimap:not([hidden])) > #portrait { border-top-left-radius: 14px; }
#hud > #console > #selection-panel, #console:has(#minimap:not([hidden])) > #selection-panel { border-top-right-radius: 14px; }
#hud > #console > #portrait, #hud > #console > #selection-panel,
#console:has(#minimap:not([hidden])) > #portrait, #console:has(#minimap:not([hidden])) > #selection-panel {
  background: linear-gradient(180deg, #141d29 0%, #0d1219 70%);
  box-shadow: inset 0 1px 0 rgba(126,200,255,.18);
}

/* 칸 안 띠 정리 (2026-10-03 사용자): 비용은 위, 그림은 가운데, 단축키는 아래 모서리.
   그림이 아래 띠를 덜 침범하게 여백을 주고, 단축키는 어두운 알약을 깔아 그림 위에서도 읽히게 한다. */
#card .cmd { padding-top: 17px; padding-bottom: 11px; }
#card .cmd .key { padding: 0 3px; border-radius: 3px; background: rgba(9,14,20,.72); opacity: .9; }


/* 업그레이드 전/후를 또렷하게 (2026-10-03 사용자: 직관적이지 않다).
   레벨 눈금은 칸 왼쪽의 세로 막대(아래부터 채워짐)인데 5px 로 가늘고 어두워 보이지 않았다.
   글자는 넣지 않고 — 막대를 굵히고, 받은 칸은 금빛으로 빛내고, 바로 다음 칸은 금 테두리로 '여기까지 올라간다'를 보여 준다. */
#card .cmd .cmd-meter { left: 5px; width: 8px; top: 9px; bottom: 9px; gap: 3px; }
#card .cmd .cmd-meter i {
  border-radius: 3px; background: #0b1119;
  box-shadow: inset 0 0 0 1px rgba(126,200,255,.3);
}
#card .cmd .cmd-meter i.on {
  background: linear-gradient(180deg, #ffeab0, #d6a93f);
  box-shadow: 0 0 8px rgba(214,169,63,.85), inset 0 0 0 1px rgba(255,255,255,.5);
}
/* 다음에 올라갈 한 칸 (column-reverse 라 DOM 순서로 첫 off) */
#card .cmd:not(.maxed):not([aria-disabled=true]) .cmd-meter i:not(.on):first-child,
#card .cmd:not(.maxed):not([aria-disabled=true]) .cmd-meter i.on + i:not(.on) {
  background: rgba(214,169,63,.18); box-shadow: inset 0 0 0 1.5px rgba(255,214,110,.85);
}
/* 연구 중이면 그 칸이 숨 쉰다 */
#card .cmd.researching .cmd-meter i:not(.on):first-child,
#card .cmd.researching .cmd-meter i.on + i:not(.on) { animation: upPulse 1.2s ease-in-out infinite; }
@keyframes upPulse { 0%, 100% { background: rgba(214,169,63,.16); } 50% { background: rgba(255,214,110,.6); } }
/* 다 올린 칸: 막대 전체가 금, 카드 왼쪽에도 금 선 */
#card .cmd.maxed .cmd-meter i { background: linear-gradient(180deg, #ffeab0, #d6a93f); box-shadow: 0 0 8px rgba(214,169,63,.8); }
#card .cmd.maxed { border-left: 2px solid #d6a93f; }
/* 막대가 그림을 밀지 않게 그림만 오른쪽으로 조금 */
#card .cmd:has(.cmd-meter) > img:not(.badge) { margin-left: 10px; }
@media (prefers-reduced-motion: reduce) { #card .cmd.researching .cmd-meter i { animation: none; } }


/* ═════════ 하단 바 치수 — 카드 한 변 하나에서 전부 역산 (2026-10-03 사용자) ═════════
   ① 명령 카드 한 변 --cmd (정사각형)
   ② 오른쪽 명령 패널 = 카드 3×3 + 간격 + 여백      → 폭 --cmd-w · 높이 --side-h
   ③ 가운데 상태창 = 양 옆보다 --lift 만큼 낮게     → --hud-height (전장 아래 경계도 이것)
   ④ 왼쪽 미니맵 패널 = --side-h 정사각형, 캔버스가 빈 곳 없이 채운다 */
:root {
  --cmd: clamp(58px, 7.8vh, 80px);                                       /* ① 카드 한 변 — 모든 치수의 출발점 */
  --cmd-gap: 5px;
  --cmd-w: calc(var(--cmd) * 3 + var(--cmd-gap) * 2 + 20px);            /* ② 좌우 여백 10+10 */
  --side-h: calc(var(--cmd) * 3 + var(--cmd-gap) * 2 + 20px);           /* ② 위아래 여백 10+10 ('명령' 제목은 뺐다) */
  --lift: calc(var(--cmd) * .5);
  --hud-height: calc(var(--side-h) - var(--lift));                       /* ③ */
}
#hud > #console, #console:has(#minimap:not([hidden])) {
  --lift: calc(var(--cmd) * .5);
  height: var(--hud-height);
  grid-template-columns: var(--side-h) 116px minmax(0, 1fr) var(--cmd-w) !important;
}
/* 양 옆 패널: 같은 높이 --side-h 로 가운데보다 --lift 만큼 솟는다 */
#hud > #console > #minimap, #hud > #console > #command-panel,
#console:has(#minimap:not([hidden])) > #minimap, #console:has(#minimap:not([hidden])) > #command-panel {
  height: var(--side-h) !important; margin-top: calc(var(--lift) * -1) !important; align-self: end;
}
/* ④ 미니맵: 패널을 꽉 채우는 정사각형 (여백 8px 만) */
#hud > #console > #minimap, #console:has(#minimap:not([hidden])) > #minimap { padding: 8px !important; }
#hud > #console > #minimap canvas, #console:has(#minimap:not([hidden])) > #minimap canvas {
  width: calc(var(--side-h) - 16px) !important; height: calc(var(--side-h) - 16px) !important; margin: 0 !important;
}
/* ② 명령 패널과 ① 3×3 정사각형 격자 */
#hud > #console > #command-panel, #console:has(#minimap:not([hidden])) > #command-panel { padding: 10px !important; display: grid; place-items: center; }
/* '명령' 제목은 화면에서 뺀다 (사용자) — 읽기 프로그램용으로만 남긴다 */
#command-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#hud > #console #card, #console:has(#minimap:not([hidden])) #card {
  width: calc(var(--cmd) * 3 + var(--cmd-gap) * 2) !important; height: calc(var(--cmd) * 3 + var(--cmd-gap) * 2) !important;
  grid-template-columns: repeat(3, var(--cmd)) !important; grid-template-rows: repeat(3, var(--cmd)) !important;
  gap: var(--cmd-gap) !important; margin: 0 !important; padding: 0 !important;
}
#card .cmd, #card .cmd-empty { width: var(--cmd) !important; height: var(--cmd) !important; }

/* 연구 중인 카드: 비용이 빠진 위쪽 띠를 진행 막대로 채운다 (2026-10-03 사용자) */
#card .cmd.researching .cmd-progress {
  top: 6px; bottom: auto; left: 7px; right: 7px; width: auto; transform: none; height: 7px;
  border-radius: 3px; background: #0b1119; box-shadow: inset 0 0 0 1px rgba(126,200,255,.35); overflow: hidden;
}
#card .cmd.researching .cmd-progress i {
  background: linear-gradient(90deg, #2c7fd0, #7ec8ff); box-shadow: 0 0 6px rgba(58,160,255,.7);
  background-size: 200% 100%; animation: researchFlow 1.4s linear infinite;
}
@keyframes researchFlow { from { background-position: 0 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #card .cmd.researching .cmd-progress i { animation: none; } }

/* ───────── 카드 한 장 안쪽 (2026-10-03 사용자: 한 땀 한 땀) ─────────
   띠 셋: 위 비용(또는 연구 막대) 3~15px · 가운데 그림 · 아래 오른쪽 단축키. 업그레이드는 왼쪽에 세로 레벨 막대.
   비용 줄이 카드 폭을 넘어 옆 칸으로 삐져나가던 것 — 카드 폭 안에서 가운데 정렬하고 넘치면 자른다. */
#card .cmd { padding: 17px 5px 12px !important; overflow: hidden; }
#card .cmd > img:not(.badge) { max-width: calc(100% - 4px); max-height: 100%; object-fit: contain; }
#card .cmd .cmd-cost, #card .cmd .cmd-cost.wide, #card .cmd .cmd-cost.mana {
  position: absolute; top: 3px; left: 3px; right: 3px; height: 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font: 600 9.5px/12px var(--font); letter-spacing: -.2px; white-space: nowrap; overflow: hidden;
}
#card .cmd .cmd-cost img { width: 9px !important; height: 9px !important; margin-right: 1px; flex: none; }
#card .cmd .cmd-cost.unit-cost span { display: inline-flex; align-items: center; gap: 1px; }
#card .cmd .key { position: absolute !important; right: 3px !important; bottom: 2px !important; left: auto !important; top: auto !important;
  font: 700 9px/12px var(--font); padding: 0 3px; border-radius: 3px; background: rgba(9,14,20,.75); color: #c8d4e2; opacity: 1; }
/* 업그레이드: 레벨 막대는 비용 띠 아래부터, 그림은 막대만큼 비켜 선다 */
#card .cmd .cmd-meter { top: 18px !important; bottom: 7px !important; left: 5px !important; width: 7px !important; }
#card .cmd:has(.cmd-meter) > img:not(.badge) { margin-left: 9px; max-width: calc(100% - 14px); }
/* 연구 중 막대도 같은 위쪽 띠에 */
#card .cmd.researching .cmd-progress { top: 5px !important; height: 7px !important; left: 6px !important; right: 6px !important; }
/* 그림을 가운데 띠 높이만큼 키운다 (23×28 → 띠 꽉): 단축키는 오른쪽 아래 모서리라 가운데 그림과 거의 안 만난다 */
#card .cmd { padding: 16px 4px 5px !important; }
#card .cmd > img:not(.badge):not(.flat) { width: auto !important; height: 100% !important; max-width: calc(100% - 6px); }
#card .cmd > img.flat { width: 52% !important; height: auto !important; max-height: 100%; }
#card .cmd:has(.cmd-meter) > img:not(.badge) { max-width: calc(100% - 22px); }
/* 세 자리 비용 둘도 한 줄에 들어가게 */
#card .cmd .cmd-cost, #card .cmd .cmd-cost.wide, #card .cmd .cmd-cost.mana { left: 2px; right: 2px; gap: 3px; letter-spacing: -.35px; }
#card .cmd .cmd-cost img { margin-right: 0; }
/* 그림 크기는 퍼센트가 아니라 카드 한 변에서 바로 계산한다 — 칸 안 격자 칸이 내용 크기라 %가 엉뚱하게 풀렸다 (업그레이드 그림 17px) */
#card .cmd { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
#card .cmd > img:not(.badge):not(.flat) {
  width: calc(var(--cmd) - 26px) !important; height: calc(var(--cmd) - 26px) !important;
  max-width: none !important; max-height: none !important; margin: 0; align-self: center; justify-self: center;
}
/* 업그레이드: 왼쪽 레벨 막대만큼 비켜 서고 조금 작게 — 오른쪽 아래 단축키와 만나지 않게 */
#card .cmd:has(.cmd-meter) > img:not(.badge):not(.flat) {
  width: calc(var(--cmd) - 32px) !important; height: calc(var(--cmd) - 32px) !important; margin-left: 6px;
}
#card .cmd .key { font-size: 8.5px; line-height: 11px; padding: 0 2px; right: 2px !important; bottom: 2px !important; }
/* 세 자리 비용 둘 */
#card .cmd .cmd-cost.wide { gap: 2px; letter-spacing: -.5px; }
/* 바 전체를 가로지르던 발광 띠를 뺀다 — 양옆이 솟으면서 미니맵과 명령 칸 한가운데를 그었다 (2026-10-03 사용자).
   각 패널이 제 윗선을 가진다. */
#hud > #console::before, #console:has(#minimap:not([hidden]))::before { content: none !important; display: none !important; }
#hud > #console, #console:has(#minimap:not([hidden])) { border-top: 0 !important; background: transparent !important; }
/* 기본은 상하좌우 가운데 (2026-10-03 사용자). 위쪽 비용 띠(또는 연구 막대)가 있는 카드만 그만큼 내려 앉힌다 */
#card .cmd { padding: 5px !important; }
#card .cmd:has(.cmd-cost), #card .cmd.researching { padding-top: 16px !important; }
/* 기호 아이콘(공격 이동·정지·홀드·취소 등)은 카드의 40% 로 가운데 */
#card .cmd > img.flat { width: calc(var(--cmd) * .4) !important; height: calc(var(--cmd) * .4) !important; max-width: none !important; max-height: none !important; align-self: center; justify-self: center; }

/* ═════════ 가운데 상태창 다듬기 (2026-10-03 사용자: 카드처럼 한 땀 한 땀) ═════════
   모든 선택 상황이 같은 기준선을 쓴다: 왼쪽 위에 이름·상태, 오른쪽 위 모서리에 '군대 전체', 그 아래 내용.
   예전엔 단일 선택만 560px 상자에 가운데로 떠 있어 상황마다 버튼 자리와 시작선이 달랐다. */
#info, #info.building-info { padding: 12px 16px !important; justify-content: flex-start !important; align-items: stretch !important; }
#info .selection-display { display: block !important; max-width: none !important; margin: 0 !important; height: auto !important; }
#info .selection-art { display: none !important; } /* 같은 그림은 왼쪽 초상화가 보여 준다 */
#info .selection-readout { display: flex; flex-direction: column; gap: 10px; height: auto !important; justify-content: flex-start !important; }
#info .selection-heading .heading-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
#info .selection-heading h2 { font-size: 18px; line-height: 24px; font-weight: 700; letter-spacing: -.2px; color: #eef3f8; }
#info .selection-heading .army-all { margin-left: auto; flex: none; height: 28px; padding: 0 8px; border-radius: 6px;
  border: 1px solid #2c4a66; background: rgba(58,160,255,.06); color: #c8d4e2; font-size: 13px; }
#info .selection-heading .army-all:hover { border-color: #7ec8ff; background: rgba(58,160,255,.14); }
#info .selection-state, #info .selection-heading p { margin: 3px 0 0 !important; color: #8fa3b8 !important; font-size: 13px !important; line-height: 18px !important; }

/* 능력치: 작은 라벨 위에 큰 숫자, 칸 사이 얇은 구분선 */
#info .unit-stats { display: flex; gap: 0; margin: 2px 0 0; padding: 0; }
#info .unit-stats > div { min-width: 64px; padding: 4px 14px 2px 0; margin-right: 14px; border-right: 1px solid #1e3247; }
#info .unit-stats > div:last-child { border-right: 0; margin-right: 0; }
#info .unit-stats dt { color: #6f8499; font-size: 11px; line-height: 14px; letter-spacing: .02em; }
#info .unit-stats dd { margin: 1px 0 0; color: #eef3f8; font: 700 18px/22px var(--font); font-variant-numeric: tabular-nums; }


/* 병력 현황 줄: 비었을 때도 가운데 높이에 맞춰 읽히게 */
#army { align-items: center; min-height: 34px; padding: 4px var(--info-inset, 10px) !important; }
.army-empty { line-height: 20px !important; color: #6f8499 !important; font-size: 12px; }

/* 왼쪽 초상화 칸: 모델 상자·이름·체력을 한 축에 */
#portrait { padding: 10px 10px 8px !important; gap: 4px !important; align-items: stretch; }
#portrait canvas { border-radius: 8px; border: 1px solid #22384e; background: radial-gradient(circle at 50% 62%, #1c2c3c 0, #0c131b 70%); }
#portrait-label { text-align: center; color: #d4dde7 !important; font-size: 12px; line-height: 16px; font-weight: 600; }
#hp-value { text-align: center; color: #9fb2c5 !important; font-size: 12px; }
/* 아래 병력 칸과 포메이션 버튼도 남색 금속으로 — 회색 상자만 따로 놀았다 */
#army button { background: linear-gradient(180deg, #121c28, #0c131b) !important; border: 1px solid #1f3349 !important; border-radius: 6px !important; }
#army button:hover { border-color: #7ec8ff !important; background: linear-gradient(180deg, #16243a, #0e1824) !important; }
#info .formation-bar { border: 1px solid #2c4a66 !important; background: rgba(58,160,255,.06) !important; border-radius: 6px !important; color: #c8d4e2 !important; }
#info .formation-bar[aria-pressed="true"] { border-color: #7ec8ff !important; background: rgba(58,160,255,.18) !important; color: #eef3f8 !important; }
/* 여러 유닛 칩: 칸 폭을 늘이지 않고 정사각형 그대로 (명령 카드와 같은 모양) */
#info .unit-roster { grid-template-columns: repeat(auto-fill, var(--card)) !important; grid-auto-rows: var(--card); justify-content: start; }
#info .heading-row > .selection-state { margin: 0 !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#info:has(> .unit-roster) { row-gap: 6px; }
#info:has(> .unit-roster) { min-height: 0; overflow: hidden; } /* 칩이 정보창 높이를 밀어 올리지 않게 — 높이는 바깥 틀이 정한다 */
/* 제목 줄 안의 자원 칩 (띠 대신) */
#info .heading-row > .node-peek { flex: 0 1 auto; min-width: 0; height: 28px; margin: 0; padding: 0 10px; gap: 6px; box-sizing: border-box; white-space: nowrap; overflow: hidden; }
#info .heading-row > .node-peek img { width: 18px; height: 18px; }
#info .heading-row > .node-peek span { margin-left: 6px; }
/* 칩이 칸을 다 못 채우고 남는 몇 px 는 제목과 칩 사이로 — 아래 여백이 늘 위와 같게 */
#info:has(> .unit-roster) { justify-content: space-between !important; }
/* 초상화 칸 (2026-10-03 사용자): 이름은 그림 카드 안 아래쪽, 체력·마나는 같은 모양의 막대 안에 숫자 */
#portrait .portrait-card { position: relative; flex: 1; min-height: 0; display: flex; }
#portrait .portrait-card canvas { flex: 1; width: 100% !important; height: 100% !important; min-height: 0; box-sizing: border-box; }
#portrait .portrait-card #portrait-label { position: absolute; left: 1px; right: 1px; bottom: 1px; padding: 10px 4px 4px !important; border-radius: 0 0 7px 7px;
  background: linear-gradient(180deg, transparent, rgba(6,10,15,.88) 55%); color: #eef3f8 !important; font-size: 12px; line-height: 14px; font-weight: 700;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
#portrait #hp, #portrait.has-health-value #hp, #portrait #mana { position: relative !important; left: auto; right: auto; bottom: auto; flex: none; width: 100%; height: 14px;
  border-radius: 4px; background: #0b1118; border: 1px solid #22384e; box-sizing: border-box; overflow: hidden; }
#portrait #hp i { background: linear-gradient(180deg, #5fe07a, #2fa84c); }
#portrait #mana i { background: linear-gradient(180deg, #5bb4ff, #2a78d6); }
#portrait #hp-value, #portrait #mana-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff !important; font-size: 10px !important; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
#portrait #hp-value[hidden] { display: none; }

/* 라운지판: 시작 화면의 접힌 랭킹 점수 규칙 (2026-11-13) */
#modes .score-rule { width: 100%; font: 500 13px/1.5 var(--font); color: var(--fg); opacity: .85; }
#modes .score-rule summary { cursor: pointer; display: flex; align-items: center; min-height: 28px; font-weight: 600; }
#modes .score-rule ul { margin: 4px 0 0; padding-left: 18px; }
/* 전체 화면 단추 (2026-11-16): 오른쪽 위 고정, 네모 단추(알약 아님), 아이콘 상하좌우 가운데 */
.fs-btn { width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; background: rgba(10,18,40,.62); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.fs-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fs-btn:hover { background: rgba(10,18,40,.85); border-color: rgba(255,255,255,.7); }
.fs-btn:focus-visible { outline: 2px solid #FFD36E; outline-offset: 2px; }
.fs-fixed { position: fixed; z-index: 2147483000; }

.fs-fixed { top: 6px; right: 12px; }
#pconly { gap: 14px; flex-wrap: wrap; }
.fs-btn.fs-inline { width: auto; height: 40px; padding: 0 14px; gap: 8px; font-size: 15px; font-weight: 700; }
body:has(#pconly:not([hidden])) .fs-fixed { display: none; }
#game-tools .fs-btn.fs-tool { width: 32px; height: 32px; padding: 0; border-radius: 6px; background: transparent; border: 1px solid var(--hairline); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; }
#game-tools .fs-btn.fs-tool svg { width: 18px; height: 18px; }
.fs-hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; text-align: center; }
