/* ===========================================================================
   Plush Town UI — 「자정의 인형 가게」
   규격 문서: docs/UI.md  ← 색·치수·컴포넌트의 단일 기준. 여기 없는 색을 새로
   만들지 않는다. 빛은 **항상 위-왼쪽**에서 온다 (게임 안 조명과 같은 방향).
   =========================================================================== */

/* ── 갈무리11 (SIL OFL 1.1 · assets/fonts/LICENSE.txt) ─────────────────────
   비트맵에서 뽑은 서체라 11px·22px 에서만 또렷하다. 그 사이 크기는 쓰지 않는다. */
@font-face {
  font-family: Galmuri11;
  font-style: normal; font-weight: 400; font-display: swap;
  src: local('Galmuri11 Regular'), url('./assets/fonts/Galmuri11.woff2') format('woff2');
}
@font-face {
  font-family: Galmuri11;
  font-style: normal; font-weight: 700; font-display: swap;
  src: local('Galmuri11 Bold'), url('./assets/fonts/Galmuri11-Bold.woff2') format('woff2');
}

:root {
  /* ── 흑연 (중립 램프) ──
     ★ 베이스는 **무채색**이다. 예전엔 자두빛이 깔려 있었는데, 바탕에 색이
       있으면 캐릭터·게임 화면의 색과 싸운다. 바탕은 물러서고 포인트만 나선다. */
  --c-void:  #0c0c0f;
  --c-w9:    #141419;
  --c-w7:    #1d1d23;
  --c-w6:    #26262d;
  --c-w5:    #30303a;
  --c-w4:    #42424e;
  --c-w3:    #5a5a68;
  --c-w2:    #8b8b98;
  --c-w1:    #b9b9c4;
  --c-paper: #f2f2f6;

  /* ── 포인트 — 넷뿐이고 각자 뜻이 있다. 바탕이 무채색이라 **고채도**로 간다 ──
     분홍=고른 것 · 금=수치 · 민트=이어져 있음 · 주황=주의 · 풀=살아 있음 */
  --c-plush:   #ff5c8a;  --c-plush-d: #8f2547;
  --c-brass:   #ffc233;  --c-brass-d: #8a6108;
  --c-mint:    #2ee6b0;  --c-mint-d:  #10725a;
  --c-ember:   #ff5f3c;  --c-ember-d: #8c2a12;
  --c-moss:    #5ddc5d;

  /* 모서리 — 각지면 올드하고 투박하다. 도트 글씨는 그대로 두고 판만 둥글린다 */
  --r-sm: 4px;
  --r: 7px;
  --r-lg: 12px;

  /* 유리 — 게임 위에 뜨는 판. 알파 + 흐림, 글씨는 그 위에 온전히 */
  --glass: rgba(29, 29, 35, .62);
  --glass-on: rgba(29, 29, 35, .95);
  --blur: blur(10px) saturate(1.1);

  /* 역할 이름 (옛 이름 호환) */
  --bg: var(--c-w9);
  --fg: var(--c-paper);
  --dim: var(--c-w2);
  --line: var(--c-w4);
  --accent: var(--c-plush);
  --accent2: var(--c-mint);

  /* ── 도트 모서리 타일 (9슬라이스) — tools/make-frames.mjs 가 만든다 ──
     ★ 손으로 고치지 마라. 색을 바꿨으면 `node tools/make-frames.mjs --write` */
  --f-panel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%231d1d23'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-panel-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%231d1d23'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-card: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%2326262d'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-card-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%2326262d'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-raise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%2330303a'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-raise-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%2330303a'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%2342424e'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-hover-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%2342424e'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-sink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%23141419'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-sink-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%23141419'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-plush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%23ff5c8a'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-plush-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%23ff5c8a'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-brass: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%23ffc233'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-brass-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%23ffc233'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-mint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%232ee6b0'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-mint-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%232ee6b0'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-ember: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%23ff5f3c'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-ember-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%23ff5f3c'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%230c0c0f'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  --f-glass: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' shape-rendering='crispEdges'%3E%3Cg fill='%231d1d23' fill-opacity='0.38'%3E%3Crect x='4' y='1' width='1' height='7'/%3E%3Crect x='1' y='4' width='7' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='6' y='5' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='5' y='6' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='1' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3Crect x='4' y='7' width='1' height='1'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='4' y='8' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='6' y='2' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='6' y='6' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='5' y='1' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='5' y='7' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  --f-glass-lg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cg fill='%231d1d23' fill-opacity='0.38'%3E%3Crect x='8' y='2' width='1' height='13'/%3E%3Crect x='2' y='8' width='13' height='1'/%3E%3Crect x='4' y='6' width='2' height='2'/%3E%3Crect x='11' y='6' width='2' height='2'/%3E%3Crect x='4' y='9' width='2' height='2'/%3E%3Crect x='11' y='9' width='2' height='2'/%3E%3Crect x='6' y='4' width='2' height='2'/%3E%3Crect x='9' y='4' width='2' height='2'/%3E%3Crect x='6' y='11' width='2' height='2'/%3E%3Crect x='9' y='11' width='2' height='2'/%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='7' y='2' width='2' height='2'/%3E%3Crect x='8' y='13' width='2' height='2'/%3E%3Crect x='7' y='13' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Crect x='8' y='0' width='1' height='2'/%3E%3Crect x='8' y='15' width='1' height='2'/%3E%3Crect x='0' y='8' width='2' height='1'/%3E%3Crect x='15' y='8' width='2' height='1'/%3E%3Crect x='2' y='6' width='2' height='2'/%3E%3Crect x='13' y='6' width='2' height='2'/%3E%3Crect x='2' y='9' width='2' height='2'/%3E%3Crect x='13' y='9' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='11' y='4' width='2' height='2'/%3E%3Crect x='4' y='11' width='2' height='2'/%3E%3Crect x='11' y='11' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='9' y='2' width='2' height='2'/%3E%3Crect x='6' y='13' width='2' height='2'/%3E%3Crect x='9' y='13' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E");
  /* ── 타일 끝 ── */

  --u: 4px;              /* 격자. 모든 여백은 이것의 배수 */
  --fs: 11px;
  --lh: 16px;

  color-scheme: dark;
}

/* ── 면 — 이 UI 의 문법 ──────────────────────────────────────────────────
   ★ 모서리는 **온전한 픽셀 계단**이다. border-radius 는 안티에일리어싱된 곡선이라
     도트 글씨 옆에 놓으면 거기만 매끈해서 딴 물건처럼 보인다.
     그래서 계단을 그린 작은 SVG 타일을 네 모서리·네 변으로 늘려 붙인다.
     타일은 tools/make-frames.mjs 가 만든다 — 손으로 고치지 마라.

   ★ `border-width` 가 타일이 앉을 자리를 잡는다. box-sizing 이 border-box 라
     그만큼 안쪽이 줄어드니, 안여백은 그만큼 덜어서 적는다.
     작은 것(버튼·입력칸)은 4px, 큰 것(판·창)은 8px. */
.frame, .frame-lg {
  border-style: solid;
  border-color: transparent;
  border-radius: 0;
  border-image-repeat: stretch;
  image-rendering: pixelated;
  box-shadow: none;
}
.frame { border-width: 4px; border-image-slice: 4 fill; border-image-width: 4px; }
.frame-lg { border-width: 8px; border-image-slice: 8 fill; border-image-width: 8px; }

/* 작은 것 — 버튼·칩·입력칸·썸네일 */
button, .chip, input[type=text], input[type=search], select, textarea,
.thumb, #frame-strip button, .tabs button, input[type=color] {
  border-style: solid; border-color: transparent; border-width: 4px;
  border-radius: 0;
  border-image-slice: 4 fill; border-image-width: 4px; border-image-repeat: stretch;
  image-rendering: pixelated;
  box-shadow: none;
}
/* 큰 것 — 판·카드·창 */
.pt-panel, .panel, .stage-bar, .viewer, .anim-bar,
.pgroup, .pair, .tone-box, .slot, .adv, #frame-strip, .dialog,
.win, #chat-panel, .lobby-card, #editor-play {
  border-style: solid; border-color: transparent; border-width: 8px;
  border-radius: 0;
  border-image-slice: 8 fill; border-image-width: 8px; border-image-repeat: stretch;
  image-rendering: pixelated;
}

/* 어느 타일을 쓸까 */
button, .chip, .thumb { border-image-source: var(--f-raise); background: transparent; }
button:hover, .chip:hover, .thumb:hover { border-image-source: var(--f-hover); background: transparent; }
button:disabled { border-image-source: var(--f-card); background: transparent; }
button.on, .chip.on, .thumb.on, .tabs button.on {
  border-image-source: var(--f-plush); background: transparent; color: var(--c-void);
}
.chipgrid.add .chip.on { border-image-source: var(--f-mint); }
#frame-strip button { border-image-source: var(--f-card); background: transparent; }
#frame-strip button.on { border-image-source: var(--f-brass); background: transparent; }
.tabs button { border-image-source: none; background: transparent; }
.tabs button:hover { border-image-source: var(--f-card); }
input[type=text], input[type=search], select, textarea, input[type=color] {
  border-image-source: var(--f-sink); background: transparent;
}
#frame-strip { border-image-source: var(--f-sink-lg); background: transparent; }
.pt-panel, .panel, .stage-bar, .viewer, .anim-bar, .dialog,
.lobby-card, #editor-play {
  border-image-source: var(--f-panel-lg); background: transparent;
}
.pgroup, .pair, .tone-box, .slot, .adv {
  border-image-source: var(--f-card-lg); background: transparent;
}
.win, #chat-panel { border-image-source: var(--f-glass-lg); background: transparent; }

* { box-sizing: border-box; }

/* ★ [hidden] 은 **무조건** 이긴다.
   브라우저가 주는 `[hidden] { display: none }` 은 UA 규칙이라, 우리가 어딘가에
   `display: flex` 를 적어두면 그쪽이 이겨서 **el.hidden = true 가 아무 일도
   안 한다.** 이걸로 세 번 데였다 — 대화창이 안 닫히고, 무늬 줄이 안 숨고,
   좌우 비대칭 줄이 잠가도 그대로 보였다. 규칙 하나로 끝낸다.
   (숨기고 싶지 않은데 hidden 을 다는 경우는 없다) */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--c-w9);
  color: var(--fg);
  font-family: Galmuri11, 'Courier New', monospace;
  font-size: var(--fs);
  line-height: var(--lh);
  /* 도트 서체에 안티에일리어싱이 끼면 글자가 흐려진다 */
  -webkit-font-smoothing: none;
  font-smooth: never;
  /* 진짜 볼드 파일이 없는 글자에 가짜 볼드가 씌워지면 뭉갠다 */
  font-synthesis: none;
}

h1, h2, h3, h4 { font-weight: 400; }

/* 스크롤막대도 나무판이다 */
* { scrollbar-width: thin; scrollbar-color: var(--c-w4) var(--c-w9); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-w9); }
::-webkit-scrollbar-thumb { background: var(--c-w4); border: 2px solid var(--c-w9); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-w3); }
::selection { background: var(--c-plush); color: var(--c-void); }

/* ── 버튼 ────────────────────────────────────────────────────────────────
   누르면 베벨이 뒤집히고 1px 밀린다. 실제로 눌리는 판처럼. */
button {
  font: inherit; color: var(--c-w1);
  background: var(--c-w5);
  padding: 0 6px; min-height: 24px;
  cursor: pointer;
  transition: color .1s, background-color .1s, box-shadow .1s;
}
button:hover { color: var(--fg); background: var(--c-w4); }
button:active:not(:disabled) {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4);
  transform: translateY(1px);
}
button:disabled { color: var(--c-w3); background: var(--c-w6); cursor: default; }
button:focus-visible { outline: 2px solid var(--c-mint); outline-offset: 2px; }

/* 켜진 것 = 분홍. 강조색은 전부 밝으니 글씨는 검게. */
button.on {
  background: var(--c-plush); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
button.on:hover { background: #ff7ba1; color: var(--c-void); }

/* 판 위에 얹힌 조용한 버튼 — 테두리만 남긴다 */
button.ghost {
  background: transparent;
  border-color: var(--c-w4);
  box-shadow: none;
}
button.ghost:hover { background: var(--c-w5); }
button.tiny { padding: 0 2px; min-height: 24px; }

/* ── 입력칸 ──────────────────────────────────────────────────────────── */
input[type=text], input[type=search], select, textarea {
  font: inherit; color: var(--fg);
  background: var(--c-w9);
  padding: 0 5px; min-height: 24px;
}
/* ★ select 는 두고 보면 안 된다. 브라우저가 자기 화살표를 그려서 도트 화면
   한가운데에 OS 위젯이 하나 박힌다 — 통일감을 가장 먼저 깨는 자리다.
   지우고 2px 블록으로 쌓은 삼각형을 직접 그린다. */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 18px;
  background-image:
    linear-gradient(var(--c-plush) 0 0), linear-gradient(var(--c-plush) 0 0),
    linear-gradient(var(--c-plush) 0 0);
  background-size: 10px 2px, 6px 2px, 2px 2px;
  background-position: right 3px top 9px, right 5px top 11px, right 7px top 13px;
  background-repeat: no-repeat;
}
select:disabled { color: var(--c-w3); }
input[type=text]:focus, select:focus, textarea:focus {
  outline: none; color: var(--fg);
  border-color: var(--c-plush);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 2px rgba(255, 92, 138, .25);
}
input::placeholder { color: var(--c-w3); }

/* 색 고르는 칸 — 브라우저 기본 테두리를 걷어내고 나무틀에 끼운다 */
input[type=color] {
  width: 32px; height: 24px; padding: 0; flex: none;
  cursor: pointer; overflow: hidden;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 2px; }
input[type=color]:disabled { opacity: .4; cursor: default; }

/* ── 체크상자 — 도트 체크표 ──────────────────────────────────────────── */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: none;
  width: 14px; height: 14px; margin: 0;
  background: var(--c-w9);
  border: 1px solid var(--c-w4);
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
  cursor: pointer;
}
input[type=checkbox]:checked { background: var(--c-mint); border-color: var(--c-mint-d); }
/* 2px 블록 다섯 개로 그린 체크표 */
input[type=checkbox]:checked::after {
  content: ''; position: absolute; left: 1px; top: 4px;
  width: 2px; height: 2px; color: var(--c-void); background: currentColor;
  box-shadow: 2px 2px 0, 4px 0 0, 6px -2px 0, 8px -4px 0;
}
input[type=checkbox]:focus-visible { outline: 2px solid var(--c-mint); outline-offset: 2px; }

