/* 친구랑 체스 첫 화면 — harulogs 스킨 (색은 var(--hl-*) 토큰, 판 색만 이 파일에서 정한다) */
.chess-game {
    /* 판 색 (라이트) — 목업 정본 값 */
    --cz-sq-l: #EEF0FB;
    --cz-sq-d: #8E95D4;
    --cz-sq-last: rgba(250, 204, 21, .5);
    --cz-sq-sel: rgba(245, 158, 11, .7);
    --cz-sq-hint: rgba(16, 185, 129, .55);
    --cz-dot: rgba(15, 23, 42, .28);
    /* 말 색 — 테마와 무관하게 백은 흰색, 흑은 짙은 남색 */
    --cz-w-fill: #FFFFFF;
    --cz-w-line: #1F2937;
    --cz-b-fill: #1F2937;
    --cz-b-line: #0B0F19;
    --cz-b-detail: #E5E7EB;
}
[data-bs-theme="dark"] .chess-game {
    --cz-sq-l: #C9CDE8;
    --cz-sq-d: #6A71B0;
}

/* hidden 속성이 부트스트랩 d-flex(!important)에 지지 않게 */
.chess-game [hidden] { display: none !important; }

/* 히어로 — 제목·판 수를 왼쪽, 작은 체스판 그림을 오른쪽에 둔 띠 */
.chess-game .cz-hero {
    padding: 22px 28px;
    border-radius: 16px;
    border: 1px solid var(--hl-border-subtle);
    background: linear-gradient(120deg, var(--hl-accent-subtle), var(--hl-surface) 70%);
}
.chess-game .cz-hero-text { min-width: 0; }
.chess-game .cz-hero h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--hl-text-strong);
}
.chess-game .cz-mark { color: var(--hl-fg-primary); }
.chess-game .cz-hero p { color: var(--hl-text-muted); font-size: 15px; }
.chess-game #czRooms,
.chess-game #czWait,
.chess-game #czRanking { scroll-margin-top: 90px; }

/* 히어로 작은 체스판 (장식, 4×4) */
.chess-game .cz-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 152px;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 22px var(--hl-shadow);
    transform: rotate(-4deg);
}
.chess-game .cz-mini-sq {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cz-sq-l);
}
.chess-game .cz-mini-sq.is-dark { background: var(--cz-sq-d); }
.chess-game .cz-mini .cz-pc { width: 88%; height: 88%; }

/* 진행 중·기다리는·오늘 끝난 판 (히어로 안 알약) */
.chess-game .cz-live-item {
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--hl-surface);
    border: 1px solid var(--hl-border-subtle);
    color: var(--hl-text-muted);
    font-size: 14px;
    text-decoration: none;
}
.chess-game a.cz-live-item:hover { border-color: var(--hl-accent); color: var(--hl-fg-primary); }
.chess-game .cz-live-item strong {
    color: var(--hl-text-strong);
    font-variant-numeric: tabular-nums;
}
.chess-game .cz-live-item .bi { color: var(--hl-fg-primary); }
.chess-game .cz-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hl-fg-success);
    animation: czBlink 1.6s ease-in-out infinite;
}
@keyframes czBlink { 50% { opacity: .35; } }

/* 준비 중 표시 */
.chess-game .cz-soon-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.5;
    vertical-align: middle;
}
.chess-game .cz-soon-badge {
    color: var(--hl-text-muted);
    background: var(--hl-surface-3);
    border: 1px solid var(--hl-border);
}
.chess-game .cz-sample-note { font-size: 12.5px; color: var(--hl-text-muted); }

/* 카드 */
.chess-game .cz-card {
    background: var(--hl-surface);
    border: 1px solid var(--hl-border-subtle);
    border-radius: 14px;
    box-shadow: 0 2px 10px var(--hl-shadow);
    padding: 24px;
    color: var(--hl-text);
}
.chess-game .cz-card-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--hl-text-strong);
    margin-bottom: 16px;
}
.chess-game .cz-card-title .bi { color: var(--hl-fg-primary); }
.chess-game .cz-field { margin-bottom: 18px; }
.chess-game .cz-label {
    display: block;
    font-weight: 700;
    color: var(--hl-text-strong);
    margin-bottom: 8px;
    font-size: 15px;
}
.chess-game .cz-hint { font-size: 13px; color: var(--hl-text-muted); }
.chess-game .cz-field .cz-hint { margin-top: 6px; }
.chess-game .cz-input { padding: 11px 14px; border-radius: 10px; font-size: 16px; }
.chess-game .cz-input[readonly] { background: var(--hl-surface-3); }
.chess-game .cz-btn-lg { border-radius: 12px; font-weight: 700; padding-top: 14px; padding-bottom: 14px; }

/* 시간·색 고르기 */
.chess-game .cz-seg {
    display: flex;
    gap: 8px;
}
.chess-game .cz-seg button {
    flex: 1 1 0;
    min-width: 0;
    border: 1.5px solid var(--hl-border);
    background: var(--hl-surface);
    color: var(--hl-text);
    border-radius: 10px;
    padding: 10px 6px;
    font-size: 14.5px;
    line-height: 1.35;
    transition: border-color .15s, background .15s;
}
.chess-game .cz-seg button small {
    display: block;
    color: var(--hl-text-muted);
    font-size: 12px;
    font-weight: 400;
}
.chess-game .cz-seg button:hover { background: var(--hl-surface-hover); }
.chess-game .cz-seg button.is-on {
    border-color: var(--hl-accent);
    background: var(--hl-accent-subtle);
    color: var(--hl-fg-primary);
    font-weight: 700;
}

/* 세 단계 안내 */
.chess-game .cz-steps li {
    flex: 1 1 0;
    text-align: center;
    font-size: 13px;
    color: var(--hl-text-muted);
}
.chess-game .cz-steps .bi {
    display: block;
    font-size: 20px;
    color: var(--hl-fg-primary);
    margin-bottom: 4px;
}

/* 친구 기다리기 (샘플) */
.chess-game .cz-wait .cz-hint { font-size: 14px; }
.chess-game .cz-pulse { display: inline-flex; gap: 6px; margin: 4px 0 14px; }
.chess-game .cz-pulse i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hl-accent);
    animation: czPulse 1.2s infinite;
}
.chess-game .cz-pulse i:nth-child(2) { animation-delay: .2s; }
.chess-game .cz-pulse i:nth-child(3) { animation-delay: .4s; }
@keyframes czPulse {
    0%, 80%, 100% { opacity: .25; transform: scale(.8); }
    40% { opacity: 1; transform: scale(1); }
}
.chess-game .cz-chip {
    background: var(--hl-accent-subtle);
    color: var(--hl-fg-primary);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13.5px;
    font-weight: 600;
}
.chess-game .cz-qr {
    padding: 14px;
    border-radius: 12px;
    background: var(--hl-surface-3);
    font-size: 13.5px;
    color: var(--hl-text-muted);
}
.chess-game .cz-qr strong { color: var(--hl-text-strong); }
.chess-game .cz-qr-box {
    flex: none;
    width: 76px;
    height: 76px;
    border-radius: 8px;
    border: 1.5px dashed var(--hl-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--hl-text-faint);
}
.chess-game .cz-copied { min-height: 1.4em; font-size: 13px; color: var(--hl-fg-success); }

/* 게임 계정 */
.chess-game .cz-tabs button {
    flex: 1 1 0;
    border: 0;
    border-radius: 8px;
    padding: 8px 6px;
    background: var(--hl-surface-3);
    color: var(--hl-text-muted);
    font-weight: 600;
    font-size: 14px;
}
.chess-game .cz-tabs button.is-on {
    background: var(--hl-accent-subtle);
    color: var(--hl-fg-primary);
}
.chess-game .cz-warn {
    font-size: 13px;
    color: var(--hl-alert-warning-fg);
    background: var(--hl-alert-warning-bg);
    border: 1px solid var(--hl-alert-warning-bd);
    border-radius: 10px;
    padding: 10px 12px;
}
.chess-game .cz-error { min-height: 0; font-size: 13px; color: var(--hl-fg-danger); }
.chess-game .cz-error:empty { display: none; }
.chess-game .cz-avatar { width: 48px; height: 48px; flex: none; }
.chess-game .cz-avatar-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hl-accent);
    color: var(--hl-on-accent);
    font-weight: 800;
    font-size: 20px;
}
.chess-game .cz-member strong,
.chess-game .cz-signed strong { color: var(--hl-text-strong); }

/* 방 만들기 — 누구로 두는지 */
.chess-game .cz-who {
    margin: -6px 0 18px;
    font-size: 14px;
    color: var(--hl-text-muted);
}
.chess-game .cz-who .bi { color: var(--hl-fg-primary); font-size: 18px; }
.chess-game .cz-public-note {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--hl-fg-success);
}

/* 계정 확인 모달 */
.chess-game .cz-gate {
    background: var(--hl-surface);
    color: var(--hl-text);
    border: 1px solid var(--hl-border-subtle);
    border-radius: 14px;
}
.chess-game .cz-gate .modal-header { border-bottom-color: var(--hl-border-subtle); }

/* 방 목록 행 (대기 중·진행 중 공용) */
.chess-game .cz-open li {
    padding: 12px 4px;
    border-bottom: 1px solid var(--hl-border-subtle);
}
.chess-game .cz-open li:last-child { border-bottom: 0; }
.chess-game .cz-open li.is-mine {
    background: var(--hl-accent-subtle);
    border-radius: 10px;
    padding-left: 10px;
    padding-right: 10px;
}
.chess-game .cz-open-main { min-width: 0; }
.chess-game .cz-open strong { color: var(--hl-text-strong); }
.chess-game .cz-avatar-sm {
    width: 38px;
    height: 38px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hl-surface-3);
    color: var(--hl-fg-primary);
    font-weight: 800;
    border: 1px solid var(--hl-border-subtle);
}
.chess-game .cz-tag {
    padding: 1px 9px;
    border-radius: 6px;
    background: var(--hl-surface-3);
    color: var(--hl-text);
    font-size: 12.5px;
    font-weight: 600;
}
.chess-game .cz-mine-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--hl-accent);
    color: var(--hl-on-accent);
    font-size: 12.5px;
    font-weight: 700;
}
.chess-game .cz-empty { padding: 18px 0 8px; }
.chess-game .cz-empty > .bi { font-size: 30px; color: var(--hl-text-faint); }
.chess-game .cz-empty-title { font-weight: 700; color: var(--hl-text-strong); }
.chess-game .cz-open-note { font-size: 13.5px; color: var(--hl-fg-primary); }
.chess-game .cz-open-note:empty { display: none; }

