/* 스타쿼래프트 — 영상 영역 소유 · 로비 균일 축소 · CSS 확대 · 게임 화면(852×480) · 원작 콘솔.
   계약: docs/minigame-framework.md §18, docs/starqraft.md §6. 모든 규칙은 #starqraftRoot 안으로 한정한다. */

.game-starqraft { --game-color: 56, 189, 248; }

#starqraftRoot {
  position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box;
  z-index: 40; display: none; overflow: hidden; container-type: size;
  color: #e2e8f0; font-family: inherit;
  background: radial-gradient(circle at 20% 10%, rgba(56, 189, 248, .14), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(168, 85, 247, .12), transparent 38%), #070b12;
}
#starqraftRoot.sq-visible { display: block; }
#starqraftRoot * { box-sizing: border-box; }
#starqraftRoot [hidden] { display: none !important; }
#starqraftRoot button { font: inherit; border: 1px solid #253247; border-radius: 9px; padding: 7px 12px; background: #111a28; color: #dbe6f3; cursor: pointer; }
#starqraftRoot button:disabled { opacity: .45; cursor: default; }
#starqraftRoot button:focus-visible { outline: 3px solid #38bdf8; outline-offset: 1px; }
.sq-body { position: absolute; inset: 0; pointer-events: none; }
.sq-body > * { pointer-events: auto; }