/* ── 슬라이더 — 홈은 파이고 손잡이는 솟는다 ──────────────────────────── */
input[type=range] {
  appearance: none; -webkit-appearance: none;
  height: 16px; background: none; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; background: var(--c-w9);
  border: 1px solid var(--c-void); border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 12px; height: 12px; margin-top: -4px; border-radius: 50%;
  background: var(--c-plush); border: 1px solid var(--c-plush-d);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
input[type=range]::-moz-range-track {
  height: 6px; background: var(--c-w9); border: 1px solid var(--c-void); border-radius: 999px;
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-plush); border: 1px solid var(--c-plush-d);
}
input[type=range]:disabled::-webkit-slider-thumb { background: var(--c-w3); }
input[type=range]:focus-visible { outline: 2px solid var(--c-mint); outline-offset: 2px; }

/* ── 판 ──────────────────────────────────────────────────────────────── */
.pt-panel, .panel, .stage-bar, .viewer, .anim-bar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

/* ── 유리 — 게임 위에 뜨는 판 ──────────────────────────────────────────
   ★ 한때 2px 디더로 비치게 했는데 **글씨가 안 읽혔다.** 체커가 글자 획 사이로
     비쳐서 눈이 아팠다. 투명은 그냥 알파로, 뒤는 흐림으로 눌러 둔다. */
.pt-glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

/* ── 상단바 ──────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: var(--c-w7);
  border-bottom: 2px solid var(--c-void);
  box-shadow: inset 0 2px 0 var(--c-w5);
}
.topbar h1 { margin: 0; font-size: 22px; line-height: 32px; letter-spacing: 0; }
.topbar h1 span { color: var(--c-plush); }
.topbar .sub { margin: 0; color: var(--c-w2); }
.spacer { flex: 1; }

/* ── 첫 화면 ─────────────────────────────────────────────────────────────
   캐릭터를 보고 · 저장해둔 것 중에 고르고 · 이름을 적고 · 들어간다. 그뿐이다.
   ★ 안에 든 무대·옷장·이름칸은 에디터와 **같은 물건**을 옮겨 온 것이라,
     여기서는 담을 자리만 만들고 생김새는 원래 규칙에 맡긴다. */
.lobby { display: grid; place-items: start center; padding: 16px 12px 24px; }
.lobby-card {
  width: min(520px, 94vw);
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
}
/* 무대는 에디터에서 flex:1 로 늘어난다. 여기서도 늘어날 자리를 준다 */
.lobby-stage { display: flex; min-height: 280px; }
/**
 * ★ 첫 화면에서는 캐릭터도 판 안에 **맞춰 줄인다.** 에디터는 도트를 정확히
 *   봐야 해서 원래 크기로 두고 넘치면 밀어 보지만, 첫 화면은 구경하는 자리라
 *   좁은 폰에서 캐릭터가 판 밖으로 나가면 그게 더 이상하다.
 */
.lobby-stage #stage { height: 40vh; min-height: 280px; }
.lobby-h {
  margin: 2px 0 0; color: var(--c-brass);
  border-bottom: 2px solid var(--c-w5); padding-bottom: 4px;
}
/* 옷장이 길어져도 첫 화면이 통째로 늘어나지 않게 */
.lobby-skins { max-height: 210px; overflow-y: auto; }
.lobby-skins .thumbs { margin-top: 0; }

/* 이름 칸 + 시작 단추. 첫 화면과 에디터를 오간다 */
#playbar { display: flex; align-items: center; gap: 8px; }
#playbar #name-input { flex: 1; min-width: 0; }
#playbtns { display: flex; align-items: center; gap: 8px; }

/**
 * 시작 단추 — 이 화면에서 **제일 하고 싶은 일**이다. 나머지와 같은 크기·같은
 * 색으로 두면 어디를 눌러야 하는지 한 번 훑어봐야 한다.
 */
#btn-enter.big {
  min-height: 36px; padding: 0 22px; font-size: 14px;
  /* 포인트컬러 — 이 판의 "고른 것" 색을 그대로 쓴다 (button.on 과 같은 타일).
     새 색을 들이면 포인트가 다섯이 되고, 그때부터 어느 것도 눈에 안 띈다 */
  border-image-source: var(--f-plush);
  background: transparent;
  color: var(--c-void);
}
/* 테두리 타일을 바꾸면 조각 크기(slice)가 안 맞아 일그러진다. 밝기만 올린다 */
#btn-enter.big:hover { filter: brightness(1.15); }

/* 첫 화면에서는 이름 아래 한 줄, 가운데로 */
#lobby-play #playbar { flex-direction: column; align-items: stretch; gap: 10px; }
#lobby-play #playbtns { justify-content: center; }
/* 에디터에서는 캐릭터 위에 판 하나로 앉는다.
   ★ 첫 화면에 있는 동안은 이 자리가 비니까 빈 테두리가 남지 않게 접는다 */
#editor-play { padding: 8px; }
#editor-play:empty { display: none; }

/* ── 레이아웃 ────────────────────────────────────────────────────────── */
.layout[hidden] { display: none; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px var(--panel-w, 440px);
  gap: 8px;
  padding: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel-grip { display: none; }
}

.panel-grip {
  align-self: stretch; min-height: 240px;
  cursor: col-resize; background: transparent;
}
.panel-grip::after {
  content: ''; display: block;
  width: 4px; height: 100%; margin: 0 auto;
  background: var(--c-w5);
  border-left: 2px solid var(--c-void); border-right: 2px solid var(--c-void);
}
.panel-grip:hover::after, .panel-grip.dragging::after { background: var(--c-plush); }
body.resizing-panel { cursor: col-resize; user-select: none; }

.stage-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* ===========================================================================
   뷰어 — 캐릭터를 보는 곳 (docs/UI.md §7)
   왼쪽은 보는 곳, 오른쪽은 고치는 곳. 방향·동작·프레임이 전부 여기 있다.
   =========================================================================== */
.viewer { display: flex; align-items: stretch; gap: 8px; padding: 4px; }

.viewer-stage {
  flex: 1; min-width: 0;
  /* 위: 8방향 시트 (폭에 맞춰 늘었다 줄었다) · 아래: 캐릭터. 배경은 한 장이다 */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 12px; overflow: auto;
  /* 투명 체커 — 무채색이라 어떤 색 캐릭터든 읽힌다 */
  background: repeating-conic-gradient(#c8c8ce 0% 25%, #b0b0b8 0% 50%) 0 0 / 16px 16px;
  border: 1px solid var(--c-void);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35);
}
#stage { image-rendering: pixelated; display: block; }
/**
 * 8방향 시트 — 캐릭터 위에 작게.
 * ★ 캔버스 픽셀 수는 그대로 두고 **CSS 폭만** 늘렸다 줄인다. 패널을 끌어
 *   무대가 넓어지면 같이 커지고, 좁히면 같이 작아진다. 원본(512px)보다는
 *   안 키운다 — 도트가 흐물거려 보인다.
 */
#sheet {
  image-rendering: pixelated; display: block;
  width: 100%; max-width: 512px; height: auto;
  flex: none;
}

