/* หมากรุก and หมากฮอส (2026-11-22): the home card and the full-screen board layer.
   Text on the orange is Ink; taps are 44px or more; motion is transform/opacity only. */

/* ---------- the home card ---------- */
.cl-home .panel-b { display: grid; gap: 14px; }
.cl-hello { display: flex; align-items: center; gap: 14px; }
.cl-hello img { width: 88px; height: 88px; flex: none; object-fit: contain; }
.cl-hello p { margin: 0; font-weight: 700; line-height: 1.6; color: var(--text); }
.cl-mode { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--fill, rgba(17, 17, 17, .04)); }
.cl-mode h2, .cl-h { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 1.05rem/1.4 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; color: var(--text); }
.cl-mode h2 img { width: 26px; height: 26px; }
.cl-note { margin: 0; font-size: .88rem; color: var(--muted, #6b655c); }
.cl-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 64px; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--edge, rgba(17, 17, 17, .14)); background: var(--surface, #fffdf6); color: var(--text, #111111);
  font: 700 .95rem/1.2 Inter, "SukhumvitSet", system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
.cl-opt img { width: 20px; height: 20px; }
.cl-opt[aria-pressed="true"] { background: var(--pill, #111111); color: var(--pill-ink, #f3eee3); border-color: transparent; }
.cl-opt:disabled { opacity: .55; cursor: default; }
.cl-pdot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px #111111; }
.cl-pdot.w { background: #f6f1e6; }
.cl-pdot.b { background: #2a2a2a; box-shadow: 0 0 0 2px #f3eee3, 0 0 0 3px #111111; }
.cl-big {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--edge, rgba(17, 17, 17, .14)); background: var(--surface, #fffdf6); color: var(--text, #111111);
  font: 700 1.05rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; cursor: pointer; touch-action: manipulation; text-align: left;
}
.cl-big img { width: 28px; height: 28px; flex: none; }
.cl-big small { display: block; font: 500 .8rem/1.3 Inter, "SukhumvitSet", system-ui, sans-serif; color: var(--muted, #6b655c); }
.cl-big.go { background: #ff4b2b; color: #111111; border-color: transparent; box-shadow: 0 4px 0 var(--ink-sh, #111111); }
.cl-big.go small { color: #111111; }
.cl-big.go:active { transform: translateY(3px); box-shadow: none; }
.cl-big.ghost { background: transparent; }
.cl-big:disabled { opacity: .55; cursor: default; }
.cl-name { display: flex; align-items: center; gap: 8px; }
.cl-name img { width: 24px; height: 24px; flex: none; }
.cl-name input, .cl-join input { flex: 1; min-height: 48px; min-width: 0; }
.cl-join { display: flex; gap: 8px; }
.cl-join input { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; }
.cl-join .cl-big { width: auto; flex: none; }
.cl-rules-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; color: var(--accent-text, #c22c0e); text-decoration: none; }
.cl-rules-link img { width: 24px; height: 24px; }

/* ---------- the board layer ---------- */
html.cl-on, html.cl-on body { overflow: hidden; }
.cl-play {
  position: fixed; inset: 0; z-index: 2147482000; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 40%, #fbf7ef 0%, #ece4d4 72%, #e2d8c4 100%);
  color: #111111; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
html[data-theme="dark"] .cl-play { background: radial-gradient(120% 80% at 50% 40%, #2a2622 0%, #181614 72%, #111111 100%); color: #f3eee3; }
.cl-play[hidden] { display: none; }
.cl-stage { position: absolute; inset: 0; }
.cl-stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.cl-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
.cl-top > span { display: flex; gap: 8px; }
.cl-ib {
  width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; pointer-events: auto; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: rgba(255, 253, 246, .88); color: #111111; box-shadow: 0 2px 0 rgba(17, 17, 17, .18);
  font: 800 .85rem/1 Inter, system-ui, sans-serif;
}
html[data-theme="dark"] .cl-ib { background: rgba(40, 36, 32, .92); color: #f3eee3; box-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.cl-ib[hidden] { display: none; }
.cl-ib svg { width: 24px; height: 24px; }
.cl-ib img { width: 28px; height: 28px; pointer-events: none; }
.cl-ib[aria-pressed="true"] { background: #ff4b2b; color: #111111; }
.cl-ib:focus-visible, .cl-btn:focus-visible, .cl-big:focus-visible, .cl-opt:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }

/* the players: the one across the table on top, the one at the phone below */
.cl-side { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; display: flex; justify-content: center; padding: 0 12px; }
.cl-side.t { top: calc(max(10px, env(safe-area-inset-top)) + 54px); }
.cl-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 4px; border-radius: 999px;
  background: rgba(255, 253, 246, .9); color: #111111; box-shadow: 0 2px 0 rgba(17, 17, 17, .16);
  font: 700 .9rem/1.15 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; font-variant-numeric: tabular-nums;
  transition: box-shadow .2s, transform .2s;
}
html[data-theme="dark"] .cl-chip { background: rgba(40, 36, 32, .92); color: #f3eee3; }
.cl-chip.on { box-shadow: 0 0 0 3px #ff4b2b, 0 2px 0 rgba(17, 17, 17, .16); }
.cl-chip > img, .cl-chip > .cl-pdot { width: 34px; height: 34px; border-radius: 50%; background-color: #fffdf6; }
.cl-chip > .cl-pdot { width: 26px; height: 26px; margin: 4px; }
.cl-chip > .cl-pdot.b { background-color: #2a2a2a; }
.cl-cn { display: grid; }
.cl-cn small { font: 600 .72rem/1.2 Inter, "SukhumvitSet", system-ui, sans-serif; opacity: .7; }
.cl-tk { display: inline-flex; align-items: center; gap: 2px; font-size: .82rem; }
.cl-tk img { width: 18px; height: 18px; }
.cl-clock { padding: 2px 8px; border-radius: 999px; background: #111111; color: #f3eee3; font-size: .85rem; }
.cl-clock.low { background: #ff4b2b; color: #111111; }

.cl-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none;
  display: grid; justify-items: center; gap: 8px;
  padding: 0 max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
.cl-status { margin: 0; min-height: 1.4em; padding: 4px 14px; border-radius: 999px; background: rgba(17, 17, 17, .78); color: #f3eee3; font-weight: 700; font-size: .92rem; text-align: center; }
.cl-status:empty { visibility: hidden; }
.cl-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; pointer-events: auto; }
.cl-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px 6px 8px; border-radius: 999px; border: 0;
  background: rgba(255, 253, 246, .92); color: #111111; box-shadow: 0 2px 0 rgba(17, 17, 17, .18);
  font: 700 .9rem/1.2 Inter, "SukhumvitSet", system-ui, sans-serif; cursor: pointer; touch-action: manipulation;
}
html[data-theme="dark"] .cl-btn { background: rgba(40, 36, 32, .94); color: #f3eee3; }
.cl-btn img { width: 24px; height: 24px; }
.cl-btn.go { background: #ff4b2b; color: #111111; }
.cl-btn.warn { background: #111111; color: #f3eee3; }
.cl-btn:disabled { opacity: .45; cursor: default; }

.cl-toast {
  position: absolute; left: 50%; top: 42%; z-index: 4; margin: 0; transform: translate(-50%, -50%); max-width: 86vw;
  padding: 10px 18px; border-radius: 999px; background: #111111; color: #f3eee3; font-weight: 700; pointer-events: none; text-align: center;
  animation: clIn .2s ease-out;
}
.cl-toast[hidden] { display: none; }
.cl-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 3;
  padding: 10px 18px; border-radius: 999px; background: rgba(255, 253, 246, .92); color: #111111; font-weight: 700; pointer-events: none; }
.cl-load[hidden] { display: none; }

/* the quick rules and the end card */
.cl-sheet, .cl-end { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: rgba(17, 17, 17, .42); }
.cl-sheet[hidden], .cl-end[hidden] { display: none; }
.cl-card {
  width: min(380px, 100%); max-height: 86vh; overflow: auto; padding: 22px; border-radius: 26px; text-align: center;
  background: var(--surface, #fffdf6); color: var(--text, #111111); box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  animation: clIn .25s ease-out;
}
.cl-card h2 { margin: 6px 0 2px; font: 700 1.6rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; }
.cl-why { margin: 0; font-weight: 700; color: var(--accent-text, #c22c0e); }
.cl-line { margin: 8px 0 0; color: var(--muted, #6b655c); }
.cl-endmali { width: 120px; height: 120px; object-fit: contain; }
.cl-endacts { display: grid; gap: 8px; margin-top: 16px; }
.cl-wait { margin: 0; font-weight: 700; }
.cl-card ul { margin: 12px 0 0; padding: 0; list-style: none; text-align: left; display: grid; gap: 8px; }
.cl-card li { padding: 10px 12px; border-radius: 14px; background: var(--fill, rgba(17, 17, 17, .05)); line-height: 1.5; }
.cl-card li b { display: block; }

@keyframes clIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.96); } to { opacity: 1; } }
.cl-card { animation-name: clCard; }
@keyframes clCard { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cl-toast, .cl-card { animation: none; } .cl-big.go:active { transform: none; } .cl-chip { transition: none; } }
