/* Cờ cá ngựa – toàn bộ CSS của trò (mọi lớp dùng tiền tố cangua-). Nạp sau style.css.
   Khung cảnh: bàn cờ bìa cứng in bốn màu đặt trên khăn trải bàn caro đỏ trắng. Màu riêng của trò: đỏ, xanh dương, xanh lá, vàng. */
.art-cangua {
  background-color: #f6ecd6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Crect width='96' height='96' fill='%23f6ecd6'/%3E%3Crect x='2' y='2' width='92' height='92' rx='7' fill='%23fffaf0' stroke='%2324233a' stroke-width='2'/%3E%3Crect x='3.5' y='3.5' width='35' height='35' rx='5' fill='%23d9483b'/%3E%3Crect x='9' y='9' width='24' height='24' rx='5' fill='%23fffaf0'/%3E%3Ccircle cx='15' cy='15' r='3.6' fill='%23d9483b' opacity='.35'/%3E%3Ccircle cx='27' cy='15' r='3.6' fill='%23d9483b' opacity='.35'/%3E%3Ccircle cx='15' cy='27' r='3.6' fill='%23d9483b' opacity='.35'/%3E%3Ccircle cx='27' cy='27' r='3.6' fill='%23d9483b' opacity='.35'/%3E%3Crect x='57.5' y='3.5' width='35' height='35' rx='5' fill='%232f6fd1'/%3E%3Crect x='63' y='9' width='24' height='24' rx='5' fill='%23fffaf0'/%3E%3Ccircle cx='69' cy='15' r='3.6' fill='%232f6fd1' opacity='.35'/%3E%3Ccircle cx='81' cy='15' r='3.6' fill='%232f6fd1' opacity='.35'/%3E%3Ccircle cx='69' cy='27' r='3.6' fill='%232f6fd1' opacity='.35'/%3E%3Ccircle cx='81' cy='27' r='3.6' fill='%232f6fd1' opacity='.35'/%3E%3Crect x='57.5' y='57.5' width='35' height='35' rx='5' fill='%232e9a52'/%3E%3Crect x='63' y='63' width='24' height='24' rx='5' fill='%23fffaf0'/%3E%3Ccircle cx='69' cy='69' r='3.6' fill='%232e9a52' opacity='.35'/%3E%3Ccircle cx='81' cy='69' r='3.6' fill='%232e9a52' opacity='.35'/%3E%3Ccircle cx='69' cy='81' r='3.6' fill='%232e9a52' opacity='.35'/%3E%3Ccircle cx='81' cy='81' r='3.6' fill='%232e9a52' opacity='.35'/%3E%3Crect x='3.5' y='57.5' width='35' height='35' rx='5' fill='%23e4b62b'/%3E%3Crect x='9' y='63' width='24' height='24' rx='5' fill='%23fffaf0'/%3E%3Ccircle cx='15' cy='69' r='3.6' fill='%23e4b62b' opacity='.35'/%3E%3Ccircle cx='27' cy='69' r='3.6' fill='%23e4b62b' opacity='.35'/%3E%3Ccircle cx='15' cy='81' r='3.6' fill='%23e4b62b' opacity='.35'/%3E%3Ccircle cx='27' cy='81' r='3.6' fill='%23e4b62b' opacity='.35'/%3E%3Crect x='39.4' y='3.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='3.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='3.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='9.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='9.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='9.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='15.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='15.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='15.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='21.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='21.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='21.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='27.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='27.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='27.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='33.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='33.4' width='5.2' height='5.2' rx='1' fill='%232f6fd1' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='33.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='3.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='9.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='15.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='21.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='27.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='33.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='57.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='63.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='69.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='75.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='81.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='87.4' y='39.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='3.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='9.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='15.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='21.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='27.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='33.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23d9483b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='57.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='63.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='69.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='75.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='81.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='87.4' y='45.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='3.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='9.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='15.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='21.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='27.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='33.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='57.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='63.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='69.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='75.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='81.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%232e9a52' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='87.4' y='51.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='57.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='57.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='57.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='63.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='63.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='63.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='69.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='69.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='69.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='75.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='75.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='75.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='81.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='81.4' width='5.2' height='5.2' rx='1' fill='%23e4b62b' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='81.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='39.4' y='87.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='45.4' y='87.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Crect x='51.4' y='87.4' width='5.2' height='5.2' rx='1' fill='%23fffdf6' stroke='%23b7a57e' stroke-width='.5'/%3E%3Cpolygon points='39,39 39,57 48,48' fill='%23d9483b'/%3E%3Cpolygon points='39,39 57,39 48,48' fill='%232f6fd1'/%3E%3Cpolygon points='57,39 57,57 48,48' fill='%232e9a52'/%3E%3Cpolygon points='39,57 57,57 48,48' fill='%23e4b62b'/%3E%3Cg transform='translate(9 8) scale(0.48)'%3E%3Cpath d='M7.5 39.2c0-3.4 2.6-5.6 6.3-6.1h12.4c3.7.5 6.3 2.7 6.3 6.1z' fill='%23d9483b' stroke='%238f2219' stroke-width='2'/%3E%3Cpath d='M13.4 33.4C14.6 29 17.2 27 16.2 24.6L11.6 23.2C9.4 22.6 7.5 21.5 7.1 19.4 6.7 17.3 8.2 15.3 10.3 13.5L14.2 9.6 15.4 4.4 18.7 7.9C24.8 7.7 30.3 11.6 31.5 18.6 32.4 23.8 31.5 28.8 30.3 33.4z' fill='%23d9483b' stroke='%238f2219' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='15.8' cy='13.4' r='2' fill='%238f2219'/%3E%3C/g%3E%3Cg transform='translate(62 62) scale(0.48)'%3E%3Cpath d='M7.5 39.2c0-3.4 2.6-5.6 6.3-6.1h12.4c3.7.5 6.3 2.7 6.3 6.1z' fill='%232e9a52' stroke='%231a5c30' stroke-width='2'/%3E%3Cpath d='M13.4 33.4C14.6 29 17.2 27 16.2 24.6L11.6 23.2C9.4 22.6 7.5 21.5 7.1 19.4 6.7 17.3 8.2 15.3 10.3 13.5L14.2 9.6 15.4 4.4 18.7 7.9C24.8 7.7 30.3 11.6 31.5 18.6 32.4 23.8 31.5 28.8 30.3 33.4z' fill='%232e9a52' stroke='%231a5c30' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='15.8' cy='13.4' r='2' fill='%231a5c30'/%3E%3C/g%3E%3Cg transform='translate(64 9) scale(0.42)'%3E%3Cpath d='M7.5 39.2c0-3.4 2.6-5.6 6.3-6.1h12.4c3.7.5 6.3 2.7 6.3 6.1z' fill='%232f6fd1' stroke='%231a3f80' stroke-width='2'/%3E%3Cpath d='M13.4 33.4C14.6 29 17.2 27 16.2 24.6L11.6 23.2C9.4 22.6 7.5 21.5 7.1 19.4 6.7 17.3 8.2 15.3 10.3 13.5L14.2 9.6 15.4 4.4 18.7 7.9C24.8 7.7 30.3 11.6 31.5 18.6 32.4 23.8 31.5 28.8 30.3 33.4z' fill='%232f6fd1' stroke='%231a3f80' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='15.8' cy='13.4' r='2' fill='%231a3f80'/%3E%3C/g%3E%3Cg transform='translate(10 64) scale(0.42)'%3E%3Cpath d='M7.5 39.2c0-3.4 2.6-5.6 6.3-6.1h12.4c3.7.5 6.3 2.7 6.3 6.1z' fill='%23e4b62b' stroke='%2386650a' stroke-width='2'/%3E%3Cpath d='M13.4 33.4C14.6 29 17.2 27 16.2 24.6L11.6 23.2C9.4 22.6 7.5 21.5 7.1 19.4 6.7 17.3 8.2 15.3 10.3 13.5L14.2 9.6 15.4 4.4 18.7 7.9C24.8 7.7 30.3 11.6 31.5 18.6 32.4 23.8 31.5 28.8 30.3 33.4z' fill='%23e4b62b' stroke='%2386650a' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='15.8' cy='13.4' r='2' fill='%2386650a'/%3E%3C/g%3E%3Cg transform='translate(30.5 58) scale(0.36)'%3E%3Cpath d='M7.5 39.2c0-3.4 2.6-5.6 6.3-6.1h12.4c3.7.5 6.3 2.7 6.3 6.1z' fill='%23d9483b' stroke='%238f2219' stroke-width='2'/%3E%3Cpath d='M13.4 33.4C14.6 29 17.2 27 16.2 24.6L11.6 23.2C9.4 22.6 7.5 21.5 7.1 19.4 6.7 17.3 8.2 15.3 10.3 13.5L14.2 9.6 15.4 4.4 18.7 7.9C24.8 7.7 30.3 11.6 31.5 18.6 32.4 23.8 31.5 28.8 30.3 33.4z' fill='%23d9483b' stroke='%238f2219' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='15.8' cy='13.4' r='2' fill='%238f2219'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
body[data-scene="cangua"] {
  background-color: #f7efe1;
  background-image:
    repeating-linear-gradient(90deg, rgba(195, 38, 44, .07) 0 22px, transparent 22px 44px),
    repeating-linear-gradient(0deg, rgba(195, 38, 44, .07) 0 22px, transparent 22px 44px),
    radial-gradient(rgba(120, 80, 10, .06) 1px, transparent 1.4px);
  background-size: auto, auto, 5px 5px;
}

/* ================= Màn chọn người chơi ================= */
.cangua-setup { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cangua-head { display: flex; gap: 16px; align-items: center; }
.cangua-art { display: block; width: 76px; height: 76px; flex: none; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 2px 3px 0 rgba(28, 60, 168, .15); }
.cangua-h1 { font: 700 2.5rem/1.15 "Mali", var(--f-hand); color: #2f6fd1; text-shadow: 2px 2px 0 #ffd23f, 3px 3px 0 #24233a; }
.cangua-head p { margin: 2px 0 0; color: var(--muted); }
.cangua-cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) { .cangua-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.cangua-box { background: var(--label); border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px 16px; display: grid; gap: 12px; box-shadow: 3px 4px 0 rgba(28, 60, 168, .12); min-width: 0; }
.cangua-box h2 { font-size: 1.5rem; }
.cangua-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; min-width: 0; }
.cangua-seg button { font: 500 .92rem/1.15 var(--f-body); min-height: 42px; padding: .45em 6px; background: var(--label); color: var(--ink); border: 0; border-left: 1.5px solid var(--ink); cursor: pointer; }
.cangua-seg button:first-child { border-left: 0; }
.cangua-seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.cangua-seats { display: grid; gap: 8px; }
.cangua-seat { display: grid; grid-template-columns: 36px minmax(0, 1fr) 124px; gap: 8px; align-items: center; padding: 2px 0 2px 6px; border-left: 5px solid var(--pc); border-radius: 4px; }
.cangua-seat input { min-width: 0; font: 1.15rem var(--f-hand); color: var(--red); border: 0; border-bottom: 1.5px dotted var(--ink-soft); background: transparent; padding: 6px 2px; min-height: 42px; }
.cangua-seat input:focus { outline: none; border-bottom-style: solid; }
.cangua-seat input::placeholder { color: var(--muted); opacity: .85; }
.cangua-tk { display: inline-block; width: 32px; height: 35px; flex: none; vertical-align: middle; }
.cangua-tk svg { display: block; width: 100%; height: 100%; }
.cangua-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; align-items: center; font-size: .95rem; }
.cangua-chk { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; min-height: 40px; padding-top: 6px; }
.cangua-chk input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--ink); }
.cangua-rulepick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cangua-rulepick button { display: grid; gap: 4px; align-content: start; text-align: left; padding: 10px 12px; min-height: 44px; border: 2px solid var(--ink); border-radius: 12px; background: var(--label); color: var(--text); cursor: pointer; font: inherit; box-shadow: 2px 3px 0 rgba(28, 60, 168, .12); }
.cangua-rulepick b { font: 400 1.3rem/1.1 var(--f-hand); color: var(--ink); }
.cangua-rulepick span { font-size: .8rem; line-height: 1.35; color: var(--muted); }
.cangua-rulepick button[aria-checked="true"] { background: #eaf0ff; box-shadow: inset 0 0 0 2px var(--ink), 2px 3px 0 rgba(28, 60, 168, .2); }
.cangua-rulepick button[aria-checked="true"] b::before { content: "✓ "; color: var(--red); }
.cangua-opts { display: grid; gap: 10px; padding: 10px 0 2px; border-top: 1px dotted var(--ink-soft); }
.cangua-stat { color: var(--ink); }
.cangua-resume { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff4c9; border: 2px solid #d9b740; border-radius: 14px; box-shadow: 3px 4px 0 rgba(185, 138, 46, .25); }
.cangua-resume p { margin: 0; display: grid; gap: 2px; min-width: 0; }
.cangua-resume b { font: 400 1.4rem/1.1 var(--f-hand); color: var(--red); }
.cangua-resume span { font-size: .9rem; color: var(--text); overflow-wrap: anywhere; }
.cangua-resume-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cangua-resume-btns .btn { min-height: 44px; }
.cangua-rules { background: var(--label); border: 1.5px dashed var(--ink-soft); border-radius: 14px; padding: 12px 18px; }
.cangua-rules summary { font-family: var(--f-hand); font-size: 1.4rem; color: var(--ink); cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.cangua-rules h3 { margin: 14px 0 4px; font: 400 1.3rem/1.15 var(--f-hand); color: var(--red); }
.cangua-rules p, .cangua-rules li { font-size: .95rem; max-width: 75ch; }
.cangua-rules ul { padding-left: 1.2em; margin: 4px 0; }
.cangua-note { color: var(--muted); font-size: .85rem !important; }

/* ================= Màn chơi ================= */
.cangua-play { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.cangua-bar { display: flex; align-items: center; gap: 8px; }
.cangua-back { font: 1.6rem var(--f-hand); color: var(--ink); background: none; border: 0; min-width: 40px; min-height: 40px; padding: 0 6px; cursor: pointer; }
.cangua-bt { flex: 1; min-width: 0; display: grid; }
.cangua-bt b { font: 700 1.45rem/1.15 "Mali", var(--f-hand); color: #2f6fd1; text-shadow: 1px 1px 0 #ffd23f, 2px 2px 0 #24233a; }
.cangua-sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cangua-icon { background: none; border: 0; font-size: 1.3rem; cursor: pointer; min-width: 40px; min-height: 40px; }
.cangua-bar .btn.small { min-height: 40px; }
.cangua-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .cangua-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.cangua-boardwrap { min-width: 0; padding-bottom: 10px; overflow-x: clip; overflow-clip-margin: 14px; }
.cangua-board { position: relative; width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 1 / 1; border-radius: 2.7%;
  box-shadow: 0 8px 0 #8a5a32, 0 9px 0 #5e3a1c, 0 16px 26px rgba(60, 30, 0, .28); --tc: #d9483b; --mv: 170ms; user-select: none; -webkit-user-select: none; }
.cangua-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cangua-svgn { font: 700 22px "Mali", var(--f-hand); fill: #fff; stroke: rgba(36, 35, 58, .55); stroke-width: 3.5px; paint-order: stroke; }
.cangua-off { opacity: .4; filter: saturate(.35); }
.cangua-glow { position: absolute; width: 40%; height: 40%; border-radius: 6%; pointer-events: none; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--tc), 0 0 22px 8px var(--tc); transition: left .35s, top .35s, box-shadow .35s; z-index: 1; }
@media (prefers-reduced-motion: no-preference) { .cangua-glow { animation: cangua-glow 1.6s ease-in-out infinite; } }
@keyframes cangua-glow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--tc), 0 0 10px 2px var(--tc); } }
.cangua-pcs, .cangua-fx { position: absolute; inset: 0; pointer-events: none; }
.cangua-pcs { z-index: 2; }
.cangua-fx { z-index: 3; }
.cangua-pc { position: absolute; width: 7.4%; aspect-ratio: 40 / 44; padding: 0; margin: 0; border: 0; background: none; transform: translate(-50%, -56%);
  transition: left var(--mv) ease-out, top var(--mv) ease-out, width .2s; pointer-events: none; -webkit-tap-highlight-color: transparent; }
.cangua-pc.cangua-stack { width: 5.6%; }
.cangua-pin { display: block; width: 100%; height: 100%; transform-origin: 50% 92%; }
.cangua-horse { display: block; width: 100%; height: 100%; overflow: visible; }
.cangua-pc .cangua-horse { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .6)); }
.cangua-can { pointer-events: auto; cursor: pointer; z-index: 70 !important; }
.cangua-can::before { content: ""; position: absolute; left: 50%; top: 56%; width: max(40px, 150%); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; }
.cangua-can::after { content: ""; position: absolute; left: 50%; top: 82%; width: 120%; aspect-ratio: 2.2; transform: translate(-50%, -50%); border-radius: 50%; border: 2.5px dashed var(--pc); background: rgba(255, 255, 255, .55); z-index: -1; }
.cangua-can:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .cangua-can .cangua-pin { animation: cangua-bob .75s ease-in-out infinite; }
  .cangua-target { animation: cangua-spin 3s linear infinite; }
}
@keyframes cangua-bob { 50% { transform: translateY(-14%) scale(1.06); } }
@keyframes cangua-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.cangua-moving { z-index: 80 !important; }
.cangua-kicked { transition-duration: .5s; z-index: 90 !important; }
.cangua-kicked .cangua-pin { animation: cangua-kick .75s ease-out; }
@keyframes cangua-kick { 0% { transform: none; } 30% { transform: translateY(-60%) rotate(-200deg) scale(1.2); } 100% { transform: rotate(-720deg); } }
.cangua-target { position: absolute; width: 5.4%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; padding: 0; border: 3px dotted var(--pc); background: rgba(255, 255, 255, .45); cursor: pointer; pointer-events: auto; }
.cangua-target::before { content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; transform: translate(-50%, -50%); border-radius: 50%; }
.cangua-target.hit { border: 3px solid var(--red); background: rgba(255, 210, 63, .55); }
.cangua-boom { position: absolute; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; display: grid; place-items: center; }
.cangua-boom svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cangua-boom b { position: relative; font: 700 clamp(.9rem, 3.4vw, 1.5rem)/1 "Mali", var(--f-hand); color: #c3262c; text-shadow: 0 1px 0 #fff; transform: rotate(-10deg); }
@media (prefers-reduced-motion: no-preference) { .cangua-boom { animation: cangua-boom 1.1s ease-out forwards; } }
@keyframes cangua-boom { 0% { transform: translate(-50%, -50%) scale(.2) rotate(-30deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.15) rotate(6deg); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } 100% { transform: translate(-50%, -70%) scale(.9); opacity: 0; } }
.cangua-spark { position: absolute; width: 0; height: 0; pointer-events: none; }
.cangua-spark i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #ffd23f; box-shadow: 0 0 0 2px #fff; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .cangua-spark i { animation: cangua-spark .9s ease-out forwards; }
  .cangua-spark i:nth-child(1) { --a: 0deg; } .cangua-spark i:nth-child(2) { --a: 60deg; background: #d9483b; } .cangua-spark i:nth-child(3) { --a: 120deg; background: #2f6fd1; }
  .cangua-spark i:nth-child(4) { --a: 180deg; } .cangua-spark i:nth-child(5) { --a: 240deg; background: #2e9a52; } .cangua-spark i:nth-child(6) { --a: 300deg; background: #d9483b; }
}
@keyframes cangua-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateX(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(34px) scale(.5); } }

/* Khay xúc xắc */
.cangua-side { display: grid; gap: 10px; min-width: 0; }
.cangua-turn { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; background: var(--label); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; box-shadow: 3px 4px 0 rgba(28, 60, 168, .12); }
.cangua-tray { position: relative; width: 92px; height: 92px; padding: 0; border-radius: 20px; cursor: pointer; --tc: #d9483b; --td: #8f2219; --rd: 620ms;
  border: 3px solid var(--tc); background: radial-gradient(circle at 40% 30%, #3f7a52, #24502f 75%); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .45), 0 3px 0 var(--td); transition: border-color .3s; }
.cangua-tray:disabled { cursor: default; }
.cangua-tray.cangua-ready { box-shadow: inset 0 3px 8px rgba(0, 0, 0, .45), 0 3px 0 var(--td), 0 0 0 4px rgba(255, 210, 63, .9); }
@media (prefers-reduced-motion: no-preference) { .cangua-tray.cangua-ready .cangua-die { animation: cangua-wiggle 1.4s ease-in-out infinite; } }
@keyframes cangua-wiggle { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-9deg); } 86% { transform: rotate(8deg); } 94% { transform: rotate(-4deg); } }
.cangua-dshadow { position: absolute; left: 50%; top: 50%; width: 50px; height: 14px; margin: 18px 0 0 -25px; border-radius: 50%; background: rgba(0, 0, 0, .45); filter: blur(2.5px); }
.cangua-die { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -29px 0 0 -26px; padding: 8px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 2px;
  border-radius: 12px; background: linear-gradient(150deg, #ffffff 0%, #f3eee3 60%, #ddd4c2 100%); box-shadow: inset -2px -3px 0 rgba(0, 0, 0, .1), inset 2px 2px 0 #fff, 0 2px 0 #b8ad98; }
.cangua-die i { display: block; border-radius: 50%; margin: 1px; }
.cangua-die i.on { background: radial-gradient(circle at 35% 30%, #5b5b66, #15141c 70%); }
.cangua-die i.on.red { background: radial-gradient(circle at 35% 30%, #ff7b6e, #b3121c 70%); }
@media (prefers-reduced-motion: no-preference) {
  .cangua-tossed .cangua-die { animation: cangua-toss var(--rd) cubic-bezier(.3, .6, .4, 1); }
  .cangua-tossed .cangua-dshadow { animation: cangua-shadow var(--rd) cubic-bezier(.3, .6, .4, 1); }
  .cangua-landed { animation: cangua-land .32s ease-out; }
}
@keyframes cangua-toss { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(-8px, -30px) rotate(-160deg) scale(1.08); } 50% { transform: translate(6px, -6px) rotate(-320deg); } 70% { transform: translate(-3px, -14px) rotate(-420deg); } 100% { transform: translate(0, 0) rotate(-540deg); } }
@keyframes cangua-shadow { 25% { transform: scale(.55); opacity: .35; } 50% { transform: scale(.95); opacity: 1; } 70% { transform: scale(.75); opacity: .6; } }
@keyframes cangua-land { 0% { transform: scale(1.12, .86); } 60% { transform: scale(.96, 1.05); } 100% { transform: none; } }
.cangua-tinfo { display: grid; gap: 8px; min-width: 0; }
.cangua-status { margin: 0; min-height: 2.6em; font: 1.18rem/1.3 var(--f-hand); color: var(--ink); overflow-wrap: anywhere; }
.cangua-status b { color: var(--red); font-weight: 400; }
.cangua-roll { min-height: 44px; }
.cangua-roll:disabled { background: #e6e4ef; color: var(--muted); border-color: #c9c6dd; box-shadow: none; cursor: default; }

/* Người chơi */
.cangua-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 900px) { .cangua-players { grid-template-columns: minmax(0, 1fr); } }
.cangua-pl { display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-width: 0; padding: 6px 8px; background: var(--label);
  border: 2px solid #c9c6dd; border-left: 6px solid var(--pc); border-radius: 12px; transition: border-color .2s, box-shadow .2s, background .2s; }
.cangua-pl .cangua-tk { grid-row: 1 / 3; width: 30px; height: 33px; }
.cangua-pl.on { border-color: var(--pc); background: var(--pl); box-shadow: 0 0 0 3px rgba(28, 60, 168, .12); }
.cangua-pl.win { border-color: #d9b740; background: #fff4c9; }
.cangua-pn { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cangua-pn b { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cangua-pn small { flex: none; font-size: .74rem; color: var(--muted); }
.cangua-dots { display: flex; gap: 4px; }
.cangua-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--pc); background: transparent; }
.cangua-dots i.run { background: linear-gradient(90deg, var(--pc) 50%, transparent 50%); }
.cangua-dots i.home { background: var(--pc); box-shadow: 0 0 0 2px #ffd23f; }
.cangua-logbox { background: var(--label); border: 1.5px dashed var(--ink-soft); border-radius: 12px; padding: 4px 12px; }
.cangua-logbox summary { font: 1.15rem var(--f-hand); color: var(--ink); cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.cangua-log { margin: 0 0 8px; padding-left: 1.1em; list-style: disc; max-height: 220px; overflow-y: auto; font-size: .85rem; color: var(--text); }
.cangua-log li { padding: 2px 0; border-bottom: 1px dotted #e2dfee; }
.cangua-log li:first-child { font-weight: 600; }
.cangua-reopen { justify-self: start; }

/* Kết quả */
.cangua-modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(36, 35, 58, .5); padding: 16px; z-index: 50; overflow-y: auto; }
.cangua-res { width: min(100%, 420px); background: var(--label); border: 3px double var(--ink); border-radius: 18px; padding: 20px 18px; display: grid; gap: 8px; text-align: center; animation: pop .25s ease-out; }
.cangua-res h2 { font-size: 2rem; line-height: 1.1; }
.cangua-res p { margin: 0; }
.cangua-stamp { justify-self: center; font: 1.7rem var(--f-hand); color: var(--red); border: 3px solid var(--red); border-radius: 50%; width: 88px; height: 88px; display: grid; place-items: center; transform: rotate(-12deg); }
.cangua-stamp.lose { color: var(--ink); border-color: var(--ink); }
.cangua-rank { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; text-align: left; counter-reset: r; }
.cangua-rank li { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 8px; border-left: 5px solid var(--pc); background: #faf8f2; border-radius: 6px; counter-increment: r; }
.cangua-rank li::before { content: counter(r); font: 1.3rem var(--f-hand); color: var(--ink); }
.cangua-rank li:first-child { background: #fff4c9; }
.cangua-rank .cangua-tk { width: 28px; height: 31px; }
.cangua-rank span:not(.cangua-tk) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cangua-rank b { font-size: .8rem; font-weight: 500; color: var(--muted); }
.cangua-rbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.cangua-rbtns .btn { min-height: 44px; }

@media (max-width: 480px) {
  .cangua-h1 { font-size: 2.1rem; }
  .cangua-art { width: 64px; height: 64px; }
  .cangua-seat { grid-template-columns: 32px minmax(0, 1fr) 112px; }
  .cangua-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .cangua-rulepick b { font-size: 1.15rem; }
  .cangua-box { padding: 12px 12px 14px; }
  .cangua-turn { grid-template-columns: 84px minmax(0, 1fr); padding: 8px 10px; gap: 10px; }
  .cangua-tray { width: 84px; height: 84px; }
  .cangua-status { font-size: 1.08rem; }
  .cangua-pl { padding: 5px 6px; column-gap: 6px; }
  .cangua-pn small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cangua-pc { transition: none; }
  .cangua-glow { transition: none; }
}

/* ================= Điện thoại xoay ngang ================= */
/* Cột trái: tiêu đề, xúc xắc, người chơi, diễn biến (tự cuộn); cột phải: bàn cờ cao bằng màn hình. */
@media (orientation: landscape) and (max-height: 540px) {
  #app:has(.cangua-play) { max-width: none; }
  .cangua-play { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; row-gap: 6px; height: calc(100dvh - 18px); }
  .cangua-layout { display: contents; }
  .cangua-bar { grid-column: 1; grid-row: 1; gap: 6px; }
  .cangua-bar .rot-btn { min-height: 40px; }
  .cangua-bt b { font-size: 1.25rem; }
  .cangua-side { grid-column: 1; grid-row: 2; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 8px 0; }
  .cangua-turn { grid-template-columns: 80px minmax(0, 1fr); gap: 10px; padding: 8px 10px; }
  .cangua-tray { width: 80px; height: 80px; }
  .cangua-status { min-height: 0; font-size: 1.08rem; }
  .cangua-boardwrap { grid-column: 2; grid-row: 1 / -1; align-self: start; padding-bottom: 0; }
  .cangua-board { width: calc(100dvh - 42px); max-width: none; }
}