/* 오른쪽 세로 기둥 — 방향 조작 */
.viewer-side {
  flex: none; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: flex-start;
}
.viewer-side .cap {
  color: var(--c-w2); text-align: center;
}
.dpad { display: grid; grid-template-columns: repeat(3, 32px); gap: 2px; flex: none; }
.dpad button { padding: 0; height: 32px; min-height: 0; font-size: 11px; }
/* 지금 보고 있는 방향 */
.dpad button.on { background: var(--c-plush); color: var(--c-void); }
.dpad .spin { color: var(--c-mint); }
.dpad .spin.on { background: var(--c-mint); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.viewer-side .dirname {
  color: var(--c-brass); text-align: center; min-width: 98px;
}

/* ── 동작 띠 ─────────────────────────────────────────────────────────── */
.anim-bar { padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 8px; }
.anim-row { display: flex; align-items: flex-start; gap: 8px; }
.anim-row > .lbl {
  flex: none; width: 48px; color: var(--c-w2); padding-top: 2px;
}
.chipgrid { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.chip {
  font: inherit; color: var(--c-w1); background: var(--c-w5);
  padding: 0 6px; min-height: 24px; cursor: pointer;
  transition: color .1s, background-color .1s;
}
.chip:hover { color: var(--fg); background: var(--c-w4); }
.chip.on {
  background: var(--c-plush); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
/* 겹쳐 재생하는 것은 민트 — 「이어져 있음」 */
.chipgrid.add .chip.on {
  background: var(--c-mint);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

/* 재생 조작 */
.transport { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.transport button { min-width: 32px; padding: 0 3px; text-align: center; }
/* 기호 하나짜리는 조금 넓게 — ⏸ 와 ▶ 의 폭이 달라서 눌러도 안 흔들리게 */
.transport button.icon { min-width: 36px; font-size: 13px; }
#btn-play { min-width: 52px; }
#btn-play.playing { color: var(--c-mint); }
.transport .readout {
  color: var(--c-brass); margin-left: auto;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* 프레임 띠 — 칸 하나가 한 프레임. 점이 찍힌 칸은 키프레임. */
#frame-strip {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 2px; min-height: 32px;
}
#frame-strip button {
  position: relative;
  min-width: 26px; min-height: 24px; padding: 0;
  font-variant-numeric: tabular-nums;
  color: var(--c-w2); background: var(--c-w6);
}
#frame-strip button:hover { color: var(--fg); }
#frame-strip button.on {
  background: var(--c-brass); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}
/* 키가 실제로 있는 프레임 — 밑에 점 */
#frame-strip button.key::after {
  content: ''; position: absolute; left: 50%; bottom: 1px;
  width: 2px; height: 2px; margin-left: -1px;
  background: var(--c-mint);
}
#frame-strip button.on.key::after { background: var(--c-void); }
#frame-strip .empty { color: var(--c-w3); padding: 2px 6px; }

/* ── 보기 설정 줄 ────────────────────────────────────────────────────── */
.stage-bar { padding: 4px 8px; display: flex; flex-direction: column; gap: 6px; }
.stack { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row > span { width: 40px; color: var(--c-w2); flex: none; }
.row input[type=range] { flex: 1; min-width: 60px; }
.row output { width: 48px; text-align: right; color: var(--c-w1); font-variant-numeric: tabular-nums; }
.toggles { flex-wrap: wrap; gap: 4px 12px; }
.toggles label, .chk {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--c-w2); cursor: pointer;
}
.toggles label:hover, .chk:hover { color: var(--fg); }

/* 밝은 배경을 골랐을 때, 그 위에 직접 얹히는 글자만 어둡게 뒤집는다 */
body.bg-light .sheet-head { color: #26262d; }

/* ── 배경색 지정 줄 ──────────────────────────────────────────────────── */
.bgrow { gap: 6px; flex-wrap: wrap; }
.bgrow > button { padding: 0 5px; min-height: 24px; }
.swatches { display: flex; gap: 2px; }
/**
 * ★ 단추의 픽셀 테두리를 **벗긴다.** 테두리 그림이 색 위에 얹히면 정작 무슨
 *   색인지가 안 보인다 (테두리가 안쪽까지 먹어서 색이 몇 픽셀만 남았다).
 *   여기 필요한 건 네모 안의 색 하나뿐이다.
 */
.swatches button {
  width: 22px; height: 22px; min-height: 0; padding: 0;
  border: 1px solid var(--c-void);
  border-image: none;
  border-radius: 2px;
  box-shadow: none;
}
.swatches button:hover { border-color: var(--c-w1); }
.swatches button.on { border-color: var(--c-plush); box-shadow: 0 0 0 1px var(--c-plush); }

#sheet { image-rendering: pixelated; display: block; }

/* ── 오른쪽 패널 ─────────────────────────────────────────────────────── */
.panel { overflow: hidden; display: flex; flex-direction: column; }
/* 무리 탭은 판이 준 높이 안에서만 스크롤한다 */
.panel .tab { flex: 1; min-height: 0; }

/* ★ 넓은 화면에서는 에디터가 **창을 꽉 채우고 페이지는 안 구른다.**
   기둥마다 제 안에서만 스크롤한다. 예전엔 판이 sticky 였는데, 화면 맨 위로
   스크롤하기 전에는 판 아래가 창 밖으로 삐져나가서 목록 끝을 보려면 페이지를
   먼저 내려야 했다. 높이를 flex 로 나눠 주면 삐져나갈 자리가 없다.
   (좁은 화면은 그대로 둔다 — 폰에서 칸마다 따로 구르면 손이 헷갈린다) */
@media (min-width: 901px) {
  body:not(.in-game) {
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .topbar { flex: none; }
  #screen-game { flex: none; }
  .layout { flex: 1; min-height: 0; align-items: stretch; }
  .stage-col { overflow-y: auto; min-height: 0; }
  .panel { min-height: 0; }
  /* 게임 위에 얹힌 에디터는 자기가 fixed 라 flex 바깥이다. 높이는 inset 이 준다 */
  body.live-edit .layout { min-height: 0; }
}
.tabs {
  display: flex; gap: 2px; padding: 2px 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.tabs button {
  flex: 1; padding: 0; min-height: 28px;
  color: var(--c-w2); background: transparent; border-color: transparent;
}
.tabs button:hover { background: transparent; }
.tabs button.on {
  background: var(--c-plush); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.tab { padding: 10px; overflow-y: auto; }
.tab.hidden { display: none; }
.tab h3 {
  margin: 16px 0 6px; color: var(--c-brass);
  border-bottom: 2px solid var(--c-w5); padding-bottom: 4px;
}
.tab h3:first-child { margin-top: 0; }

/* ── 오버레이 · 대화상자 ─────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(12, 12, 15, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }

/* ── 구석에 뜨는 작은 팝업 ───────────────────────────────────────────────
   ★ 화면을 덮지 않는다. 답하기 전에도 걸어다니고 대화할 수 있다 —
     남이 부른 것 때문에 내 놀이가 멈추면 안 된다.
   ★ 창(마을 사람·가방)보다 위에 온다. 잠깐 떴다 답하면 사라지는 것이라
     그 아래 깔려 못 찾는 편이 훨씬 나쁘다.
   ★ 좁은 화면에서는 폭을 화면에 맞춘다. */
.corner-pop {
  /* ★ fixed 다 — 이 팝업은 무대 밖(body 바로 아래)에 놓여 있어서, absolute 로
       두면 어느 조상을 기준으로 삼을지가 화면 구조에 따라 흔들린다. */
  position: fixed; right: 12px; bottom: 12px; z-index: 160;
  max-width: min(320px, calc(100vw - 24px));
  animation: cornerPop .18s ease-out;
}
.corner-pop[hidden] { display: none; }
.corner-pop .dialog {
  min-width: 0; box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.corner-pop .dialog h2 { font-size: 16px; line-height: 22px; }
.corner-pop .dialog p { margin: 0 0 8px; font-size: 12px; }
@keyframes cornerPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.dialog {
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  padding: 10px 14px; min-width: 300px;
}
.dialog h2 { margin: 0 0 4px; font-size: 22px; line-height: 32px; color: var(--c-plush); }
.dialog p { margin: 0 0 12px; color: var(--c-w2); }
.dialog input[type=text] { width: 100%; margin-bottom: 12px; }
.dialog .row { justify-content: flex-end; gap: 8px; }

/* ── 파츠 썸네일 ─────────────────────────────────────────────────────── */
.pgroup {
  padding: 4px 6px 6px;
  margin-bottom: 8px;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sublabel { color: var(--c-w2); margin-top: 6px; }
.pgroup .thumbs.side, .pgroup .sublabel { display: none; }
.pgroup.split .thumbs.both { display: none; }
.pgroup.split .thumbs.side { display: flex; }
.pgroup.split .sublabel { display: block; }
.pgroup .pair-head .lk { margin-left: 6px; padding: 0 3px; min-height: 24px; }

.thumb {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0; width: 58px; flex: none;
  color: var(--c-w2);
  cursor: pointer;
}
.thumb canvas {
  image-rendering: pixelated;
  width: 44px; height: 44px; display: block; flex: none;
  background: repeating-conic-gradient(rgba(255, 255, 255, .07) 0% 25%, transparent 0% 50%) 0 0 / 8px 8px;
}
.thumb span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thumb:hover { color: var(--fg); background: var(--c-w4); }
.thumb.on {
  background: var(--c-plush); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.thumb.none { justify-content: center; height: 68px; }

/* ── 설정창 ──────────────────────────────────────────────────────────── */
.dialog.wide { width: min(540px, 94vw); max-height: 86vh; overflow-y: auto; }
.dialog.wide h3 {
  margin: 14px 0 6px; color: var(--c-brass);
  border-bottom: 2px solid var(--c-w5); padding-bottom: 4px;
}
.dialog.wide h3:first-of-type { margin-top: 0; }
.srow { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.srow .lb { width: 68px; flex: none; color: var(--c-w2); }
.srow input[type=range] { flex: 1; min-width: 0; }
.srow output { width: 46px; flex: none; text-align: right; color: var(--c-w1); }
.srow select { flex: 1; min-width: 0; }
table.keys { width: 100%; border-collapse: collapse; }
table.keys td { padding: 3px 0; vertical-align: top; }
table.keys td:first-child { width: 84px; color: var(--c-w2); }
table.keys em { font-style: normal; color: var(--c-ember); }
#btn-settings, #btn-settings-game { padding: 2px 8px; }

/* ── 실험실 ────────────────────────────────────────────────────────────
   ★ 판 안의 다른 것들과 **같은 세로선**에 맞춘다. 탭 내용은 12px 안여백을
     갖는데 여기만 0 이라 버튼이 판 가장자리에 붙어 혼자 삐뚤어 보였다.
   ★ flex: none — 판이 세로 flex 라 안 박아두면 남는 높이를 먹고 늘어난다. */
.lab {
  flex: none;
  margin: 0; padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.lab[hidden] { display: none; }
.lab > summary {
  cursor: pointer; color: var(--c-w2);
  list-style: none; user-select: none; padding: 2px 0;
}
.lab .note { margin: 6px 0 0; }
.lab .saverow { margin: 6px 0 0; }
.lab > summary::-webkit-details-marker { display: none; }
.lab > summary::before { content: '▸ '; }
.lab[open] > summary::before { content: '▾ '; }
.lab > summary:hover { color: var(--fg); }

/* ── 저장 탭 ─────────────────────────────────────────────────────────── */
.saverow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.saverow input { flex: 1; min-width: 0; }
.thumb .slotname {
  color: var(--c-w2); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thumb.on .slotname { color: var(--c-void); }
/* ── 저장된 모습 목록 ──────────────────────────────────────────────────────
   ★ 예전엔 파츠 썸네일과 같은 격자에 「이름·덮기·복사·삭제」를 밑에 욱여넣었다.
     칸 너비(84px)를 넘어가는 순간 오른쪽 단추가 **그냥 잘려서 안 보였다.**
     칸 수가 늘 것까지 생각하면 격자가 아니라 **줄 목록**이 맞다 —
     세로로 쌓이니 몇 개가 되든 스크롤 한 번으로 끝나고, 단추 자리도 넉넉하다. */
#skin-slots { display: flex; flex-direction: column; gap: 4px; }
#skin-slots .thumb {
  flex-direction: row; align-items: center; gap: 8px;
  width: 100%; padding: 4px 6px; text-align: left;
}
/**
 * ★ **셀과 1:1 이다** (64칸 -> 64px).
 *   예전엔 64칸 그림을 36px 로 **눌러** 담았다 — 도트는 줄이는 순간 줄이 걸러
 *   빠져 뭉갠다. 지금은 그리는 쪽이 **얼굴만 36칸 잘라** 오므로 1:1 이다.
 *   칸이 작아야 목록이 길어져도 세로를 안 먹는다.
 */
#skin-slots .thumb canvas { width: 42px; height: 42px; flex: none; }
#skin-slots .thumb .slotname {
  flex: 1 1 auto; min-width: 0; text-align: left;
}
.thumb .slotbtns { display: flex; gap: 2px; flex: none; }
.thumb .slotbtns i {
  font-style: normal; line-height: 20px; padding: 0 6px;
  border: 1px solid var(--c-w4);
  color: var(--c-w1); cursor: pointer; white-space: nowrap;
}
.thumb.on .slotbtns i { color: var(--c-plush-d); border-color: var(--c-plush-d); }
.thumb .slotbtns i:hover { background: var(--c-ember); color: var(--c-void); border-color: var(--c-ember); }
/* 손가락으로 누르는 화면에서는 단추가 더 커야 한다 */
@media (pointer: coarse) {
  .thumb .slotbtns i { line-height: 30px; padding: 0 10px; }
}

/* ===========================================================================
   플레이 화면
   =========================================================================== */
body.in-game .topbar { display: none; }
body.in-game { overflow: hidden; }
/* ★ 폰에서 100vh 는 주소창에 가린 높이까지 포함한다. 그대로 쓰면 화면 맨 아래가
   브라우저 막대 뒤로 숨어서 거기 둔 점프·문 버튼이 잘려 보인다. */
#screen-game {
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: var(--app-h, 100dvh);
}
#screen-game[hidden] { display: none; }

.game-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--c-w7);
  border-bottom: 2px solid var(--c-void);
  box-shadow: inset 0 2px 0 var(--c-w5);
}
#game-who { color: var(--c-plush); }
.game-stage {
  flex: 1; min-height: 0; display: grid; place-items: center;
  background: var(--c-void); overflow: hidden;
  position: relative;
  touch-action: none; overscroll-behavior: none;
}
#game-canvas { image-rendering: pixelated; display: block; touch-action: none; }

/* 지금 어느 구역인지 */
.zone-tag {
  flex: none; padding: 1px 9px; border-radius: 999px;
  background: var(--c-w5); color: var(--c-moss);
  border: 1px solid var(--c-void);
}
.zone-tag[data-zone="cave"] { color: var(--c-w1); }
.zone-tag[data-zone="climb"] { color: var(--c-mint); }

/* 모은 금화 — 놋쇠는 「수치」다 */
.gold {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 1px 9px; border-radius: 999px;
  background: var(--c-w5); color: var(--c-brass);
  border: 1px solid var(--c-void);
  font-variant-numeric: tabular-nums;
}
.gold b { font-weight: 400; }
@keyframes goldpop {
  0% { background: var(--c-w5); }
  30% { background: var(--c-brass); color: var(--c-void); }
  100% { background: var(--c-w5); }
}
.gold.pop { animation: goldpop .45s steps(3, end); }

.emotes { display: flex; gap: 3px; }
.emotes button { padding: 0 4px; min-height: 24px; }
.emotes button kbd { font: inherit; color: var(--c-w3); margin-left: 4px; }
.emotes button:hover kbd { color: var(--c-mint); }

/* 닫은 창을 다시 여는 단추들 */
.dock { display: inline-flex; gap: 2px; margin-left: 4px; }
.dock button { padding: 0 3px; color: var(--c-w3); }
.dock button.on { color: var(--c-mint); }

/* ── 접속한 채로 에디터에 와 있을 때 위에 뜨는 띠 ───────────────────── */
#live-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--c-w7);
  border-bottom: 2px solid var(--c-void);
  box-shadow: inset 0 2px 0 var(--c-w5);
}
#live-bar[hidden] { display: none; }
#live-bar .dot { width: 8px; height: 8px; background: var(--c-moss); flex: none; }
/* 부드럽게 숨쉬는 대신 도트답게 딱딱 끊어 깜빡인다 */
@keyframes livepulse { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .15; } }
#live-bar .dot { animation: livepulse 1.2s steps(1, end) infinite; }
#live-bar .sub { color: var(--c-w2); }

/* ── 접속한 채로 아바타 고치기 ───────────────────────────────────────── */
body.live-edit #screen-editor {
  position: fixed; inset: 52px 20px 20px; z-index: 70;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--r-lg);
  background: var(--c-w9);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .6);
}
body.live-edit .layout { padding: 10px; }
/* 창 밖은 마을이다. 디더로 덮어서 창에 눈이 가게 한다 */
body.live-edit #screen-game::after {
  content: ''; position: fixed; inset: 0; z-index: 55; pointer-events: none;
  background: rgba(12, 12, 15, .5);
}
/* ★ TV iframe 은 캔버스 위에 뜨는 물건이라 안 숨기면 창을 뚫고 나온다 */
body.live-edit #chat-panel,
body.live-edit #roster,
body.live-edit #tv-panel,
body.live-edit #tv-screen { display: none !important; }

/* ── 터치 조작 ────────────────────────────────────────────────────────
   ★ 조이스틱은 자리가 정해져 있지 않다. 손가락을 대는 곳에 생긴다. */
/* 대사창 — 스크린(z 8)보다 위. 조작 단추(z 7)보다도 위여야 대사가 안 가린다 */
#talk-layer {
  position: absolute; inset: 0; z-index: 9;
  pointer-events: none; image-rendering: pixelated;
}
#talk-layer[hidden] { display: none; }

#touch { position: absolute; inset: 0; pointer-events: none; z-index: 7; touch-action: none; }
#touch[hidden] { display: none; }
#touch-stick {
  position: absolute; width: 128px; height: 128px; margin: -64px 0 0 -64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  border: 2px solid rgba(255, 255, 255, .26);
}
#touch-stick[hidden] { display: none; }
#touch-stick i {
  position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: var(--c-plush); border: 2px solid var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
/* ★ 버튼은 각자 제자리에 못 박는다. 나란히 쌓아두면 문 버튼이 떴다 사라질 때마다
   점프 버튼이 오르내려서, 뛰려던 손가락이 딴 걸 누른다. */
