/* ================= Cờ Vây — bàn cờ, quân, mẫu bàn / kiểu quân, màn chơi nền xanh rêu dịu mắt ================= */

/* ---------- bàn: .gboard > .pt ×(n·n) — cỡ theo cqw nên dùng chung cho bàn thật và ô xem thử cửa hàng ---------- */
.board-wrap { display: flex; justify-content: center; }
.gboard { --n: 9; --size: min(100%, 560px, calc(100dvh - 300px)); container-type: inline-size; position: relative; width: var(--size); min-width: 240px; aspect-ratio: 1; display: grid;
  grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); padding: 2.4cqw; border-radius: 6px; background: var(--wood-img, none), var(--wood);
  box-shadow: 0 0 0 .7cqw var(--frame), 0 1.6cqw 4cqw rgba(0, 0, 0, .28); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pt { --c: calc((100cqw - 4.8cqw) / var(--n)); --lw: max(1px, calc(var(--c) * .05)); position: relative; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.pt::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: var(--lw); transform: translateY(-50%); background: var(--ln); }
.pt::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: var(--lw); transform: translateX(-50%); background: var(--ln); }
.pt.cl::before { left: 50%; } .pt.cr::before { right: 50%; } .pt.ct::after { top: 50%; } .pt.cb::after { bottom: 50%; }
.pt .hs { position: absolute; left: 50%; top: 50%; width: calc(var(--c) * .2); height: calc(var(--c) * .2); transform: translate(-50%, -50%); border-radius: 50%; background: var(--ln); z-index: 1; }
.pt .st { position: absolute; inset: 6%; z-index: 2; }
.pt .hv { position: absolute; inset: 8%; z-index: 2; border-radius: 50%; opacity: 0; pointer-events: none; }
@media (hover: hover) {
  .gboard.can.t1 .pt.empty:hover .hv { opacity: .45; background: radial-gradient(circle at 32% 28%, var(--b1), var(--b2) 70%); }
  .gboard.can.t2 .pt.empty:hover .hv { opacity: .6; background: radial-gradient(circle at 32% 28%, var(--w1), var(--w2) 70%); }
}
.pt .tr { position: absolute; left: 50%; top: 50%; width: calc(var(--c) * .34); height: calc(var(--c) * .34); transform: translate(-50%, -50%); z-index: 3; border-radius: 2px; pointer-events: none; }
.pt .tr.b { background: rgba(20, 22, 26, .72); box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.pt .tr.w { background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.pt .hn { position: absolute; inset: 4%; z-index: 4; border: max(2px, calc(var(--c) * .08)) solid #19c37d; border-radius: 50%; pointer-events: none; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.18); opacity: .55; } }

/* Quân: dùng chung cho bàn, ô thẻ người chơi, ô xem thử. Màu lấy từ --b1/--b2 (đen) và --w1/--w2 (trắng) của kiểu quân. */
.st { display: block; border-radius: 50%; box-shadow: 0 calc(var(--c, 30px) * .05) calc(var(--c, 30px) * .09) rgba(0, 0, 0, .42), var(--st-ring, 0 0 0 0 transparent); }
.st.b { background: radial-gradient(circle at 32% 28%, var(--b1), var(--b2) 72%); }
.st.w { background: radial-gradient(circle at 32% 28%, var(--w1), var(--w2) 74%); }
.pt .st.drop { animation: drop .22s ease-out; }
@keyframes drop { from { transform: scale(1.4); opacity: .2; } to { transform: none; opacity: 1; } }
.pt .st.last::after { content: ''; position: absolute; inset: 35%; border-radius: 50%; background: #e5534b; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.pt .st.dead { opacity: .34; }
.pt .st.ghost { opacity: .55; }
.gboard.over .pt { cursor: default; }

/* ---------- mẫu bàn (GoCatalog.BOARDS): lớp .gb-<id> ---------- */
.gb-tre      { --wood: #e6c487; --wood-img: repeating-linear-gradient(90deg, rgba(150, 100, 30, .07) 0 3px, transparent 3px 11px); --frame: #b88a4a; --ln: rgba(70, 44, 12, .78); }
.gb-kaya     { --wood: #f1dba8; --wood-img: radial-gradient(ellipse at 30% 40%, rgba(190, 140, 60, .14) 0 24%, transparent 26%), radial-gradient(ellipse at 74% 70%, rgba(190, 140, 60, .12) 0 20%, transparent 22%); --frame: #c9a35a; --ln: rgba(60, 40, 10, .8); }
.gb-gu       { --wood: #8a4a2b; --wood-img: repeating-linear-gradient(95deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 9px); --frame: #4a2410; --ln: rgba(240, 206, 160, .82); }
.gb-giay     { --wood: #f6efdb; --wood-img: radial-gradient(circle at 20% 20%, rgba(150, 120, 60, .1), transparent 40%); --frame: #8b7a58; --ln: rgba(30, 30, 30, .78); }
.gb-da       { --wood: #93a6b3; --wood-img: linear-gradient(135deg, rgba(255, 255, 255, .22), transparent 45%, rgba(0, 0, 0, .1)); --frame: #4b5c68; --ln: rgba(20, 34, 44, .82); }
.gb-sonmai   { --wood: #a8221b; --wood-img: linear-gradient(160deg, rgba(255, 255, 255, .2), transparent 40%); --frame: #4a0f0b; --ln: rgba(244, 208, 120, .9); }
.gb-sen      { --wood: #e9f2df; --wood-img: radial-gradient(circle at 82% 82%, rgba(240, 130, 170, .28) 0 14%, transparent 15%), radial-gradient(circle at 14% 18%, rgba(100, 170, 120, .22) 0 12%, transparent 13%); --frame: #5a9a6a; --ln: rgba(52, 96, 62, .82); }
.gb-dem      { --wood: #1d2a4a; --wood-img: radial-gradient(circle at 70% 24%, rgba(255, 255, 255, .6) 0 1px, transparent 1.6px), radial-gradient(circle at 26% 72%, rgba(190, 210, 255, .5) 0 1px, transparent 1.6px); --frame: #0b1226; --ln: rgba(150, 180, 255, .78); }
.gb-hoangkim { --wood: #e6bf58; --wood-img: linear-gradient(135deg, rgba(255, 255, 255, .55), transparent 52%); --frame: #7a5200; --ln: rgba(88, 56, 0, .82); }

/* ---------- kiểu quân (GoCatalog.STONES): lớp .gs-<id> đặt màu hai bên ---------- */
.gs-da       { --b1: #6a6f7a; --b2: #0a0c10; --w1: #ffffff; --w2: #c9ced6; }
.gs-thuytinh { --b1: #5a86c8; --b2: #070e22; --w1: #ffffff; --w2: #a9d6ff; --st-ring: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.gs-voso     { --b1: #7a7684; --b2: #15141a; --w1: #fffaf2; --w2: #dfc7b8; }
.gs-gom      { --b1: #4d4040; --b2: #141010; --w1: #fffcf4; --w2: #e5d6ba; }
.gs-gom .st.w { --st-ring: inset 0 0 0 max(1.5px, calc(var(--c, 30px) * .06)) rgba(52, 104, 178, .75); }
.gs-ngoc     { --b1: #4f9a74; --b2: #0a2b1c; --w1: #f6fff9; --w2: #b3dcc4; }
.gs-dao      { --b1: #9a4a72; --b2: #2c0f20; --w1: #fff4f6; --w2: #f2a9bd; }
.gs-sao      { --b1: #384a86; --b2: #070a1c; --w1: #faf6ff; --w2: #b3a6ee; }
.gs-sao .st.b { background: radial-gradient(circle at 70% 30%, #fff 0 5%, transparent 7%), radial-gradient(circle at 30% 70%, #cfd8ff 0 4%, transparent 6%), radial-gradient(circle at 32% 28%, var(--b1), var(--b2) 72%); }
.gs-lua      { --b1: #ff9a40; --b2: #6e1200; --w1: #f6fdff; --w2: #78c8ff; }
.gs-vang     { --b1: #fbe27a; --b2: #8a5800; --w1: #ffffff; --w2: #9aa6b4; }

/* ---------- màn chơi: nền xanh rêu dịu mắt (body.go-play) ---------- */
body.mb-light.go-play { --mb-bg: #3b574d; --mb-line: #557666; --mb-txt: #f2f6f0; --mb-mut: #cbdacf; --mb-acc: #ffe9a8; --mb-hover: #486a5e; --mb-btn: #46665b; --mb-on: #4a6a5f; --txt: #f2f6f0; --muted: #cbdacf; --line: #557666;
  background: radial-gradient(ellipse at 50% 28%, #4f7367 0%, #3e5c52 52%, #32493f 100%) fixed !important; color: #f2f6f0; }
/* Dialogs stay white during play: put the light-theme colours back (the dark play colours made their text unreadable). */
body.mb-light.go-play .dialog { --mb-line: #e3e5e8; --mb-txt: #191b1d; --mb-mut: #606368; --mb-acc: #335fff; --mb-hover: #f2f4f5; --mb-btn: #fff; --mb-on: #eef2ff;
  --txt: #191b1d; --muted: #606368; --line: #e3e5e8; color: #191b1d; }
.gp { display: flex; flex-direction: column; min-height: calc(100dvh - 128px); max-width: 600px; margin: 0 auto; padding: 4px 0 10px; }
.gp .board-wrap { flex: 1; align-items: center; }
.gp-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; margin: 0 0 12px; }
.gp-p { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; background: rgba(255, 255, 255, .09); transition: box-shadow .2s, background .2s; min-width: 0; }
.gp-p.right { flex-direction: row; justify-content: flex-end; text-align: right; }
.gp-p.turn { background: rgba(255, 255, 255, .2); box-shadow: 0 0 0 2px #ffe08a; }
.gp-p .st { position: static; flex: none; width: 34px; height: 34px; --c: 34px; }
.gp-i { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gp-i small { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #cbdacf; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-i b { font-size: 18px; font-variant-numeric: tabular-nums; }
.gp-i em { font-style: normal; font-size: 12px; font-weight: 700; color: #e4eee4; }
.gp-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 4px; line-height: 1.15; }
.gp-mid small { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: #cbdacf; }
.gp-mid b { font-size: 26px; font-variant-numeric: tabular-nums; }
.gp-mid em { font-style: normal; font-size: 12px; font-weight: 800; color: #ffe9a8; }
.gp-status { margin: 12px auto 10px; padding: 7px 16px; width: fit-content; max-width: 100%; border-radius: 999px; background: rgba(0, 0, 0, .2); color: #fff6d6; font-size: 14px; font-weight: 800; letter-spacing: .4px; text-align: center; }
.gp-status.me { background: rgba(255, 224, 138, .22); color: #ffe9a8; }
.gp-tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 460px; margin: 0 auto; }
.gp-tools button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: #e9f1e8; font-size: 11px; font-weight: 700; }
.gp-tools button svg { box-sizing: content-box; width: 24px; height: 24px; padding: 13px; border-radius: 50%; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); fill: none; stroke: #f6f3e2; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gp-tools button u { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 9px; background: #ffe08a; color: #2f4a3f; font-size: 10px; font-weight: 900; text-decoration: none; line-height: 16px; text-align: center; }
.gp-tools button:disabled { opacity: .38; cursor: default; }
@media (hover: hover) { .gp-tools button:not(:disabled):hover svg { background: rgba(255, 255, 255, .24); } }
.gp-score { max-width: 460px; margin: 12px auto 0; padding: 12px 14px; border-radius: 16px; background: rgba(0, 0, 0, .22); text-align: center; }
.gp-score p { margin: 0 0 10px; font-weight: 700; line-height: 1.45; }
.gp-sbtn { display: flex; gap: 8px; justify-content: center; }
.gp-sbtn button { flex: 1; padding: 11px 10px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 800; }
.gp-sbtn button.pri { background: #ffe08a; border-color: #ffe08a; color: #2f4a3f; }
body.go-play .gboard { --size: min(100%, 560px, calc(100dvh - 330px)); }
@media (orientation: landscape) and (max-height: 520px) {
  body.go-play #scPlay:not(.hidden) .gp { display: grid; grid-template-columns: auto minmax(220px, 1fr); grid-template-areas: "board head" "board status" "board tools" "board score"; column-gap: 16px; align-content: start; max-width: none; }
  body.go-play .gp-head { grid-area: head; margin: 0 0 6px; } body.go-play .board-wrap { grid-area: board; } body.go-play .gp-status { grid-area: status; margin: 4px 0; }
  body.go-play .gp-tools { grid-area: tools; width: 100%; } body.go-play .gp-score { grid-area: score; width: 100%; }
  body.go-play .gboard { --size: calc(100dvh - 86px); min-width: 200px; }
}
.thinking::after { content: ' …'; animation: blink 1s steps(3) infinite; }
@keyframes blink { 50% { opacity: .3; } }
/* Bài tập sống chết: points outside the bài area are shaded and refuse stones; the key stone gets a dashed ring. */
.gboard.bai .pt.off { background: rgba(60, 40, 10, .2); cursor: default; }
.gboard.bai .pt.off .hv { display: none; }
.gboard.bai .pt.key .st::before { content: ''; position: absolute; inset: -9%; border-radius: 50%; border: max(2px, calc(var(--c) * .07)) dashed #e5374f; }
