/* FunChat Chess — styles (uses the CSS variables defined by games.html) */
#chessMenuView.active, #chessGameView.active { display: flex; flex-direction: column; align-items: center; }
#chessMenuView { padding: 26px 16px 60px; }
#chessGameView { padding: 10px 10px 40px; }

.chx-wrap { width: 100%; max-width: 420px; margin: 0 auto; }
.chx-hero { text-align: center; margin-bottom: 18px; }
.chx-hero .ico { font-size: 3.2rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(168, 85, 247, .45)); }
.chx-hero h1 {
  font-family: 'Playfair Display', serif; font-style: italic; font-size: 2rem; margin: 6px 0 4px;
  background: linear-gradient(135deg, var(--lav), var(--rose), var(--gold)); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.chx-hero p { font-family: 'DM Mono', monospace; font-size: .6rem; letter-spacing: 1.4px; color: var(--muted); }
.chx-online { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-family: 'DM Mono', monospace; font-size: .56rem; color: var(--text2); }
.chx-online i { width: 7px; height: 7px; border-radius: 50%; background: var(--online); box-shadow: 0 0 8px var(--online); }

.chx-card { background: linear-gradient(160deg, var(--card), var(--card2)); border: 1px solid var(--b2); border-radius: 18px; padding: 16px; margin-bottom: 12px; box-shadow: 0 18px 44px rgba(0, 0, 0, .3); }
.chx-label { font-family: 'DM Mono', monospace; font-size: .54rem; letter-spacing: 1.5px; color: var(--muted); display: block; margin-bottom: 9px; }
.chx-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chx-chip {
  padding: 8px 12px; border-radius: 100px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .03);
  color: var(--text2); font-size: .74rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.chx-chip small { font-family: 'DM Mono', monospace; font-size: .5rem; color: var(--muted); margin-left: 4px; }
.chx-chip:hover { border-color: rgba(192, 132, 252, .4); }
.chx-chip.on { background: linear-gradient(135deg, var(--lav2), var(--rose2)); color: #fff; border-color: transparent; box-shadow: 0 4px 16px rgba(168, 85, 247, .32); }
.chx-chip.on small { color: rgba(255, 255, 255, .8); }

.chx-btn {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .04);
  color: var(--text); font-weight: 700; font-size: .86rem; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 12px;
  margin-bottom: 9px; transition: all .15s;
}
.chx-btn:hover { border-color: rgba(192, 132, 252, .4); transform: translateY(-1px); }
.chx-btn .e { font-size: 1.5rem; flex-shrink: 0; }
.chx-btn .t { flex: 1; min-width: 0; }
.chx-btn .t b { display: block; font-size: .86rem; }
.chx-btn .t span { display: block; font-family: 'DM Mono', monospace; font-size: .56rem; color: var(--muted); margin-top: 2px; font-weight: 400; }
.chx-btn.primary { background: linear-gradient(135deg, var(--lav2), var(--rose2)); border-color: transparent; box-shadow: 0 8px 24px rgba(168, 85, 247, .32); }
.chx-btn.primary .t span { color: rgba(255, 255, 255, .8); }
.chx-btn.small { width: auto; padding: 10px 16px; margin: 0; justify-content: center; font-size: .76rem; }
.chx-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.chx-row { display: flex; gap: 8px; }
.chx-input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .05);
  color: var(--text); font-family: 'DM Mono', monospace; font-size: .9rem; letter-spacing: 3px; text-transform: uppercase; outline: none;
}
.chx-input:focus { border-color: var(--lav2); }
.chx-back { display: block; margin: 8px auto 0; background: none; border: 1px solid var(--b2); border-radius: 10px; padding: 9px 18px; color: var(--muted); font-size: .72rem; cursor: pointer; }

.chx-lb { font-size: .74rem; }
.chx-lb div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--b2); color: var(--text2); }
.chx-lb div:last-child { border: 0; }
.chx-lb b { color: var(--gold); font-family: 'DM Mono', monospace; font-size: .66rem; }
.chx-empty { font-family: 'DM Mono', monospace; font-size: .6rem; color: var(--muted); text-align: center; padding: 6px 0; }