#touch-acts {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 76px; height: 76px;
}
#touch-acts button {
  position: absolute; right: 0;
  pointer-events: auto;
  width: 76px; height: 76px; min-height: 0; border-radius: 50%;
  font-size: 22px; line-height: 1;
  color: var(--c-paper); background: var(--c-w5);
  border: 2px solid var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  touch-action: none; user-select: none;
}
#touch-acts button[hidden] { display: none; }
#touch-acts button:active {
  background: var(--c-plush); color: var(--c-void); transform: none;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35);
}
#touch-jump { bottom: 0; }
#touch-up { bottom: 84px; }
/* 상호작용(좌판·낚시) — 문 버튼 위. 마을에서는 문 버튼이 안 뜨니 대개 비어 있다 */
#touch-act { bottom: 168px; font-size: 15px; }
/* 건너뛰기 — 상호작용 단추 왼쪽. 대화 중에만 뜬다 */
#touch-acts #touch-skip {
  bottom: 168px; right: 84px; width: 92px; font-size: 13px; border-radius: 999px;
}
#touch-act.hot { background: var(--c-brass); color: var(--c-void); }

/* 감정표현 — 조작 버튼들과 **같은 오른쪽 기둥**에 세운다.
   ★ 처음엔 왼쪽 아래에 뒀는데 거기는 대화창 자리다. 버튼이 창 위에 얹혀서
     대화를 읽으려면 버튼을 피해 눌러야 했다. 창은 왼쪽, 조작은 오른쪽으로 가른다. */
#touch-emotes {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(272px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 6px;
}
#touch-emote {
  pointer-events: auto; flex: none; order: 2;
  width: 58px; height: 58px; min-height: 0; border-radius: 50%;
  font-size: 13px; color: var(--c-w1); background: var(--c-w5);
  border: 2px solid var(--c-void); touch-action: none; user-select: none;
}
#touch-emote:active, #touch-emote.on { background: var(--c-plush); color: var(--c-void); }
/* 펼치면 **왼쪽으로** 눕는다. 위로 쌓으면 화면 밖으로 넘어간다 */
#touch-emote-row { display: flex; gap: 5px; order: 1; }
#touch-emote-row[hidden] { display: none; }
#touch-emote-row button {
  pointer-events: auto;
  min-height: 44px; padding: 2px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--c-paper); background: var(--c-w5); border: 2px solid var(--c-void);
}
/* 켜둔 것(점프·흔들처럼 되풀이하는 것)은 켜져 있다고 보여준다 */
#touch-emote-row button.on { background: var(--c-mint); color: var(--c-void); }

/* ── 광장 스크린 ──────────────────────────────────────────────────────
   유튜브는 캔버스에 못 그린다. iframe 을 캔버스 위에 겹쳐 카메라를 따라 옮긴다. */
#tv-screen {
  position: absolute; left: 0; top: 0;
  /* ★ 광장에 박힌 스크린은 **맵의 일부**다. 캔버스 바로 위, UI 아래에 둔다 —
     예전엔 4 라서 대화창·참가자 목록보다 위로 올라와 창을 덮었다.
     작게 띄운 창(PIP)만 UI 취급이라 맨 위로 간다 (아래 .pip). */
  transform-origin: 0 0; z-index: 1;
  overflow: hidden; pointer-events: none; background: #000;
}
#tv-screen[hidden] { display: none; }
#tv-screen .tv-frame { width: 100%; height: 100%; }
#tv-screen iframe { width: 100%; height: 100%; display: block; border: 0; pointer-events: auto; }
#tv-screen .pip-bar, #tv-screen .pip-grip { display: none; }

/* ★ 여기서 opacity 를 건드리지 않는다. 예전엔 '평소 .6 · 올리면 1' 이었는데
   그래서 진하기 조절바가 먹지 않았고 작게 띄운 화면은 늘 어두웠다.
   진하기는 사람이 머리띠의 조절바로 정한다 (tv.js `_applyOpacity`). */
#tv-screen.pip {
  z-index: 8; overflow: visible;
  /* ★ 검은 바탕을 걷어낸다. PIP 는 영상 판만 흐려지는데 밑에 검정이 깔려
     있으면 흐려질수록 **검게** 될 뿐 뒤가 안 비친다. */
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--r);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .55);
  transition: opacity .1s;
}
#tv-screen.pip .pip-bar {
  display: flex; align-items: center; gap: 5px;
  position: absolute; left: -1px; right: -1px; top: -22px; height: 22px;
  padding: 0 5px;
  background: var(--glass-on);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, .12); border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  color: var(--c-w2);
  cursor: grab; user-select: none; touch-action: none; pointer-events: auto;
}
/* ★ 머리띠 안에 눕힌 진하기 조절바. **높이를 키우면 안 된다** — 머리띠가
   두꺼워지면 창이 통째로 아래로 밀린다. 그래서 손잡이도 납작하게. */
#tv-screen.pip .pip-bar .op {
  width: 72px; flex: none; height: 12px; margin: 0; cursor: pointer;
}
#tv-screen.pip .pip-bar .op::-webkit-slider-runnable-track { height: 4px; }
#tv-screen.pip .pip-bar .op::-webkit-slider-thumb {
  width: 10px; height: 10px; margin-top: -4px;
}
#tv-screen.pip .pip-bar .op::-moz-range-thumb { width: 10px; height: 10px; }
#tv-screen.pip .pip-bar:active { cursor: grabbing; }
#tv-screen.pip .pip-bar .grab { letter-spacing: -2px; color: var(--c-w3); }
#tv-screen.pip .pip-bar .sp { flex: 1; }
#tv-screen.pip .pip-bar .x {
  background: none; border: 0; box-shadow: none; color: var(--c-w2);
  cursor: pointer; padding: 0 4px; min-height: 0;
}
#tv-screen.pip .pip-bar .x:hover { color: var(--c-ember); background: none; }
#tv-screen.pip .pip-grip {
  display: block; position: absolute; right: -1px; bottom: -1px;
  width: 14px; height: 14px; cursor: nwse-resize;
  pointer-events: auto; touch-action: none;
  background: var(--c-plush); border: 1px solid var(--c-void);
  border-radius: 0 0 var(--r) 0;
}

/* ── 게임 위 창 공통 ──────────────────────────────────────────────────
   대화 · 참가자 · 스크린이 같은 규칙을 쓴다. 자리는 window.js 가 기억한다. */
/* ── 게임 위에 뜨는 창 ────────────────────────────────────────────────────
   ★ 유리판을 **뒷겹(::before)으로 뺐다.** 내가 창 뒤로 지나가면 창이 비켜줘야
     하는데(--win-fade), 창 자체에 opacity 를 걸면 **머리띠까지 흐려진다.**
     그러면 되돌리려고 잡아야 할 물건이 먼저 안 보인다 — PIP 와 같은 규칙이다.
     그래서 흐려지는 것은 유리판과 속내용뿐이고 머리띠는 늘 또렷하다. */
.win, #chat-panel {
  /* 맵(캔버스 0 · 광장 스크린 1) 위, 터치 조작(7) 아래 */
  z-index: 5;
  /* ★ 테두리는 **자리만** 잡는다 (속내용을 8px 안으로 밀어 넣는다).
     그림은 뒷겹이 그린다 — 여기에 그리면 흐려질 때 머리띠까지 딸려간다. */
  border-image-source: none;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}
.win > *, #chat-panel > * { position: relative; z-index: 1; }
/* inset: -8px = 테두리 자리까지 덮는다. 속내용은 그 안쪽에 그대로 있다. */
.win::before, #chat-panel::before {
  content: ''; position: absolute; inset: -8px; z-index: 0;
  border-style: solid; border-color: transparent; border-width: 8px;
  border-image-source: var(--f-glass-lg);
  border-image-slice: 8 fill; border-image-width: 8px; border-image-repeat: stretch;
  image-rendering: pixelated;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  opacity: var(--win-fade, 1);
  transition: opacity .1s;
  pointer-events: none;
}
/* 속내용도 같이 비켜준다. 머리띠(.win-bar)만 빼고. */
.win > *:not(.win-bar), #chat-panel > *:not(.win-bar) { opacity: var(--win-fade, 1); }
/* 볼 일이 있을 때는 또렷하게 — 비켜주던 것도 멈춘다 */
.win:hover, .win:focus-within, #chat-panel:hover, #chat-panel.active { --win-fade: 1; }
.win-bar {
  display: flex; align-items: center; gap: 6px;
  /* ★ 오른쪽에 귀퉁이 너비만큼 비운다 — 크기 조절 자리다.
       안 비우면 닫기 단추가 그 자리에 앉는데, 머리띠는 z-index:1 로 제 층을
       이루므로 **단추를 아무리 올려도** 위에 얹힌 귀퉁이를 못 이긴다.
       층으로 다투는 대신 자리를 나눠준다. */
  padding: 2px 14px 2px 4px;
  color: var(--c-w1);
  /* ★ 머리띠는 늘 또렷하다. 뒷겹이 비켜줘도 여기만은 제 바탕을 갖는다 */
  background: var(--glass-on);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  cursor: grab; user-select: none; touch-action: none;
}
.win-bar:active { cursor: grabbing; }
.win-bar .grab { letter-spacing: -2px; color: var(--c-w3); flex: none; }
/* ★ 좁아지면 줄여서 … 로 끝내야 한다. 그냥 두면 flex 가 폭을 0 까지 짜서
   한글이 한 글자씩 세로로 흐른다 (폰에서 창 제목이 그렇게 됐다). */
.win-bar .ttl { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-bar .spacer { flex: 1; min-width: 0; }
.win-bar .cnt, .win-bar .mini { flex: none; }
.win-bar .cnt { padding: 0 5px; background: var(--c-w9); color: var(--c-brass); }
.win-bar .mini {
  background: none; border: 0; box-shadow: none;
  color: var(--c-w2); padding: 0 5px; min-height: 18px; cursor: pointer;
}
.win-bar .mini:hover { color: var(--fg); background: var(--c-w4); }
.win-bar [data-close]:hover { color: var(--c-void); background: var(--c-ember); }
.win.dragging, #chat-panel.dragging { transition: none; }
.win.folded { height: auto !important; min-height: 0; }

#tv-panel {
  position: absolute; right: 12px; top: 12px; z-index: 6;
  width: 240px; max-width: calc(100% - 24px);
  overflow: hidden;
}
#tv-panel[hidden] { display: none; }
#tv-panel.folded #tv-body { display: none; }

#tv-body { padding: 6px 2px 2px; display: flex; flex-direction: column; gap: 6px; }
#tv-now {
  color: var(--c-w1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 1px 1px 0 var(--c-void);
}
#tv-seek {
  height: 8px; cursor: pointer; border-radius: 999px; overflow: hidden;
  background: var(--c-w9); border: 1px solid var(--c-void);
}
#tv-seek i { display: block; height: 100%; width: 0; background: var(--c-plush); }
#tv-seek.live { cursor: default; }
#tv-seek.live i { background: var(--c-ember); }
#tv-time {
  display: flex; justify-content: space-between;
  color: var(--c-w2); font-variant-numeric: tabular-nums;
  text-shadow: 1px 1px 0 var(--c-void);
}
.tv-btns { display: flex; align-items: center; gap: 3px; }
.tv-btns button { padding: 0 2px; min-height: 24px; }
/* 글자 대신 기호를 쓰는 단추. 폭을 잡아둬야 ▶ 와 ‖ 를 오갈 때 옆줄이 안 흔들린다 */
.tv-btns button.ico { min-width: 24px; text-align: center; }

.tv-vol { display: flex; align-items: center; gap: 6px; }
.tv-vol button {
  background: none; border: 0; box-shadow: none;
  color: var(--c-w2); cursor: pointer; padding: 0 2px; min-height: 20px;
}
.tv-vol button:hover { color: var(--fg); background: none; }
.tv-vol input[type=range] { flex: 1; min-width: 0; }
.tv-vol #tv-vol-out {
  color: var(--c-brass); min-width: 22px; text-align: right;
  font-variant-numeric: tabular-nums; text-shadow: 1px 1px 0 var(--c-void);
}
.tv-vol .ic { color: var(--c-w2); padding: 0 2px; }

#tv-add-form { display: flex; gap: 4px; }
#tv-add-form input { flex: 1; min-width: 0; padding: 0 4px; min-height: 24px; }
#tv-add-form button { padding: 0 4px; min-height: 24px; }
#tv-hint { color: var(--c-w2); min-height: 16px; text-shadow: 1px 1px 0 var(--c-void); }
#tv-hint.bad { color: var(--c-ember); }
.tv-check { display: flex; align-items: center; gap: 6px; color: var(--c-w1); cursor: pointer;
  text-shadow: 1px 1px 0 var(--c-void); }

#tv-results, #tv-queue {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
#tv-results { max-height: 168px; border-top: 2px solid var(--c-w5); padding-top: 4px; }
#tv-results[hidden] { display: none; }
#tv-queue { max-height: 132px; }
#tv-queue:empty { display: none; }
#tv-results li, #tv-queue li {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 4px; background: var(--c-w6);
  border: 2px solid transparent;
}
#tv-results li { cursor: pointer; }
#tv-results li:hover { border-color: var(--c-plush); }
#tv-queue li { cursor: grab; touch-action: none; }
#tv-queue li:active { cursor: grabbing; }
#tv-queue li.dragging { opacity: .45; }
#tv-queue li.over-top { border-top-color: var(--c-plush); }
#tv-queue li.over-bottom { border-bottom-color: var(--c-plush); }
#tv-queue .g { color: var(--c-w3); letter-spacing: -2px; }
#tv-queue .n { color: var(--c-brass); min-width: 12px; font-variant-numeric: tabular-nums; }
#tv-results .t, #tv-queue .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tv-results .m { color: var(--c-w2); white-space: nowrap; }
#tv-queue .x { padding: 0 5px; min-height: 18px; }