/* 체스판 — 8×8 은 판 자체의 구조라 grid 로 그린다 */
.chess-game .cz-board-wrap {
    container-type: inline-size;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px var(--hl-shadow);
    max-width: 440px;
    margin: 0 auto;
}
.chess-game .cz-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1 / 1;
    user-select: none;
    touch-action: manipulation;
}
.chess-game .cz-sq {
    position: relative;
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
    background: var(--cz-sq-l);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.chess-game .cz-sq.is-dark { background: var(--cz-sq-d); }
.chess-game .cz-sq:focus-visible { outline: 3px solid var(--hl-accent); outline-offset: -3px; z-index: 3; }
.chess-game .cz-sq.is-last::before,
.chess-game .cz-sq.is-sel::before {
    content: "";
    position: absolute;
    inset: 0;
}
.chess-game .cz-sq.is-last::before { background: var(--cz-sq-last); }
.chess-game .cz-sq.is-sel::before { background: var(--cz-sq-sel); }
.chess-game .cz-sq.is-target::after {
    content: "";
    position: absolute;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: var(--cz-dot);
    z-index: 2;
}
.chess-game .cz-sq.is-target.is-capture::after {
    width: 86%;
    height: 86%;
    background: transparent;
    border: 4px solid var(--cz-dot);
}
/* AI 힌트 (#2231, 허용 계정 화면에만) — 추천 수의 출발·도착 칸 + 판 위 화살표 */
.chess-game .cz-sq.is-ai-from::before,
.chess-game .cz-sq.is-ai-to::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--cz-sq-hint);
}
.chess-game .cz-sq.is-ai-from::before { opacity: .55; }
.chess-game .cz-hint-arrow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}
.chess-game .cz-hint-arrow line {
    stroke: var(--hl-fg-success);
    stroke-width: .16;
    stroke-linecap: round;
    opacity: .85;
}
.chess-game .cz-hint-arrow marker path { fill: var(--hl-fg-success); }
.chess-game .cz-ai-hint {
    font-size: 14px;
    font-weight: 600;
    color: var(--hl-fg-success);
}
.chess-game .cz-ai-hint.is-muted { color: var(--hl-text-muted); font-weight: 500; }
.chess-game .cz-sq.is-wrong { animation: czShake .35s; }
@keyframes czShake {
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
.chess-game .cz-pcs {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.chess-game .cz-pc {
    position: relative;
    z-index: 1;
    width: 94%;
    height: 94%;
    pointer-events: none;
}
.chess-game .cz-pc .body { stroke-width: 1.5; stroke-linejoin: round; }
.chess-game .cz-pc .dt { fill: none; stroke-width: 1.4; stroke-linecap: round; }
.chess-game .cz-pc.w .body { fill: var(--cz-w-fill); stroke: var(--cz-w-line); }
.chess-game .cz-pc.w .dt { stroke: var(--cz-w-line); }
.chess-game .cz-pc.w .dtf { fill: var(--cz-w-line); }
.chess-game .cz-pc.b .body { fill: var(--cz-b-fill); stroke: var(--cz-b-line); }
.chess-game .cz-pc.b .dt { stroke: var(--cz-b-detail); }
.chess-game .cz-pc.b .dtf { fill: var(--cz-b-detail); }
.chess-game .cz-co {
    position: absolute;
    font-size: 2.6cqw;
    font-weight: 700;
    line-height: 1;
    opacity: .8;
    z-index: 1;
    pointer-events: none;
}
.chess-game .cz-co.f { right: 3px; bottom: 2px; }
.chess-game .cz-co.r { left: 3px; top: 3px; }
.chess-game .cz-sq.is-dark .cz-co { color: var(--cz-sq-l); }
.chess-game .cz-sq:not(.is-dark) .cz-co { color: var(--cz-sq-d); }

/* 주간 순위 */
.chess-game .cz-rank li {
    padding: 8px 4px;
    border-bottom: 1px solid var(--hl-border-subtle);
    font-size: 15px;
}
.chess-game .cz-rank li:last-child { border-bottom: 0; }
.chess-game .cz-rank-no {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--hl-surface-3);
    color: var(--hl-text-muted);
}
.chess-game .cz-rank li.is-top .cz-rank-no { background: var(--hl-accent); color: var(--hl-on-accent); }
.chess-game .cz-rank-wins { font-weight: 700; color: var(--hl-text-strong); font-variant-numeric: tabular-nums; }

/* 휴대폰 폭 */
@media (max-width: 575.98px) {
    /* 휴대폰 — 작은 판은 오른쪽 위에 띄우고, 알약 줄은 판 아래까지 폭을 다 쓴다 */
    .chess-game .cz-hero { position: relative; padding: 16px; }
    .chess-game .cz-hero h1,
    .chess-game .cz-hero p { padding-right: 84px; }
    .chess-game .cz-hero-art { position: absolute; top: 16px; right: 14px; }
    .chess-game .cz-hero h1 { font-size: 23px; }
    .chess-game .cz-hero p { font-size: 13.5px; }
    .chess-game .cz-mini { width: 76px; border-radius: 7px; }
    .chess-game .cz-live-item { padding: 4px 10px; font-size: 13px; }
    .chess-game .cz-card { padding: 18px 16px; }
    .chess-game .cz-seg { gap: 6px; }
    .chess-game .cz-seg button { font-size: 14px; padding: 9px 4px; }
    .chess-game .cz-co { font-size: 3cqw; }
}

/* 게임 계정 — 실제 연결 (#2214) */
.chess-game .cz-signed-main { min-width: 0; }
.chess-game .cz-linked {
    font-size: 13px;
    color: var(--hl-text-muted);
}
.chess-game .cz-linked .bi { color: var(--hl-fg-primary); font-size: 16px; }
.chess-game .cz-code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
}
/* 복구 코드 — 크게, 고정폭, 줄바꿈 없이 */
.chess-game .cz-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(22px, 7vw, 30px);
    font-weight: 800;
    letter-spacing: .12em;
    white-space: nowrap;
    color: var(--hl-text-strong);
    background: var(--hl-surface-3);
    border: 1.5px dashed var(--hl-border-strong);
    border-radius: 12px;
    padding: 14px 8px;
    user-select: all;
}
.chess-game .cz-copied.is-bad { color: var(--hl-fg-danger); }

/* 글자 단추 — 스킨 colors.css 의 .btn-link 는 칠한 단추 모양이라 여기서는 쓰지 않는다 */
.chess-game .cz-linkbtn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--hl-fg-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.chess-game .cz-linkbtn:hover { text-decoration: underline; }
.chess-game .cz-linkbtn:focus-visible { outline: 2px solid var(--hl-accent); outline-offset: 2px; border-radius: 4px; }

/* ── #2221 — 히어로의 내 닉네임 줄 ── */
.chess-game .cz-me { font-size: 14px; color: var(--hl-text-muted); min-width: 0; }
.chess-game .cz-me .bi { color: var(--hl-fg-primary); font-size: 17px; }
.chess-game .cz-me-signed { min-width: 0; }
.chess-game .cz-me strong { color: var(--hl-text-strong); max-width: 14em; }
.chess-game .cz-avatar-xs {
    width: 24px;
    height: 24px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hl-accent);
    color: var(--hl-on-accent);
    font-size: 12px;
    font-weight: 800;
}

/* ── 방 목록 탭 (대기 중 / 진행 중) ── */
.chess-game .cz-room-tabs {
    padding: 4px;
    border-radius: 12px;
    background: var(--hl-surface-3);
}
.chess-game .cz-room-tabs button {
    border: 0;
    border-radius: 9px;
    padding: 7px 14px;
    background: transparent;
    color: var(--hl-text-muted);
    font-weight: 700;
    font-size: 14.5px;
    white-space: nowrap;
}
.chess-game .cz-room-tabs button:hover { color: var(--hl-text-strong); }
.chess-game .cz-room-tabs button.is-on {
    background: var(--hl-surface);
    color: var(--hl-fg-primary);
    box-shadow: 0 1px 4px var(--hl-shadow);
}
.chess-game .cz-room-tabs button:focus-visible { outline: 2px solid var(--hl-accent); outline-offset: 1px; }
.chess-game .cz-count {
    display: inline-block;
    min-width: 1.6em;
    margin-left: 2px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--hl-border-subtle);
    color: var(--hl-text-muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.chess-game .cz-room-tabs button.is-on .cz-count { background: var(--hl-accent-subtle); color: var(--hl-fg-primary); }
.chess-game .cz-create-btn { border-radius: 10px; font-weight: 700; }

/* 진행 중 행 — 백 vs 흑 */
.chess-game .cz-vs-line { min-width: 0; }
.chess-game .cz-vs-side { min-width: 0; }
.chess-game .cz-vs { font-size: 12px; font-weight: 700; color: var(--hl-text-faint); }
.chess-game .cz-pc-dot {
    width: 12px;
    height: 12px;
    flex: none;
    border-radius: 50%;
    border: 1.5px solid var(--cz-w-line);
}
.chess-game .cz-pc-dot.is-w { background: var(--cz-w-fill); }
.chess-game .cz-pc-dot.is-b { background: var(--cz-b-fill); border-color: var(--cz-b-line); }
[data-bs-theme="dark"] .chess-game .cz-pc-dot.is-b { border-color: var(--hl-border-strong); }

/* 기다리기 화면 — 목록 카드 안에서 링크 칸 폭만 줄인다 */
.chess-game .cz-wait {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--hl-border-subtle);
}
.chess-game .cz-wait-box { max-width: 460px; }

/* 처음 온 브라우저에서만 보이는 「먼저 둘러볼게요」 */
.chess-game .cz-skip { color: var(--hl-text-muted); }

