/* 홀덤·카드게임 실연동 공통 부품(poker-live.js): 카드게임 지갑 상자, 전환 창, 앉기(바이인) 창, 테스트 계정 안내, 연결 상태 알약.
   색·글꼴은 site.css 의 토큰(--gold --ivory --line …)을 그대로 쓴다. 평평한 노랑 금지: 금색은 var(--gold-btn)(.btn-gold)·.gilt 로.
   움직임 줄이기(reduce)로 연출을 끄지 않는다(README 5절). */

/* 공통 모양 */
.pk-kv { display: grid; gap: 9px; margin: 0 0 14px; padding: 0; }
.pk-kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 14px; }
.pk-kv dt { color: var(--ivory-3); }
.pk-kv dd { margin: 0; color: var(--ivory); text-align: right; font-variant-numeric: tabular-nums; }
.pk-kv dd.strong { font-weight: 800; color: var(--gold-hi); }
.pk-kv dd.muted { color: var(--ivory-3); }
.pk-msg { min-height: 20px; margin: 4px 0 10px; text-align: center; font-size: 14px; line-height: 1.5; color: var(--warn); }
.pk-act { display: flex; gap: 10px; }
.pk-act .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
.pk-dlg .dlg-in { padding: 34px 26px 24px; }
.pk-dlg h2 { margin-bottom: 16px; }

/* 방향 고르기 */
.pk-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 0 0 16px; padding: 3px; border-radius: 10px; background: rgba(12, 9, 7, .7); box-shadow: inset 0 0 0 1px var(--line-2); }
.pk-seg button { min-height: 42px; padding: 0 8px; border: 0; border-radius: 8px; background: none; font: 600 14px/1.2 var(--sans); color: var(--ivory-2); cursor: pointer; }
.pk-seg button:hover { color: var(--ivory); }
.pk-seg button[aria-pressed="true"] { background: var(--gold-btn); color: #1d1408; box-shadow: inset 0 1px 0 rgba(255, 250, 230, .7); }

.pk-conv .fld { margin-bottom: 8px; }
.pk-conv .fld input { text-align: right; font-variant-numeric: tabular-nums; }
.pk-amts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 6px 0 14px; }
.pk-amts3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0 14px; }
.pk-amts button, .pk-amts3 button { min-height: 42px; }
.pk-conv-note, .pk-buy-note { margin: 0 0 8px; font-size: 13px; line-height: 1.65; color: var(--ivory-3); }

/* 앉기 창 */
.pk-buy-pick { margin: 0 0 4px; }
.pk-buy-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.pk-buy-row label { font-size: 13.5px; color: var(--ivory-2); }
.pk-buy-row b { font: 800 22px/1 var(--sans); letter-spacing: -.02em; color: var(--gold-hi); }
.pk-buy .range { width: 100%; }
.pk-buy-short { margin: 0 0 14px; padding: 14px 16px; border-radius: 10px; background: rgba(200, 64, 42, .1); box-shadow: inset 0 0 0 1px rgba(200, 64, 42, .35); }
.pk-buy-short p { margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: var(--ivory-2); }

/* 카드게임 지갑 상자 */
.pk-wal .pk-wal-guest p { margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: var(--ivory-2); }
.pk-wal .pk-kv { margin-bottom: 12px; }
.pk-wal-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: rgba(217, 177, 101, .07); font-size: 12.5px; line-height: 1.6; color: var(--ivory-3); }
.pk-wal-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pk-wal-act .btn { min-width: 0; padding: 0 8px; }