/* ── 참가자 목록 ─────────────────────────────────────────────────────── */
#roster {
  position: absolute; right: 12px; top: 12px;
  min-width: 132px; max-width: 200px; overflow: hidden;
}
#roster-head { color: var(--c-w1); }
#roster-list {
  list-style: none; margin: 0; padding: 4px 2px 2px;
  max-height: 40vh; overflow-y: auto;
}
#roster-list li {
  padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 1px 1px 0 var(--c-void);
}
#roster-list li.me::after { content: ' (나)'; color: var(--c-w2); }
/* ★ 접으면 **두 칸 다** 접힌다. 사람 칸만 적어뒀더니 친구 칸을 보는 중에
     접었을 때 창은 그대로 펴진 것처럼 보이는데 크기 손잡이만 사라져서,
     「친구 탭에서는 크기조절이 안 된다」로 보였다. 칸이 둘이면 규칙도 둘이다. */
#roster.folded #roster-list,
#roster.folded #roster-friends { display: none; }

/* ── 대화창 ──────────────────────────────────────────────────────────── */
#chat-panel {
  position: absolute; left: 12px; bottom: 12px;
  width: 336px; height: 192px;
  min-width: 192px; min-height: 96px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
/* 위쪽 `[hidden] { display: none !important }` 이 맡는다. 예전엔 이 줄이 없어서
   '닫기'가 먹히지 않았고, 닫힌 줄 아는 창 시스템이 자리 계산을 건너뛰어
   드래그도 안 되고 화면 밖으로도 나갔다 — 세 증상이 한 뿌리였다. */
#chat-head { flex: none; }
#chat-log {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 4px 3px;
  color: var(--fg); overflow-wrap: anywhere;
  /* ★ 판은 비쳐도 글씨는 온전해야 한다. 외곽선을 깔아 어떤 배경에서도 읽히게. */
  text-shadow: 1px 1px 0 var(--c-void), -1px 0 0 var(--c-void), 0 -1px 0 var(--c-void);
}
#chat-log .mine { border-left: 2px solid var(--c-plush); margin-left: -4px; padding-left: 4px; }
/* 보낸 시각 — 찾으면 보이고 안 찾으면 안 보이는 정도로 */
#chat-log time {
  color: var(--c-w3); margin-left: 5px; white-space: nowrap;
  font-variant-numeric: tabular-nums; text-shadow: 1px 1px 0 var(--c-void);
  transition: color .08s;
}
#chat-panel:hover #chat-log time, #chat-panel.active #chat-log time { color: var(--c-w2); }

#chat-form { display: flex; gap: 4px; padding: 0 2px 2px; flex: none; }
#chat-input { flex: 1; min-width: 0; }
#chat-form button { padding: 0 5px; }

/* ★ 오른쪽 **위** 모서리다. 이 창은 왼쪽 아래에 붙어 있어서, 위로 끌면
   아랫변은 그대로 두고 위로 자란다 — 붙은 자리를 손댈 일이 없다. */
#chat-panel.folded { height: auto !important; min-height: 0; }
#chat-panel.folded #chat-log,
#chat-panel.folded #chat-form { display: none; }

/* ── 새 버전 알림 ────────────────────────────────────────────────────── */
#stale-note {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  z-index: 200; padding: 6px 14px;
  background: var(--c-w7); color: var(--fg);
  border: 2px solid var(--c-void);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); border-top: 2px solid var(--c-plush);
}

/* ===========================================================================
   패널 안 부품 (파츠 · 색상 탭)
   =========================================================================== */
.pair {
  padding: 4px 6px;
  margin-bottom: 6px;
}
.pair-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pair.single .pair-head { margin-bottom: 2px; }
button.link { padding: 0 4px; min-height: 24px; color: var(--c-w2); }
button.link.on {
  color: var(--c-void); background: var(--c-mint);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.srow > span { width: 56px; flex: none; color: var(--c-w2); }
.srow.solo > span { display: none; }
.srow button[data-c] { width: 40px; flex: none; padding: 0; min-height: 24px; }

.field { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.field label { width: 78px; flex: none; color: var(--c-w2); }
.field select { flex: 1; min-width: 0; }
.field .hex { color: var(--c-w2); width: 64px; }

.note { margin: 4px 0 10px; color: var(--c-w2); }
.chk.big { color: var(--fg); margin-bottom: 6px; }

.tone-box, .slot {
  padding: 4px 6px 6px;
  margin-bottom: 8px;
}
.trow { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.trow > span { width: 78px; flex: none; color: var(--c-w2); }
.trow input[type=range] { flex: 1; min-width: 0; }
.trow output { width: 44px; text-align: right; color: var(--c-w1); font-variant-numeric: tabular-nums; }

.slot-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.slot-top button.lk { padding: 0 4px; min-height: 24px; }
.ramp { display: flex; gap: 2px; }
.ramp i { width: 16px; height: 16px; border: 1px solid var(--c-void); border-radius: 3px; }
.ramp i.line { margin-left: 5px; }

.crow { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.crow > span { width: 60px; flex: none; color: var(--c-w2); }
.crow .spacer { width: 38px; flex: none; }
.crow button[data-a], .crow button[data-lk] {
  width: 40px; flex: none; padding: 0; min-height: 24px; text-align: center;
}
.crow em { font-style: normal; color: var(--c-w2); margin-left: auto; }
.crow.off { opacity: .45; }

/* 눌러서 고칠 수 있는 숫자·색코드 칸 — 파인 티는 안 내지만 고칠 수 있다.
   ★ `input.` 로 시작해야 한다. `input[type=text]` 이 (0,1,1) 이라 클래스 하나로는
     못 이긴다 — 그러면 이 칸들이 전부 파인 입력칸으로 보인다. */
input.numbox, input.hexbox {
  flex: none; text-align: right;
  background: none; border: 2px solid transparent; box-shadow: none;
  padding: 0 3px; min-height: 20px;
  font: inherit; color: var(--c-brass);
  cursor: text;
}
input.numbox { width: 48px; }
input.hexbox { margin-left: auto; width: 72px; }
input.numbox:hover, input.hexbox:not(.ro):hover {
  border-color: var(--c-w4); color: var(--fg);
}
input.numbox:focus, input.hexbox:focus {
  outline: none; box-shadow: none;
  border-color: var(--c-plush); color: var(--fg); background: var(--c-w9);
}
input.hexbox.ro { color: var(--c-w3); cursor: default; }
.srow input.numbox { width: 44px; }

.gaze { display: grid; grid-template-columns: repeat(3, 32px); gap: 2px; }
.gaze button { padding: 0; height: 32px; min-height: 0; }

.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 3px 0; border-bottom: 2px solid var(--c-w5); }
.kv td:first-child { color: var(--c-w2); }
.kv td:last-child { text-align: right; color: var(--c-brass); font-variant-numeric: tabular-nums; }

.layers { margin: 0; padding-left: 22px; color: var(--c-w2); }
.layers li { padding: 1px 0; }
.layers b { color: var(--fg); font-weight: 400; }
.layers .g { color: var(--c-mint); }

#asset-status { font-family: inherit; }

/* ===========================================================================
   작은 화면 (폰)
   게임 그림 자체는 안 건드린다 (배율이 정수라 fitGameCanvas 가 맞춘다).
   주변 것들만 접어서 무대를 넓힌다.
   =========================================================================== */
@media (max-width: 900px) {
  .viewer { flex-direction: column; }
  .viewer-side { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .viewer-side .cap { display: none; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .topbar .sub { display: none; }
  .layout { padding: 6px; gap: 6px; }
  .viewer-stage { padding: 6px; }

  .game-bar { gap: 4px; padding: 4px 6px; flex-wrap: wrap; }
  #game-who { display: none; }
  .game-bar .spacer { display: none; }
  .emotes { gap: 2px; }
  .emotes button { padding: 1px 6px; }
  /* ★ 원래 규칙이 `.emotes button kbd` 라 더 좁게 써야 이긴다.
     `.emotes kbd` 로는 안 먹어서 숫자가 계속 붙어 있었다. */
  .emotes button kbd { display: none; }
  #win-reset { display: none; }
  .dock { margin-left: 0; }
  .game-bar .lb { display: none; }

  #tv-panel { width: min(92vw, 320px); }
  #roster { max-width: 136px; }
  #chat-panel { max-width: 92vw; }
}

/* 손가락으로 조작할 때 — 눌리는 것들을 손가락 크기로 키운다.
   ★ 작은 접기/닫기 단추는 손가락으로 못 누른다. 창을 못 닫는다는 뜻이다.

   ★ **미디어 쿼리로 가르지 않는다.** `pointer: coarse` 는 터치 되는 PC·2in1 에서도
     참이 되는 일이 있어서, 마우스로 쓰는 사람 화면에 조이스틱과 커다란 단추가
     떴다. 기기가 무엇을 **할 수 있는가**와 사람이 무엇을 **쓰고 있는가**는 다른
     물음이다. 후자는 app.js 가 실제 입력을 보고 body.touch-ui 로 알려준다. */
body.touch-ui .game-bar button, body.touch-ui .dock button, body.touch-ui .emotes button { min-height: 34px; padding: 4px 10px; }
body.touch-ui .win-bar { padding: 4px; }
body.touch-ui .win-bar .mini { min-width: 34px; min-height: 30px; padding: 4px 8px; }
body.touch-ui #chat-form button { min-height: 34px; padding: 4px 12px; }
body.touch-ui .tv-btns button { min-height: 34px; min-width: 34px; }
/* 스크린 창의 음소거·대기열 담기 단추도 손가락 크기로. 여기만 빠져 있었다 */
body.touch-ui .tv-vol button, body.touch-ui #tv-add-form button { min-height: 32px; min-width: 32px; }
body.touch-ui .tv-vol input[type=range] { height: 28px; }
body.touch-ui #chat-input { font-size: 16px; }   /* 16px 미만이면 iOS 가 화면을 확대한다 */
/* 손가락으로도 귀퉁이가 잡히게. 단추가 비켜설 자리도 같이 넓힌다 */
body.touch-ui .win-corner { width: 22px; height: 22px; }
body.touch-ui .win-bar { padding-right: 22px; }
body.touch-ui #frame-strip button { min-width: 32px; min-height: 30px; }
body.touch-ui .chip { min-height: 30px; padding: 2px 10px; }

/* ── 에디터 쪽도 손가락 크기로 ──
   ★ 여기가 오래 비어 있었다. 위 규칙들은 전부 **게임 화면** 것이라, 정작
     손이 제일 많이 가는 아바타 에디터는 24px 짜리 데스크톱 크기 그대로였다.
     폰에서 열면 단추도 슬라이더도 손톱으로 겨우 찍어야 했다. */
body.touch-ui .topbar button,
body.touch-ui .panel button, body.touch-ui .panel select,
body.touch-ui .stage-bar button, body.touch-ui .stage-bar select,
body.touch-ui .anim-edit button, body.touch-ui .anim-edit select,
body.touch-ui .saverow button, body.touch-ui .saverow input[type=text],
body.touch-ui #playbar button, body.touch-ui #playbar input[type=text],
body.touch-ui .dialog button, body.touch-ui .dialog input[type=text] { min-height: 36px; }

/* 글자칸은 16px 미만이면 iOS 가 화면을 확대해버린다 (다시 줄일 방법이 없다) */
body.touch-ui .panel input[type=text], body.touch-ui .dialog input[type=text],
body.touch-ui .saverow input[type=text], body.touch-ui #skin-code,
body.touch-ui #playbar input[type=text], body.touch-ui #screen-acc input { font-size: 16px; }

/* 탭 여덟 개가 375px 안에 들어가려니 한 칸이 41px 이었다.
   넘치면 줄로 접지 말고 **옆으로 밀어** 본다 — 줄이 늘면 판이 그만큼 내려간다 */
body.touch-ui .tabs { overflow-x: auto; overscroll-behavior-x: contain; }
body.touch-ui .tabs button { min-height: 38px; padding: 2px 12px; flex: none; }

/* 슬라이더는 16px 였다. 손가락으로 잡으려면 이 정도는 돼야 한다.
   ★ 설정창(.srow)도 같이 잡는다 — 폰에서 확대·소리를 만질 유일한 자리다 */
body.touch-ui .panel input[type=range], body.touch-ui .stage-bar input[type=range],
body.touch-ui .srow input[type=range] { height: 28px; }

/* 방향판·색칸·작은 단추 */
body.touch-ui #dpad button { min-width: 40px; min-height: 40px; }
body.touch-ui input[type=color] { min-width: 40px; min-height: 34px; }
body.touch-ui .tiny, body.touch-ui button.tiny { min-height: 32px; padding: 2px 10px; }

/* 재생 조작줄과 자물쇠는 min-height 를 제 손으로 24px 로 못 박아둬서
   위의 넉넉한 규칙을 이긴다. 여기서 다시 풀어준다 */
body.touch-ui .transport button { min-height: 36px; min-width: 40px; }
body.touch-ui .pgroup .pair-head .lk, body.touch-ui .slot-top button.lk { min-height: 32px; min-width: 32px; }

/* 계정 창 — 닉네임 창과 같은 틀 */
#screen-auth .dialog input { width: 100%; margin-bottom: 6px; }
#screen-auth .row { gap: 6px; flex-wrap: wrap; }
#auth-msg { min-height: 16px; color: var(--c-ember); margin: 2px 0 6px; }
#auth-msg.ok { color: var(--c-mint); }
#btn-account.on { color: var(--c-mint); }

/* 계정 설정 — 칸마다 <form> 이 따로다 (크롬이 각각을 알아보게) */
#screen-acc form { margin-bottom: 4px; }
#screen-acc input { width: 100%; margin-bottom: 6px; }
#screen-acc input[readonly] { color: var(--c-w2); background: var(--c-w7); }
#screen-acc .row { justify-content: flex-end; }
#acc-who { color: var(--c-w1); }
#acc-msg { min-height: 16px; color: var(--c-ember); margin: 8px 0 6px; }
#acc-msg.ok { color: var(--c-mint); }
/* 되돌릴 수 없는 단추는 그렇게 보여야 한다 */
#screen-acc h3.warn, button.danger { color: var(--c-ember); }
button.danger:hover { background: var(--c-ember); color: var(--c-void); }

/* ── 사진 찍기 ─────────────────────────────────────────────────────────
   무대를 덮고 끌어서 자리를 고른다. 고른 자리만 밝고 나머지는 눌러 둔다. */
#shot {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(8, 8, 11, .45);
  cursor: crosshair;
}
#shot[hidden] { display: none; }
#shot-sel {
  position: absolute;
  border: 1px solid var(--c-plush);
  box-shadow: 0 0 0 9999px rgba(8, 8, 11, .45);
  background: transparent;
  pointer-events: none;
}
#shot-sel[hidden] { display: none; }
#shot-bar {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; max-width: 94%;
  background: var(--glass-on);
  backdrop-filter: var(--blur);
  border: 2px solid var(--c-void);
}
#shot-bar .note { margin: 0; }
body.touch-ui #shot-bar { flex-wrap: wrap; }

/* 관전(유령) 표시 — 내 화면에만 뜬다 */
#ghost-tag {
  color: var(--c-mint); padding: 0 6px;
  border-style: solid; border-color: transparent; border-width: 4px;
  border-image-source: var(--f-sink);
  border-image-slice: 4 fill; border-image-width: 4px; border-image-repeat: stretch;
  image-rendering: pixelated; white-space: nowrap;
}
#ghost-tag[hidden] { display: none; }

/* ── 부팅 실패 안내 ──────────────────────────────────────────────────── */
#boot-error {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px; padding: 8vh 10vw;
  background: var(--c-w9); color: var(--fg);
  font-size: 22px; line-height: 32px;
}
#boot-error[hidden] { display: none; }
#boot-error b { color: var(--c-ember); }
#boot-error p { margin: 0; color: var(--c-w2); font-size: 11px; line-height: 16px; }
#boot-error pre, #boot-error code {
  background: var(--c-w7); border: 2px solid var(--c-void);
  padding: 4px 8px; font: inherit; font-size: 11px; line-height: 16px;
  color: var(--c-mint); display: inline-block; margin: 4px 0;
  white-space: pre-wrap; word-break: break-all;
}