/* ── 관전 화면 (샘플) ── */
.chess-game .cz-watch-board { max-width: 480px; }
.chess-game .cz-watch-board .cz-board-wrap { max-width: none; }
.chess-game .cz-board.is-static .cz-sq { cursor: default; }
.chess-game .cz-player {
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--hl-surface-3);
    color: var(--hl-text-strong);
    min-width: 0;
}
.chess-game .cz-clock {
    padding: 3px 10px;
    border-radius: 8px;
    background: var(--hl-surface);
    border: 1px solid var(--hl-border-subtle);
    font-weight: 800;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    color: var(--hl-text-strong);
}
.chess-game .cz-player.is-turn .cz-clock {
    background: var(--hl-accent);
    border-color: var(--hl-accent);
    color: var(--hl-on-accent);
}
.chess-game .cz-movelog {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    max-height: 7.5em;
    overflow-y: auto;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--hl-text-strong);
}
.chess-game .cz-mv-no { color: var(--hl-text-faint); }

/* 채팅 자리 */
.chess-game .cz-chat {
    min-height: 0;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--hl-border-subtle);
    background: var(--hl-surface-2, var(--hl-surface));
    gap: 10px;
}
.chess-game .cz-chat .form-check-label { font-size: 13px; }
.chess-game .cz-chat-log {
    min-height: 160px;
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chess-game .cz-chat-msg { font-size: 14px; line-height: 1.45; }
.chess-game .cz-chat-body { min-width: 0; overflow-wrap: anywhere; }
.chess-game .cz-chat-body strong { color: var(--hl-text-strong); margin-right: 2px; }
.chess-game .cz-chat-msg.is-me .cz-chat-body strong { color: var(--hl-fg-primary); }
.chess-game .cz-chat-side {
    flex: none;
    margin-top: 1px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.6;
    background: var(--hl-surface-3);
    color: var(--hl-text-muted);
}
.chess-game .cz-chat-side.is-w { background: var(--cz-w-fill); color: var(--cz-w-line); border: 1px solid var(--hl-border); }
.chess-game .cz-chat-side.is-b { background: var(--cz-b-fill); color: var(--cz-b-detail); }
.chess-game .cz-chat-menu { color: var(--hl-text-faint); line-height: 1; padding: 2px 4px; }
.chess-game .cz-chat-menu:hover { color: var(--hl-text-strong); text-decoration: none; }
.chess-game .cz-chat-note { font-size: 13px; color: var(--hl-text-muted); }

@media (max-width: 575.98px) {
    .chess-game .cz-room-tabs button { padding: 7px 10px; font-size: 14px; }
}
/* #2267 — 탭과 한 줄에 안 들어가는 폭(<768, 실측: ko 는 576 부터 들어가지만 en·ja 는 700 무렵까지 밀린다)에서는
   [컴퓨터와 두기]·[방 만들기]를 아이콘만(44px 정사각). 글자는 시각적으로만 숨긴다(화면 읽기 프로그램은 읽음, 단추에 aria-label·title 도 있음) */
@media (max-width: 767.98px) {
    .chess-game .cz-create-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        font-size: 18px;
    }
    .chess-game .cz-create-btn .cz-create-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}
/* #2267 — 좁은 휴대폰(<430)에서는 탭을 조금 더 조여 아이콘 단추 둘과 한 줄에 들어가게 한다(en 「In progress」가 가장 길다) */
@media (max-width: 429.98px) {
    .chess-game .cz-room-tabs { padding: 3px; }
    .chess-game .cz-room-tabs button { padding: 7px 4px; font-size: 13px; }
    .chess-game .cz-room-tabs .cz-count { padding: 0 4px; margin-left: 1px; min-width: 1.4em; }
}

/* ── #2224 — 효과음 끄기/켜기 (아이콘만, 눈에 덜 띄게) ── */
.chess-game .cz-sound-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--hl-text-muted);
    font-size: 17px;
    line-height: 1;
}
.chess-game .cz-sound-btn:hover { color: var(--hl-fg-primary); text-decoration: none; }
.chess-game .cz-sound-btn.is-muted { opacity: .7; }

/* ══════════ #2230 — 대국 화면 (기다리기 · 대국 · 관전 · 결과) ══════════ */
.chess-game #czPlay { scroll-margin-top: 90px; }
.chess-game .cz-play-bar { min-width: 0; }
.chess-game .cz-refresh { font-size: 13px; color: var(--hl-text-muted); }
.chess-game button.cz-mine-badge { border: 0; }
.chess-game .cz-invite-mark { display: block; font-size: 40px; line-height: 1; margin-bottom: 8px; }

/* QR — 어두운 화면에서도 찍히도록 늘 흰 바탕에 검은 점 */
.chess-game .cz-qr-box { border-style: solid; background: #FFFFFF; color: #000000; padding: 4px; }
.chess-game .cz-qr-svg { display: block; width: 100%; height: 100%; }
.chess-game .cz-qr-svg path { fill: currentColor; }

/* 판 — 대국 화면은 화면 폭에 맞게 (휴대폰에서 판이 폭을 다 쓴다) */
.chess-game .cz-table { max-width: 560px; }
.chess-game .cz-board-play { max-width: none; }
.chess-game .cz-board-play .cz-board { touch-action: none; }
.chess-game .cz-board.is-static .cz-sq { cursor: default; }
.chess-game .cz-sq.is-mine { cursor: grab; }
.chess-game .cz-sq.is-check::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(239, 68, 68, .9) 0%, rgba(239, 68, 68, .45) 45%, transparent 75%);
}
.chess-game .cz-sq.is-dragging .cz-pcs { opacity: .3; }
/* #2272 움직임 효과 — 이동·잡기·승진·체크 맥박은 chess-play.js 의 element.animate, 여기는 상태로 남는 것만
 *  판 크기·칸 배치는 건드리지 않는다(transform·opacity 만). 움직임을 줄인 설정이면 아래 미디어쿼리가 끈다 */
