/* Cờ gánh – toàn bộ CSS của trò (tiền tố coganh-). Nạp sau style.css.
   Khung cảnh: sân lát gạch tàu đỏ, bàn cờ kẻ bằng than, quân là nắp chai đỏ và xanh (lật mặt khi bị gánh, bị vây). */
body[data-scene="coganh"] {
  background-color: #b5603d;
  background-image:
    radial-gradient(ellipse 70% 45% at 20% 10%, rgba(255, 220, 180, .16), transparent 70%),
    radial-gradient(ellipse 60% 50% at 85% 85%, rgba(60, 20, 5, .22), transparent 70%),
    radial-gradient(rgba(255, 210, 170, .10) 1px, transparent 1.6px),
    radial-gradient(rgba(70, 25, 10, .14) 1px, transparent 1.7px),
    repeating-linear-gradient(90deg, rgba(90, 38, 20, .55) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(90, 38, 20, .55) 0 2px, transparent 2px 64px),
    conic-gradient(from 90deg at 50% 50%, #b8623f 0 25%, #ad5737 0 50%, #bd6943 0 75%, #b25c3a 0);
  background-size: auto, auto, 7px 7px, 11px 11px, auto, auto, 128px 128px;
}
body[data-scene="coganh"] .coganh-backlink { color: #fff0dc; text-shadow: 1px 1px 0 rgba(60, 20, 5, .6); background: none; border: 0; cursor: pointer; padding: 0; }
.art-coganh { background: #b9603d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Crect x='0' y='0' width='32' height='32' fill='%23b9603d'/%3E%3Crect x='32' y='0' width='32' height='32' fill='%23c26a43'/%3E%3Crect x='64' y='0' width='32' height='32' fill='%23ad5636'/%3E%3Crect x='0' y='32' width='32' height='32' fill='%23bf6640'/%3E%3Crect x='32' y='32' width='32' height='32' fill='%23b45b3a'/%3E%3Crect x='64' y='32' width='32' height='32' fill='%23c87347'/%3E%3Crect x='0' y='64' width='32' height='32' fill='%23b05a38'/%3E%3Crect x='32' y='64' width='32' height='32' fill='%23bc6340'/%3E%3Crect x='64' y='64' width='32' height='32' fill='%23c06844'/%3E%3Cpath d='M32 0V96M64 0V96M0 32H96M0 64H96' stroke='%236e3420' stroke-width='2' opacity='.6'/%3E%3Cg fill='%23e9a57a' opacity='.25'%3E%3Ccircle cx='9' cy='40' r='2'/%3E%3Ccircle cx='71' cy='12' r='1.6'/%3E%3Ccircle cx='50' cy='88' r='2.2'/%3E%3Ccircle cx='88' cy='58' r='1.5'/%3E%3C/g%3E%3Cpath d='M14 14H82M14 14V82M14 31H82M31 14V82M14 48H82M48 14V82M14 65H82M65 14V82M14 82H82M82 14V82M14 14L82 82M82 14L14 82M48 14L82 48L48 82L14 48Z' fill='none' stroke='%2323170f' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' opacity='.85'/%3E%3Cpath d='M14 14H82M14 14V82M14 31H82M31 14V82M14 48H82M48 14V82M14 65H82M65 14V82M14 82H82M82 14V82M14 14L82 82M82 14L14 82M48 14L82 48L48 82L14 48Z' fill='none' stroke='%233a2518' stroke-width='.8' transform='translate(.7 -.5)' opacity='.5'/%3E%3Ccircle cx='14' cy='82' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='14' cy='82' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M10.6 80.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='31' cy='82' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='31' cy='82' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M27.6 80.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='48' cy='82' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='48' cy='82' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M44.6 80.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='82' cy='82' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='82' cy='82' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M78.6 80.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='14' cy='65' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='14' cy='65' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M10.6 63.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='48' cy='48' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='48' cy='48' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M44.6 46.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='65' cy='65' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='65' cy='65' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M61.6 63.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='31' cy='48' r='6.4' fill='%23d8392b' stroke='%238c1b12' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='31' cy='48' r='4' fill='none' stroke='%238c1b12' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M27.6 46.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='14' cy='14' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='14' cy='14' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M10.6 12.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='31' cy='14' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='31' cy='14' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M27.6 12.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='65' cy='14' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='65' cy='14' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M61.6 12.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='82' cy='14' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='82' cy='14' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M78.6 12.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='82' cy='31' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='82' cy='31' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M78.6 29.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='48' cy='31' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='48' cy='31' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M44.6 29.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Ccircle cx='82' cy='48' r='6.4' fill='%232f63c8' stroke='%23173a82' stroke-width='1.6' stroke-dasharray='1.4 .9'/%3E%3Ccircle cx='82' cy='48' r='4' fill='none' stroke='%23173a82' stroke-width='.8' opacity='.6'/%3E%3Cpath d='M78.6 46.4a4 4 0 0 1 3-2.6' stroke='%23fff' stroke-width='1.2' fill='none' opacity='.6' stroke-linecap='round'/%3E%3Cellipse cx='88' cy='90' rx='4' ry='2.8' fill='%23e8e1d0' stroke='%238d8370' stroke-width='.8'/%3E%3Crect x='3' y='86' width='10' height='4' rx='1.6' fill='%231d1714' transform='rotate(-18 8 88)'/%3E%3C/svg%3E") center/cover no-repeat; }
.coganh-svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* ================= Màn chọn ================= */
.coganh-setup, .coganh-lobby { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); max-width: 640px; }
.coganh-head { display: flex; gap: 14px; align-items: center; color: #fff0dc; }
.coganh-headart { display: block; width: 76px; height: 76px; flex: none; border-radius: 12px; border: 3px solid #4a1f10; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.coganh-h1 { margin: 0; font: 700 2.6rem/1.25 "Mali", var(--f-hand); color: #fff6e6; text-shadow: 2px 2px 0 #4a1f10; text-wrap: balance; padding-top: .08em; }
.coganh-head p { margin: 4px 0 0; color: #ffe6cc; font-size: .95rem; text-shadow: 1px 1px 0 rgba(60, 20, 5, .5); }
.coganh-box { background: #fff8ee; border: 2px solid #4a1f10; border-radius: 16px; padding: 14px 16px 16px; display: grid; gap: 14px; box-shadow: 0 5px 0 rgba(60, 20, 5, .3); min-width: 0; }
.coganh-field { display: grid; gap: 6px; min-width: 0; }
.coganh-field h2 { margin: 0; font: 400 1.3rem/1.3 var(--f-hand); color: #7a2e16; text-wrap: balance; }
.coganh-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.coganh-seg button { font: 600 .9rem/1.3 var(--f-body); min-height: 40px; padding: .4em .95em; border-radius: 999px; border: 1.5px solid #a44a28; background: #fff; color: #6a2812; cursor: pointer; white-space: nowrap; }
.coganh-seg button[aria-checked="true"] { background: #7a2e16; border-color: #7a2e16; color: #fff6e6; }
.coganh-mods { display: grid; gap: 2px; padding: 4px 2px 0; }
.coganh-chk { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: .95rem; cursor: pointer; }
.coganh-chk input { width: 22px; height: 22px; accent-color: #7a2e16; flex: none; }
.coganh-rnote, .coganh-lvhint { min-height: 1.3em; }
.coganh-box .btn.ink { background: #7a2e16; border-color: #4a1f10; box-shadow: 2px 3px 0 rgba(74, 31, 16, .3); }
.coganh-box .btn.red { background: #fff; }
.coganh-stat { color: #7a2e16; }
.coganh-rules { background: #fff8ee; border: 1.5px dashed #a44a28; border-radius: 14px; padding: 12px 18px; }
.coganh-rules summary { font-family: var(--f-hand); font-size: 1.4rem; line-height: 1.4; color: #7a2e16; cursor: pointer; min-height: 40px; display: list-item; }
.coganh-rules p, .coganh-rules li { font-size: .95rem; }
.coganh-rules ul { padding-left: 1.2em; }
.coganh-note { color: var(--muted); font-size: .86rem !important; }
.coganh-mini { position: relative; width: min(220px, 70%); aspect-ratio: 1; margin: 10px auto 4px; background: #c06844; border-radius: 8px; border: 2px solid #6e3420; }
.coganh-mini-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.coganh-mini i { position: absolute; width: 13%; height: 13%; translate: -50% -50%; display: block; }
.coganh-resume { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; padding: 12px 14px; background: #fff3c4; border: 2.5px solid #e0a400; border-radius: 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.coganh-resume > div:first-child { display: grid; gap: 2px; min-width: 0; }
.coganh-resume b { font: 400 1.35rem/1.3 var(--f-hand); color: #7a2e16; }
.coganh-resume span { font-size: .88rem; color: #6a2812; }
.coganh-resume-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.coganh-resume .btn.ink { background: #7a2e16; border-color: #4a1f10; }
.coganh-resume .btn:not(.ink) { border-color: #7a2e16; color: #7a2e16; box-shadow: 2px 3px 0 rgba(74, 31, 16, .2); }

/* Phòng chờ */
.coganh-lhead { display: flex; gap: 12px; align-items: center; }
.coganh-lhead h1 { margin: 0; font: 700 1.7rem/1.3 "Mali", var(--f-hand); color: #7a2e16; text-wrap: balance; }
.coganh-lhead p { margin: 0; color: var(--muted); }
.coganh-lhead .coganh-headart { width: 56px; height: 56px; }
.coganh-code { margin: 0; font: 700 clamp(2.2rem, 12vw, 3.2rem)/1.2 var(--f-body); letter-spacing: .08em; color: #7a2e16; text-align: center; }
.coganh-lstatus { margin: 0; min-height: 1.5em; font: 400 1.2rem/1.35 var(--f-hand); color: #6a2812; text-align: center; }
.coganh-lacts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ================= Màn chơi ================= */
.coganh-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.coganh-bar { display: flex; align-items: center; gap: 8px; color: #fff0dc; min-width: 0; }
.coganh-back { font: 1.7rem/1 var(--f-hand); color: #fff0dc; background: none; border: 0; padding: 2px 8px 2px 0; cursor: pointer; min-width: 40px; min-height: 40px; }
.coganh-bt { flex: 1; min-width: 0; display: grid; }
.coganh-bt b { font: 700 1.45rem/1.3 "Mali", var(--f-hand); color: #fff6e6; text-shadow: 1px 1px 0 #4a1f10; }
.coganh-sub { font-size: .8rem; line-height: 1.4; color: #ffe2c6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coganh-icon { background: none; border: 0; font-size: 1.3rem; cursor: pointer; padding: 6px; min-width: 40px; min-height: 40px; }
.coganh-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: #fff3c4; border: 2px solid #e0a400; font-size: .95rem; }
.coganh-banner .btn { background: #fff; }
.coganh-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.coganh-left { display: grid; gap: 6px; width: 100%; max-width: min(100%, calc(100svh - 230px)); min-width: 280px; justify-self: center; }
@media (max-width: 330px) { .coganh-left { min-width: 0; } }
@media (min-width: 900px) {
  .coganh-layout { grid-template-columns: minmax(0, auto) 290px; justify-content: center; }
  .coganh-left { width: min(600px, calc(100svh - 200px)); max-width: none; }
}

/* Hàng người chơi */
.coganh-pl { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 10px; border-radius: 10px; background: rgba(60, 20, 5, .28); color: #fff0dc; border: 1.5px solid transparent; transition: border-color .2s, background .2s; min-height: 44px; }
.coganh-pl.on { border-color: #ffd27a; background: rgba(60, 20, 5, .45); }
.coganh-plcap { width: 24px; height: 24px; flex: none; }
.coganh-pname { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.coganh-pname em { font-style: normal; font-weight: 400; color: #ffd9b8; font-size: .85em; }
.coganh-bar16 { flex: 1; min-width: 24px; height: 6px; border-radius: 3px; background: rgba(255, 240, 220, .2); overflow: hidden; }
.coganh-bar16 i { display: block; height: 100%; background: #ffd27a; border-radius: 3px; transition: width .4s; }
.coganh-cnt { font-size: .85rem; white-space: nowrap; color: #ffe2c6; }
.coganh-cnt b { font: 700 1.25rem/1 var(--f-body); color: #fff6e6; font-variant-numeric: tabular-nums; }

/* Bàn cờ: một mảng gạch sáng hơn, kẻ than; điểm đặt quân ở 10%..90% */
.coganh-frame { padding: 6px; border-radius: 12px; background: #6e3420; box-shadow: 0 8px 18px rgba(40, 12, 2, .45), inset 0 0 0 2px rgba(255, 200, 160, .15); }
.coganh-board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 7px; overflow: hidden; container-type: inline-size; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background-color: #c66d45;
  background-image:
    radial-gradient(ellipse 60% 50% at 30% 25%, rgba(255, 220, 190, .18), transparent 70%),
    radial-gradient(rgba(255, 215, 180, .14) 1px, transparent 1.6px),
    radial-gradient(rgba(80, 30, 10, .16) 1px, transparent 1.7px),
    linear-gradient(90deg, transparent calc(33.33% - 1px), rgba(110, 52, 32, .5) calc(33.33% - 1px) calc(33.33% + 1px), transparent 0, transparent calc(66.66% - 1px), rgba(110, 52, 32, .5) calc(66.66% - 1px) calc(66.66% + 1px), transparent 0),
    linear-gradient(0deg, transparent calc(33.33% - 1px), rgba(110, 52, 32, .5) calc(33.33% - 1px) calc(33.33% + 1px), transparent 0, transparent calc(66.66% - 1px), rgba(110, 52, 32, .5) calc(66.66% - 1px) calc(66.66% + 1px), transparent 0);
  background-size: auto, 6px 6px, 9px 9px, auto, auto; }
.coganh-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.coganh-marks, .coganh-pcs, .coganh-pts { position: absolute; inset: 0; }
.coganh-marks, .coganh-pcs { pointer-events: none; }
.coganh-pts { z-index: 5; }
.coganh-pt { position: absolute; width: 20%; height: 20%; border: 0; padding: 0; margin: 0; background: none; cursor: default; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.coganh-pt.coganh-can, .coganh-pt.coganh-tg { cursor: pointer; }
.coganh-pt:focus-visible { outline: 3px solid #ffd27a; outline-offset: -6px; }
/* Đánh dấu nằm dưới quân */
.coganh-marks > span { position: absolute; width: 20%; height: 20%; display: grid; place-items: center; }
.coganh-lastfrom::before { content: ""; width: 36%; height: 36%; border-radius: 50%; border: max(2px, calc(.6 * var(--cq))) dashed rgba(255, 246, 225, .85); }
.coganh-lastto::before { content: ""; width: 86%; height: 86%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 225, 110, .75) 45%, rgba(255, 225, 110, 0) 70%); }
.coganh-dot::before { content: ""; width: 30%; height: 30%; border-radius: 50%; background: rgba(255, 246, 225, .9); box-shadow: 0 0 0 max(2px, calc(.5 * var(--cq))) rgba(40, 20, 10, .55); }
.coganh-dotcap::before { width: 44%; height: 44%; background: #ffd27a; }
.coganh-dot b { position: absolute; font: 700 max(11px, calc(3.4 * var(--cq)))/1 var(--f-body); color: #4a1f10; }
.coganh-force::before { content: ""; width: 88%; height: 88%; border-radius: 50%; border: max(3px, calc(.9 * var(--cq))) solid #ff3b2b; box-shadow: 0 0 10px rgba(255, 60, 40, .8); }
@media (prefers-reduced-motion: no-preference) { .coganh-force::before { animation: coganh-pulse 1s ease-in-out infinite; } }
@keyframes coganh-pulse { 50% { scale: .86; opacity: .7; } }
.coganh-hintmk::before { content: ""; width: 84%; height: 84%; border-radius: 50%; border: max(3px, calc(.8 * var(--cq))) solid #ffe14d; }
/* Quân */
.coganh-pcs { z-index: 3; }
.coganh-pc { position: absolute; left: 0; top: 0; width: 20%; height: 20%; display: grid; place-items: center; transition: transform .26s cubic-bezier(.3, .7, .3, 1); will-change: transform; perspective: 400px; }
.coganh-pc.coganh-moving { z-index: 4; }
.coganh-flip { position: relative; width: 74%; height: 74%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4, .1, .3, 1.3); }
.coganh-flip.coganh-c1 { transform: rotateY(180deg); }
.coganh-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.coganh-face .coganh-svg { filter: drop-shadow(0 2px 1.5px rgba(40, 10, 0, .55)); }
.coganh-f1 { transform: rotateY(180deg); }
@media (prefers-reduced-motion: no-preference) {
  .coganh-pc.coganh-moving .coganh-flip { scale: 1.12; }
  .coganh-pc.coganh-hit .coganh-flip { animation: coganh-hop .5s ease-out; }
}
@keyframes coganh-hop { 40% { translate: 0 -12%; } }
@media (prefers-reduced-motion: reduce) { .coganh-pc, .coganh-flip { transition: none; } }
/* Chọn quân: vòng phấn quanh quân */
.coganh-pt.coganh-sel::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: max(3px, calc(.8 * var(--cq))) solid #fff6e1; box-shadow: 0 0 0 2px rgba(40, 20, 10, .5); }
.coganh-pt.coganh-can:not(.coganh-sel)::after { content: ""; position: absolute; left: 50%; bottom: 10%; width: 12%; height: 12%; translate: -50% 0; border-radius: 50%; background: rgba(255, 246, 225, .7); }
.coganh-fx { position: absolute; z-index: 7; translate: -50% -50%; pointer-events: none; font: 700 clamp(1.1rem, calc(7 * var(--cq)), 2.4rem)/1.3 "Mali", var(--f-hand); color: #fff; padding: .05em .45em; border-radius: 10px; white-space: nowrap; opacity: 0; box-shadow: 0 3px 10px rgba(0, 0, 0, .35); }
.coganh-fxg { background: rgba(170, 30, 20, .92); }
.coganh-fxv { background: rgba(30, 60, 150, .92); }
@media (prefers-reduced-motion: no-preference) { .coganh-fx { animation: coganh-fx 1.15s ease-out; } }
@media (prefers-reduced-motion: reduce) { .coganh-fx { opacity: .95; } }
@keyframes coganh-fx { 0% { opacity: 0; scale: .6; } 20% { opacity: 1; scale: 1.06; } 70% { opacity: 1; scale: 1; translate: -50% -70%; } 100% { opacity: 0; translate: -50% -90%; } }

.coganh-result { overflow-y: auto; }

/* Cột bên */
.coganh-side { display: grid; gap: 10px; background: #fff8ee; border: 2px solid #4a1f10; border-radius: 14px; padding: 10px 12px 12px; box-shadow: 0 4px 0 rgba(60, 20, 5, .3); min-width: 0; }
.coganh-status { margin: 0; min-height: 2.6em; font: 400 1.2rem/1.3 var(--f-hand); color: #6a2812; text-wrap: pretty; }
.coganh-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.coganh-acts .btn { border-color: #7a2e16; color: #7a2e16; box-shadow: 1px 2px 0 rgba(74, 31, 16, .2); min-height: 40px; padding: .4em .75em; white-space: nowrap; }
.coganh-acts .btn.red { border-color: var(--red); color: var(--red); }
.coganh-acts .btn.ink { background: #7a2e16; color: #fff6e6; }
.coganh-acts .btn:disabled { opacity: .45; cursor: default; }
.coganh-emos { display: flex; flex-wrap: wrap; gap: 6px; }
.coganh-emo { font: 600 .85rem/1.2 var(--f-body); min-height: 40px; padding: .3em .8em; border-radius: 999px; border: 1.5px dashed #a44a28; background: #fff; color: #6a2812; cursor: pointer; }
.coganh-log { margin: 0; padding: 6px 8px; list-style: none; max-height: 7.5em; overflow-y: auto; background: #f7e8d6; border-radius: 8px; font: .88rem/1.55 var(--f-body); color: #4a1f10; }
.coganh-log span { color: #a0684a; font-variant-numeric: tabular-nums; }
.coganh-log i, .coganh-log .coganh-empty { color: #a0684a; }
@media (min-width: 900px) { .coganh-log { max-height: 22em; } }
@media (max-width: 899.98px) { .coganh-side { padding: 8px 10px 10px; } .coganh-status { font-size: 1.12rem; } }
@media (max-width: 360px) { .coganh-seg { gap: 5px; } .coganh-seg button { padding: .4em .68em; font-size: .86rem; } .coganh-box { padding: 12px 12px 14px; } }
@media (max-width: 420px) {
  .coganh-frame { padding: 4px; border-radius: 9px; }
  .coganh-acts .btn { font-size: .84rem; padding: .4em .6em; }
  #app:has(.coganh-play) { padding-top: 8px; }
  .coganh-h1 { font-size: 2.2rem; }
  .coganh-headart { width: 64px; height: 64px; }
}

/* ================= Điện thoại xoay ngang ================= */
/* Cột trái: tiêu đề, người chơi trên, trạng thái + nút (tự cuộn), người chơi dưới; cột phải: bàn cờ cao bằng màn hình. */
@media (orientation: landscape) and (max-height: 540px) {
  #app:has(.coganh-play) { max-width: none; padding-top: 8px; padding-bottom: 8px; }
  .coganh-play { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto minmax(0, 1fr) auto; column-gap: 14px; row-gap: 6px; height: calc(100dvh - 16px); }
  .coganh-layout, .coganh-left { display: contents; }
  .coganh-bar { grid-column: 1; grid-row: 1; gap: 6px; }
  .coganh-bar .rot-btn { min-height: 40px; }
  .coganh-bt b { font-size: 1.2rem; }
  .coganh-banner { grid-column: 1; grid-row: 2; padding: 4px 10px; font-size: .85rem; }
  .coganh-pl-top { grid-column: 1; grid-row: 3; }
  .coganh-pl-bot { grid-column: 1; grid-row: 5; }
  .coganh-side { grid-column: 1; grid-row: 4; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 10px; }
  .coganh-status { font-size: 1.05rem; min-height: 0; }
  .coganh-log { max-height: none; min-height: 3em; }
  .coganh-frame { grid-column: 2; grid-row: 1 / -1; align-self: center; width: calc(100dvh - 20px); }
  .coganh-pl { min-height: 40px; padding: 3px 10px; }
  .coganh-result { padding: 8px; }
  .coganh-result .res-card { width: min(100%, 560px); grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 4px; padding: 12px 16px; text-align: left; align-items: center; }
  .coganh-result .res-stamp { grid-row: 1 / 3; width: 70px; height: 70px; font-size: 1.4rem; }
  .coganh-result .res-card h2 { font-size: 1.6rem; }
  .coganh-result .res-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; margin-top: 4px; gap: 6px; }
  .coganh-result .res-actions .btn { min-height: 40px; padding: .35em .6em; }
}
/* 1% bề rộng bàn; trình duyệt cũ (iOS < 16) không hiểu cqw thì core.js tự đặt bằng px */
@supports (width: 1cqw) { .coganh-board { --cq: 1cqw; } }