/* ── 고급 색 설정 ─────────────────────────────────────────────────────────
   ★ 처음 열었을 때 도구가 깊어 보이면 안 된다. 그림자·아웃라인을 손으로
     만지는 것은 **스위치를 켠 사람에게만** 보인다 (docs/UI.md §8). */
.adv {
  padding: 4px 6px 6px;
  margin-bottom: 8px;
}
.adv .adv-head { margin: 0; color: var(--fg); }
.adv .note { margin: 4px 0 0; }
.adv-body { margin-top: 8px; border-top: 2px solid var(--c-w5); padding-top: 8px; }
.adv-body[hidden] { display: none; }
.adv-body h3:first-of-type { margin-top: 12px; }

/* 무늬 겹 한 덩이 — 색 한 줄 + (고급이면) 그림자·스트로크 두 줄 */
.patlayer { margin-bottom: 4px; }
.patlayer[hidden] { display: none; }
.crow.sub { padding-left: 12px; }
.crow.sub[hidden] { display: none; }
.crow.sub > span { color: var(--c-w3); }
.crow button[data-none] { width: 40px; flex: none; padding: 0; min-height: 24px; }
.crow button[data-none].on {
  background: var(--c-mint); color: var(--c-void);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

/* ── 스크롤 칸 공통 ───────────────────────────────────────────────────────
   목록·로그처럼 길어질 수 있는 칸은 **자기 상자 안에서** 스크롤한다.
   화면 밖으로 자라나면 막대를 잡을 수가 없다. */
#tv-queue, #tv-results, #roster-list, #chat-log, #skin-slots {
  overscroll-behavior: contain;
}
#skin-slots { max-height: 40vh; overflow-y: auto; }

/* ── 애니메이션 편집기 (편집 모드에서만 뜬다) ────────────────────────────── */
.anim-edit {
  border-style: solid; border-color: transparent; border-width: 8px;
  border-image-source: var(--f-card-lg);
  border-image-slice: 8 fill; border-image-width: 8px; border-image-repeat: stretch;
  image-rendering: pixelated;
  padding: 4px 6px 6px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.ae-head { display: flex; align-items: center; gap: 8px; }
.ae-head .ae-where { color: var(--c-brass); font-variant-numeric: tabular-nums; }
.ae-clip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ae-clip select { flex: none; width: 104px; }
.ae-frames { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ae-cap { color: var(--c-w2); font-variant-numeric: tabular-nums; }
.ae-out { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 아직 게임에 안 들어간 수정이 있다 */
.ae-dirty { color: var(--c-ember); }
/* 세 걸음 안내 — 늘 보이되 물러서 있는다 */
.ae-head .ae-steps { color: var(--c-w2); }
/* 값 칸의 자물쇠 — 짝 파츠에서만 뜬다. 풀면 좌우 두 칸이 된다 */
.ae-lock {
  min-height: 0; padding: 0 2px; margin-left: 3px;
  border-image: none; border: 1px solid transparent; color: var(--c-w3);
}
.ae-lock.on { color: var(--c-mint); }
.ae-f.bysides { flex-wrap: wrap; }
.ae-f.bysides input.ae-side { width: 40px; }

/* ── 값 무리 ──────────────────────────────────────────────────────────
   열세 칸을 한 줄로 늘어놓으면 벽처럼 읽힌다. 무엇을 만지는지로 묶고
   이름표를 왼쪽에 세운다 — 눈이 먼저 무리를 고르고 그 안에서 찾는다. */
.ae-group {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--c-w5);
}
.ae-group:first-of-type { border-top: 0; }
.ae-gname {
  flex: none; width: 34px; padding-top: 4px;
  color: var(--c-w2); text-align: right;
}
.ae-group .ae-fields { flex: 1; min-width: 0; }
/* 값 칸 — 이름·입력칸·단추가 한 덩어리로 읽히게 */
.ae-f {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 3px; margin: 0 3px 3px 0;
  border: 1px solid transparent; border-radius: 3px;
}
.ae-f.on { border-color: var(--c-w4); background: var(--c-w7); }
.ae-f.bydir { border-color: var(--c-brass); }
.ae-f.inherit > span { color: var(--c-w3); }
.ae-f > span { min-width: 26px; }

/* 인스펙터 머리 — 슬롯 · 프레임 · 방향을 한눈에 */
.ae-at { color: var(--c-w1); font-variant-numeric: tabular-nums; }
.ae-insp-head .ae-dirnow {
  color: var(--c-void); background: var(--c-brass);
  padding: 0 4px; border-radius: 2px;
}

/* ── 도프시트 — 가로가 프레임, 세로가 슬롯 ──
   길이를 240 까지 줄 수 있으니 **자기 상자 안에서** 옆으로 스크롤한다.
   판이 화면 밖으로 자라나면 막대를 잡을 수가 없다. */
.ae-sheet-wrap { overflow-x: auto; overscroll-behavior: contain; }
.ae-sheet { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ae-sheet th, .ae-sheet td { padding: 0; font-weight: 400; }

.ae-slotcell {
  padding: 0 6px 0 3px; text-align: left; color: var(--c-w1);
  white-space: nowrap; cursor: pointer;
}
.ae-srow.on .ae-slotcell { color: var(--c-plush); }

.ae-fnum {
  width: 17px; min-width: 17px; text-align: center;
  color: var(--c-w3); cursor: pointer;
}
.ae-fnum.now { color: var(--c-brass); }
/* 오래 머무는 프레임 — 어디서 늘어지는지 표에서 바로 읽혀야 한다 */
.ae-fnum.held { color: var(--c-mint); text-decoration: underline; }

/* 칸 하나 = 슬롯 하나의 한 프레임. ◆ 가 있으면 키가 있는 것 */
.ae-cell {
  width: 17px; min-width: 17px; height: 17px;
  text-align: center; cursor: pointer; color: var(--c-w4);
  background: var(--c-w9); box-shadow: inset 0 0 0 1px var(--c-w7);
}
.ae-cell:hover { background: var(--c-w6); }
.ae-cell.now { background: var(--c-w7); }
.ae-cell.key { color: var(--c-mint); }
.ae-cell.now.key { background: var(--c-w6); }
/* 끌어서 고른 키들. 여러 줄을 가로질러 고를 수 있다 */
.ae-cell.pick { background: var(--c-plush); }
.ae-cell.key.pick { color: var(--c-w9); }
/* 고른 키를 끌고 가는 중 — 놓을 자리 */
.ae-cell.drop { box-shadow: inset 0 0 0 2px var(--c-brass); }
.ae-sheet.dragging .ae-cell { cursor: grabbing; }
.ae-sheet.dragging { user-select: none; }

/* 지금 조절판이 보고 있는 그 키 */
.ae-cell.sel { box-shadow: inset 0 0 0 1px var(--c-plush); }
.ae-cell.key.sel { color: var(--c-plush); }
/* 이어지는 키는 오른쪽으로 선이 뻗는다 — 어디가 흐르고 어디가 끊기는지 한눈에.
   체크칸을 하나하나 눌러보게 해서는 안 된다 */
.ae-cell.flow::after {
  content: ''; position: absolute; right: 0; top: 50%; width: 50%;
  border-top: 1px solid var(--c-mint);
}
.ae-cell { position: relative; }

.ae-addrow { padding-top: 4px; }
.ae-addrow select { width: 88px; margin-right: 4px; }

/* 프레임 띠 — 오래 머무는 칸은 그만큼 넓다 (박자가 눈에 보이게) */
#frame-strip button.hold { min-width: calc(var(--hold, 1) * 1.1em); color: var(--c-mint); }

/* ── 조절판 — 고른 키 한 개 ─────────────────────────────────────────────── */
.ae-insp {
  display: flex; flex-direction: column; gap: 6px; padding: 5px 7px;
  border-style: solid; border-color: transparent; border-width: 8px;
  border-image-source: var(--f-sink-lg);
  border-image-slice: 8 fill; border-image-width: 8px; border-image-repeat: stretch;
}
.ae-insp-head { display: flex; align-items: center; gap: 6px; }
.ae-insp-head > b { color: var(--c-plush); font-weight: 400; }
.ae-fields { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
/* 값이 들어 있는 칸은 놋쇠로 — 어느 칸이 살아 있는지 한눈에 */
.ae-f { display: inline-flex; align-items: center; gap: 4px; color: var(--c-w3); }
.ae-f.on { color: var(--c-brass); }
.ae-f input[type=text] { width: 44px; padding: 0 3px; min-height: 22px; text-align: right; }
/* 키가 없는 자리에 흐르고 있는 값. 빈칸으로 두면 0인지 이어받은 값인지 모른다 */
.ae-f.inherit input[type=text] { color: var(--c-w3); font-style: italic; }
.ae-insp-head .note { margin: 0; }
/* 지금 보고 있는 방향 — 방향별 값을 만지는 화면이라 늘 보여야 한다 */
.ae-dirnow { color: var(--c-brass); }
/* 값 한 칸의 「전체 / 이 방향」 단추. 켜지면 그 값은 이 방향만의 것 */
.ae-dirflag {
  min-height: 0; padding: 0 3px; margin-left: 3px;
  color: var(--c-w3); border-image: none; border: 1px solid transparent;
}
.ae-dirflag.on { color: var(--c-void); background: var(--c-brass); border-radius: 2px; }
.ae-f.bydir > span { color: var(--c-brass); }
.ae-note { margin: 0; }

/* ── 가방 · 좌판 ─────────────────────────────────────────────────────────── */
#bag { position: absolute; right: 12px; bottom: 12px; width: 236px; max-width: calc(100% - 24px); }
#bag[hidden] { display: none; }
#bag.folded #bag-body { display: none; }
#bag-body { padding: 6px 2px 2px; }
#bag-note { margin: 0; }

#shop { position: absolute; left: 12px; top: 12px; width: 236px; max-width: calc(100% - 24px); }
#shop[hidden] { display: none; }
#shop.folded #shop-body { display: none; }
#shop-body { padding: 6px 2px 2px; }
#shop-note { margin: 4px 0 0; color: var(--c-brass); }
#shop-tabs { margin-bottom: 5px; }
#shop-tabs:empty { display: none; }

/* -- 격자 판 (가방 . 좌판) -------------------------------------------------
   칸은 정사각형이고 아이콘만 들어간다. 이름을 칸에 박으면 칸이 글자 길이에
   끌려다녀 격자가 아니라 목록이 된다 -- 이름과 설명은 밑의 띠 한 곳에서만. */
.slotgrid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), 1fr);
  gap: 3px;
  max-height: 40vh; overflow-y: auto; overscroll-behavior: contain;
}
.slotgrid:focus { outline: none; }

/* ★ **`.slot` 은 에디터가 먼저 쓰고 있던 이름이다** (오른쪽 판의 카드 한 장).
   여기 규칙을 그냥 `.slot` 으로 달았더니 에디터의 카드가 전부 정사각형
   가로 flex 로 바뀌어서 색 줄이 판 밖으로 밀려났다. 반드시 `.slotgrid` 안으로
   가둔다 — 같은 낱말을 두 곳이 쓰고 있으면 좁은 쪽이 양보한다. */
.slotgrid .slot {
  position: relative;
  aspect-ratio: 1 / 1;                 /* 1:1 -- 무슨 물건이 들어와도 칸 모양은 같다 */
  display: flex; align-items: center; justify-content: center;
  border-style: solid; border-color: transparent; border-width: 4px;
  border-image-source: var(--f-sink);
  border-image-slice: 4 fill; border-image-width: 4px; border-image-repeat: stretch;
  image-rendering: pixelated;
  color: var(--c-w1); cursor: pointer;
}
.slotgrid .slot.empty { cursor: default; }
.slotgrid .slot i { font-style: normal; font-size: 15px; line-height: 1; }

/* 개수는 오른쪽 아래, 값은 왼쪽 아래. 자리가 다르니 둘이 겹치지 않는다 */
.slotgrid .slot em { position: absolute; font-style: normal; font-size: 11px; line-height: 1;
  font-variant-numeric: tabular-nums; text-shadow: 1px 1px 0 var(--c-void); }
.slotgrid .slot .cnt { right: 1px; bottom: 0; color: var(--c-paper); }
.slotgrid .slot .price { left: 1px; bottom: 0; color: var(--c-brass); }

/* 마우스가 올라간 칸과 화살표가 고른 칸을 다르게 보여준다 --
   둘이 같은 표시면 어느 쪽이 지금 설명되는 것인지 알 수 없다 */
.slotgrid .slot.hot { border-image-source: var(--f-hover); }
.slotgrid .slot.on { border-image-source: var(--f-raise); box-shadow: inset 0 0 0 1px var(--c-plush); }
/* 손에 든 칸 — 고른 칸(분홍)과 다른 뜻이라 색을 가른다 (민트 = 지금 쓰는 것) */
.slotgrid .slot.held { box-shadow: inset 0 0 0 2px var(--c-mint); }
.slotgrid .slot.held::after {
  content: '✋'; position: absolute; right: 1px; top: 0; font-size: 9px; line-height: 10px;
}
/* 못 사는 것은 흐려진다 -- 눌러보고 알면 늦다 */
.slotgrid .slot.cant i, .slotgrid .slot.cant .price { color: var(--c-w3); }

/* 이름 . 설명 띠. 칸을 안 고르면 자리만 잡고 비어 있는다 --
   높이가 들쭉날쭉하면 격자가 위아래로 튄다 */
.slotinfo {
  min-height: 30px; margin-top: 5px; padding: 3px 5px;
  border-style: solid; border-color: transparent; border-width: 4px;
  border-image-source: var(--f-sink);
  border-image-slice: 4 fill; border-image-width: 4px; border-image-repeat: stretch;
  image-rendering: pixelated;
  display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap;
  color: var(--c-w2);
}
.slotinfo b { color: var(--c-paper); font-weight: 400; }
.slotinfo .price { font-style: normal; color: var(--c-brass); font-variant-numeric: tabular-nums; }
.slotinfo span { flex-basis: 100%; }

/* ── 애니메이터: 휘날림 물리 ────────────────────────────────────────────
   손잡이가 열 개를 넘어서 한 줄로 늘어놓으면 화면을 다 먹는다. 좁은 칸을
   여러 줄로 흘려 담는다 (auto-fill) — 패널을 좁히면 저절로 줄 수가 준다. */
.ae-tune { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--c-w4); }
.ae-tune-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ae-tune-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 2px 12px;
}
.ae-tune-grid .trow { margin: 0; }
.ae-tune-grid .trow > span { min-width: 84px; }