.chess-game .cz-sq.is-moving { z-index: 3; }                 /* 미끄러지는 말이 이웃 칸 아래로 숨지 않게 */
.chess-game .cz-sq .cz-pcs { transition: transform .12s ease-out, filter .12s ease-out; }
.chess-game .cz-sq.is-sel .cz-pcs {                          /* 말 집기 — 살짝 떠오름 */
    transform: scale(1.08);
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35));
}
.chess-game .cz-sq.is-target::after { animation: czDotIn .16s ease-out both; }
@keyframes czDotIn {
    from { opacity: 0; transform: scale(.4); }
    to { opacity: 1; transform: none; }
}
.chess-game .cz-fx { z-index: 1; }                           /* 잡힌 말·승진 전 폰 조각 */
.chess-game .cz-fx-check {                                   /* 체크 맥박 — 체크 표시 위, 말 아래 */
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(239, 68, 68, .95) 0%, rgba(239, 68, 68, .5) 50%, transparent 78%);
}
.chess-game .cz-sq.is-mated .cz-pc {                         /* 체크메이트 — 진 킹이 기운 채로 */
    transform: rotate(12deg);
    transition: transform .45s ease-out .2s;
}
.chess-game .cz-result:not([hidden]) { animation: czResultUp .32s ease-out .15s both; }
@keyframes czResultUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-sq .cz-pcs,
    .chess-game .cz-sq.is-mated .cz-pc { transition: none; }
    .chess-game .cz-sq.is-target::after,
    .chess-game .cz-result:not([hidden]) { animation: none; }
}
/* 끌고 다니는 말 — body 에 붙으므로 .chess-game 밖에서도 보이게 따로 칠한다 */
.cz-ghost {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--cz-ghost, 48px);
    height: var(--cz-ghost, 48px);
    pointer-events: none;
    z-index: 2000;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35));
}
.cz-ghost .cz-pc { width: 100%; height: 100%; }
.cz-ghost .cz-pc .body { stroke-width: 1.5; stroke-linejoin: round; }
.cz-ghost .cz-pc .dt { fill: none; stroke-width: 1.4; stroke-linecap: round; }
.cz-ghost .cz-pc.w .body { fill: #FFFFFF; stroke: #1F2937; }
.cz-ghost .cz-pc.w .dt { stroke: #1F2937; }
.cz-ghost .cz-pc.w .dtf { fill: #1F2937; }
.cz-ghost .cz-pc.b .body { fill: #1F2937; stroke: #0B0F19; }
.cz-ghost .cz-pc.b .dt { stroke: #E5E7EB; }
.cz-ghost .cz-pc.b .dtf { fill: #E5E7EB; }

/* 폰 승진 */
.chess-game .cz-promo {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(15, 23, 42, .55);
}
.chess-game .cz-promo-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--hl-surface);
    box-shadow: 0 10px 30px var(--hl-shadow);
}
.chess-game .cz-promo-pc {
    width: 58px;
    height: 58px;
    padding: 4px;
    border-radius: 10px;
    border: 1.5px solid var(--hl-border);
    background: var(--cz-sq-l);
}
.chess-game .cz-promo-pc:hover,
.chess-game .cz-promo-pc:focus-visible { border-color: var(--hl-accent); outline: none; }
.chess-game .cz-promo-pc .cz-pc { width: 100%; height: 100%; }

/* 두 사람 줄 */
.chess-game .cz-player { position: relative; }
.chess-game .cz-player-main { min-width: 0; }
.chess-game .cz-player.is-me strong[data-name] { color: var(--hl-fg-primary); }
.chess-game .cz-off-badge {
    padding: 0 7px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.6;
    color: var(--hl-alert-warning-fg);
    background: var(--hl-alert-warning-bg);
}
.chess-game .cz-captured {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 16px;
    line-height: 1;
}
.chess-game .cz-captured .cz-pc { width: 16px; height: 16px; margin-right: -3px; }
.chess-game .cz-lead { margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--hl-text-muted); }
.chess-game .cz-clock.is-low { background: var(--hl-fg-danger); border-color: var(--hl-fg-danger); color: #FFFFFF; }
.chess-game .cz-player.is-turn .cz-clock.is-low { background: var(--hl-fg-danger); border-color: var(--hl-fg-danger); }
/* 반응 말풍선 — 시계 왼쪽 위에 잠깐 */
.chess-game .cz-bubble {
    position: absolute;
    right: 84px;
    top: 50%;
    z-index: 4;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--hl-surface);
    border: 1px solid var(--hl-border);
    box-shadow: 0 4px 12px var(--hl-shadow);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--hl-text-strong);
    transform: translateY(-50%);
}
.chess-game .cz-bubble.is-pop { animation: czPop .3s ease-out; }
@keyframes czPop {
    0% { transform: translateY(-50%) scale(.6); opacity: 0; }
    100% { transform: translateY(-50%) scale(1); opacity: 1; }
}

/* 차례 한 줄 · 알림 */
.chess-game .cz-turn { min-height: 1.5em; font-weight: 700; color: var(--hl-text-strong); text-align: center; }
.chess-game .cz-turn.is-mine { color: var(--hl-fg-primary); }
.chess-game .cz-turn.is-warn { color: var(--hl-alert-warning-fg); }
/* #2266 — 대국 중 나타났다 사라지는 안내는 판 위쪽 가장자리에 겹쳐 띄운다(레이아웃 흐름 밖).
 * 판 아래 줄로 끼어들면 전체화면에서 판이 남는 높이에 맞춘 정사각이라 그만큼 줄어든다.
 * 판 위라 사이트 테마와 상관없이 어두운 반투명 말풍선. 빈 자리는 판을 그대로 누를 수 있게 pointer-events 를 뺀다. */
.chess-game .cz-float {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 5;            /* 힌트 화살표(4) 위, 승진 고르기(5, DOM 뒤라 위)·결과 카드(6) 아래 */
    pointer-events: none;
}
.chess-game .cz-float > [hidden] { display: none !important; }
.chess-game .cz-notice,
.chess-game .cz-float .cz-ai-hint {
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    color: #F3F4FB;
    background: rgba(12, 15, 30, .84);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: czFloatIn .18s ease-out;
}
/* 글 자리는 아래 칸을 그대로 누르고 끌 수 있게 두고(상대 끊김 안내가 몇 분 떠 있어도 둘 수 있게), 단추만 누른다 */
.chess-game .cz-notice .btn { pointer-events: auto; }
.chess-game .cz-notice.is-warn { color: #FDE68A; border-color: rgba(251, 191, 36, .6); }
.chess-game .cz-notice.is-danger { border-color: rgba(248, 113, 113, .8); }
.chess-game .cz-notice .btn-outline-secondary { color: #E8EAF6; border-color: rgba(255, 255, 255, .35); }
.chess-game .cz-notice .btn-outline-secondary:hover { background: rgba(255, 255, 255, .12); }
.chess-game .cz-notice .btn-outline-danger { color: #FCA5A5; border-color: #F87171; }
.chess-game .cz-float .cz-ai-hint { color: #4ADE80; }
.chess-game .cz-float .cz-ai-hint.is-muted { color: #CBD5E1; }
/* #2275 — 힌트·형세 말풍선은 더 얇고 투명하게. 누르면 닫히고(✕ 포함) 3초 뒤 .is-out 으로 흐려지며 사라진다 */
.chess-game .cz-float .cz-ai-hint {
    padding: 3px 4px 3px 12px;
    font-size: 13px;
    background: rgba(12, 15, 30, .58);
    border-color: rgba(255, 255, 255, .10);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
    pointer-events: auto;
    cursor: pointer;
    transition: opacity .4s ease;
}
.chess-game .cz-ai-hint-x {
    flex: none;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #CBD5E1;
    font-size: 11px;
    line-height: 1;
}
.chess-game .cz-ai-hint-x:hover { background: rgba(255, 255, 255, .12); }
.chess-game .cz-ai-hint.is-out,
.chess-game .cz-notice.is-out { opacity: 0; transition: opacity .4s ease; }

/* #2274 형세 막대 — .cz-stage 기준 절대 위치(판 크기 불변). 바탕 = 상대 색, 채움 = 내 색(--cz-eval 만큼 내 쪽에서) */
.chess-game .cz-stage { position: relative; }
.chess-game .cz-eval {
    --cz-eval-me: #F1F5F9;
    --cz-eval-opp: #1E2233;
    position: absolute;
    top: 8px;                  /* 판의 my-2 만큼 */
    bottom: 8px;
    left: -12px;
    width: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--cz-eval-opp);
    box-shadow: 0 0 0 1px rgba(127, 127, 127, .35);
    transition: opacity .3s ease;
}
.chess-game .cz-eval.is-me-b { --cz-eval-me: #1E2233; --cz-eval-opp: #F1F5F9; }
.chess-game .cz-eval-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--cz-eval, 50%);
    background: var(--cz-eval-me);
    transition: height .4s ease, width .4s ease;
}
.chess-game .cz-eval.is-stale { opacity: .35; }
@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-eval,
    .chess-game .cz-eval-fill,
    .chess-game .cz-float .cz-ai-hint,
    .chess-game .cz-notice.is-out { transition: none; }
}

/* #2274 힌트 고르기 메뉴 — 누른 단추 위에 화면 기준으로 뜬다(자리는 JS 가 변수로) */
.chess-game .cz-hint-menu {
    position: fixed;
    left: var(--cz-hm-left, 8px);
    bottom: var(--cz-hm-bottom, 80px);
    z-index: 1060;
    min-width: 168px;
    padding: 4px;
    border-radius: 12px;
    background: var(--hl-surface);
    border: 1px solid var(--hl-border-subtle);
    box-shadow: 0 8px 24px var(--hl-shadow);
}
.chess-game .cz-hint-menu[hidden] { display: none !important; }   /* d-flex 보다 우선 */
.chess-game .cz-hint-menu button {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hl-text-strong);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}
.chess-game .cz-hint-menu button:hover,
.chess-game .cz-hint-menu button:focus-visible { background: var(--hl-surface-3); outline: 0; }
.chess-game .cz-hint-menu .bi { font-size: 16px; color: var(--hl-fg-primary); }
@keyframes czFloatIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-notice,
    .chess-game .cz-float .cz-ai-hint { animation: none; }
}

/* 반응 단추 6개 */
.chess-game .cz-react-btn {
    width: 40px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--hl-border-subtle);
    background: var(--hl-surface-3);
    font-size: 18px;
    line-height: 1;
}
.chess-game .cz-react-btn:hover { border-color: var(--hl-accent); }
.chess-game .cz-react-btn:disabled { opacity: .5; }

/* 결과 */
.chess-game .cz-result {
    padding: 18px 16px;
    border-radius: 14px;
    background: var(--hl-surface);
    border: 1px solid var(--hl-border-subtle);
    box-shadow: 0 2px 10px var(--hl-shadow);
}
.chess-game .cz-result-title { font-size: 24px; font-weight: 800; color: var(--hl-text-strong); }
.chess-game .cz-result-title.is-win { color: var(--hl-fg-success); }
.chess-game .cz-result-title.is-lose { color: var(--hl-fg-danger); }

/* 채팅 — 꺼짐 안내·오류 */
.chess-game .cz-chat-off {
    font-size: 13px;
    color: var(--hl-text-muted);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--hl-surface-3);
}
.chess-game .cz-chat-err { color: var(--hl-fg-danger); min-width: 0; }

@media (max-width: 575.98px) {
    .chess-game .cz-play .cz-card { padding: 16px 14px; }
    .chess-game .cz-player { padding: 6px 10px; }
    .chess-game .cz-clock { font-size: 16px; padding: 2px 8px; }
    .chess-game .cz-bubble { right: 72px; font-size: 13px; }
    .chess-game .cz-promo-pc { width: 52px; height: 52px; }
}
/* 넓은 화면 — 채팅 칸이 왼쪽 판 높이만큼 늘어나고 글은 그 안에서 스크롤 */
@media (min-width: 992px) {
    .chess-game #czChat .cz-chat-log { flex: 1 1 0; min-height: 220px; max-height: none; }
}

/* ── #2239 컴퓨터와 두기 — 모달 난이도 다섯 칸 ── */
.chess-game .cz-seg-level button { padding-left: 2px; padding-right: 2px; }
@media (max-width: 575.98px) {
    .chess-game .cz-seg-level { gap: 4px; }
    .chess-game .cz-seg-level button { font-size: 13px; }
}

/* ══════════ #2249 — 휴대폰 전체화면 게임 화면 ══════════
 *  chess-play.js 가 대국 화면이 보이는 동안 폭 768 이하(또는 높이 520 이하 가로 화면)에서
 *  #czPlay 에 .is-fs 와 data-bs-theme="dark" 를, <html> 에 .cz-fs 를 붙인다. 아래 규칙은 전부 그때만 쓰인다.
 *  PC 폭에서는 아래 줄 단추·시트 머리·닫기 단추·「나가기」 글자를 숨겨 지금 모양 그대로 둔다.
 *  부트스트랩 간격 클래스(mb-3·my-2·mt-3 등)가 PC 에서 쓰이는 자리는 전체화면에서만 !important 로 0 으로 돌린다. */
.chess-game .cz-dock,
.chess-game .cz-sheet-x,
.chess-game .cz-fs-only,
.chess-game .cz-leave-fs,
.chess-game .cz-sheet-back { display: none; }
/* 「방 목록」·「나가기」 글자를 span 으로 나눠 HTML 압축이 아이콘 뒤 띄어쓰기를 지우므로 간격은 여기서 */
.chess-game #czLeave .bi { margin-right: .3em; }

html.cz-fs,
html.cz-fs body { overflow: hidden; overscroll-behavior: none; }

.chess-game .cz-play.is-fs {
    /* 게임 화면 전용 팔레트 — 사이트 테마와 상관없이 어둡게 */
    --cz-fs-bg: #0C0F1E;
    --cz-fs-panel: #171B34;
    --cz-fs-line: rgba(255, 255, 255, .10);
    --cz-fs-text: #E8EAF6;
    --cz-fs-muted: #A3A9C9;
    --cz-fs-accent: #818CF8;
    --cz-sq-l: #D6D9F0;
    --cz-sq-d: #6A71B0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1045;   /* 사이트 머리글(1030) 위, 부트스트랩 모달(1050~) 아래 */
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: radial-gradient(120% 55% at 50% 0%, #1D2350 0%, var(--cz-fs-bg) 62%) var(--cz-fs-bg);
    color: var(--cz-fs-text);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* 위 줄 — 나가기 · 방 정보 · 관전 수 · 소리 */
.chess-game .cz-play.is-fs .cz-play-bar {
    flex: none;
    position: relative;
    z-index: 7;   /* 결과 카드의 어두운 막 위에 남는다 */
    margin-bottom: 0 !important;
    padding: 6px 10px;
    min-height: 56px;
}
.chess-game .cz-play.is-fs .cz-leave-pc { display: none; }
.chess-game .cz-play.is-fs .cz-leave-fs { display: inline; }
.chess-game .cz-play.is-fs #czLeave {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--cz-fs-text);
    background: rgba(255, 255, 255, .06);
    border-color: var(--cz-fs-line);
}
.chess-game .cz-play.is-fs #czPlayMeta {
    font-size: 12px;
    color: var(--cz-fs-muted);
    background: rgba(255, 255, 255, .06);
}
.chess-game .cz-play.is-fs #czWatchers { color: var(--cz-fs-muted); }
.chess-game .cz-play.is-fs .cz-sound-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 21px;
    color: var(--cz-fs-text);
    background: rgba(255, 255, 255, .06);
}

