/* ⭕ Cờ caro – giao diện riêng (khung chung ở shared/ui/gamekit.css). Bàn giấy kẻ ô, quân X / O tự vẽ. */
:root{--acc:#2563eb;--acc2:#ef4444;--bg:#f3f6fb;--line:#d5deea}
body{background:radial-gradient(900px 500px at 0 -10%,#dbe8ff 0,transparent 60%),radial-gradient(800px 520px at 100% 0,#ffe0e0 0,transparent 60%),var(--bg)}
.home-card .hero{height:110px;display:grid;grid-template-columns:repeat(5,34px);grid-auto-rows:34px;justify-content:center;align-content:center;margin-bottom:12px;background:linear-gradient(#cdd9ea 1px,transparent 1px) 0 0/34px 34px,linear-gradient(90deg,#cdd9ea 1px,transparent 1px) 0 0/34px 34px;border-radius:12px}
.home-card .hero i{font:800 26px/34px "Baloo 2",sans-serif;font-style:normal;text-align:center}.x{color:#2563eb}.o{color:#ef4444}
#screen-game.active{display:flex;flex-direction:column;min-height:100dvh}
.round{font:800 14.5px "Baloo 2",Nunito,sans-serif;background:#fff;border:1.5px solid var(--line);border-radius:999px;padding:6px 14px;min-height:42px;display:flex;align-items:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.arena{flex:1;display:flex;flex-direction:column;gap:8px;padding:2px 8px max(10px,env(safe-area-inset-bottom));width:100%;max-width:720px;margin:0 auto}
.bar{display:flex;gap:8px}.pl{flex:1;display:flex;align-items:center;gap:8px;background:#fff;border:2px solid var(--line);border-radius:14px;padding:6px 10px;font:800 14px Nunito,sans-serif;min-width:0}.pl b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pl.turn{border-color:var(--pc);box-shadow:0 0 0 3px color-mix(in srgb,var(--pc) 22%,transparent)}.pl.away{opacity:.5}
.msg{min-height:22px;text-align:center;font:800 15px Nunito,sans-serif}.msg small{color:var(--muted);font-weight:700}
.wrap{display:flex;justify-content:center}
/* bàn luôn nằm gọn trong màn hình (không phải kéo ngang / dọc): ô co theo cả bề ngang lẫn bề cao */
.board{--n:15;--cs:min(calc((min(100vw,720px) - 22px) / var(--n)),calc((100dvh - 236px) / var(--n)));display:grid;grid-template-columns:repeat(var(--n),var(--cs));grid-auto-rows:var(--cs);border-radius:12px;overflow:hidden;background:#fffef9;border:2px solid #9fb2cc;box-shadow:0 12px 26px -16px #2a2340;touch-action:manipulation}
.cell{position:relative;border:0;border-right:1px solid #c3d2e6;border-bottom:1px solid #c3d2e6;background:none;padding:0;cursor:pointer;min-width:0}
.cell:nth-child(5n){border-right-color:#a9bdd8}.cell:disabled{cursor:default}
.cell::before{content:"";position:absolute;inset:15%;pointer-events:none}
.cell.x::before,.mk.x::before{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%231d4ed8' stroke-linecap='round'%3E%3Cpath d='M17 15C34 30 62 60 85 87' stroke-width='13'/%3E%3Cpath d='M86 14C66 34 40 58 14 86' stroke-width='12'/%3E%3Cpath d='M20 19C40 38 60 59 82 83' stroke='%2393b4f5' stroke-width='3'/%3E%3C/svg%3E") center/contain no-repeat}
.cell.o::before,.mk.o::before{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23dc2626' stroke-linecap='round'%3E%3Cpath d='M55 13C29 9 11 30 13 53C15 78 38 91 60 86C81 81 91 60 86 39C82 22 68 12 49 14' stroke-width='12'/%3E%3C/svg%3E") center/contain no-repeat}
.cell::before{transform:rotate(var(--rt,0deg))}
.cell.x:not(.pend),.cell.o:not(.pend){animation:cr-pop .18s ease-out}
.cell.last{background:#fff0a8}.cell.win{background:#fff6cf}
/* gạch một nét qua 5 quân thắng (kiểu bút bi) – hướng nét theo hướng của hàng */
.board:not(.stone) .cell.win::after{content:"";position:absolute;z-index:2;left:-8%;right:-8%;top:calc(50% - 2px);height:4px;border-radius:3px;background:#111827;opacity:.85;pointer-events:none}
.board:not(.stone) .cell.win.w-v::after{transform:rotate(90deg)}.board:not(.stone) .cell.win.w-a::after{left:-27%;right:-27%;transform:rotate(45deg)}.board:not(.stone) .cell.win.w-b::after{left:-27%;right:-27%;transform:rotate(-45deg)}
.cell.pend{background:#eaf1ff}.cell.pend::before{opacity:.4}
.cell:not(:disabled):not(.x):not(.o):hover{background:#eef4ff}
.pl .mk{position:relative;margin-left:auto;width:22px;height:22px;flex:none}.pl .mk::before{content:"";position:absolute;inset:0}
/* kiểu "quân cờ gỗ": bàn gỗ, quân đen / trắng đặt trên giao điểm */
.board.stone{background:#e3b76a linear-gradient(100deg,#ffffff18 0 12%,#0000 12% 31%,#00000010 31% 44%,#0000 44% 68%,#ffffff14 68% 80%,#0000 80%);border-color:#8a5a22}
.board.stone .cell{border:0;background:linear-gradient(#0000 calc(50% - .6px),#6b4416 calc(50% - .6px) calc(50% + .6px),#0000 calc(50% + .6px)),linear-gradient(90deg,#0000 calc(50% - .6px),#6b4416 calc(50% - .6px) calc(50% + .6px),#0000 calc(50% + .6px))}
.board.stone .cell::before{inset:7%;border-radius:50%;transform:none}
.board.stone .cell.x::before,.stone-mk.x::before{background:radial-gradient(circle at 34% 28%,#7a7a7a,#1b1b1b 58%,#000);box-shadow:0 2px 3px #0008;border-radius:50%}
.board.stone .cell.o::before,.stone-mk.o::before{background:radial-gradient(circle at 34% 28%,#fff,#e6e6e6 60%,#bdbdbd);box-shadow:0 2px 3px #0007;border-radius:50%}
.board.stone .cell.last::after{content:"";position:absolute;left:38%;top:38%;width:24%;height:24%;border-radius:50%;background:#ef4444;pointer-events:none}
.board.stone .cell.win::before{box-shadow:0 0 0 3px #22c55e,0 2px 3px #0008}
.board.stone .cell.pend::before{opacity:.5}
@keyframes cr-pop{from{transform:scale(.4);opacity:.3}}@media (prefers-reduced-motion:reduce){.cell::before{animation:none!important}.cell{animation:none!important}}
.acts{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;min-height:46px}.acts .btn{flex:0 1 180px;min-height:46px}
.guide h3{font-size:17px;margin:12px 0 4px}.guide p,.guide li{font-size:15px}.guide ul{margin:0;padding-left:20px}