/* CSS 확대(§18.3). Alt+Enter 전체화면은 .sq-game 요소 자체를 쓴다(사용자 결정, docs/starqraft.md §6.2). */
#starqraftRoot.sq-expanded {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 10000;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.sq-collapse { position: absolute; top: 8px; right: 8px; z-index: 60; display: none; font-size: 12px; font-weight: 700; }
#starqraftExpand { display: none; margin: 5px auto; padding: 9px 16px; border-radius: 9px; border: 1px solid #253247; background: none; color: #cfd8e0; font: inherit; cursor: pointer; }
@media (pointer: coarse), (max-width: 900px) { #starqraftExpand.sq-show { display: block; } }

/* ── 패널(로비·준비·관전·결과): 원작 브루드워 메뉴처럼 어두운 금속 테두리 + 노랑·초록 글자 강조.
   고정 논리 크기를 균일 축소한다 (§18.2 #3 — fit()). ── */
.sq-panel {
  position: absolute; left: 50%; top: 50%; transform-origin: center; z-index: 30;
  width: 660px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  color: #dde6dd; color-scheme: dark;
  background: linear-gradient(180deg, #0e1419 0%, #06090c 100%);
  border: 2px solid #4b5864; border-radius: 6px;
  box-shadow: inset 0 0 0 1px #04070a, inset 0 0 0 3px #1b252d, 0 18px 48px rgba(0, 0, 0, .55);
}
@container (max-aspect-ratio: 4/5) { .sq-panel { width: 380px; } }
.sq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sq-title { margin: 0; font-size: 21px; font-weight: 850; letter-spacing: -.4px; color: #fcfc38; text-shadow: 0 1px 0 #000; }
.sq-title small { margin-left: 4px; font-size: 12px; font-weight: 800; letter-spacing: 0; color: #9fe89f; }
.sq-title.sq-win { color: #4ade80; }
.sq-title.sq-lose { color: #f87171; }
.sq-sub { margin: 3px 0 0; font-size: 11.5px; color: #97a69b; }
.sq-sub b { color: #fcfc38; }
.sq-head-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
#starqraftRoot .sq-mini { padding: 5px 10px; font-size: 11px; font-weight: 700; border-radius: 999px; }
.sq-row { display: flex; align-items: center; gap: 10px; }
.sq-label { flex: 0 0 auto; min-width: 34px; font-size: 11px; font-weight: 800; letter-spacing: .5px; color: #97a69b; }
.sq-choices { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
#starqraftRoot .sq-chip { padding: 6px 12px; font-size: 12px; font-weight: 700; border-radius: 999px; }
#starqraftRoot .sq-chip.sq-active { background: #38bdf8; border-color: #38bdf8; color: #06121f; }
.sq-select { background: #111a28; color: #e2e8f0; border: 1px solid #253247; border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 12px; max-width: 260px; }
/* 패널 안 버튼·목록: 원작 메뉴 버튼처럼 각진 금속 테두리와 초록 글자, 올리면 노랑. 켜진 것은 초록 불. */
#starqraftRoot .sq-panel button, .sq-panel .sq-select {
  border: 1px solid #4b5864; border-radius: 3px; background: linear-gradient(180deg, #1a2329 0%, #0b1014 100%); color: #bfeebf;
}
.sq-panel .sq-select { padding: 5px 6px; cursor: pointer; }
.sq-panel .sq-select option { background: #0b1014; color: #dde6dd; }
.sq-panel .sq-select option:disabled { color: #5f6d64; }
#starqraftRoot .sq-panel button:hover:not(:disabled), .sq-panel .sq-select:hover:not(:disabled) { border-color: #9fb2c0; color: #fcfc38; }
#starqraftRoot .sq-panel .sq-chip { border-radius: 3px; }
#starqraftRoot .sq-panel .sq-chip.sq-active, .sq-panel .sq-select.sq-on {
  border-color: #4ade4a; background: linear-gradient(180deg, #1f4d1f 0%, #0f2a0f 100%); color: #d8ffd8;
}
#starqraftRoot .sq-panel .sq-primary { border-color: #4ade4a; background: linear-gradient(180deg, #2b6d2b 0%, #133a13 100%); color: #f0fff0; box-shadow: 0 0 10px rgba(74, 222, 74, .28); }
#starqraftRoot .sq-panel .sq-primary.sq-armed { border-color: #fcfc38; background: linear-gradient(180deg, #3b3b13 0%, #1c1c08 100%); color: #fcfc38; box-shadow: none; }
.sq-help { margin: 0; font-size: 11px; color: #8d9b91; line-height: 1.5; }
.sq-help b { color: #dde6dd; }
.sq-reason { margin: 0; font-size: 12px; color: #fcfc38; overflow-wrap: anywhere; }
.sq-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.sq-standby { margin-right: auto; font-size: 12px; color: #97a69b; }
#starqraftRoot .sq-btn { padding: 9px 16px; font-weight: 800; border-radius: 11px; }
#starqraftRoot .sq-primary { background: #38bdf8; border-color: #38bdf8; color: #06121f; }
#starqraftRoot .sq-primary.sq-armed { background: #1e293b; border-color: #38bdf8; color: #e2e8f0; }
.sq-progress { height: 10px; border-radius: 2px; background: #04070a; overflow: hidden; border: 1px solid #36434d; }
.sq-progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2e9e2e, #8cf08c); transition: width .2s; }
.sq-stats { width: 100%; border-collapse: collapse; font-size: 12px; }
.sq-stats th { color: #97a69b; font-weight: 700; text-align: right; padding: 4px 6px; border-bottom: 1px solid #253039; }
.sq-stats td { text-align: right; padding: 4px 6px; }
.sq-stats th:first-child, .sq-stats td:first-child { text-align: left; }
.sq-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ── 게임 방(로비·준비): 원작 게임 방 배치 — 왼쪽 자리 목록, 오른쪽 맵 칸(그림·정보·주인의 방 설정) ──
   넓고 낮은 영상 영역(≥ 3:2)은 맵 칸 안을 [그림 | 정보·설정]으로, 좁은 세로(≤ 4:5)는 맵 칸을 위로 접는다. */
.sq-panel.sq-roompanel { width: 800px; }
.sq-room { display: grid; grid-template-columns: minmax(0, 1fr) 254px; gap: 12px; align-items: stretch; }
.sq-frame {
  display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 8px 10px 10px;
  border: 1px solid #36434d; border-radius: 3px;
  background: linear-gradient(180deg, rgba(22, 31, 38, .72) 0%, rgba(3, 6, 8, .88) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(170, 190, 205, .08);
}
.sq-frame-title { display: flex; align-items: baseline; gap: 6px; padding-bottom: 5px; border-bottom: 1px solid #253039; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #fcfc38; }
.sq-frame-title span { color: #97a69b; letter-spacing: 0; }
.sq-groups { display: flex; flex-direction: column; gap: 8px; }
.sq-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sq-team-head { display: flex; align-items: center; gap: 8px; padding: 0 2px; font-size: 12px; font-weight: 800; color: #9fe89f; overflow-wrap: anywhere; min-width: 0; }
.sq-team-head span { color: #6f8075; font-weight: 700; }
.sq-seats { display: flex; flex-direction: column; gap: 3px; }
/* 자리 한 줄: [P번호·색] 이름 · 태그 · 상태. 긴 이름은 이름 칸 안에서 줄을 바꾼다(말줄임 없음, §18.2 #5). */
.sq-card {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 30px; padding: 4px 8px;
  border: 1px solid #1c262e; border-left: 3px solid #3a4751; border-radius: 2px; background: rgba(9, 14, 18, .92);
}
.sq-card.sq-mine { border-left-color: #4ade4a; background: linear-gradient(90deg, rgba(74, 222, 74, .13) 0%, rgba(9, 14, 18, .92) 45%); }
.sq-card.sq-bot { border-left-color: #e0a73a; }
.sq-card.sq-cpu { border-left-color: #56616b; background: rgba(6, 9, 12, .9); }
.sq-lead { flex: 0 0 auto; }
.sq-name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 800; line-height: 1.25; color: #eef4ee; overflow-wrap: anywhere; }
.sq-me, .sq-owner { margin-left: 4px; font-size: 11px; color: #38bdf8; }
.sq-owner { color: #fbbf24; }
.sq-name .sq-me { color: #4ade4a; }
.sq-name .sq-owner { color: #fcfc38; }
.sq-cpu-name, .sq-open { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 800; color: #8a988e; }
.sq-open { font-weight: 700; color: #6f7f75; }
.sq-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex: 0 0 auto; }
.sq-tag { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 2px; background: #18222a; color: #c7d2c9; white-space: nowrap; }
.sq-tag.sq-race-terran { background: rgba(59, 130, 246, .22); color: #9cc8ff; }
.sq-tag.sq-race-zerg { background: rgba(168, 85, 247, .22); color: #dbb8ff; }
.sq-tag.sq-race-protoss { background: rgba(234, 179, 8, .2); color: #fde68a; }
.sq-tag.sq-ai { background: rgba(224, 167, 58, .16); color: #f1c878; }
.sq-tag.sq-off { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.sq-state { flex: 0 0 auto; min-width: 46px; text-align: right; font-size: 11px; font-weight: 800; }
.sq-ready { color: #4ade4a; }
.sq-wait { color: #7f8f84; }
.sq-card [data-removebot] { flex: 0 0 auto; }
.sq-slot { display: inline-flex; align-items: center; gap: 3px; min-width: 32px; }
.sq-slot > b { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
/* 빈 자리(원작의 「열림」): 누를 수 있으면 옮기기·참가·팀 바꾸기 */
.sq-seat, #starqraftRoot .sq-panel button.sq-seat {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 30px; padding: 4px 8px;
  border: 1px dashed #34414b; border-radius: 2px; background: rgba(0, 0, 0, .28); color: #6f7f75;
  font-size: 11.5px; font-weight: 700; text-align: left;
}
.sq-seat > b { flex: 0 0 auto; margin-left: auto; font-size: 11px; color: #56656b; }
#starqraftRoot .sq-panel button.sq-seat > b { color: #4ade4a; }
#starqraftRoot .sq-panel button.sq-seat:hover { border-color: #4ade4a; color: #cfe9cf; }
.sq-myrow { padding-top: 7px; border-top: 1px solid #1f2931; }
.sq-myrow + .sq-myrow { padding-top: 0; border-top: 0; }
.sq-slotpane .sq-label { min-width: 46px; }
.sq-slotpane .sq-help { margin-top: auto; }
/* 맵 칸 */
.sq-mapgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; }
.sq-preview { position: relative; justify-self: center; width: 192px; height: 192px; border: 1px solid #36434d; background: #000; }
/* 그림은 가장 긴 변 192px — 화면 픽셀이 더 많으면(DPR·확대) 흐리지 않게 계단으로 키운다. */
.sq-preview img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.sq-preview > b { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 76px; font-weight: 900; color: #fcfc38; text-shadow: 0 2px 0 #000, 0 0 18px rgba(252, 252, 56, .35); }
.sq-preview.sq-random, .sq-preview.sq-noimg {
  background: repeating-linear-gradient(0deg, transparent 0 15px, rgba(90, 110, 120, .2) 15px 16px),
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(90, 110, 120, .2) 15px 16px), #05090c;
}
.sq-preview.sq-random > b, .sq-preview.sq-noimg > b { display: flex; }
.sq-preview.sq-noimg img { display: none; }
.sq-mapinfo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sq-mapname { font-size: 14px; font-weight: 850; line-height: 1.3; color: #fcfc38; overflow-wrap: anywhere; }
.sq-facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 11px; line-height: 1.4; }
.sq-facts > div { display: flex; gap: 6px; min-width: 0; }
.sq-facts .sq-wide { grid-column: 1 / -1; }
.sq-facts dt { flex: 0 0 auto; font-weight: 700; color: #7f8f84; }
.sq-facts dd { margin: 0; min-width: 0; font-weight: 700; color: #dde6dd; overflow-wrap: anywhere; }
.sq-desc { margin: 0; font-size: 11px; line-height: 1.45; color: #b9c6bc; overflow-wrap: anywhere; }
.sq-settings, .sq-readonly, .sq-loading { padding-top: 8px; border-top: 1px solid #1f2931; }
.sq-settings { display: flex; flex-direction: column; gap: 6px; }
.sq-settings .sq-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.sq-settings .sq-label { color: #9fe89f; }
.sq-settings .sq-select[data-map] { width: 100%; max-width: none; }
.sq-genres { flex-wrap: nowrap; gap: 4px; }
.sq-genres .sq-select { flex: 1 1 0; min-width: 0; max-width: none; }
#starqraftRoot .sq-chip-static { display: inline-block; border: 1px solid #4ade4a; cursor: default; }
.sq-readonly { margin: 0; font-size: 11px; color: #8d9b91; }
.sq-readonly b { color: #fcfc38; }
.sq-loading { display: flex; flex-direction: column; gap: 6px; }
.sq-roompanel .sq-foot { padding-top: 10px; border-top: 1px solid #1f2931; }
.sq-status { display: flex; flex-direction: column; gap: 2px; margin-right: auto; min-width: 0; }
@container (min-aspect-ratio: 3/2) {
  .sq-panel.sq-roompanel { width: 1040px; }
  .sq-room { grid-template-columns: minmax(0, 1fr) 456px; }
  .sq-mapgrid { grid-template-columns: 192px minmax(0, 1fr); column-gap: 10px; }
  .sq-mapgrid > .sq-preview { grid-row: 1 / span 2; }
  .sq-mapgrid > :not(.sq-preview) { grid-column: 2; }
}
@container (max-aspect-ratio: 4/5) {
  .sq-panel.sq-roompanel { width: 420px; }
  .sq-room { grid-template-columns: minmax(0, 1fr); }
  .sq-mappane { order: -1; }
  .sq-mapgrid { grid-template-columns: 128px minmax(0, 1fr); column-gap: 10px; }
  .sq-preview { width: 128px; height: 128px; }
  .sq-preview > b { font-size: 52px; }
  .sq-mapgrid > .sq-mapinfo { grid-column: 2; }
  .sq-mapgrid > .sq-settings, .sq-mapgrid > .sq-readonly, .sq-mapgrid > .sq-loading { grid-column: 1 / -1; }
  .sq-settings .sq-row { grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 8px; }
}

/* ── 경기: 게임 화면 + 상단 정보줄 ─────────────────────────────────── */
.sq-game { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#starqraftRoot:not(.sq-in-game) .sq-game { display: none; }
.sq-game:fullscreen { width: 100vw; height: 100vh; }
.sq-surface { display: contents; }
.sq-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.sq-overlay > * { pointer-events: auto; }
.sq-topline {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 180px); padding: 3px 10px; border-radius: 999px; background: rgba(2, 6, 12, .62);
  font-size: 11px; white-space: nowrap; overflow: hidden;
}
#starqraftRoot:not(.sq-in-game) .sq-topline { display: none; }
/* 좁은 화면(모바일 세로)에서 관전 정보줄이 위 폭 예산(오른쪽 위 자원 자리를 비운 max-width)을 넘으면 자르지 않고
   줄 전체를 그 폭에 맞게 줄인다(client fitTopline, 사용자 요청 2026-09-28). 넉넉한 화면은 그대로다. */
.sq-topline.sq-fit { width: max-content; max-width: none; overflow: visible; transform: translateX(-50%) scale(var(--sq-bar-scale, 1)); transform-origin: 50% 0; }
.sq-vs { display: flex; gap: 6px; align-items: center; overflow: hidden; text-overflow: ellipsis; }
.sq-vs span { font-weight: 700; }
.sq-vs i { font-style: normal; color: #94a3b8; font-weight: 600; }
.sq-vs b { color: #fbbf24; }
.sq-vs .sq-out { text-decoration: line-through; opacity: .55; }
.sq-vs .sq-dc { color: #fca5a5; }
.sq-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 12px;
  background: rgba(2, 6, 12, .82); font-size: 13px; font-weight: 700; color: #e2e8f0;
}

/* 엔진 stage: fitStage()가 16:9 픽셀 크기를 정한다. 원작 콘솔 그림은 엔진 캔버스에, 글자는 .sq-ui(엔진 좌표
   852×480을 transform: scale로 확대)에 얹는다 — docs/starqraft.md §6.5. */
.sq-stage { position: relative; width: 852px; height: 480px; flex: 0 0 auto; overflow: hidden; }
/* 표시 캔버스는 원본을 정수배로 키운 것 — 브라우저가 화면 크기로 부드럽게 줄인다(sharp bilinear, docs/starqraft.md §6.10). */
.sq-screen { display: block; width: 100%; height: 100%; image-rendering: auto; touch-action: none; background: #000; }
.sq-cursor { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 50; image-rendering: pixelated; }
.sq-ui {
  position: absolute; left: 0; top: 0; width: 852px; height: 480px; transform-origin: 0 0; z-index: 10; pointer-events: none;
  contain: layout style; font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif; color: #e8e8e8;
  --sq-outline: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}
.sq-console-text, .sq-console-text * { pointer-events: none; }
.sq-console-text > *, .sq-stat > *, .sq-res > * { position: absolute; }
.sq-res, .sq-stat { position: absolute; inset: 0; }
/* 자원 막대 = 원작 statres: 글자 초록(색 코드 7), 보급 초과 때 사용 숫자만 빨강(색 코드 6) */
.sq-rcell { font-weight: 700; font-size: 11px; line-height: 16px; color: #10fc18; text-shadow: var(--sq-outline); white-space: nowrap; }
.sq-rcell .sq-rcap { color: #c81818; }
.sq-sname { text-align: center; font-size: 11px; font-weight: 700; color: #f4f4f4; line-height: 14px; white-space: nowrap; overflow: hidden; text-shadow: 1px 1px 0 #000; }
.sq-shp { text-align: center; font-size: 10px; font-weight: 700; line-height: 12px; white-space: nowrap; text-shadow: 1px 1px 0 #000; }
.sq-shield { color: #d8dcff; }
.sq-energy { color: #fff; }   /* 원작 에너지 줄은 흰색 글자색 코드 \x04 */
.sq-sline { font-size: 10px; line-height: 14px; color: #dcdcdc; white-space: nowrap; overflow: hidden; text-shadow: 1px 1px 0 #000; }
.sq-center { text-align: center; }
.sq-glvl { display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 3px 2px 0; font-weight: 800; font-size: 10px; line-height: 1; color: #fff; text-shadow: var(--sq-outline); }
/* 원작 statdata: 보급·자원 줄(-10~-13)은 작은 글꼴, 생산 대기열 숫자는 칸 오른쪽 아래(활성 1 = 기본색, 대기 2~5 = 노랑 \x03) */
.sq-sline.sq-small { font-size: 9px; }
.sq-qnum { display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 3px 2px 0; font-weight: 800; font-size: 10px; line-height: 1; color: #b8b8e8; text-shadow: var(--sq-outline); }
.sq-qnum.sq-qwait { color: #dcdc3c; }
#starqraftRoot .sq-cbtn {
  padding: 0; border: 0; border-radius: 3px; background: rgba(0, 0, 0, .55); color: #d4dcd4;
  font-weight: 700; font-size: 10px; line-height: 1; text-shadow: 1px 1px 0 #000; cursor: none;
}
#starqraftRoot .sq-cbtn.sq-hot { color: #fcfc38; background: rgba(20, 30, 20, .7); }
/* 원작 툴팁 상자(0x481510): 불투명 검정 바탕, 1px 파란 테(0,75,227), 글자 기본색 2(#b8b8e8), 단축키 노랑(#dcdc3c) */
.sq-tip {
  position: absolute; padding: 2px 4px; border: 1px solid rgb(0, 75, 227); border-radius: 0; background: #000;
  font-size: 10px; line-height: 13px; white-space: nowrap; color: #b8b8e8;
}
.sq-tip b { color: #dcdc3c; }
.sq-tip-r, .sq-tip-d { color: #b8b8e8; }
.sq-tip-l { padding-left: 12px; }   /* 회색 버튼 문자열의 둘째 줄부터(원작 「\n   」 들여쓰기) */
/* 정보 칸 상태 글자 — 원작 글자색 코드(\x06 빨강 · \x03 노랑 · \x07 초록 · \x04 흰색) */
.sq-sline.sq-st-red { color: #f40404; }
.sq-sline.sq-st-yellow { color: #fcfc38; }
.sq-sline.sq-st-green { color: #10fc18; }
.sq-sline.sq-st-white { color: #fff; }
.sq-tip-c { display: flex; gap: 8px; align-items: center; }
.sq-tip-c img { width: 12px; height: 12px; margin-right: 2px; vertical-align: -2px; image-rendering: pixelated; }

/* 채팅(원작처럼 왼쪽, 콘솔 위) · 인게임 입력 */
/* 원작 글 줄(0x48cf60): 11칸 고리, x 10..(화면 폭 − 10), y 112 + 16×칸 — 칸 자리는 런타임이 준다(top) */
.sq-chatlog { position: absolute; left: 10px; top: 112px; width: 832px; height: 176px; pointer-events: none; }
.sq-chatline { position: absolute; left: 0; right: 0; height: 16px; font-size: 11px; font-weight: 700; line-height: 16px; color: #b8b8e8; text-shadow: var(--sq-outline); white-space: nowrap; overflow: hidden; }
.sq-chatline.sq-sys { color: #dcdc3c; }
/* 원작처럼 콘솔 위 가운데에 얇게 뜬다(유닛 정보 칸 바로 위). */
/* 원작 입력 줄(?textbox.bin): 테란 (170,346) 폭 280, 저그 (190,338) 270, 프로토스 (190,338) 258 — 852 화면은 가운데 칸이 106px 오른쪽 */
.sq-chatin.sq-chatin-r1 { left: 276px; top: 346px; width: 280px; transform: none; }
.sq-chatin.sq-chatin-r0 { left: 296px; top: 338px; width: 270px; transform: none; }
.sq-chatin.sq-chatin-r2 { left: 296px; top: 338px; width: 258px; transform: none; }
.sq-chatin {
  position: absolute; left: 50%; top: 347px; transform: translateX(-50%); width: 400px; height: 17px; display: flex; gap: 5px; align-items: center;
  padding: 0 6px; border: 1px solid #56646f; background: rgba(0, 0, 0, .82); pointer-events: auto; font-size: 10.5px; color: #9fe8ff;
}
.sq-chatin input { flex: 1; min-width: 0; height: 15px; padding: 0; border: 0; outline: 0; background: transparent; color: #fff; font-weight: 700; font-size: 10.5px; line-height: 15px; }
/* 원작 오류 줄(0x48ccb0): 가운데, y 295, 흰색, 7초, 흐려짐 없음 */
.sq-toast {
  position: absolute; left: 50%; top: 295px; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: #fff;
  text-shadow: var(--sq-outline); white-space: nowrap; opacity: 0;
}
.sq-toast.show { opacity: 1; }
.sq-follow { position: absolute; left: 8px; top: 4px; padding: 2px 8px; border-radius: 3px; background: rgba(0, 0, 0, .6); font-size: 10px; font-weight: 700; color: #9fe8ff; }
/* 유즈맵(docs/starqraft.md §7): 트리거 글(원작 색 코드), 관전 세로 목록(오른쪽 위 자원 아래).
   카운트다운 = 원작 statres.bin -10 칸(자원 막대 왼쪽 220+212, 80×20, 큰 글꼴), 리더보드 = statlb.bin(왼쪽 위 0,0, 줄 14px, 배경 없음) */
.sq-chatline.sq-umsline { font-weight: 700; color: #b8e8ff; white-space: pre-wrap; }
.sq-ums-timer { position: absolute; left: 432px; top: 0; width: 80px; height: 20px; font-size: 13px; line-height: 20px; font-weight: 800; color: #b8b8e8; text-align: right; text-shadow: var(--sq-outline); white-space: nowrap; }
.sq-ums-lb { position: absolute; left: 0; top: 0; width: 200px; height: 112px; font-size: 11px; line-height: 14px; font-weight: 700; color: #b8e8ff; text-shadow: var(--sq-outline); pointer-events: none; }
.sq-ums-lbrow { position: absolute; left: 0; width: 200px; height: 14px; }
.sq-ums-lbrow > span { position: absolute; top: 0; white-space: nowrap; }
.sq-ums-lbbox { top: 2px !important; width: 10px; height: 10px; box-shadow: 0 0 0 1px #000; }
.sq-ums-lbicon > img { display: block; width: 14px; height: 14px; image-rendering: pixelated; }
.sq-ums-lblabel { display: inline; margin-left: 4px; white-space: pre; }
.sq-ums-obj { max-height: 260px; overflow-y: auto; padding: 4px 2px; font-size: 11px; line-height: 16px; font-weight: 700; text-align: left; }
.sq-ums-objline { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 16px; }
.sq-roster { position: absolute; right: 4px; top: 22px; display: flex; flex-direction: column; gap: 2px; max-width: 170px; pointer-events: auto; }
#starqraftRoot .sq-roster-item {
  display: flex; align-items: center; gap: 5px; padding: 2px 7px; border: 1px solid rgba(86, 100, 111, .8); border-radius: 3px;
  background: rgba(0, 0, 0, .62); color: #e8e8e8; font: 700 10.5px/14px 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-shadow: 1px 1px 0 #000;
}
#starqraftRoot .sq-roster-item > i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 2px; }
#starqraftRoot .sq-roster-item.sq-on { border-color: #9fe8ff; color: #9fe8ff; background: rgba(8, 40, 56, .8); }
#starqraftRoot .sq-roster-item.sq-out { color: #7c8894; text-decoration: line-through; }
#starqraftRoot .sq-roster-item.sq-dc { opacity: .6; }
.sq-roster.sq-roster-melee { max-width: 220px; }
#starqraftRoot .sq-roster-melee .sq-roster-item { overflow: visible; text-overflow: clip; }
.sq-roster-team { padding: 1px 7px; font-size: 10.5px; line-height: 14px; font-weight: 700; color: #9fe8ff; background: rgba(0, 0, 0, .62); }
.sq-lockhint {
  position: absolute; left: 50%; top: 290px; transform: translateX(-50%); padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .74); font-size: 10.5px; white-space: nowrap;
}
.sq-lockhint b { color: #fcfc38; }
.sq-banner { position: absolute; inset: 0 0 80px; display: flex; align-items: center; justify-content: center; }
.sq-banner span { font-size: 42px; font-weight: 800; text-shadow: 0 2px 16px rgba(0, 0, 0, .9); }
.sq-banner.sq-banner-err span { font-size: 18px; font-weight: 700; max-width: 90%; text-align: center; padding: 10px 16px; background: rgba(0, 0, 0, .7); border-radius: 6px; }

/* 게임 메뉴(F10) — 원작 Game Menu 자리(264 폭, 위에서 32px). 효과음·음악 줄을 나눠(원작 Ctrl+S·Ctrl+M) 한 줄 늘어서 간격을 줄였다 —
   유즈맵 메뉴(임무 목표 포함)도 480 안에 든다. */
.sq-dlg {
  position: absolute; left: 294px; top: 32px; width: 264px; display: flex; flex-direction: column; gap: 4px; padding: 8px 18px 10px;
  border: 2px solid #4b5a66; border-radius: 3px; background: rgba(6, 10, 14, .94); box-shadow: 0 8px 24px rgba(0, 0, 0, .7);
  pointer-events: auto; font-size: 11px;
  z-index: 20;   /* 원작처럼 메뉴 창이 맨 위 — 콘솔 글자 층(유닛 이름 등)이 DOM에서 뒤에 붙어 위로 겹쳤다 */
}
.sq-dlg-title { margin-bottom: 4px; text-align: center; font-size: 13px; font-weight: 800; color: #fcfc38; }
#starqraftRoot .sq-dlg button {
  width: 100%; padding: 5px 8px; border: 1px solid #3a4a58; border-radius: 2px; background: #0f171f; color: #e4e4e4;
  font-weight: 700; font-size: 11px; line-height: 1.3; text-align: center;
}
#starqraftRoot .sq-dlg button:hover { background: #1b2a38; color: #fcfc38; }
#starqraftRoot .sq-dlg button:disabled { opacity: .5; }
#starqraftRoot .sq-dlg .sq-dlg-danger { border-color: #6b2020; background: #2a0c0c; }
#starqraftRoot .sq-dlg .sq-dlg-main { margin-top: 4px; border-color: #6a6a3a; }
.sq-dlg-range { display: flex; align-items: center; gap: 8px; padding: 2px 2px; color: #dcdcdc; }
.sq-dlg-range input { flex: 1; min-width: 0; accent-color: #fcfc38; }
.sq-dlg.sq-dlg-help { left: 196px; width: 460px; gap: 4px; line-height: 1.5; }
.sq-dlg-help b { color: #fcfc38; }
/* 동맹 창: 엔진 좌표 안에서 최대 7명을 전부 표시하며, 실제 관계와 상대의 설정을 구분한다. */
.sq-dlg.sq-dlg-alliance { left: 146px; width: 560px; }
.sq-alliance-view { text-align: center; color: #9fe8ff; margin-bottom: 4px; }
.sq-alliance-head, .sq-alliance-row { display: grid; grid-template-columns: minmax(100px, 1fr) 38px 60px 60px minmax(120px, 1.2fr); gap: 8px; align-items: center; }
.sq-alliance-head { color: #b8b8e8; text-align: center; padding-bottom: 4px; border-bottom: 1px solid #34414b; }
.sq-alliance-row { min-height: 28px; padding: 3px 0; border-bottom: 1px solid #23313d; }
.sq-alliance-row > span { overflow-wrap: anywhere; }
.sq-alliance-row > input { justify-self: center; width: 14px; height: 14px; margin: 0; accent-color: #fcfc38; cursor: pointer; }
.sq-alliance-row > input:disabled { cursor: default; opacity: .45; }
.sq-alliance-row [data-a-incoming] { color: #b8b8e8; font-size: 10px; }

.sq-dlg-note { margin-top: 2px; color: #9aa4ad; font-size: 10px; }
/* Esc로 고정이 잠깐 풀린 동안(다음 클릭에 다시 고정) 페이지 어디에서도 OS 커서를 숨긴다 — 가상 커서만 보인다. */
html.sq-hide-cursor, html.sq-hide-cursor * { cursor: none !important; }

/* 관전 정보줄의 선수 이름 = 시점 따라가기 버튼 */
#starqraftRoot .sq-vs .sq-pick { padding: 1px 6px; border: 1px solid transparent; border-radius: 999px; background: none; font: inherit; font-weight: 700; color: inherit; }
#starqraftRoot .sq-vs .sq-pick:hover { border-color: #38bdf8; }
#starqraftRoot .sq-vs .sq-pick.sq-on { border-color: #38bdf8; background: rgba(56, 189, 248, .22); color: #e0f5ff; }

/* 결과 카드는 게임 화면 위에 뜬다. */
.sq-panel.sq-result { width: 520px; }
.sq-panel.sq-watch { width: 460px; }
/* 유즈맵 경기 화면: 확대 버튼 줄(sq-topline-mini)은 맨 윗줄 엔진 240칸, 선수 세로 목록은 런타임이 오른쪽 위에 그린다.
   관전 따라가기 안내(런타임 .sq-follow, 기본 왼쪽 위)는 리더보드를 피해 가운데 위로 옮긴다. */
#starqraftRoot.sq-ums .sq-follow { left: 50%; transform: translateX(-50%); white-space: nowrap; }

/* ── 신청 팝업 ─────────────────────────────────────────────────────── */
.sq-challenge { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; background: rgba(0, 0, 0, .45); }
.sq-challenge-card { min-width: 280px; padding: 18px 20px; border-radius: 16px; background: #0b1220; border: 1px solid #1e2b3d; color: #e2e8f0; text-align: center; }
.sq-challenge-card h3 { margin: 0 0 6px; }
.sq-challenge-card p { margin: 0 0 8px; }
.sq-challenge-time { margin-bottom: 12px; color: #94a3b8; font-size: 12px; }
.sq-challenge-card .sq-btn { font: inherit; padding: 8px 16px; border-radius: 10px; border: 1px solid #253247; background: #111a28; color: #e2e8f0; cursor: pointer; margin: 0 4px; }
.sq-challenge-card .sq-primary { background: #38bdf8; border-color: #38bdf8; color: #06121f; }
/* 참가자·유즈맵 화면은 원작처럼 비워 둔다 — 확대/축소 버튼 하나만, 전체화면 안내(.sq-fshint)와 같은 자리:
   맨 윗줄 리더보드(엔진 0~200)와 카운트다운(432~512) 사이의 엔진 240칸(사용자 결정 2026-10-05 — 왼쪽 위는 리더보드를 가렸다). */
.sq-topline.sq-topline-mini {
  left: calc(var(--sq-stage-x, 0px) + 240px * var(--sq-stage-s, 1)); top: calc(var(--sq-stage-y, 0px) + 3px * var(--sq-stage-s, 1));
  transform: none; padding: 0; background: none;
}
/* 모바일(바깥 「확대 (스타쿼래프트)」 버튼이 보이는 조건 — 위 #starqraftExpand와 같은 media)에서는 게임 안 「확대」를 숨긴다.
   게임 중에는 루트 「축소」(.sq-collapse)를 숨기므로 확대 상태의 「축소」는 남긴다(사용자 결정 2026-10-05). */
@media (pointer: coarse), (max-width: 900px) { #starqraftRoot:not(.sq-expanded) .sq-topline [data-toggle-expand] { display: none; } }
/* 마우스가 게임에 고정된 동안(커서가 게임 밖으로 못 나감)은 확대 버튼을 숨기고 전체화면 단축키만 작게 보인다(client paintFocusHint).
   자리는 맨 윗줄, 리더보드(엔진 좌표 0~200)와 카운트다운(432~512) 사이 빈칸의 엔진 240칸부터(사용자 결정 2026-10-04) —
   게임 화면 기준 좌표는 fitStage가 넘기는 --sq-stage-x/y/s, 좁은 화면에서 줄이는 배율은 --sq-fshint-k. */
.sq-topline.sq-focused [data-toggle-expand] { display: none; }
.sq-overlay > .sq-fshint {
  position: absolute; left: calc(var(--sq-stage-x, 0px) + 240px * var(--sq-stage-s, 1)); top: calc(var(--sq-stage-y, 0px) + 3px * var(--sq-stage-s, 1));
  transform: scale(var(--sq-fshint-k, 1)); transform-origin: 0 0; padding: 2px 8px; border-radius: 999px; background: rgba(2, 6, 12, .55);
  font-size: 10px; font-weight: 700; color: rgba(226, 232, 240, .75); white-space: nowrap; pointer-events: none;
}
.sq-overlay > .sq-fshint[hidden] { display: none; }
#starqraftRoot.sq-in-game:not(.sq-ending) .sq-collapse { display: none !important; }
#starqraftRoot.sq-ending .sq-topline { display: none; }