/* 안내·초대·기다리기 카드 — 가운데에 띄우고 넘치면 카드 안에서 스크롤 */
.chess-game .cz-play.is-fs > .cz-card {
    flex: 0 1 auto;
    margin: auto 12px;
    max-height: calc(100% - 68px);
    overflow-y: auto;
    background: var(--cz-fs-panel);
    border-color: var(--cz-fs-line);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.chess-game .cz-play.is-fs .cz-wait { border-bottom-color: var(--cz-fs-line); }
.chess-game .cz-play.is-fs .cz-chip { background: rgba(129, 140, 248, .16); color: #C7CEFF; }
.chess-game .cz-play.is-fs .cz-qr { background: rgba(255, 255, 255, .05); }

/* 대국 — 판이 남는 자리를 다 차지하는 세로 틀 */
.chess-game .cz-play.is-fs #czGame {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    flex-direction: column;
    flex-wrap: nowrap;
}
.chess-game .cz-play.is-fs #czGame > .col-lg-7 {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 10px 8px;
}
.chess-game .cz-play.is-fs #czGame > .col-lg-5 { flex: none; height: 0; padding: 0; }
.chess-game .cz-play.is-fs .cz-table {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* 판 자리 — 기본 높이는 화면 폭(정사각), 세로가 모자라면 줄어들고 판은 가로·세로 중 짧은 쪽에 맞춘다.
 * 두 사람 줄이 판에 붙고, 남는 세로는 위 줄 위와 아래 단추 위에 반씩 (margin-top:auto 두 곳) */
.chess-game .cz-play.is-fs .cz-stage {
    flex: 0 1 calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    min-height: 0;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chess-game .cz-play.is-fs .cz-stage .cz-board-wrap {
    width: 100%;                  /* 컨테이너 단위를 모르는 옛 브라우저(iOS 15 이하)는 폭에 맞춘다 */
    width: min(100cqw, 100cqh);
    max-width: none;
    margin: 0 !important;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
}
/* 형세 막대 — 게임 화면에서는 판 위 가장자리에 가로로 겹친다(판 정사각 = min(100cqw, 100cqh), 가운데 정렬). 내 색은 왼쪽부터 */
.chess-game .cz-play.is-fs .cz-eval {
    top: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    top: calc((100cqh - min(100cqw, 100cqh)) / 2);
    left: calc((100cqw - min(100cqw, 100cqh)) / 2);
    width: min(100cqw, 100cqh);
    height: 5px;
    z-index: 5;
    border-radius: 6px 6px 0 0;
    box-shadow: none;
}
.chess-game .cz-play.is-fs .cz-eval-fill { top: 0; right: auto; width: var(--cz-eval, 50%); height: 100%; }
.chess-game .cz-play.is-fs .cz-hint-menu {
    background: #171B34;
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.chess-game .cz-play.is-fs .cz-hint-menu button { color: #E8EAF6; min-height: 46px; }
.chess-game .cz-play.is-fs .cz-hint-menu button:hover,
.chess-game .cz-play.is-fs .cz-hint-menu button:focus-visible { background: rgba(255, 255, 255, .08); }
.chess-game .cz-play.is-fs .cz-hint-menu .bi { color: #A5B4FC; }

/* 두 사람 줄 — 큰 시계, 내 차례면 빛난다 */
.chess-game .cz-play.is-fs .cz-player {
    flex: none;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--cz-fs-line);
    color: var(--cz-fs-text);
    transition: border-color .2s, box-shadow .2s;
}
.chess-game .cz-play.is-fs #czTopBar,
.chess-game .cz-play.is-fs .cz-dock { margin-top: auto; }
.chess-game .cz-play.is-fs .cz-player strong[data-name] { font-size: 15px; color: #F3F4FB; }
.chess-game .cz-play.is-fs .cz-player.is-me strong[data-name] { color: #C7CEFF; }
.chess-game .cz-play.is-fs .cz-pc-dot { width: 14px; height: 14px; }
.chess-game .cz-play.is-fs .cz-captured { min-height: 18px; }
.chess-game .cz-play.is-fs .cz-captured .cz-pc { width: 18px; height: 18px; }
.chess-game .cz-play.is-fs .cz-lead { color: var(--cz-fs-muted); }
/* 잡은 말 줄 — 어두운 틀에서 흑말이 배경에 묻히지 않게 판의 밝은 칸 색 칩 위에 올린다(#2280).
   높이는 말 크기(18px) 그대로라 줄 높이·판 크기는 변하지 않는다. 팝(#2272)은 말 svg 에 걸려 칩과 무관 */
.chess-game .cz-play.is-fs .cz-captured:not(:empty) {
    width: fit-content;
    max-width: 100%;
    padding: 0 7px 0 4px;
    border-radius: 999px;
    background: rgba(214, 218, 240, .92);
}
.chess-game .cz-play.is-fs .cz-captured .cz-lead { color: #3730A3; }
/* 두 사람 줄 앞 색 점 — 흑 점도 테두리를 밝게 */
.chess-game .cz-play.is-fs .cz-pc-dot.is-b { border-color: rgba(214, 218, 240, .75); }
.chess-game .cz-play.is-fs .cz-clock {
    min-width: 96px;
    padding: 4px 10px;
    border-radius: 10px;
    text-align: center;
    font-size: 26px;
    line-height: 1.2;
    background: rgba(0, 0, 0, .35);
    border-color: var(--cz-fs-line);
    color: #F3F4FB;
}
.chess-game .cz-play.is-fs .cz-player.is-turn .cz-clock {
    background: var(--cz-fs-accent);
    border-color: var(--cz-fs-accent);
    color: #0C0F1E;
}
.chess-game .cz-play.is-fs .cz-player.is-turn.is-me {
    border-color: var(--cz-fs-accent);
    box-shadow: 0 0 0 1px var(--cz-fs-accent), 0 0 22px rgba(129, 140, 248, .45);
    animation: czGlow 1.8s ease-in-out infinite;
}
@keyframes czGlow {
    50% { box-shadow: 0 0 0 1px var(--cz-fs-accent), 0 0 34px rgba(129, 140, 248, .75); }
}
.chess-game .cz-play.is-fs .cz-clock.is-low,
.chess-game .cz-play.is-fs .cz-player.is-turn .cz-clock.is-low { background: #DC2626; border-color: #DC2626; color: #FFFFFF; }
.chess-game .cz-play.is-fs .cz-player.is-turn .cz-clock.is-low { animation: czLowBlink 1s step-end infinite; }
@keyframes czLowBlink { 50% { background: #7F1D1D; border-color: #7F1D1D; } }
.chess-game .cz-play.is-fs .cz-bubble { right: 108px; }

/* 차례 한 줄 · 알림 · 힌트 글 */
/* 차례 줄은 높이를 고정하고 한 줄로 자른다 — 글이 생기거나(재연결·체크) 길어져도 판 자리가 줄지 않게(#2266) */
.chess-game .cz-play.is-fs #czTurn {
    flex: none;
    margin: 0 !important;
    height: 1.5em;
    min-height: 0;
    line-height: 1.5;
    font-size: 14px;
    color: var(--cz-fs-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chess-game .cz-play.is-fs #czTurn.is-mine { color: #C7CEFF; }
.chess-game .cz-play.is-fs #czNotice { font-size: 13.5px; }
.chess-game .cz-play.is-fs #czNotice .btn { min-height: 40px; }
.chess-game .cz-play.is-fs #czActions { flex: none; }
.chess-game .cz-play.is-fs .cz-act-row { display: none !important; }   /* 단추는 아래 줄(#czDock)이 대신한다 */

/* 아래 줄 큰 단추 — 기권 · 무승부 · 수 기록 (+ 힌트). 채팅·반응은 떠 있는 단추(#2265) */
.chess-game .cz-play.is-fs .cz-dock {
    flex: none;
    display: flex;
    gap: 6px;
    padding-top: 2px;
}
.chess-game .cz-dock-btn {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 58px;
    padding: 6px 2px;
    border: 1px solid var(--cz-fs-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    color: var(--cz-fs-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.chess-game .cz-dock-btn > span:not(.cz-dock-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chess-game .cz-dock-btn .bi { font-size: 22px; line-height: 1; }
.chess-game .cz-dock-btn.is-danger .bi { color: #F87171; }
.chess-game .cz-dock-btn.is-on { background: rgba(129, 140, 248, .22); border-color: var(--cz-fs-accent); }
.chess-game .cz-dock-btn:active { background: rgba(255, 255, 255, .12); }
.chess-game .cz-dock-btn:disabled { opacity: .38; }
.chess-game .cz-dock-btn:focus-visible { outline: 2px solid var(--cz-fs-accent); outline-offset: 2px; }
.chess-game .cz-dock-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 22px);
    min-width: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: var(--cz-fs-text);
    font-size: 10.5px;
    line-height: 17px;
    text-align: center;
}
.chess-game .cz-dock-badge:empty { display: none; }

/* 결과 — 판 위 큰 카드 (뒤를 어둡게) */
.chess-game .cz-play.is-fs #czResult {
    position: absolute;
    top: 50%;
    left: 6px;
    right: 6px;
    z-index: 6;
    margin: 0 !important;
    padding: 28px 18px 20px;
    border-radius: 22px;
    background: var(--cz-fs-panel);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 0 0 100vmax rgba(5, 7, 16, .62), 0 24px 60px rgba(0, 0, 0, .5);
    transform: translateY(-50%);
    animation: czResultIn .28s ease-out;
}
@keyframes czResultIn {
    from { opacity: 0; transform: translateY(-46%) scale(.94); }
    to { opacity: 1; transform: translateY(-50%) scale(1); }
}
.chess-game .cz-play.is-fs .cz-result-title { font-size: 34px; margin-bottom: 6px !important; }
.chess-game .cz-play.is-fs .cz-result-title.is-win { color: #4ADE80; }
.chess-game .cz-play.is-fs .cz-result-title.is-lose { color: #F87171; }
.chess-game .cz-play.is-fs #czResultWhy { font-size: 15px; color: var(--cz-fs-muted); }
.chess-game .cz-play.is-fs #czResult .btn { min-height: 48px; padding-left: 20px; padding-right: 20px; border-radius: 12px; font-weight: 700; }
.chess-game .cz-play.is-fs #czResult .cz-linkbtn { min-height: 44px; font-size: 15px; color: #C7CEFF; }
/* 「한 판 더」만 글자가 span 이라 HTML 압축이 아이콘 뒤 띄어쓰기를 지운다 */
.chess-game .cz-play.is-fs #czRematchBtn .bi { margin-right: .35em; }
.chess-game .cz-play.is-fs #czResultNote:empty { min-height: 0; margin: 0 !important; }

/* 바텀시트 — 채팅 · 수 기록 (반응 시트는 #2265 부터 열지 않는다 — 떠 있는 😊 가 대신) */
.chess-game .cz-play.is-fs .cz-sheet-back {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1046;
    background: rgba(4, 6, 14, .55);
}
.chess-game .cz-play.is-fs .cz-sheet-back[hidden] { display: none !important; }
.chess-game .cz-play.is-fs .cz-sheet-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--cz-fs-muted);
    font-size: 18px;
}
.chess-game .cz-play.is-fs .cz-sheet-x:active { background: rgba(255, 255, 255, .08); }
.chess-game .cz-play.is-fs .cz-fs-only { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.chess-game .cz-play.is-fs #czChat,
.chess-game .cz-play.is-fs #czMovesPane,
.chess-game .cz-play.is-fs #czReactSheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1047;
    max-height: 72dvh;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 1px solid var(--cz-fs-line);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: var(--cz-fs-panel);
    box-shadow: 0 -16px 40px rgba(0, 0, 0, .45);
    color: var(--cz-fs-text);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
}
.chess-game .cz-play.is-fs[data-sheet="chat"] #czChat,
.chess-game .cz-play.is-fs[data-sheet="moves"] #czMovesPane,
.chess-game .cz-play.is-fs[data-sheet="react"] #czReactSheet {
    transform: none;
    visibility: visible;
    transition: transform .22s ease;
}
.chess-game .cz-play.is-fs .cz-label { color: #F3F4FB; }
.chess-game .cz-play.is-fs #czChat { height: min(72dvh, 520px); gap: 10px; }
.chess-game .cz-play.is-fs #czChat .cz-chat-log { flex: 1 1 0; min-height: 0; max-height: none; }
.chess-game .cz-play.is-fs #czChatInput { font-size: 16px; min-height: 44px; }   /* 16px 아래면 아이폰이 확대한다 */
.chess-game .cz-play.is-fs #czChatSend { min-width: 72px; }
.chess-game .cz-play.is-fs .cz-movelog { max-height: 46dvh; font-size: 15px; gap: 6px 14px; }
.chess-game .cz-play.is-fs .cz-reacts { flex-wrap: nowrap !important; justify-content: center; gap: 8px !important; }
.chess-game .cz-play.is-fs .cz-react-btn { flex: 1 1 0; min-width: 44px; max-width: 64px; width: auto; height: 56px; border-radius: 14px; font-size: 26px; background: rgba(255, 255, 255, .06); border-color: var(--cz-fs-line); }

/* 가로 화면 — 판은 왼쪽, 두 사람 줄·알림·단추는 오른쪽 */
@media (orientation: landscape) {
    .chess-game .cz-play.is-fs {
        --cz-side: calc(100dvh - 56px - 10px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
    .chess-game .cz-play.is-fs #czGame > .col-lg-7 { padding: 0 12px 10px; }
    .chess-game .cz-play.is-fs .cz-table {
        flex-flow: column wrap;
        align-content: flex-start;
        gap: 8px 16px;
    }
    .chess-game .cz-play.is-fs .cz-stage { order: -1; flex: none; height: 100%; width: var(--cz-side); }
    .chess-game .cz-play.is-fs .cz-table > :not(.cz-stage):not(#czResult):not(#czFab) { width: calc(100% - var(--cz-side) - 16px); }
    .chess-game .cz-play.is-fs #czTopBar,
    .chess-game .cz-play.is-fs .cz-dock { margin-top: 0; }
    .chess-game .cz-play.is-fs #czBottomBar { margin-top: auto; }
    .chess-game .cz-play.is-fs #czResult { left: auto; right: 0; width: min(420px, calc(100% - var(--cz-side) - 16px)); }
    /* 시트는 오른쪽에서 나오는 판 */
    .chess-game .cz-play.is-fs #czChat,
    .chess-game .cz-play.is-fs #czMovesPane,
    .chess-game .cz-play.is-fs #czReactSheet {
        top: 0;
        left: auto;
        width: min(420px, 60vw);
        height: auto;
        max-height: none;
        padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) 16px;
        border-bottom: 1px solid var(--cz-fs-line);
        border-right: 0;
        border-radius: 20px 0 0 20px;
        transform: translateX(105%);
    }
    .chess-game .cz-play.is-fs .cz-movelog { max-height: none; }
}

/* 움직임을 줄인 설정이면 빛·깜빡임·튀어나옴을 끈다 (빨간 시계는 그대로) */
@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-play.is-fs .cz-player.is-turn.is-me,
    .chess-game .cz-play.is-fs .cz-player.is-turn .cz-clock.is-low,
    .chess-game .cz-play.is-fs #czResult { animation: none; }
    .chess-game .cz-play.is-fs #czChat,
    .chess-game .cz-play.is-fs #czMovesPane,
    .chess-game .cz-play.is-fs #czReactSheet { transition: none; }
}

/* ══════════ #2265 — 떠 있는 채팅·반응 단추 · 새 채팅 미리보기 (게임 틀에서만) ══════════
 *  #czFab 은 .cz-table 기준 절대 위치 — 판 크기·흐름에 영향이 없다. 자리(--cz-fab-top·--cz-fab-right)는 chess-play.js placeFab() 이 잰다.
 *  판 위에 겹칠 때(.is-over)는 반투명. 반응 여섯 개는 😊 왼쪽으로 펼친다(#czFabFan). PC 폭에서는 숨긴다. */
.chess-game .cz-fab,
.chess-game .cz-chat-peek { display: none; }
.chess-game .cz-play.is-fs .cz-table > #czFab {
    position: absolute;
    top: var(--cz-fab-top, auto);
    right: var(--cz-fab-right, 0);
    width: auto;
    z-index: 7;            /* 결과 카드(6)의 어두운 막 위 — 끝난 뒤에도 채팅할 수 있게 */
    display: flex;
    align-items: center;
    gap: 8px;
}
.chess-game .cz-play.is-fs .cz-table > #czFab[hidden],
.chess-game .cz-play.is-fs .cz-fab [hidden] { display: none !important; }
.chess-game .cz-fab-react { position: relative; display: flex; }
.chess-game .cz-fab-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .16);
    background: var(--cz-fs-panel, #171B34);
    color: #F3F4FB;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.chess-game .cz-fab-btn:active { background: #232850; }
.chess-game .cz-fab-btn.is-on { border-color: var(--cz-fs-accent, #818CF8); background: #2A3170; }
.chess-game .cz-fab-btn:focus-visible { outline: 2px solid var(--cz-fs-accent, #818CF8); outline-offset: 2px; }
.chess-game .cz-fab.is-over .cz-fab-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
    background: rgba(12, 15, 30, .58);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.chess-game .cz-fab.is-over .cz-fab-btn.is-on { background: rgba(42, 49, 112, .85); }
.chess-game .cz-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #F43F5E;
    color: #FFFFFF;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--cz-fs-bg, #0C0F1E);
}
.chess-game .cz-fab-fan {
    position: absolute;
    top: 50%;
    right: calc(100% + 8px);
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(12, 15, 30, .92);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    transform: translateY(-50%);
    animation: czFanIn .16s ease-out;
}
/* 아래 줄 반응 시트용 큰 단추 규칙(.is-fs .cz-react-btn)보다 앞서도록 .is-fs 까지 붙인다 */
.chess-game .cz-play.is-fs .cz-fab-fan .cz-react-btn {
    flex: none;
    width: 40px;
    min-width: 0;
    max-width: none;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: transparent;
    font-size: 22px;
}
.chess-game .cz-play.is-fs .cz-fab-fan .cz-react-btn:active { background: rgba(255, 255, 255, .14); }
@keyframes czFanIn {
    from { opacity: 0; transform: translate(8px, -50%); }
    to { opacity: 1; transform: translateY(-50%); }
}
/* 반응이 펼쳐지면 💬 자리는 펼침이 덮는다 — 💬 와 배지는 그동안 숨긴다 */
.chess-game .cz-fab.is-fan .cz-fab-react { z-index: 1; }
.chess-game .cz-fab.is-fan [data-fab="chat"] { visibility: hidden; }
/* 판 위쪽 미리보기 — 「닉네임: 앞부분」 한 줄 */
.chess-game .cz-play.is-fs .cz-chat-peek {
    display: block;
    max-width: 100%;
    padding: 7px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    color: #F3F4FB;
    background: rgba(12, 15, 30, .84);
    border: 1px solid rgba(129, 140, 248, .5);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chess-game .cz-chat-peek strong { color: #C7CEFF; }
.chess-game .cz-chat-peek.is-pop { animation: czFloatIn .18s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-fab-fan,
    .chess-game .cz-chat-peek.is-pop { animation: none; }
}

/* ── 요청 중 단추 (#2263) — chess-page.js ChessBusy 가 aria-busy + .is-busy 를 붙인다.
 *    누를 수 없게 흐리게 하고 글자 뒤에 작은 스피너. 아래 줄 큰 단추는 아이콘 자리 위 모서리에 띄운다 */
.chess-game .is-busy { cursor: progress; }
.chess-game .cz-linkbtn.is-busy { opacity: .6; }
.chess-game .is-busy::after {
    content: "";
    display: inline-block;
    width: .9em;
    height: .9em;
    margin-inline-start: .45em;
    vertical-align: -.12em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: czSpin .7s linear infinite;
}
.chess-game .cz-dock-btn.is-busy { position: relative; }
.chess-game .cz-dock-btn.is-busy::after {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    width: 12px;
    height: 12px;
}
@keyframes czSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .chess-game .is-busy::after { animation-duration: 2s; }
}

/* ══════════ #2264 — 전체화면 단추 · 홈 화면에 추가 안내 · 홈 화면 앱 ══════════
 *  전체화면 단추([data-fs-toggle])는 소리 단추와 같은 .cz-sound-btn 모양을 쓴다(위 #2224·#2249 규칙).
 *  안내(#czAppHint)는 판이 보이지 않는 화면에서만 흐름 안에 놓인다 — 대국 중에는 숨겨 판 크기에 영향이 없다(#2266). */
.chess-game .cz-app-hint {
    margin-top: 12px;
    padding: 10px 8px 10px 14px;
    border: 1px solid var(--hl-border);
    border-radius: 12px;
    background: var(--hl-accent-subtle);
    font-size: 13.5px;
    line-height: 1.45;
}
.chess-game .cz-app-hint > .bi { font-size: 18px; color: var(--hl-fg-primary); }
.chess-game .cz-app-hint-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--hl-text-muted);
}
.chess-game .cz-play.is-fs .cz-app-hint {
    flex: none;
    margin: 0 12px 12px;
    border-color: var(--cz-fs-line);
    background: var(--cz-fs-panel);
    color: var(--cz-fs-text);
}
.chess-game .cz-play.is-fs .cz-app-hint > .bi { color: var(--cz-fs-accent); }
.chess-game .cz-play.is-fs .cz-app-hint-x { margin: 0; }

/* 홈 화면 앱으로 열렸을 때(chess-page.js ChessInstall 이 <html>.cz-app + viewport-fit=cover) —
 * 아이폰 상태 막대가 black-translucent 라 화면이 그 밑까지 올라오므로 노치·홈 막대 자리를 비운다.
 * 게임 틀(.is-fs)은 position:fixed 로 따로 safe-area 를 비우므로 영향이 없다. */
html.cz-app body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ══════════ #2282 — 결과 카드 접고 판 보기 (게임 틀에서만) ══════════
 *  ✕·[판 보기]를 누르면 #czResult 에 .is-folded — 카드와 어두운 막(box-shadow)이 사라져 판이 원래 밝기로 보인다.
 *  접힌 동안 결과 한 칸·[한 판 더]·[결과 보기]는 아래 줄(#czDock) 안에 선다. 아래 줄 높이(58px)는 그대로라 판 크기도 그대로(#2266).
 *  PC 폭에서는 ✕·[판 보기]를 숨기고 접혀 있어도 카드를 그대로 보인다(.is-fs 일 때만 접는다). */
.chess-game .cz-result-x,
.chess-game .cz-result-peek { display: none; }
.chess-game .cz-play.is-fs #czResult:focus { outline: none; }
.chess-game .cz-play.is-fs #czResult:focus-visible { outline: 2px solid var(--cz-fs-accent); outline-offset: 2px; }
.chess-game .cz-play.is-fs #czResult.is-folded { display: none; }
.chess-game .cz-play.is-fs .cz-result-x {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--cz-fs-muted);
    font-size: 18px;
}
.chess-game .cz-play.is-fs .cz-result-x:active { background: rgba(255, 255, 255, .08); }
.chess-game .cz-play.is-fs .cz-result-x:focus-visible { outline: 2px solid var(--cz-fs-accent); outline-offset: 2px; }
.chess-game .cz-play.is-fs #czResult .cz-result-peek { display: inline-flex; align-items: center; gap: .35em; }
/* 아래 줄의 결과 칸 — 단추보다 넓게, 두 줄(제목·까닭)을 한 줄씩 자른다 */
.chess-game .cz-play.is-fs .cz-dock-res {
    flex: 1.5 1 0;
    min-width: 0;
    padding: 0 6px;
    line-height: 1.25;
    color: var(--cz-fs-muted);
    font-size: 12px;
}
.chess-game .cz-play.is-fs .cz-dock-res[hidden] { display: none !important; }
.chess-game .cz-play.is-fs .cz-dock-res > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chess-game .cz-play.is-fs #czDockResTitle { font-size: 17px; font-weight: 800; color: #F3F4FB; }
.chess-game .cz-play.is-fs #czDockResTitle.is-win { color: #4ADE80; }
.chess-game .cz-play.is-fs #czDockResTitle.is-lose { color: #F87171; }
.chess-game .cz-play.is-fs .cz-dock-res.is-ask #czDockResWhy { color: #C7CEFF; font-weight: 600; }

/* ══════════ #2281 — PC 대국 화면 (게임 틀이 아닐 때만) ══════════
 *  :not(.is-fs) = PC 공통(769~991 「mid」 + ≥992 「wide」), .is-wide = 넓은 PC(chess-play.js layoutPc 가 붙인다).
 *  wide: 왼쪽 판은 화면 높이에 맞춘 정사각(최대 720), 오른쪽은 판 높이와 같은 한 장 패널(#czSide —
 *        상대 줄 · 결과 · [수 기록 | 채팅] · 차례 줄 · 내 줄 · 단추). 줄들은 JS 가 패널 안으로 옮긴다.
 *  mid : 판 위아래 두 사람 줄 + 판 아래 단추, 그 아래에 탭 패널.
 *  게임 틀(.is-fs)은 이 구획의 영향을 받지 않는다 — 탭 줄만 숨긴다(새로 생긴 요소라). */
.chess-game .cz-play.is-fs .cz-side-tabs { display: none !important; }

/* 위 줄 — 방 목록 · 판 정보 · 관전 수 · 소리 · 전체화면, 모두 36px 높이 */
.chess-game .cz-play:not(.is-fs) .cz-play-bar { min-height: 36px; gap: 8px !important; }
.chess-game .cz-play:not(.is-fs) #czLeave {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--hl-border);
    border-radius: 10px;
    background: var(--hl-surface);
    color: var(--hl-text-strong);
    font-size: 14px;
    font-weight: 600;
}
.chess-game .cz-play:not(.is-fs) #czLeave:hover { background: var(--hl-surface-3); border-color: var(--hl-border-strong); }
.chess-game .cz-play:not(.is-fs) #czPlayMeta {
    display: inline-block;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    line-height: 36px;
    font-size: 13px;
    color: var(--hl-text-muted);
}
.chess-game .cz-play:not(.is-fs) #czPlayMeta:empty { display: none; }
.chess-game .cz-play:not(.is-fs) #czWatchers {
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--hl-surface-3);
}
.chess-game .cz-play:not(.is-fs) .cz-play-bar .cz-sound-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 18px;
}
.chess-game .cz-play:not(.is-fs) .cz-play-bar .cz-sound-btn:hover { background: var(--hl-surface-3); }

/* 기다리기 · 초대 · 안내 카드 — 가운데 한 장, 위쪽에 은은한 색 */
.chess-game .cz-play:not(.is-fs) > .cz-card {
    max-width: 600px;
    margin: 8px auto 0;
    padding: 32px 28px 26px;
    border-radius: 18px;
    background: linear-gradient(180deg, var(--hl-accent-subtle), var(--hl-surface) 140px) var(--hl-surface);
    box-shadow: 0 10px 30px var(--hl-shadow);
}
.chess-game .cz-play:not(.is-fs) > .cz-card .cz-card-title { font-size: 22px; }
.chess-game .cz-play:not(.is-fs) .cz-wait-box { max-width: 480px; }
.chess-game .cz-play:not(.is-fs) .cz-qr { padding: 16px; background: var(--hl-surface-3); }
.chess-game .cz-play:not(.is-fs) .cz-qr-box { width: 96px; height: 96px; }

/* 판 — 은은한 테두리·그림자 */
.chess-game .cz-play:not(.is-fs) .cz-board-play {
    border-radius: 10px;
    box-shadow: 0 0 0 1px var(--hl-border-subtle), 0 14px 36px var(--hl-shadow);
}

/* 두 사람 줄 — 큰 시계, 내 차례면 빛나고 10초 아래면 깜빡인다(휴대폰 게임 틀과 같은 규칙) */
.chess-game .cz-play:not(.is-fs) .cz-player {
    min-height: 64px;
    padding: 10px 12px 10px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--hl-surface-3);
    transition: border-color .2s, box-shadow .2s;
}
.chess-game .cz-play:not(.is-fs) .cz-player strong[data-name] { font-size: 15px; }
.chess-game .cz-play:not(.is-fs) .cz-pc-dot { width: 14px; height: 14px; }
.chess-game .cz-play:not(.is-fs) .cz-captured { min-height: 18px; margin-top: 2px; }
.chess-game .cz-play:not(.is-fs) .cz-captured:empty { display: none; }   /* 잡은 말이 없으면 이름을 시계와 가운데 맞춤 (줄 높이는 min-height 64 로 그대로) */
.chess-game .cz-play:not(.is-fs) .cz-captured .cz-pc { width: 18px; height: 18px; }
.chess-game .cz-play:not(.is-fs) .cz-clock {
    flex: none;
    min-width: 100px;
    padding: 4px 12px;
    border-radius: 10px;
    border-color: var(--hl-border);
    text-align: center;
    font-size: 26px;
    line-height: 1.2;
}
.chess-game .cz-play:not(.is-fs) .cz-player.is-turn.is-me {
    border-color: var(--hl-accent);
    box-shadow: 0 0 0 1px var(--hl-accent), 0 0 18px color-mix(in srgb, var(--hl-accent) 32%, transparent);
    animation: czGlowPc 1.8s ease-in-out infinite;
}
@keyframes czGlowPc {
    50% { box-shadow: 0 0 0 1px var(--hl-accent), 0 0 30px color-mix(in srgb, var(--hl-accent) 55%, transparent); }
}
.chess-game .cz-play:not(.is-fs) .cz-player.is-turn .cz-clock.is-low { animation: czLowBlink 1s step-end infinite; }
.chess-game .cz-play:not(.is-fs) .cz-bubble { right: 122px; }

/* 대국자 단추 — 무승부 · 기권 · 힌트, 같은 크기 */
.chess-game .cz-play:not(.is-fs) .cz-act-row { flex-wrap: nowrap !important; gap: 8px !important; margin-bottom: 0 !important; }
.chess-game .cz-play:not(.is-fs) .cz-act-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 8px;
    border: 1px solid var(--hl-border);
    border-radius: 10px;
    background: var(--hl-surface);
    color: var(--hl-text-strong);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.chess-game .cz-play:not(.is-fs) .cz-act-btn > span:not(.cz-act-badge) { overflow: hidden; text-overflow: ellipsis; }
.chess-game .cz-play:not(.is-fs) .cz-act-btn .bi { font-size: 16px; color: var(--hl-text-muted); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn.is-danger .bi { color: var(--hl-fg-danger); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn.is-hint .bi { color: var(--hl-fg-primary); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn:hover:not(:disabled) { background: var(--hl-surface-3); border-color: var(--hl-border-strong); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn.is-danger:hover:not(:disabled) { border-color: var(--hl-fg-danger); color: var(--hl-fg-danger); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn.is-hint:hover:not(:disabled) { border-color: var(--hl-accent); color: var(--hl-fg-primary); }
.chess-game .cz-play:not(.is-fs) .cz-act-btn:disabled { opacity: .45; }
.chess-game .cz-play:not(.is-fs) .cz-act-btn:focus-visible { outline: 2px solid var(--hl-accent); outline-offset: 2px; }
/* 무승부 남은 횟수 — 「무승부」 글자 오른쪽 위 작은 숫자 */
.chess-game .cz-act-badge {
    align-self: flex-start;
    margin: 5px 0 0 -3px;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--hl-surface-3);
    color: var(--hl-text-muted);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.chess-game .cz-act-badge:empty { display: none; }

/* 결과 카드 */
.chess-game .cz-play:not(.is-fs) #czResult { border-radius: 14px; }
.chess-game .cz-play:not(.is-fs) #czRematchBtn .bi { margin-right: .35em; }   /* 글자가 span 이라 HTML 압축이 띄어쓰기를 지운다 */
.chess-game .cz-play:not(.is-fs) #czResultNote:empty { min-height: 0; margin: 0 !important; }

/* 오른쪽(또는 아래) 패널 — 한 장의 카드 */
.chess-game .cz-play:not(.is-fs) .cz-side {
    border: 1px solid var(--hl-border-subtle);
    border-radius: 16px;
    background: var(--hl-surface);
    box-shadow: 0 6px 24px var(--hl-shadow);
    overflow: hidden;
}
.chess-game .cz-play:not(.is-fs) .cz-side-tabs { flex: none; margin: 12px 12px 0; }
.chess-game .cz-play:not(.is-fs) .cz-side-tabs button {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 14px;
}
/* 컴퓨터 판 — 채팅 탭이 없으면 탭 줄을 제목 한 줄로 */
.chess-game .cz-play:not(.is-fs) .cz-side-tabs.is-single { padding: 0 2px; background: none; }
.chess-game .cz-play:not(.is-fs) .cz-side-tabs.is-single button {
    flex: none;
    padding: 2px 0;
    background: none;
    box-shadow: none;
    color: var(--hl-text-strong);
    cursor: default;
}
.chess-game .cz-play:not(.is-fs) .cz-side-tabs .cz-count { margin-left: 0; background: var(--hl-accent); color: var(--hl-on-accent); }
.chess-game .cz-play:not(.is-fs) .cz-side-body { flex: 1 1 auto; min-height: 0; padding: 10px 12px 12px; }
/* 탭 — 보는 쪽만 (data-side 는 chess-play.js setSideTab) */
.chess-game .cz-play:not(.is-fs)[data-side="chat"] #czMovesPane,
.chess-game .cz-play:not(.is-fs):not([data-side="chat"]) #czChat { display: none !important; }
.chess-game .cz-play:not(.is-fs) #czMovesPane { display: flex; flex-direction: column; min-height: 0; }
.chess-game .cz-play:not(.is-fs) #czMovesPane > :first-child { display: none !important; }   /* 「수 기록」 머리 — 탭이 대신 */
.chess-game .cz-play:not(.is-fs) .cz-chat { padding: 0; border: 0; border-radius: 0; background: transparent; }
.chess-game .cz-play:not(.is-fs) .cz-chat-head .cz-label { display: none; }
.chess-game .cz-play:not(.is-fs) .cz-chat-head:not(:has(#czChatMuteWrap:not([hidden]))) { display: none !important; }

/* 수 기록 — 번호 · 백 · 흑 세 칸, 마지막 수 강조 */
.chess-game .cz-play:not(.is-fs) .cz-movelog {
    display: block;
    max-height: 240px;
    margin: 0 -4px;
    font-size: 14px;
}
.chess-game .cz-play:not(.is-fs) .cz-movelog > li { display: flex; align-items: center; padding: 2px 4px; border-radius: 8px; }
.chess-game .cz-play:not(.is-fs) .cz-movelog > li:nth-child(even) { background: var(--hl-surface-2); }
.chess-game .cz-play:not(.is-fs) .cz-movelog > li.cz-hint { display: block; padding: 6px 4px; background: none; }
.chess-game .cz-play:not(.is-fs) .cz-mv-no { flex: 0 0 2.8em; font-size: 12.5px; text-align: right; padding-right: 10px; }
.chess-game .cz-play:not(.is-fs) .cz-mv { flex: 1 1 0; min-width: 0; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.chess-game .cz-play:not(.is-fs) .cz-mv.is-last { background: var(--hl-accent-subtle); color: var(--hl-fg-primary); }

/* 반응 6개 — 채팅 칸 입력줄 위 한 줄 */
.chess-game .cz-play:not(.is-fs) #czChat .cz-reacts { flex-wrap: nowrap !important; gap: 6px !important; }
.chess-game .cz-play:not(.is-fs) #czChat .cz-react-btn { flex: 1 1 0; width: auto; max-width: 52px; height: 34px; font-size: 17px; }

/* ── mid(769~991) — 판·두 사람 줄은 위, 패널은 아래 (같은 폭으로 가운데) ── */
.chess-game .cz-play:not(.is-fs):not(.is-wide) .cz-table { max-width: min(560px, max(360px, calc(100vh - 290px))); }
.chess-game .cz-play:not(.is-fs):not(.is-wide) #czActions { margin-top: 4px; }
.chess-game .cz-play:not(.is-fs):not(.is-wide) .cz-side { width: 100%; max-width: min(560px, max(360px, calc(100vh - 290px))); margin: 0 auto; }

/* ── wide(≥992) — 판 높이 = 화면 높이에 맞춘 정사각(최대 720), 패널은 판과 같은 높이 ── */
.chess-game .cz-play.is-wide #czGame {
    --cz-b: max(360px, min(720px, calc(100vh - 108px)));
    --cz-b: max(360px, min(720px, calc(100dvh - 108px)));
    flex-wrap: nowrap;
    justify-content: center;
}
.chess-game .cz-play.is-wide #czGame > .col-lg-7 { flex: 0 1 calc(var(--cz-b) + var(--bs-gutter-x)); width: auto; min-width: 0; }
.chess-game .cz-play.is-wide #czGame > .col-lg-5 {
    position: relative;
    flex: 1 1 0;
    width: auto;
    min-width: 384px;
    max-width: 452px;
    min-height: 580px;   /* 판이 작아지는 낮은 화면에서도 결과 카드·탭·두 줄이 들어가게 */
}
.chess-game .cz-play.is-wide .cz-side {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--bs-gutter-x) * .5);
    right: calc(var(--bs-gutter-x) * .5);
}
.chess-game .cz-play.is-wide .cz-table { max-width: none; }
.chess-game .cz-play.is-wide .cz-board-play { margin: 0 !important; }
.chess-game .cz-play.is-wide .cz-eval { top: 0; bottom: 0; }
.chess-game .cz-play.is-wide #czSide > .cz-player { flex: none; margin: 12px 12px 0; }
.chess-game .cz-play.is-wide #czSide > #czBottomBar { margin-top: 0; }
.chess-game .cz-play.is-wide #czSide > #czResult {
    flex: none;
    margin: 12px 12px 0 !important;
    padding: 12px 12px 10px;
    background: var(--hl-surface-2);
    box-shadow: none;
}
.chess-game .cz-play.is-wide #czSide .cz-result-title { font-size: 22px; }
.chess-game .cz-play.is-wide #czSide #czResultWhy { margin-bottom: 10px !important; }
.chess-game .cz-play.is-wide #czSide > #czTurn {
    flex: none;
    margin: 0 12px !important;
    padding: 6px 0;
    min-height: 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chess-game .cz-play.is-wide #czSide > #czTurn:empty { padding: 0; height: 12px; }
.chess-game .cz-play.is-wide #czSide > #czActions { flex: none; padding: 12px; }
.chess-game .cz-play.is-wide #czSide:has(> #czActions[hidden]) > #czBottomBar { margin-bottom: 12px; }   /* 관전자 — 단추 줄 없음 */
.chess-game .cz-play.is-wide .cz-side-body { flex: 1 1 0; overflow: hidden; }
.chess-game .cz-play.is-wide .cz-side-body > #czMovesPane,
.chess-game .cz-play.is-wide .cz-side-body > #czChat { flex: 1 1 0; min-height: 0; }
.chess-game .cz-play.is-wide .cz-movelog { flex: 1 1 0; min-height: 0; max-height: none; }
.chess-game .cz-play.is-wide #czChat .cz-chat-log { flex: 1 1 0; min-height: 0; max-height: none; }

@media (prefers-reduced-motion: reduce) {
    .chess-game .cz-play:not(.is-fs) .cz-player.is-turn.is-me,
    .chess-game .cz-play:not(.is-fs) .cz-player.is-turn .cz-clock.is-low { animation: none; }
}
