/* 쇼부카지노 카드게임 허브(/card-games)·게임별 로비(/card-games/*) 전용.
   게임 카드 6종, 오늘의 큰 판, 바로 앉을 수 있는 방, 이용 안내, 방 목록 표(휴대폰은 두 줄 카드), 규칙, 방 만들기 창. */
/* 금박 질감: site.css 의 상대 주소(../img)는 이 폴더(css/p)에서 쓰면 /assets/css/img 로 풀려 깨지므로 절대 주소로 다시 둔다 */
:root { --leaf: url("/assets/img/goldleaf.webp"); --leaf-soft: url("/assets/img/goldleaf-soft.webp"); }


/* 머리 버튼 그림 */
.cg-ph .ph-act svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cg-ph .btn-ghost { padding: 0 18px; }

/* ───────── 허브: 게임 6종 ───────── */
.cg-games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.cg-game { --ar: 3 / 2; }
.cg-game .gcard-img::before { background: linear-gradient(0deg, rgba(8, 6, 4, .96) 0%, rgba(8, 6, 4, .66) 36%, rgba(8, 6, 4, 0) 66%); }
.cg-game .gcard-cap { left: 22px; right: 22px; bottom: 20px; }
.cg-game .gcard-t { font-size: clamp(24px, 2.2vw, 31px); }
.cg-game .gcard-d { font-size: 14.5px; }
.cg-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cg-pills span { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: rgba(8, 6, 4, .62); box-shadow: inset 0 0 0 1px var(--line-2); font: 600 12.5px/1 var(--sans); color: var(--ivory-2); white-space: nowrap; }
.cg-game .gcard-live { top: 14px; right: 14px; height: 28px; padding: 0 11px; font-size: 12.5px; }

/* 상자 머리 · 납작한 표 */
.cg-box-hd { margin: 0; padding: 20px 22px 8px; }
.cg-flat { border-radius: 0; background: none; box-shadow: none; }
.cg-new td { animation: cgFlash 1.6s ease; }
@keyframes cgFlash { from { background-color: rgba(217, 177, 101, .2); } }
.cg-flash { animation: cgFlash 1.4s ease; }
tr.cg-flash td { animation: cgFlash 1.4s ease; }
tr.cg-flash { animation: none; }

/* 좌석 점 */
.cg-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.cg-dots i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.cg-dots i.on { background: var(--gold-btn); box-shadow: none; }