/* 테스트 계정 안내 */
.pk-test { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: rgba(77, 142, 240, .1); box-shadow: inset 0 0 0 1px rgba(77, 142, 240, .35); font-size: 13.5px; line-height: 1.55; color: var(--ivory-2); }
.pk-test[hidden] { display: none; }
.pk-test b { flex: none; padding: 3px 9px; border-radius: 4px; background: rgba(77, 142, 240, .22); font: 700 12px/1.3 var(--sans); color: #b9d2ff; }

/* 연결 상태 알약(테이블 머리 줄) */
.pk-conn { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; background: rgba(8, 6, 4, .72); box-shadow: inset 0 0 0 1px var(--line-2); font: 600 12.5px/1 var(--sans); color: var(--ivory-2); white-space: nowrap; }
.pk-conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--ivory-3); }
.pk-conn[data-s="live"] i { background: #5fd08f; box-shadow: 0 0 8px rgba(95, 208, 143, .8); }
.pk-conn[data-s="reconnecting"] i, .pk-conn[data-s="connecting"] i { background: var(--warn); animation: pkBlink 1.1s infinite; }
.pk-conn[data-s="closed"] i { background: var(--seal); }
@keyframes pkBlink { 50% { opacity: .35; } }

/* 불러오기 실패·빈 상태 안내 */
.pk-fail { padding: 28px 18px; text-align: center; font-size: 14.5px; line-height: 1.7; color: var(--ivory-3); }
.pk-fail b { display: block; margin-bottom: 6px; font: 700 18px/1.3 var(--serif); color: var(--ivory-2); }
.pk-fail .btn { margin-top: 12px; }

@media (max-width: 560px) {
  .pk-dlg .dlg-in { padding: 30px 16px 20px; }
  .pk-act { flex-direction: column-reverse; }
  .pk-act .btn { flex: none; width: 100%; height: 52px; }
  .pk-seg button { font-size: 13.5px; }
}

/* 테이블 화면 안내(주소가 잘못됐거나 서버와 연결되지 않은 때) */
.ht-guide-t { display: block; margin: 0 0 6px; font: 700 18px/1.3 var(--serif); color: var(--ivory-2); }

/* ───── 홀덤 테이블 소리 설정(실연동, p/poker-sound.js): 머리 오른쪽 스피커 단추 → 소리 창(끄기·켜기 + 음량). zxc OwnHoldemSoundControl ───── */
.htx-live .ht-top { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.ht-snd { position: relative; display: inline-flex; }
.ht-snd-b { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(11, 8, 6, .5); color: var(--ivory-2); cursor: pointer; }
.ht-snd-b:hover, .ht-snd-b[aria-expanded="true"] { border-color: var(--gold); color: var(--gold-hi); }
.ht-snd-b svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ht-snd-p { position: absolute; top: calc(100% + 8px); right: 0; z-index: 9; width: 236px; display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(22, 17, 11, .98); box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .62); color: var(--ivory); }
.ht-snd-p[hidden] { display: none; }
.ht-snd-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ht-snd-h strong { font: 700 15px/1.2 var(--serif); }
.ht-snd-m { min-width: 64px; height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: none; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ivory-2); font: 700 12.5px/1 var(--sans); cursor: pointer; }
.ht-snd-m[data-off="true"] { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-hi); }
.ht-snd-s { display: grid; grid-template-columns: auto minmax(0, 1fr) 44px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ivory-3); }
.ht-snd-s b { font: 700 13px/1 var(--sans); color: var(--ivory); text-align: right; font-variant-numeric: tabular-nums; }
.ht-snd-s b[data-muted="true"] { color: var(--ivory-3); font-weight: 600; }
@media (max-width: 760px) {
  /* 휴대폰: 제목 줄은 예전 그대로(제목 | 나가기), 소리 단추는 숫자 칸(블라인드·핸드·내 칩) 줄의 오른쪽 끝 */
  .htx-live .ht-top { grid-template-columns: minmax(0, 1fr) auto auto; }
  .htx-live .ht-back { grid-column: 2 / 4; justify-self: end; }
  .htx-live .ht-meta { grid-column: 1 / 3; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1fr); } /* 단추 자리만큼 줄어도 "1,000 / 2,000" 이 잘리지 않게 블라인드 칸을 더 넓게 */
  .htx-live .ht-snd { grid-column: 3; grid-row: 2; align-self: center; }
  .ht-snd-b { width: 40px; height: 40px; }
  .ht-snd-p { right: -2px; width: min(250px, calc(100vw - 32px)); }
}