/* 마디마다 폭·두께를 따로 줄 때 쓰는 작은 숫자칸 */
.crow.sub input.num { width: 64px; }

/* ★ 무대는 **크기가 고정이다.** 확대나 자락 길이에 따라 캔버스가 늘었다 줄었다
   하면 화면에 맞추느라 도로 축소돼서 캐릭터가 실처럼 가늘어 보인다.
   상자를 잡아두고 그 안에서 캐릭터만 커졌다 작아진다. */
#stage { width: 100%; height: 46vh; min-height: 300px; max-height: 560px; }

/* 색 선택 팝업 — 색 고르개와 「빛」이 한 자리에 */
/* 색 견본에 딸린 판 — 브라우저 고르개 **밑에** 폭을 맞춰 붙는다.
   ★ 게임 위 창(.win)보다 위여야 한다. 마을에 접속한 채로 색을 고치면
   판이 창 뒤로 숨어서 안 보였다 */
.cpop {
  position: fixed; z-index: 9000; width: 244px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.cpop-h { display: flex; align-items: center; gap: 6px; }
.cpop-h b { font-size: 12px; }
.cpop-x { min-height: 20px; padding: 0 6px; }
.cpop-recent { display: flex; flex-wrap: wrap; gap: 3px; }
.cpop-recent:empty { display: none; }
.cpop-sw {
  width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: 4px;
  border: 1px solid rgba(0,0,0,.45); cursor: pointer;
}
.cpop-sw:hover { transform: scale(1.15); border-color: #fff; }
.cpop-sw.on { outline: 2px solid #ffc233; outline-offset: 1px; }
/* 빛이 든 색은 테두리로 표가 난다 — 색만 보면 둘이 똑같이 생겼다 */
.cpop-sw.lit { border-color: #ffe9a8; box-shadow: 0 0 5px rgba(255,220,140,.9); }

/* 좌우로 가른 무늬 판. 잠겨 있으면 공통 판만, 풀리면 좌/우 판만 보인다
   (파츠 고르개의 .thumbs.side 와 같은 규칙) */
.slot .patside + .patside { margin-top: 6px; }
.slot:not(.split) .patside-side { display: none; }
.slot.split .patside-both { display: none; }

/* 맨 밑 항목의 색을 고칠 때 팔레트와 판이 화면 밖으로 밀려나지 않게,
   패널 끝에 화면 절반만큼 빈자리를 둔다 (스크롤해서 위로 올릴 수 있다) */
.panel .tab { padding-bottom: 55vh; }

/* 옷장 동기화 상태 — 됐는지 안 됐는지가 **보여야** 한다 */
#skin-sync.ok { color: #8fd6a0; }
#skin-sync.bad { color: #ffab8f; }

/* ── 패턴 레이어 카드 ────────────────────────────────────────────────────── */
.patcard .patstack {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid rgba(255,255,255,.10); border-radius: 6px; padding: 3px;
  max-height: 168px; overflow-y: auto;
}
.patcard .patrow {
  display: flex; align-items: center; gap: 6px; text-align: left;
  min-height: 26px; padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,.03); border: 1px solid transparent; color: inherit;
}
.patcard .patrow.on { background: rgba(255,194,51,.16); border-color: #ffc233; }
.patcard .patrow.base { opacity: .55; cursor: default; }
.patcard .patthumb {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 4px;
  background: rgba(0,0,0,.28); image-rendering: pixelated;
}
/* 끌어 옮기는 중 — 집은 줄은 흐리게, 놓일 자리는 선으로 */
.patcard .patrow { cursor: grab; }
.patcard .patrow.dragging { opacity: .4; cursor: grabbing; }
.patcard .patrow.dragover { box-shadow: inset 0 2px 0 #ffc233; }
.patcard .patrow.base { cursor: default; }
.patcard .patbar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.patcard .patbar button { min-height: 24px; padding: 0 8px; }
.patcard .patdel { color: #ffab8f; }
.patcard .patsel { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.patcard .patsel b { font-size: 12px; opacity: .85; }
/* 레이어가 하나도 없으면 고르는 판을 통째로 접는다 */
.patcard.empty .patside { display: none; }
.pat-alpha { width: 46px; }

/* 휘날리는 것은 레이어를 안 쓴다 — 목록·추가·삭제·차례 바꾸기를 통째로 접는다 */
.patcard.band .patstack,
.patcard.band .patbar { display: none; }

/* ── 우리가 그리는 색 고르개 ─────────────────────────────────────────── */
.pick { position: relative; }
.pick canvas { display: block; border-radius: 4px; cursor: crosshair; touch-action: none; }
.pick .pick-sv { width: 100%; height: 104px; }
.pick .pick-hue { width: 100%; height: 14px; margin-top: 6px; }
/* 집게 — 어두운 색 위에서도 보이게 안팎으로 두 겹 */
.pick .pick-sv-dot, .pick .pick-hue-dot {
  position: absolute; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.7);
}
.pick .pick-sv-dot {
  width: 11px; height: 11px; border-radius: 50%; margin: -6px 0 0 -6px;
}
.pick .pick-hue-dot {
  top: 104px; margin: 4px 0 0 -3px; width: 6px; height: 18px; border-radius: 3px;
  background: transparent;
}
.cpop-sw {
  width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: 4px;
  border: 1px solid rgba(0,0,0,.45); cursor: pointer;
}
.cpop-sw:hover { transform: scale(1.15); border-color: #fff; }
.cpop-sw.on { outline: 2px solid #ffc233; outline-offset: 1px; }
/* 고르개를 여는 대리 칸 — 안 보이지만 **크기가 있어야** 그 옆에 창이 붙는다 */
.pickproxy {
  position: fixed; width: 24px; height: 24px; padding: 0; border: 0;
  opacity: 0; pointer-events: none; z-index: 1;
}
.cpop-sub { font-size: 11px; opacity: .6; margin-top: 2px; }
.cpop-chip {
  width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.35);
}
.cpop-foot { gap: 6px; }
.cpop-foot .hexbox { flex: 1 1 auto; }
.cpop-more { min-height: 24px; padding: 0 8px; }
/* 브라우저 고르개는 「고르개」로만 부른다 — 판 안에서는 자리를 안 차지한다 */
.cpop input[type=color] { width: 0; height: 0; padding: 0; border: 0; opacity: 0; position: absolute; }

/* 인게임 계정 단추는 설정 왼쪽 — 첫 화면 띠와 같은 자리, 같은 모양 */
#game-account.on { color: var(--c-mint); }
/* 「자동」인 패턴 색 칸 — 눌러서 고를 수는 있지만 아직 제 색이 아니다 */
.crow input[type=color].auto { opacity: .62; border-style: dashed; }

#color-dock:empty { display: none; }
#color-dock .cpop[hidden] { display: none; }

/* ── 마디 모양 고르개 ─────────────────────────────────────────────────────
   이름 대신 모양 그대로를 보여준다. 다섯째부터는 이름을 지어줄 사람도 없고,
   무엇보다 보고 고르는 편이 빠르다. */
.shapethumb { display: block; image-rendering: pixelated; width: 18px; height: 18px; }
.chip.shape { padding: 3px 5px; line-height: 0; }
.shapepick {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 5px; line-height: 0; cursor: pointer;
}
.shapepick:disabled { opacity: .45; cursor: default; }
/* 펼치는 판은 문서 맨 위에 뜬다 — 줄 안에 두면 옆 칸에 잘리고 패널이 스크롤되면
   같이 잘려 나간다 */
.shapepanel {
  position: fixed; z-index: 90;
  display: grid; grid-template-columns: repeat(6, auto); gap: 3px;
  padding: 5px; border-radius: 4px;
  background: var(--c-bg2, #1b1622); border: 1px solid var(--c-line, #3a3145);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.shapepanel button { padding: 3px; line-height: 0; cursor: pointer; background: transparent; border: 1px solid transparent; }
.shapepanel button:hover { border-color: var(--c-line, #3a3145); }
.shapepanel button.on { border-color: var(--c-brass, #ffc233); }


/* ── 가방: 끌어 옮기기 · 오른쪽 차림표 · 몇 개 버릴까 ────────────────────── */
.slot.dragging { opacity: .45; }
.slot.over { outline: 1px solid var(--c-brass, #ffc233); outline-offset: -1px; }
/* 차림표와 묻는 창은 문서 맨 위에 뜬다 — 칸 안에 넣으면 옆 칸에 잘린다 */
.slotmenu {
  position: fixed; z-index: 95;
  display: flex; flex-direction: column; min-width: 92px; padding: 3px;
  background: var(--c-bg2, #1b1622); border: 1px solid var(--c-line, #3a3145);
  border-radius: 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.slotmenu button {
  background: transparent; border: 0; padding: 5px 9px;
  text-align: left; cursor: pointer; color: inherit;
}
.slotmenu button:hover { background: var(--c-w4, #2a2333); }
.dropask {
  position: fixed; z-index: 96; left: 50%; top: 40%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; min-width: 240px;
  background: var(--c-bg2, #1b1622); border: 1px solid var(--c-line, #3a3145);
  border-radius: 5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.dropask p { margin: 0; }
.dropask input { width: 100%; }
.dropask .row { display: flex; gap: 6px; justify-content: flex-end; }

/* 좌우 갈래 단추 — 자물쇠와 헷갈리지 않게 글자로 보여준다 */
.lk.mir { font-size: 10px; letter-spacing: -.5px; min-width: 26px; }

/* ── 오목 ────────────────────────────────────────────────────────────────
   ★ 덮개가 아니라 **떠 있는 판**이다. 두는 동안에도 마을이 보여야 한다 —
     상대가 마주 앉아 있는 것과 구경꾼이 온 것이 화면에 그대로 있어야 한다. */
#omok {
  position: fixed; right: 12px; top: 60px; z-index: 40;
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; border-radius: 12px;
  background: var(--c-panel, rgba(24, 18, 32, .94));
  border: 1px solid var(--c-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.omok-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.omok-top b { color: var(--c-plush); }
.omok-top .note { margin: 0; }
.omok-top #omok-resign, .omok-top #omok-close { margin-left: auto; }
.omok-fil { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--c-w2); }
#omok-board { display: block; border-radius: 6px; cursor: pointer; image-rendering: pixelated; }
#omok-msg { margin: 0; }
/* 좁은 화면에서는 통째로 가운데에 눕힌다 */
@media (max-width: 720px) {
  #omok { right: 6px; left: 6px; top: 52px; align-items: center; }
}

/* 우클릭 메뉴 — 캔버스 위에 뜬다 */
.ctxmenu {
  position: fixed; z-index: 60; min-width: 140px;
  display: flex; flex-direction: column;
  padding: 6px; border-radius: 10px;
  background: var(--c-panel, rgba(24, 18, 32, .97));
  border: 1px solid var(--c-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.ctxmenu .ctx-who {
  padding: 4px 8px 6px; font-size: 12px; color: var(--c-w2);
  border-bottom: 1px solid var(--c-line); margin-bottom: 4px;
}
.ctxmenu button {
  background: none; border: 0; text-align: left;
  padding: 7px 8px; border-radius: 6px; color: inherit; font: inherit; cursor: pointer;
}
.ctxmenu button:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.ctxmenu button:disabled { opacity: .4; cursor: default; }

/* 오목 결과 — 이겼는지 졌는지가 **한눈에** 보여야 한다. 글자만 있으면
   판을 들여다보던 눈이 그대로 지나친다. */
.dialog.omok-over { text-align: center; }
.omok-over-mark { font-size: 46px; line-height: 1.1; margin-bottom: 4px; }
.dialog.omok-over .row { justify-content: center; }
/* 구경하는 판은 못 둔다 — 커서로도 알려준다 */
#omok-board.watching { cursor: default; }

/* ── 친구 · 대화 칸 ──────────────────────────────────────────────────────
   ★ 친구끼리 한 말은 **색이 다르다.** 같은 색으로 섞어두면 마을 전체가
     들은 말인지 친구만 들은 말인지 구분이 안 된다 — 그게 헷갈리면
     친구 대화를 쓸 수가 없다. */
/* ★ 친구말 색은 **말풍선과 같은 값**이어야 한다 (game.js 의 FRIEND_TEXT).
   포인트컬러(--c-plush)를 쓰던 때는 너무 쨍해서 글자가 아프게 읽혔다 —
   밝은 푸른색으로 낮춘다. */
#chat-log .fr b { color: var(--c-friend); }
#chat-log .fr { color: var(--c-friend); }
#chat-log .fr::before { content: '친구 '; opacity: .55; font-size: 10px; }

#chat-tabs { display: flex; align-items: center; gap: 4px; padding: 2px 2px 0; flex: none; }
#chat-tabs .spacer { flex: 1; }
#chat-tabs button {
  padding: 1px 7px; font-size: 11px; background: none; border: 0;
  color: var(--c-w2); cursor: pointer; border-bottom: 2px solid transparent;
}
#chat-tabs button.on { color: var(--fg); border-bottom-color: var(--c-plush); }
#chat-tabs #chat-friends { border: 0; color: var(--c-w2); }
#chat-tabs #chat-friends:hover { color: var(--c-plush); }
#chat-to { padding: 0 6px; font-size: 11px; min-width: 40px; }
#chat-to.f { color: var(--c-plush); }

/* 친구 목록 한 줄 */
.fr-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-bottom: 1px solid var(--c-line);
}
.fr-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-row .where { font-size: 11px; color: var(--c-w2); }
.fr-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-w4); flex: none; }
.fr-row .dot.on { background: #5ad46a; }
.fr-row button { padding: 1px 7px; font-size: 11px; }
#friend-list:empty::after, #friend-asks:empty::after {
  content: '아직 없습니다.'; color: var(--c-w2); font-size: 12px;
}

/* 마을 사람 창의 칸 (사람 / 친구) */
#roster-tabs { display: flex; gap: 4px; padding: 2px 4px 0; }
#roster-tabs button {
  padding: 1px 8px; font-size: 11px; background: none; border: 0;
  color: var(--c-w2); cursor: pointer; border-bottom: 2px solid transparent;
}
#roster-tabs button.on { color: var(--fg); border-bottom-color: var(--c-plush); }
#roster-ask-dot { color: var(--c-plush); margin-left: 3px; font-size: 9px; vertical-align: top; }
#roster-friends { padding: 2px 4px 6px; max-height: 260px; overflow-y: auto; }
#roster-friends .note { margin: 2px 2px 6px; font-size: 11px; }
#roster-friends .fr-h { font-size: 11px; color: var(--c-w2); margin: 4px 2px 2px; }
.fr-row .nm { cursor: default; }
/* 친구에게 말하는 중이면 입력 칸이 그렇다고 말해준다 */
#chat-input.to-friends { border-color: var(--c-plush); }
/* 접속 안 한 친구는 회색으로 아래에 */
.fr-row.off { opacity: .5; }
.fr-row.off .nm { color: var(--c-w2); }

/* 창 크기 손잡이 (마을 사람 · 가방) — 이 창들은 위에 붙어 있어 오른쪽 **아래**를 잡는다 */
/* ── 창 크기 조절 — **네 귀퉁이** ─────────────────────────────────────
   ★ 예전엔 오른쪽 아래에 네모 손잡이가 하나 붙어 있었다. 눈에 거슬리고,
     붙은 자리가 하나뿐이라 창이 화면 구석에 붙어 있으면 잡기가 나빴다.
     이제 네 귀퉁이 어디로든 잡는다 — 안 보이는 칸이라 창이 깔끔하다.
   ★ 창 속칸(친구 칸이 z-index:1 이다)보다 **한 층 위**여야 한다. 같은 층이면
     DOM 순서로 갈려서 뒤에 오는 칸이 손잡이를 덮는다 (그래서 한 번 데었다).
   ★ 커서로만 알린다. 머리띠 위에 겹치는 위쪽 두 귀퉁이는 아래 padding-right
     로 단추와 자리를 나눈다. */
.win-corner {
  /* ★ 창은 8px 테두리(그림 테두리)를 두르고 있고, 절대 위치는 **테두리 안쪽**
       부터 잰다. 그래서 0 에 두면 눈에 보이는 모서리보다 8px 안이다.
       바깥으로 빼면 딱 맞겠지만 마을사람·대화창은 overflow:hidden 이라
       잘려버린다 — 그래서 대신 **넉넉히** 잡는다. */
  position: absolute; width: 14px; height: 14px; z-index: 4;
  touch-action: none;
}
/* ★ **무게를 맞춰준다.** 위의 `#chat-panel > *` 는 아이디 규칙이라 클래스
     하나짜리 `.win-corner` 를 이긴다 — 그래서 대화창의 귀퉁이만 position 이
     relative 로 남아, 네 칸이 창 밑에 줄줄이 쌓였다 (`.win` 쪽은 클래스라
     나중에 쓴 이쪽이 이겨서 멀쩡했다. 같은 코드인데 창마다 달랐던 까닭이다). */
#chat-panel > .win-corner { position: absolute; z-index: 4; }
.win-corner.c-tl { left: 0; top: 0; cursor: nwse-resize; }
.win-corner.c-tr { right: 0; top: 0; cursor: nesw-resize; }
.win-corner.c-bl { left: 0; bottom: 0; cursor: nesw-resize; }
.win-corner.c-br { right: 0; bottom: 0; cursor: nwse-resize; }
.win.folded .win-corner, #chat-panel.folded .win-corner { display: none; }
.win { position: relative; }

:root { --c-friend: #8fd0ff; }

/* ── 잠깐 떴다 사라지는 쪽지 ─────────────────────────────────────────────
   ★ 놀이를 가리지 않는 자리 — 위쪽 가장자리. 조작하는 손도, 화면 한가운데도
     비켜간다. 클릭이 통과하도록 두되 쪽지 자체는 눌러서 지울 수 있다. */
#toasts {
  position: fixed; left: 50%; top: 56px; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; gap: 6px;
  align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(18, 14, 24, .92); color: var(--fg);
  border: 1px solid var(--c-line); font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  animation: toast-in .22s ease-out;
}
.toast.fr { border-color: var(--c-friend); color: var(--c-friend); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .24s, transform .24s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ── 커뮤니티 ───────────────────────────────────────────────────────────
   ★ **올린 사람 자리는 없다.** 서버가 안 보내주니 그릴 것도 없다. */
.lobby-tabs { display: flex; gap: 4px; }
.lobby-tabs button { flex: 1; }

.cm-tabs, .cm-find, .cm-sort, .cm-page, .cm-bar { display: flex; align-items: center; gap: 6px; }
.cm-tabs { margin-bottom: 8px; }
.cm-find { margin-bottom: 6px; }
.cm-find #cm-q { flex: 1; min-width: 0; }
.cm-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; min-height: 24px; }
.cm-count { margin-left: auto; color: var(--c-w2); font-size: 11px; }

/* ★ 칸 너비를 고정하지 않는다. 폰에서는 두 줄, 넓으면 세 줄이 저절로 된다 */
.cm-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.cm-card {
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border-image-source: var(--f-card-lg); border-style: solid; border-color: transparent;
  border-width: 8px; border-image-slice: 8 fill; border-image-width: 8px;
  image-rendering: pixelated; min-width: 0;
}
.cm-face {
  /* 캔버스는 42×42 (옷장과 같다). 여기서 **정수배로** 키운다 —
     어중간한 배율로 늘리면 도트가 뭉갠다 */
  width: 84px; height: 84px; align-self: center;
  image-rendering: pixelated;
}
/* 이름·설명은 남이 적은 글이다. 길어도 칸을 안 늘린다 */
.cm-name { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-desc {
  color: var(--c-w2); font-size: 11px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cm-id { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11px; }
.cm-tag { padding: 0 4px; background: var(--c-w9); color: var(--c-brass); font-size: 10px; }
.cm-tag.warn { color: var(--c-ember); }
.linkish {
  background: none; border: 0; box-shadow: none; padding: 0;
  color: var(--c-w2); cursor: pointer; font: inherit; font-size: 11px;
}
.linkish:hover { color: var(--fg); }
.cm-bar { margin-top: auto; }
.cm-bar .spacer { flex: 1; }
.cm-vote { padding: 1px 6px; font-size: 11px; }
.cm-vote.on { border-image-source: var(--f-plush); color: var(--c-void); }
.cm-bar button { min-height: 22px; }

/* ── 마우스를 올리면 8방향 전신 ─────────────────────────────────────────
   ★ 캔버스는 256×128 (4칸 × 2줄, 1:1). **CSS 가 정수 2배로** 키운다 —
     캔버스에서 늘리면 도트가 뭉갠다.
   ★ 칸 안이 아니라 **칸 위에 띄운다.** 안에 넣으면 칸이 커지면서 격자가
     통째로 출렁이고, 그 바람에 마우스가 칸을 벗어나 깜빡인다. */
.cm-card { position: relative; }
.cm-sheet {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  width: 512px; height: 256px; max-width: min(512px, calc(100vw - 24px));
  image-rendering: pixelated;
  border-style: solid; border-color: transparent; border-width: 8px;
  border-image-source: var(--f-glass-lg); border-image-slice: 8 fill; border-image-width: 8px;
  z-index: 20; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
.cm-card.peek .cm-sheet { opacity: 1; visibility: visible; }
/* 손가락으로 쓰는 기계에는 «올리기»가 없다 — 뜨면 손가락 밑에 깔려 가린다 */
body.touch-ui .cm-sheet { display: none; }

.cm-get { padding: 1px 6px; font-size: 11px; }

/* 신고 — 칸 **우상단 구석**의 아주 작은 표.
   ★ 평소엔 흐릿하게 두고 마우스를 올렸을 때만 또렷해진다. 자주 쓰는 것이
     아니라서 눈에 먼저 들어올 이유가 없다 — 다만 찾으면 늘 같은 자리에 있다.
   ★ 미리보기(.cm-sheet)보다 아래층이라 미리보기가 뜬 동안 가려진다. 그게 맞다 —
     그림을 보는 중에 누를 단추가 아니다. */
.cm-report {
  position: absolute; right: 2px; top: 2px; z-index: 5;
  width: 18px; height: 18px; min-height: 0; padding: 0; line-height: 1;
  font-size: 11px; border: 0; box-shadow: none; background: none;
  color: var(--c-w3); opacity: .45; cursor: pointer;
}
.cm-card:hover .cm-report { opacity: 1; }
.cm-report:hover { color: var(--c-ember); background: var(--c-w9); }

.cm-page { justify-content: center; margin-top: 10px; }
.cm-page #cm-pageno { min-width: 64px; text-align: center; color: var(--c-w2); }

/* 올리기 창 */
#cm-up .dialog { width: min(460px, 94vw); }
#cm-up-pick {
  display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  max-height: 190px; overflow-y: auto; margin-bottom: 8px;
}
#cm-up-desc { width: 100%; resize: vertical; font: inherit; }
.cm-vis { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.cm-vis label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* 게임 안 커뮤니티 창 — 카드 두 줄이 들어갈 만큼은 넓게 */
#cm-win { position: absolute; left: 12px; top: 12px; width: 360px; max-width: calc(100vw - 24px); }
#cm-win[hidden] { display: none; }
#cm-win.folded #cm-host-game { display: none; }
#cm-host-game { padding: 6px 2px 2px; max-height: 60vh; overflow-y: auto; }
