.ck { max-width: 860px; margin: 0 auto; padding: 10px 8px 16px; user-select: none; color: #dfe9ff; }
.ck [hidden] { display: none !important; }
.ck-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.ck-opts { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #8aa3c4; }
.ck-opts select { background: #0b1328; color: #dfe9ff; border: 1px solid #1c2b4a; border-radius: 6px; padding: 5px 8px; font-size: 13px; margin-left: 4px; }
.ck-tools { display: flex; gap: 6px; }
.ck-btn { background: #0b1328; color: #dfe9ff; border: 1px solid #1c2b4a; border-radius: 8px; padding: 7px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
@media (hover: hover) { .ck-btn:hover:not(:disabled) { border-color: #55d6ff; } } .ck-btn:disabled { opacity: 0.4; cursor: default; }
.ck-btn:active:not(:disabled) { transform: translateY(1px); }
.ck-btn-primary { background: #ffd166; color: #1a1200; border-color: #ffd166; } @media (hover: hover) { .ck-btn-primary:hover:not(:disabled) { background: #ffe08a; border-color: #ffe08a; } }
.ck-main { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; }
.ck-boardwrap { width: 100%; max-width: 560px; margin: 0 auto; }
.ck-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; width: 100%; border: 2px solid #3d5a7a; border-radius: 6px; overflow: hidden; touch-action: none; position: relative; }
.ck-sq { position: relative; aspect-ratio: 1; min-width: 0; min-height: 0; }
.ck-sq.light { background: #c9d7e6; } .ck-sq.dark { background: #4d7099; }
.ck-sq.dark.last { background: #8f8a5c; }   /* solid tint: overlays turn muddy on blue */
.ck-sq.dark.sel { background: #3f9cc4; }
.ck-sq.hint { box-shadow: inset 0 0 0 4px #ffd166; }
.ck-sq .dot { position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(255,255,255,0.42); pointer-events: none; }
.ck-sq .num { position: absolute; left: 3px; top: 1px; font-size: 9px; font-weight: 700; color: #e6eef7; opacity: 0.5; pointer-events: none; font-variant-numeric: tabular-nums; }
.ck-sq:focus-visible { outline: none; box-shadow: inset 0 0 0 3px #55d6ff; z-index: 1; }
/* pieces: a stacked disc with a rim; kings carry a crown */
.ck-piece { position: absolute; inset: 11%; border-radius: 50%; cursor: grab; display: grid; place-items: center; }
.ck-piece.red { background: radial-gradient(circle at 50% 42%, #f0646b 0 38%, #c8323c 39% 56%, #e04c55 57% 64%, #a8222d 65%); box-shadow: 0 3px 0 #6e1219, 0 5px 8px rgba(0,0,0,0.35); }
.ck-piece.white { background: radial-gradient(circle at 50% 42%, #fffaf0 0 38%, #e2d6bd 39% 56%, #f6eedd 57% 64%, #cbbd9f 65%); box-shadow: 0 3px 0 #8e8065, 0 5px 8px rgba(0,0,0,0.35); }
.ck-piece svg { width: 56%; height: 56%; display: block; }
.ck-piece.red svg { fill: #ffd166; stroke: #7a1a20; } .ck-piece.white svg { fill: #f0b52c; stroke: #6b5a33; }
.ck-piece.crowned svg { animation: ck-crown .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes ck-crown { from { transform: scale(0); } }
.ck-sq.must .ck-piece { outline: 3px solid rgba(255,209,102,0.9); outline-offset: 2px; }
.ck-sq.taken .ck-piece { opacity: 0.35; }
.ck-piece.shake { animation: ck-shake .3s; }
@keyframes ck-shake { 25% { transform: translateX(-6%); } 75% { transform: translateX(6%); } }
.ck-board:active .ck-piece { cursor: grabbing; }
.ck-piece.dragging { opacity: 0.25; }
.ck-ghost { position: absolute; pointer-events: none; z-index: 5; width: 12.5%; height: 12.5%; }
.ck-ghost .ck-piece { inset: 6%; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5)); }
.ck-fade { position: absolute; pointer-events: none; z-index: 3; }
.ck-captured { min-height: 20px; display: flex; gap: 1px; flex-wrap: wrap; align-items: center; padding: 1px 2px; }   /* fixed floor: no jump on first capture */
.ck-captured i { width: 14px; height: 14px; border-radius: 50%; display: block; flex: none; margin-right: -3px; box-shadow: 0 0 0 1.5px #060b18; }
.ck-captured i.red { background: #d63c46; } .ck-captured i.white { background: #f2e9d6; }
.ck-captured b { font-size: 12px; color: #8aa3c4; margin-left: 9px; }
.ck-side { background: #0b1328; border: 1px solid #1c2b4a; border-radius: 10px; padding: 12px; min-height: 200px; }
.ck-status { font-weight: 700; font-size: 15px; margin: 0 0 10px; color: #fff; }
.ck-moves { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 28px 1fr 1fr; gap: 2px 6px; font-size: 13px; max-height: 320px; overflow: auto; font-variant-numeric: tabular-nums; }
.ck-moves li { display: contents; } .ck-moves .n { color: #8aa3c4; } .ck-moves span { padding: 1px 4px; border-radius: 3px; } .ck-moves span.cur { background: #1c2b4a; color: #fff; }
.ck-record { margin-top: 12px; font-size: 12px; color: #8aa3c4; }
.ck-overlay { position: fixed; inset: 0; background: rgba(2,5,14,0.78); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.ck-overlay:not([hidden]) .ck-dialog { animation: ck-pop .18s ease-out; }
@keyframes ck-pop { from { transform: scale(.94); opacity: 0; } }
.ck-dialog { background: #0b1328; border: 1px solid #244b6b; border-radius: 12px; padding: 22px; width: min(100%, 380px); text-align: center; }
.ck-dialog h3 { margin: 0 0 6px; color: #fff; font-size: 22px; } .ck-dialog p { margin: 0 0 14px; color: #8aa3c4; }
.ck-cancel { margin-top: 6px; }
.ck-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ck-thinking { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #55d6ff; margin-left: 6px; animation: ck-pulse .8s infinite alternate; }
@keyframes ck-pulse { to { opacity: 0.2; } }
@media (max-width: 700px) {   /* phones (kept last so it overrides the base rules): whose turn sits above the board, the move list becomes a strip below it */
  .ck-main { grid-template-columns: 1fr; gap: 6px; }
  .ck-side { display: contents; }
  .ck-status { order: -1; text-align: center; margin: 0; font-size: 15px; }
  .ck-moves:empty { display: none; }
  .ck-moves { order: 1; display: flex; gap: 2px 10px; overflow-x: auto; max-height: none; padding: 6px 2px; scrollbar-width: none; }
  .ck-moves::-webkit-scrollbar { display: none; }
  .ck-moves li { display: flex; gap: 4px; flex: none; }
  .ck-record { order: 2; text-align: center; margin: 0; }
}
/* full screen (.ck-fit, set by game.js inside the site's immersive stage): no page scrolling, board sized to fit */
.ck.ck-fit { max-width: none; height: 100%; margin: 0; padding: 6px 4px 8px; display: flex; flex-direction: column; overflow: hidden; }
.ck-fit .ck-top { flex: none; margin: 0 0 6px; gap: 6px; justify-content: center; }
.ck-fit .ck-opts { gap: 6px; font-size: 12px; justify-content: center; } .ck-fit .ck-opts select { padding: 4px 6px; font-size: 12.5px; }
.ck-fit .ck-btn { padding: 6px 10px; font-size: 12.5px; }
.ck-fit .ck-main { flex: 1 1 auto; min-height: 0; gap: 6px; align-items: stretch; }
.ck-fit .ck-boardwrap { min-width: 0; min-height: 0; max-width: none; width: auto; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ck-fit .ck-board, .ck-fit .ck-captured { width: var(--ck-bs); flex: none; }
.ck-fit .ck-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* portrait: status, board, move strip, record stacked */
.ck.ck-port { justify-content: center; }   /* controls and board travel together as one centred group */
.ck-port .ck-main { flex: 0 0 auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
.ck-port .ck-side { display: contents; }
.ck-port .ck-status { order: -1; text-align: center; margin: 0; font-size: 15px; }
.ck-port .ck-moves, .ck-port .ck-moves:empty { order: 1; display: flex; min-height: 24px; gap: 2px 10px; overflow-x: auto; max-height: none; padding: 2px; scrollbar-width: none; }
.ck-port .ck-moves li { display: flex; gap: 4px; flex: none; }
.ck-port .ck-record { order: 2; text-align: center; margin: 0; }
/* landscape: board on the left; controls, status and moves in a column beside it */
/* the grid is exactly board + panel, centred; the panel matches the board's height and scrolls its move list */
.ck.ck-land { display: grid; grid-template-columns: var(--ck-bs) 250px; grid-template-rows: auto minmax(0, 1fr); gap: 6px 14px; padding: 6px; height: auto; flex: 0 0 auto; margin: auto; justify-content: center; }
.ck-land .ck-main { display: contents; }
.ck-land .ck-boardwrap { grid-column: 1; grid-row: 1 / -1; }
.ck-land .ck-top { grid-column: 2; grid-row: 1; margin: 0; flex-direction: column; align-items: stretch; }
.ck-land .ck-opts { flex-direction: column; gap: 4px; }
.ck-land .ck-opts label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ck-land .ck-opts select { width: 62%; margin: 0; }
.ck-land .ck-tools { flex-wrap: wrap; } .ck-land .ck-tools .ck-btn { flex: 1 1 auto; }
.ck-land .ck-side { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; height: 0; min-height: 100%; padding: 10px; overflow: hidden; }
.ck-land .ck-status { order: 0; text-align: left; margin: 0 0 8px; }
.ck-land .ck-moves { display: grid; flex: 1 1 auto; min-height: 0; max-height: none; align-content: start; }
.ck-land .ck-moves:empty { display: grid; }
.ck-land .ck-record { margin: 8px 0 0; text-align: left; }
.ck-fit .ck-captured { flex-wrap: nowrap; overflow: hidden; height: 20px; }
.ck-fit .ck-captured i { width: min(14px, calc(var(--ck-bs) / 26)); height: min(14px, calc(var(--ck-bs) / 26)); }
/* landscape full screen keeps the three-column move table even below the phone breakpoint */
.ck-land .ck-moves li { display: contents; }
.ck-moves span { white-space: nowrap; }
/* touch: controls at least 40px tall */
@media (pointer: coarse) {
  .ck-btn, .ck-opts select { min-height: 40px; }
  .ck-fit .ck-btn, .ck-fit .ck-opts select { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .ck-thinking, .ck-overlay:not([hidden]) .ck-dialog { animation: none; }
}
@media (prefers-reduced-motion: reduce) { .ck-piece.crowned svg, .ck-piece.shake { animation: none; } }
.ck-board { container-type: inline-size; } .ck-sq .num { font-size: clamp(9px, 1.9cqw, 13px); }   /* labels grow with the board */