/* ───── 홀덤 테이블 전체 화면(실연동, p/poker-fs.js): 머리 오른쪽 단추 → 테이블이 화면 전체를 덮는다. zxc useHoldemImmersive ─────
   덮는 높이는 토스트(90) 밑, 하단 메뉴(60)·서랍(70)·머리띠(50) 위(80). 넓은 화면은 가운데 --wrap 안에서 그대로 보인다. */
.htx-live .ht-top.has-fs { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.ht-fs { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-left: -12px; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(11, 8, 6, .5); color: var(--ivory-2); cursor: pointer; }
.ht-fs:hover, .ht-fs[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-hi); }
.ht-fs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.ht-immersive, html.ht-immersive body { overflow: hidden; }
html.htx-live .ht[data-immersive="true"] {
  position: fixed; inset: 0; z-index: 80; width: auto; max-width: none; margin: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) max(var(--gut), calc((100% - var(--wrap)) / 2)) max(32px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(11, 8, 6, .8), rgba(11, 8, 6, .8)), var(--lacquer) url("/assets/img/lacquer.webp") 0 0 / 1024px repeat; /* body 와 같은 바탕(css/p 폴더라 그림 주소는 절대 주소) */
}
/* 좁은 화면(1000px 이하): 나가기는 글자 없이 ‹ 단추만 남기고(글자는 화면 낭독용으로 둔다, zxc 도 ← 단추뿐이다) 제목 칸을 넓힌다.
   머리 한 줄에 소리·전체 화면 단추가 늘어난 만큼 제목 칸의 안내 줄("● 연결 중  입문 · 노리밋 · 6인")이 두 줄로 꺾이지 않게 하려는 것이다. */
@media (max-width: 1000px) {
  .htx-live .ht-top.has-fs .ht-back { width: 42px; padding: 0; justify-content: center; }
  .htx-live .ht-top.has-fs .ht-back span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .htx-live .ht-top.has-fs { column-gap: 14px; }
  .ht-fs { margin-left: -4px; }
}
@media (max-width: 760px) {
  /* 휴대폰 머리(zxc 와 같은 모양): 윗줄 [‹ 나가기 | 제목 | 소리 | 전체 화면], 아랫줄 숫자 칸(블라인드·핸드·내 칩)이 온 폭을 쓴다 */
  .htx-live .ht-top.has-fs { grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 10px 8px; }
  .htx-live .ht-top.has-fs .ht-back { grid-column: 1; grid-row: 1; width: 40px; height: 40px; align-self: center; justify-self: start; }
  .htx-live .ht-top.has-fs .ht-title { grid-column: 2; grid-row: 1; }
  .htx-live .ht-top.has-fs .ht-snd { grid-column: 3; grid-row: 1; align-self: center; }
  .htx-live .ht-top.has-fs .ht-fs { grid-column: 4; grid-row: 1; align-self: center; width: 40px; height: 40px; margin-left: 0; }
  .htx-live .ht-top.has-fs .ht-kicker { flex-wrap: wrap; gap: 2px 8px; } /* 안내 글("입문 · 노리밋 · 6인")이 글 중간에서 꺾이지 않고, 모자라면 통째로 다음 줄로 */
  .htx-live .ht-top.has-fs #htKind { white-space: nowrap; }
  .htx-live .ht-top.has-fs .ht-meta { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); } /* 블라인드("1,000 / 2,000")가 가장 길어 그 칸을 넓힌다 */
  /* 내 차례 행동판은 평소 하단 메뉴(68px) 위에 붙는다. 덮은 동안은 하단 메뉴가 없으니 그 틈을 없앤다 — 붙는 자리는 스크롤 상자의 안쪽 여백(content box) 기준이라 덮개의 아래 여백(32px)도 0 으로 한다 */
  html.htx-live .ht[data-immersive="true"] { padding-bottom: 0; }
  html.htx-live .ht[data-immersive="true"] .ht-act[data-state="me"] { bottom: env(safe-area-inset-bottom, 0px); }
  html.htx-live .ht:not(.cgt)[data-immersive="true"] .ht-stage { height: clamp(430px, calc(100svh - 238px), 600px); } /* 머리띠·하단 메뉴가 빠진 만큼 무대를 키운다(카드게임 테이블은 게임마다 무대 높이 규칙이 달라 그대로 둔다) */
}