/* search / waiting panel */
.chx-wait { text-align: center; padding: 22px 10px; }
.chx-spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(192, 132, 252, .2); border-top-color: var(--lav); margin: 0 auto 14px; animation: chxspin 1s linear infinite; }
@keyframes chxspin { to { transform: rotate(360deg); } }
.chx-code { font-family: 'DM Mono', monospace; font-size: 2rem; letter-spacing: 8px; color: var(--gold); margin: 6px 0 12px; user-select: all; }

/* ── game screen ── */
.chx-game { width: 100%; max-width: 560px; margin: 0 auto; }
.chx-bar { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
.chx-av { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .72rem; color: #fff; flex-shrink: 0; }
.chx-who { flex: 1; min-width: 0; }
.chx-who b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chx-who .cap { font-size: .9rem; letter-spacing: -1px; color: var(--text2); min-height: 1.1em; line-height: 1.1; }
.chx-who .cap em { font-style: normal; font-family: 'DM Mono', monospace; font-size: .56rem; color: var(--online); margin-left: 4px; letter-spacing: 0; }
.chx-clock {
  font-family: 'DM Mono', monospace; font-weight: 700; font-size: 1.15rem; min-width: 74px; text-align: center; padding: 6px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); color: var(--text2); border: 1px solid transparent;
}
.chx-clock.run { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(192, 132, 252, .45); }
.chx-clock.low { color: #fff; background: var(--danger); animation: chxpulse 1s ease-in-out infinite; }
@keyframes chxpulse { 50% { opacity: .7; } }
.chx-clock.hide { display: none; }

.chx-board-box { position: relative; width: 100%; aspect-ratio: 1 / 1; }
.chx-board {
  position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 10px; overflow: hidden; box-shadow: 0 16px 44px rgba(0, 0, 0, .5); border: 2px solid rgba(192, 132, 252, .25);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.chx-sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chx-sq.l { background: #efe4f7; }
.chx-sq.d { background: #9a6fc4; }
.chx-sq.last::before { content: ''; position: absolute; inset: 0; background: rgba(251, 191, 36, .42); }
.chx-sq.sel::before { content: ''; position: absolute; inset: 0; background: rgba(45, 212, 191, .55); }
.chx-sq.chk::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(244, 63, 94, .95) 0%, rgba(244, 63, 94, .55) 45%, transparent 75%); }
.chx-sq .dot { position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 8, 30, .32); pointer-events: none; }
.chx-sq .ring { position: absolute; inset: 4%; border-radius: 50%; border: 4px solid rgba(20, 8, 30, .32); pointer-events: none; }
.chx-sq .coord { position: absolute; font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 700; pointer-events: none; opacity: .75; }
.chx-sq.l .coord { color: #9a6fc4; } .chx-sq.d .coord { color: #efe4f7; }
.chx-sq .coord.r { top: 2px; left: 3px; } .chx-sq .coord.f { bottom: 1px; right: 3px; }
.chx-sq.sel 
.chx-status { text-align: center; font-family: 'DM Mono', monospace; font-size: .64rem; letter-spacing: .6px; color: var(--text2); min-height: 20px; margin: 8px 0 4px; }
.chx-status.you { color: var(--online); } .chx-status.warn { color: var(--gold); } .chx-status.bad { color: var(--danger); }
.chx-moves { display: flex; gap: 8px; overflow-x: auto; white-space: nowrap; padding: 7px 8px; background: rgba(255, 255, 255, .04); border: 1px solid var(--b2); border-radius: 10px; font-family: 'DM Mono', monospace; font-size: .64rem; color: var(--text2); min-height: 32px; scrollbar-width: none; }
.chx-moves::-webkit-scrollbar { display: none; }
.chx-moves span.n { color: var(--muted); } .chx-moves span.cur { color: #fff; font-weight: 700; }
.chx-ctrl { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chx-ctrl .chx-btn { flex: 1; min-width: 96px; margin: 0; justify-content: center; padding: 11px 10px; font-size: .74rem; }
.chx-react { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.chx-react button { font-size: 1.1rem; padding: 5px 9px; border-radius: 100px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .04); cursor: pointer; }
.chx-bubble { position: absolute; left: 50%; top: 40%; z-index: 20; font-size: 2.6rem; transform: translate(-50%, 0); animation: chxfloat 1.8s ease-out forwards; pointer-events: none; }
@keyframes chxfloat { from { opacity: 1; transform: translate(-50%, 0) scale(.6); } 20% { transform: translate(-50%, -10px) scale(1.2); } to { opacity: 0; transform: translate(-50%, -80px) scale(1); } }

.chx-banner { margin: 6px 0; padding: 10px 12px; border-radius: 12px; font-size: .72rem; text-align: center; border: 1px solid var(--b2); background: rgba(251, 191, 36, .1); color: var(--gold); display: none; }
.chx-banner.show { display: block; }
.chx-banner .chx-row { justify-content: center; margin-top: 8px; }

/* promotion + game-over overlays */
.chx-ov { position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; background: rgba(10, 4, 16, .72); backdrop-filter: blur(3px); border-radius: 10px; }
.chx-ov.show { display: flex; }
.chx-promo { display: flex; gap: 8px; background: var(--card); padding: 12px; border-radius: 14px; border: 1px solid var(--b2); }
.chx-promo button { width: 64px; height: 64px; border-radius: 12px; border: 1px solid var(--b2); background: #efe4f7; cursor: pointer; font-size: 2.6rem; line-height: 1; }
.chx-promo button.b { background: #9a6fc4; }
.chx-over { text-align: center; background: var(--card); border: 1px solid var(--b2); border-radius: 20px; padding: 24px 22px; width: min(86%, 320px); animation: fdin .3s ease; }
.chx-over .big { font-size: 2.6rem; }
.chx-over h2 { font-size: 1.25rem; margin: 6px 0 2px; }
.chx-over p { font-family: 'DM Mono', monospace; font-size: .62rem; color: var(--muted); margin-bottom: 16px; }
.chx-over .chx-btn { justify-content: center; text-align: center; }

@media (max-width: 480px) { .chx-clock { font-size: 1rem; min-width: 64px; } }

/* ── two-player inputs, leaderboard highlight ── */
.chx-name {
  flex: 1; min-width: 0; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .05);
  color: var(--text); font-size: .82rem; outline: none;
}
.chx-name:focus { border-color: var(--lav2); }
.chx-lb div.me { background: rgba(168, 85, 247, .12); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.chx-lb em { font-style: normal; font-family: 'DM Mono', monospace; font-size: .48rem; padding: 1px 5px; border-radius: 5px; background: rgba(74, 222, 128, .18); color: var(--online); margin-left: 4px; }

/* ── in-game chat ── */
.chx-chat { margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--b2); background: linear-gradient(160deg, var(--card), var(--card2)); }
.chx-chat-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.chx-chat-h b { font-size: .8rem; }
.chx-chat-h span { font-family: 'DM Mono', monospace; font-size: .5rem; color: var(--muted); letter-spacing: .8px; }
.chx-chat-log { height: 132px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, .22); margin-bottom: 8px; scrollbar-width: thin; }
.chx-msg { max-width: 85%; align-self: flex-start; padding: 6px 10px; border-radius: 12px 12px 12px 3px; background: rgba(255, 255, 255, .08); font-size: .76rem; line-height: 1.35; word-break: break-word; }
.chx-msg b { display: block; font-size: .56rem; font-family: 'DM Mono', monospace; color: var(--lav); margin-bottom: 1px; letter-spacing: .5px; }
.chx-msg.mine { align-self: flex-end; border-radius: 12px 12px 3px 12px; background: linear-gradient(135deg, rgba(168, 85, 247, .55), rgba(255, 61, 122, .45)); }
.chx-msg.mine b { color: rgba(255, 255, 255, .8); }
.chx-quick { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; scrollbar-width: none; }
.chx-quick::-webkit-scrollbar { display: none; }
.chx-quick button { flex-shrink: 0; padding: 6px 11px; border-radius: 100px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .05); color: var(--text2); font-size: .7rem; cursor: pointer; white-space: nowrap; }
.chx-quick button:hover { border-color: rgba(192, 132, 252, .45); color: #fff; }
.chx-chat-in { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .05); color: var(--text); font-size: .8rem; outline: none; }
.chx-chat-in:focus { border-color: var(--lav2); }
.chx-rules { margin: 8px 2px 0; font-family: 'DM Mono', monospace; font-size: .48rem; color: var(--muted); line-height: 1.6; }


/* ═════════ Graphics upgrade ═════════ */
/* Piece artwork: "cburnett" set by Colin M.L. Burnett (Wikimedia Commons), used under its BSD licence option. */
.chx-pc { position: relative; z-index: 2; width: 100%; height: 100%; background: center / 90% no-repeat; pointer-events: none; filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, .38)); will-change: transform; }
.chx-pc:not([class*=" w"]):not([class*=" b"]) { display: none; }
.chx-cp { display: inline-block; width: 17px; height: 17px; margin-right: -6px; background: center / contain no-repeat; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.chx-cp:last-of-type { margin-right: 4px; }
.chx-drag { position: fixed; z-index: 9999; pointer-events: none; background: center / 92% no-repeat; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .5)); transform: translate(-50%, -58%) scale(1.08); }
.chx-pc.wK,.chx-cp.wK,.chx-drag.wK{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath stroke-linejoin=%22miter%22 d=%22M22.5 11.63V6M20 8h5%22/%3E%3Cpath fill=%22%23fff%22 stroke-linecap=%22butt%22 stroke-linejoin=%22miter%22 d=%22M22.5 25s4.5-7.5 3-10.5c0 0-1-2.5-3-2.5s-3 2.5-3 2.5c-1.5 3 3 10.5 3 10.5%22/%3E%3Cpath fill=%22%23fff%22 d=%22M11.5 37c5.5 3.5 15.5 3.5 21 0v-7s9-4.5 6-10.5c-4-6.5-13.5-3.5-16 4V27v-3.5c-3.5-7.5-13-10.5-16-4-3 6 5 10 5 10z%22/%3E%3Cpath d=%22M11.5 30c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.wQ,.chx-cp.wQ,.chx-drag.wQ{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22%23fff%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath d=%22M8 12a2 2 0 1 1-4 0 2 2 0 1 1 4 0m16.5-4.5a2 2 0 1 1-4 0 2 2 0 1 1 4 0M41 12a2 2 0 1 1-4 0 2 2 0 1 1 4 0M16 8.5a2 2 0 1 1-4 0 2 2 0 1 1 4 0M33 9a2 2 0 1 1-4 0 2 2 0 1 1 4 0%22/%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 26c8.5-1.5 21-1.5 27 0l2-12-7 11V11l-5.5 13.5-3-15-3 15-5.5-14V25L7 14z%22/%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 26c0 2 1.5 2 2.5 4 1 1.5 1 1 .5 3.5-1.5 1-1.5 2.5-1.5 2.5-1.5 1.5.5 2.5.5 2.5 6.5 1 16.5 1 23 0 0 0 1.5-1 0-2.5 0 0 .5-1.5-1-2.5-.5-2.5-.5-2 .5-3.5 1-2 2.5-2 2.5-4-8.5-1.5-18.5-1.5-27 0z%22/%3E%3Cpath fill=%22none%22 d=%22M11.5 30c3.5-1 18.5-1 22 0M12 33.5c6-1 15-1 21 0%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.wR,.chx-cp.wR,.chx-drag.wR{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22%23fff%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 39h27v-3H9zm3-3v-4h21v4zm-1-22V9h4v2h5V9h5v2h5V9h4v5%22/%3E%3Cpath d=%22m34 14-3 3H14l-3-3%22/%3E%3Cpath stroke-linecap=%22butt%22 stroke-linejoin=%22miter%22 d=%22M31 17v12.5H14V17%22/%3E%3Cpath d=%22m31 29.5 1.5 2.5h-20l1.5-2.5%22/%3E%3Cpath fill=%22none%22 stroke-linejoin=%22miter%22 d=%22M11 14h23%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.wB,.chx-cp.wB,.chx-drag.wB{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cg fill=%22%23fff%22 stroke-linecap=%22butt%22%3E%3Cpath d=%22M9 36c3.39-.97 10.11.43 13.5-2 3.39 2.43 10.11 1.03 13.5 2 0 0 1.65.54 3 2-.68.97-1.65.99-3 .5-3.39-.97-10.11.46-13.5-1-3.39 1.46-10.11.03-13.5 1-1.35.49-2.32.47-3-.5 1.35-1.94 3-2 3-2z%22/%3E%3Cpath d=%22M15 32c2.5 2.5 12.5 2.5 15 0 .5-1.5 0-2 0-2 0-2.5-2.5-4-2.5-4 5.5-1.5 6-11.5-5-15.5-11 4-10.5 14-5 15.5 0 0-2.5 1.5-2.5 4 0 0-.5.5 0 2z%22/%3E%3Cpath d=%22M25 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 1 1 5 0z%22/%3E%3C/g%3E%3Cpath stroke-linejoin=%22miter%22 d=%22M17.5 26h10M15 30h15m-7.5-14.5v5M20 18h5%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.wN,.chx-cp.wN,.chx-drag.wN{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath fill=%22%23fff%22 d=%22M22 10c10.5 1 16.5 8 16 29H15c0-9 10-6.5 8-21%22/%3E%3Cpath fill=%22%23fff%22 d=%22M24 18c.38 2.91-5.55 7.37-8 9-3 2-2.82 4.34-5 4-1.042-.94 1.41-3.04 0-3-1 0 .19 1.23-1 2-1 0-4.003 1-4-4 0-2 6-12 6-12s1.89-1.9 2-3.5c-.73-.994-.5-2-.5-3 1-1 3 2.5 3 2.5h2s.78-1.992 2.5-3c1 0 1 3 1 3%22/%3E%3Cpath fill=%22%23000%22 d=%22M9.5 25.5a.5.5 0 1 1-1 0 .5.5 0 1 1 1 0m5.433-9.75a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.wP,.chx-cp.wP,.chx-drag.wP{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cpath fill=%22%23fff%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-width=%221.5%22 d=%22M22.5 9c-2.21 0-4 1.79-4 4 0 .89.29 1.71.78 2.38C17.33 16.5 16 18.59 16 21c0 2.03.94 3.84 2.41 5.03-3 1.06-7.41 5.55-7.41 13.47h23c0-7.92-4.41-12.41-7.41-13.47 1.47-1.19 2.41-3 2.41-5.03 0-2.41-1.33-4.5-3.28-5.62.49-.67.78-1.49.78-2.38 0-2.21-1.79-4-4-4z%22/%3E%3C/svg%3E");}
.chx-pc.bK,.chx-cp.bK,.chx-drag.bK{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath stroke-linejoin=%22miter%22 d=%22M22.5 11.6V6%22/%3E%3Cpath fill=%22%23000%22 stroke-linecap=%22butt%22 stroke-linejoin=%22miter%22 d=%22M22.5 25s4.5-7.5 3-10.5c0 0-1-2.5-3-2.5s-3 2.5-3 2.5c-1.5 3 3 10.5 3 10.5%22/%3E%3Cpath fill=%22%23000%22 d=%22M11.5 37a22.3 22.3 0 0 0 21 0v-7s9-4.5 6-10.5c-4-6.5-13.5-3.5-16 4V27v-3.5c-3.5-7.5-13-10.5-16-4-3 6 5 10 5 10z%22/%3E%3Cpath stroke-linejoin=%22miter%22 d=%22M20 8h5%22/%3E%3Cpath stroke=%22%23ececec%22 d=%22M32 29.5s8.5-4 6-9.7C34.1 14 25 18 22.5 24.6v2.1-2.1C20 18 9.9 14 7 19.9c-2.5 5.6 4.8 9 4.8 9%22/%3E%3Cpath stroke=%22%23ececec%22 d=%22M11.5 30c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0m-21 3.5c5.5-3 15.5-3 21 0%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.bQ,.chx-cp.bQ,.chx-drag.bQ{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cg stroke=%22none%22%3E%3Ccircle cx=%226%22 cy=%2212%22 r=%222.75%22/%3E%3Ccircle cx=%2214%22 cy=%229%22 r=%222.75%22/%3E%3Ccircle cx=%2222.5%22 cy=%228%22 r=%222.75%22/%3E%3Ccircle cx=%2231%22 cy=%229%22 r=%222.75%22/%3E%3Ccircle cx=%2239%22 cy=%2212%22 r=%222.75%22/%3E%3C/g%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 26c8.5-1.5 21-1.5 27 0l2.5-12.5L31 25l-.3-14.1-5.2 13.6-3-14.5-3 14.5-5.2-13.6L14 25 6.5 13.5z%22/%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 26c0 2 1.5 2 2.5 4 1 1.5 1 1 .5 3.5-1.5 1-1.5 2.5-1.5 2.5-1.5 1.5.5 2.5.5 2.5 6.5 1 16.5 1 23 0 0 0 1.5-1 0-2.5 0 0 .5-1.5-1-2.5-.5-2.5-.5-2 .5-3.5 1-2 2.5-2 2.5-4-8.5-1.5-18.5-1.5-27 0z%22/%3E%3Cpath fill=%22none%22 stroke-linecap=%22butt%22 d=%22M11 38.5a35 35 1 0 0 23 0%22/%3E%3Cpath fill=%22none%22 stroke=%22%23ececec%22 d=%22M11 29a35 35 1 0 1 23 0m-21.5 2.5h20m-21 3a35 35 1 0 0 22 0m-23 3a35 35 1 0 0 24 0%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.bR,.chx-cp.bR,.chx-drag.bR{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath stroke-linecap=%22butt%22 d=%22M9 39h27v-3H9zm3.5-7 1.5-2.5h17l1.5 2.5zm-.5 4v-4h21v4z%22/%3E%3Cpath stroke-linecap=%22butt%22 stroke-linejoin=%22miter%22 d=%22M14 29.5v-13h17v13z%22/%3E%3Cpath stroke-linecap=%22butt%22 d=%22M14 16.5 11 14h23l-3 2.5zM11 14V9h4v2h5V9h5v2h5V9h4v5z%22/%3E%3Cpath fill=%22none%22 stroke=%22%23ececec%22 stroke-linejoin=%22miter%22 stroke-width=%221%22 d=%22M12 35.5h21m-20-4h19m-18-2h17m-17-13h17M11 14h23%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.bB,.chx-cp.bB,.chx-drag.bB{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cg fill=%22%23000%22 stroke-linecap=%22butt%22%3E%3Cpath d=%22M9 36c3.4-1 10.1.4 13.5-2 3.4 2.4 10.1 1 13.5 2 0 0 1.6.5 3 2-.7 1-1.6 1-3 .5-3.4-1-10.1.5-13.5-1-3.4 1.5-10.1 0-13.5 1-1.4.5-2.3.5-3-.5 1.4-2 3-2 3-2z%22/%3E%3Cpath d=%22M15 32c2.5 2.5 12.5 2.5 15 0 .5-1.5 0-2 0-2 0-2.5-2.5-4-2.5-4 5.5-1.5 6-11.5-5-15.5-11 4-10.5 14-5 15.5 0 0-2.5 1.5-2.5 4 0 0-.5.5 0 2z%22/%3E%3Cpath d=%22M25 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 1 1 5 0z%22/%3E%3C/g%3E%3Cpath stroke=%22%23ececec%22 stroke-linejoin=%22miter%22 d=%22M17.5 26h10M15 30h15m-7.5-14.5v5M20 18h5%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.bN,.chx-cp.bN,.chx-drag.bN{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22 stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 stroke-width=%221.5%22%3E%3Cpath fill=%22%23000%22 d=%22M22 10c10.5 1 16.5 8 16 29H15c0-9 10-6.5 8-21%22/%3E%3Cpath fill=%22%23000%22 d=%22M24 18c.38 2.91-5.55 7.37-8 9-3 2-2.82 4.34-5 4-1.04-.94 1.41-3.04 0-3-1 0 .19 1.23-1 2-1 0-4 1-4-4 0-2 6-12 6-12s1.89-1.9 2-3.5c-.73-1-.5-2-.5-3 1-1 3 2.5 3 2.5h2s.78-2 2.5-3c1 0 1 3 1 3%22/%3E%3Cpath fill=%22%23ececec%22 stroke=%22%23ececec%22 d=%22M9.5 25.5a.5.5 0 1 1-1 0 .5.5 0 1 1 1 0m5.43-9.75a.5 1.5 30 1 1-.86-.5.5 1.5 30 1 1 .86.5%22/%3E%3Cpath fill=%22%23ececec%22 stroke=%22none%22 d=%22m24.55 10.4-.45 1.45.5.15c3.15 1 5.65 2.49 7.9 6.75S35.75 29.06 35.25 39l-.05.5h2.25l.05-.5c.5-10.06-.88-16.85-3.25-21.34s-5.79-6.64-9.19-7.16z%22/%3E%3C/g%3E%3C/svg%3E");}
.chx-pc.bP,.chx-cp.bP,.chx-drag.bP{background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2245%22 height=%2245%22 viewBox=%220 0 45 45%22%3E%3Cpath stroke=%22%23000%22 stroke-linecap=%22round%22 stroke-width=%221.5%22 d=%22M22.5 9a4 4 0 0 0-3.22 6.38 6.48 6.48 0 0 0-.87 10.65c-3 1.06-7.41 5.55-7.41 13.47h23c0-7.92-4.41-12.41-7.41-13.47a6.46 6.46 0 0 0-.87-10.65A4.01 4.01 0 0 0 22.5 9z%22/%3E%3C/svg%3E");}

/* board themes */
#chessGameView { --sq-l: #efe4f7; --sq-d: #9a6fc4; --sq-lc: #9a6fc4; --sq-dc: #efe4f7; --frame1: #3a2150; --frame2: #1d1029; }
#chessGameView[data-theme="walnut"] { --sq-l: #f0d9b5; --sq-d: #b58863; --sq-lc: #b58863; --sq-dc: #f0d9b5; --frame1: #4a3020; --frame2: #26170e; }
#chessGameView[data-theme="emerald"] { --sq-l: #eeeed2; --sq-d: #769656; --sq-lc: #769656; --sq-dc: #eeeed2; --frame1: #2d4a2a; --frame2: #162614; }
#chessGameView[data-theme="slate"] { --sq-l: #dfe4e8; --sq-d: #7f93a3; --sq-lc: #7f93a3; --sq-dc: #dfe4e8; --frame1: #2c3a46; --frame2: #151d24; }
.chx-sq.l { background: var(--sq-l); } .chx-sq.d { background: var(--sq-d); }
.chx-sq.l .coord { color: var(--sq-lc); } .chx-sq.d .coord { color: var(--sq-dc); }
.chx-sq::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(0, 0, 0, .07)); }
.chx-sq .coord { z-index: 3; }
.chx-sq .coord:empty { display: none; }
.chx-sq .mk { position: absolute; z-index: 3; pointer-events: none; }
.chx-sq .mk.dot { width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 8, 30, .30); box-shadow: 0 0 0 2px rgba(255, 255, 255, .10); }
.chx-sq .mk.ring { inset: 3%; border-radius: 50%; border: 5px solid rgba(20, 8, 30, .30); }
.chx-sq:hover .mk.dot { background: rgba(20, 8, 30, .5); transform: scale(1.25); transition: .1s; }
.chx-sq.drag-src .chx-pc { opacity: .25; }
.chx-sq.sel .chx-pc { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .45)); }
.chx-board-box { padding: 9px; border-radius: 18px; background: linear-gradient(145deg, var(--frame1), var(--frame2)); box-shadow: 0 22px 54px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 1px rgba(192, 132, 252, .22); box-sizing: border-box; }
#chessGameView .chx-board { inset: 9px; border: 0; border-radius: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .35); touch-action: none; }
#chessGameView .chx-ov { inset: 9px; border-radius: 8px; }
.chx-promo button .chx-pc { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.chx-promo button { padding: 3px; transition: transform .12s; } .chx-promo button:hover { transform: scale(1.08); }

/* whose turn it is */
.chx-bar { border-radius: 14px; padding: 7px 8px; transition: background .2s, box-shadow .2s; }
.chx-bar.turn { background: rgba(168, 85, 247, .13); box-shadow: inset 0 0 0 1px rgba(192, 132, 252, .35); }
.chx-bar.turn .chx-av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--lav2); }

/* menu: hero piece + board style swatches */
.chx-hero .ico .chx-pc { display: block; width: 74px; height: 74px; margin: 0 auto; filter: drop-shadow(0 8px 14px rgba(168, 85, 247, .55)); }
.chx-chip .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 7px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }

/* win celebration */
.chx-confetti { position: absolute; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; border-radius: 12px; }
.chx-confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: chxfall linear forwards; }
@keyframes chxfall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(520px) rotate(720deg); } }


/* ═════════ In-game customisation ═════════ */
.chx-sq.last::before { background: var(--hl, rgba(251, 191, 36, .45)) !important; }
.chx-pc { background-size: var(--psize, 90%); }
#chessGameView[data-coords="0"] .chx-sq .coord, #chxSheet[data-coords="0"] .coord { display: none; }
#chessGameView[data-hints="0"] .chx-sq .mk { display: none; }
.chx-tools { margin-top: 8px; }
.chx-tools .chx-btn { font-size: .72rem; }
.chx-sheet { position: fixed; inset: 0; z-index: 10050; display: none; }
.chx-sheet.show { display: block; }
.chx-sheet-bg { position: absolute; inset: 0; background: rgba(5, 2, 10, .62); backdrop-filter: blur(2px); }
.chx-sheet-card { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 480px); max-height: 86vh; overflow-y: auto; background: var(--card); border: 1px solid var(--b2); border-radius: 22px 22px 0 0; padding: 16px 16px 24px; box-shadow: 0 -20px 60px rgba(0, 0, 0, .55); animation: chxup .24s ease; color: var(--text); }
@keyframes chxup { from { transform: translate(-50%, 50px); opacity: 0; } }
.chx-sheet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chx-sheet-h b { font-size: 1rem; }
.chx-sheet-h button { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--text2); font-size: .9rem; cursor: pointer; }
.chx-sheet .chx-label { margin-top: 14px; }
.chx-sheet .chx-label em { font-style: normal; color: var(--lav); }
.chx-prev { display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .4); }
.chx-prev div { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.chx-prev .l { background: var(--sq-l); } .chx-prev .d { background: var(--sq-d); }
.chx-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chx-th { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 4px; border-radius: 12px; border: 1px solid var(--b2); background: rgba(255, 255, 255, .03); color: var(--text2); font-size: .66rem; font-weight: 600; cursor: pointer; }
.chx-th .mini { width: 34px; height: 34px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.chx-th.on { border-color: var(--lav2); background: rgba(168, 85, 247, .16); color: #fff; }
.chx-colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chx-colors label { display: flex; flex-direction: column; gap: 6px; font-size: .66rem; color: var(--text2); align-items: flex-start; }
.chx-colors input[type=color] { width: 100%; height: 38px; border: 1px solid var(--b2); border-radius: 10px; background: rgba(255, 255, 255, .05); padding: 3px; cursor: pointer; }
.chx-range { width: 100%; accent-color: var(--lav2); }
.chx-toggles { margin-top: 8px; }
.chx-tg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--b2); cursor: pointer; }
.chx-tg b { display: block; font-size: .8rem; } .chx-tg small { display: block; font-size: .62rem; color: var(--muted); margin-top: 2px; }
.chx-sw { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 44px; height: 26px; border-radius: 13px; background: rgba(255, 255, 255, .16); position: relative; cursor: pointer; transition: background .2s; }
.chx-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; }
.chx-sw:checked { background: var(--lav2); } .chx-sw:checked::after { left: 21px; }