/* 바로 앉을 수 있는 방 */
.cg-quick { margin: 0; padding: 0; list-style: none; }
.cg-quick li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 11px 6px; margin: 0 -6px; border-radius: 8px; border-bottom: 1px solid rgba(217, 177, 101, .08); }
.cg-quick li:last-child { border-bottom: 0; }
.cg-quick .bdg { justify-content: center; }
.cg-q-m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cg-q-m b { font: 700 14.5px/1.25 var(--sans); color: var(--ivory); }
.cg-q-m small { font-size: 12.5px; color: var(--ivory-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-q-s { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 12.5px; color: var(--ivory-2); }
.cg-quick .btn { padding: 0 14px; }

/* 이용 안내 */
.cg-guide .box { position: relative; padding-top: 26px; }
.cg-gi { display: block; margin-bottom: 14px; font: 900 30px/1 var(--serif); color: var(--gold); opacity: .9; }
.cg-guide .box-d { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--ivory-2); }
.cg-rules { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.cg-rule { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px; background: rgba(19, 15, 10, .6); box-shadow: inset 0 0 0 1px var(--line); color: inherit; text-decoration: none; transition: box-shadow .25s; }
.cg-rule:hover { box-shadow: inset 0 0 0 1px var(--gold); }
.cg-rule b { font: 700 15px/1.3 var(--sans); color: var(--ivory); }
.cg-rule small { font-size: 12.5px; color: var(--ivory-3); }

/* ───────── 로비: 방 목록 ───────── */
.cg-bar { margin-bottom: 14px; }
.cg-bar > .chips { flex: 1 1 auto; min-width: 0; }
.cg-sw { flex: none; min-height: 40px; }
.cg-rooms-wrap .empty { padding: 48px 20px; }
.cg-rooms.is-empty thead { display: none; }
.cg-rooms td { vertical-align: middle; }
.cg-rooms th:nth-child(1) { width: 25%; }
.cg-rooms th:nth-child(2) { width: 15%; }
.cg-rooms th:nth-child(3) { width: 22%; }
.cg-rooms th:nth-child(4) { width: 15%; }
.cg-rooms th:nth-child(5) { width: 10%; }
.cg-no b { margin-right: 8px; font: 700 15.5px/1.2 var(--sans); color: var(--ivory); }
.cg-no .bdg { height: 22px; padding: 0 8px; vertical-align: 1px; }
.cg-st { display: block; margin-top: 5px; font-size: 12px; color: var(--ivory-3); }
.cg-st[data-st="play"] { color: #8fdcb0; }
.cg-st[data-st="play"]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--ok); vertical-align: 2px; }
.cg-stake { font-weight: 700; color: var(--gold-hi); }
.cg-seat { white-space: nowrap; }
.cg-seat .num { margin-left: 10px; color: var(--ivory-2); }
.cg-go { width: 1%; text-align: right; }
.cg-go .btn { min-width: 104px; }
.cg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cg-more { display: flex; justify-content: center; margin-top: 22px; }
.cg-more .n { font-size: 13px; font-weight: 600; opacity: .7; }

/* 규칙 · 최근 큰 판 · 판돈 등급 */
#cgRules { scroll-margin-top: calc(var(--hd-h) + 16px); }
#cgRules .acc-b ul { margin: 0 0 4px; padding-left: 18px; }
#cgRules .acc-b li { margin: 4px 0; }
#cgRules .acc-b b { color: var(--ivory); }
.cg-side { display: grid; gap: 14px; min-width: 0; }
.cg-big { margin: 0; padding: 0; list-style: none; }
.cg-big li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(217, 177, 101, .08); }
.cg-big li:last-child { border-bottom: 0; }
.cg-big-t { font-size: 12.5px; color: var(--ivory-3); font-variant-numeric: tabular-nums; }
.cg-big-m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cg-big-m b { font: 600 14px/1.3 var(--sans); color: var(--ivory); }
.cg-big-m small { font-size: 12.5px; color: var(--champagne); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-big em { font-style: normal; font-weight: 700; font-size: 14px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.cg-kv { margin-top: 14px; }
.cg-kv dd { color: var(--gold-hi); font-weight: 600; }
.cg-kv-note { margin: 14px 0 0; font-size: 12.5px; color: var(--ivory-3); }

/* ───────── 방 만들기 창 ───────── */
.cg-dlg { width: min(520px, calc(100vw - 32px)); }
.cg-dlg h2 { margin-bottom: 20px; }
.cg-opts { margin-bottom: 14px; }
.cg-opts .opt > span { padding: 12px 14px; }
.cg-row { gap: 12px; }
.cg-secret { margin: 4px 0 14px; }
.cg-dlg-act { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; margin-top: 8px; }
.cg-dlg-act .btn-lg { height: 54px; padding: 0 12px; font-size: 16px; }

/* ───────── 반응형 ───────── */
@media (max-width: 1240px) {
  .cg-rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .cg-games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cg-ph .ph-act { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cg-ph .ph-act .btn-lg { height: 50px; padding: 0 10px; font-size: 15px; }
  .cg-ph .ph-act .btn-ghost { grid-column: 1 / -1; height: 44px; }
  .cg-games { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cg-game { --ar: 16 / 9; }
  .cg-game .gcard-cap { left: 16px; right: 16px; bottom: 15px; }
  .cg-game .gcard-t { font-size: 24px; }
  .cg-game .gcard-d { font-size: 13.5px; }
  .cg-pills { margin-top: 10px; }
  .cg-box-hd { padding: 18px 16px 6px; }
  .cg-quick li { grid-template-columns: 62px minmax(0, 1fr) auto auto; gap: 8px; }
  .cg-quick .bdg { padding: 0 4px; font-size: 11px; }
  .cg-guide { grid-template-columns: minmax(0, 1fr); }
  .cg-guide .box { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 10px; padding: 18px 16px; }
  .cg-gi { grid-row: span 2; margin: 2px 0 0; font-size: 26px; }
  .cg-guide .box-d { margin-top: 4px; }
  .cg-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cg-rule { padding: 12px 14px; }

  .cg-bar > .chips { flex: 1 1 100%; margin-inline: calc(-1 * var(--gut)); padding-inline: var(--gut); }
  /* 방 목록: 한 방을 두 줄 카드로 */
  .dt.cg-rooms thead { display: none; }
  .dt.cg-rooms, .dt.cg-rooms tbody { display: block; width: 100%; }
  .dt.cg-rooms tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "no go" "stake seat" "avg wait"; align-items: center; gap: 7px 12px; padding: 14px 16px; border-bottom: 1px solid rgba(217, 177, 101, .1); }
  .dt.cg-rooms tr[hidden] { display: none; }
  .dt.cg-rooms tbody tr:last-child { border-bottom: 0; }
  .dt.cg-rooms td { display: block; padding: 0; border: 0; white-space: nowrap; text-align: left; font-size: 13.5px; }
  .dt.cg-rooms tbody tr:hover td { background: none; }
  .dt.cg-rooms td:nth-child(1) { grid-area: no; }
  .dt.cg-rooms td:nth-child(2) { grid-area: stake; }
  .dt.cg-rooms td:nth-child(3) { grid-area: seat; }
  .dt.cg-rooms td:nth-child(4) { grid-area: avg; }
  .dt.cg-rooms td:nth-child(5) { grid-area: wait; }
  .dt.cg-rooms td:nth-child(6) { grid-area: go; justify-self: end; width: auto; }
  .dt.cg-rooms td:nth-child(n+2):nth-child(-n+5)::before { content: attr(data-th); margin-right: 6px; font-size: 12.5px; font-weight: 400; color: var(--ivory-3); }
  .dt.cg-rooms .cg-st { margin-top: 4px; }
  .cg-no b { margin-right: 6px; }
  .cg-seat .num { margin-left: 6px; }
  .cg-go .btn { min-width: 0; }
  .cg-dlg-act .btn-lg { height: 50px; font-size: 15.5px; }

  /* 큰 당첨 표: 한 줄을 두 줄 묶음으로(시간 | 이름·금액 / 회원·결과) */
  .dt.cg-wins thead { display: none; }
  .dt.cg-wins, .dt.cg-wins tbody { display: block; width: 100%; }
  .dt.cg-wins tr { display: grid; grid-template-columns: 44px auto minmax(0, 1fr) auto; grid-template-areas: "t g g a" "t u r r"; align-items: baseline; gap: 4px 10px; padding: 12px 16px; border-bottom: 1px solid rgba(217, 177, 101, .08); }
  .dt.cg-wins tbody tr:last-child { border-bottom: 0; }
  .dt.cg-wins td { display: block; min-width: 0; padding: 0; border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
  .dt.cg-wins tbody tr:hover td { background: none; }
  .dt.cg-wins td:nth-child(1) { grid-area: t; font-size: 12.5px; }
  .dt.cg-wins td:nth-child(2) { grid-area: g; font-weight: 600; }
  .dt.cg-wins td:nth-child(3) { grid-area: u; font-size: 13px; color: var(--ivory-2); }
  .dt.cg-wins td:nth-child(4) { grid-area: r; font-size: 13px; color: var(--champagne); }
  .dt.cg-wins td:nth-child(4)::before { content: "· "; color: var(--ivory-3); }
  .dt.cg-wins td.wrap-txt { min-width: 0; white-space: nowrap; }
  .dt.cg-wins td:nth-child(5) { grid-area: a; font-weight: 700; text-align: right; }
}

/* 큰 당첨 표의 게임 이름 링크: 눈에 보이는 높이는 그대로 두고 누르는 자리만 40px 로 */
.dt.cg-wins td:nth-child(2) { overflow: visible; }
.dt.cg-wins td:nth-child(2) a { display: inline-flex; align-items: center; min-height: 40px; min-width: 44px; margin: -12px 0; }

/* 실연동(html.api-live, cardgames-live.js): 서버 값을 받기 전에는 꾸민 숫자(열린 방·오늘 판 수·바로 앉을 수 있는 방 수)를 가린다(자리는 그대로 둔다) */
html.api-live:not(.cgx-ready) .ph-stats, html.api-live:not(.cgx-ready) #cgOpenN { visibility: hidden; }
