/* บันไดงู (2026-11-28): what classic.css (the board-game layer) doesn't already give.
   The layer is a grid: top bar, the players, the board (as big as fits), the die.
   Text on the orange is Ink; taps are 44px or more; motion is transform/opacity only. */

/* ---------- the home card ---------- */
.sn-names { display: grid; gap: 8px; }
.sn-names label { display: flex; align-items: center; gap: 10px; }
.sn-names input { flex: 1; min-width: 0; min-height: 46px; }
.sn-pc-mini {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid #111111; color: #111111; font: 700 .95rem/1 "Chakra Petch", Inter, system-ui, sans-serif;
}
.sn-pc-mini img { width: 26px; height: 26px; }
.sn-who { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sn-who li { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sn-set { border-radius: 18px; background: var(--fill, rgba(17, 17, 17, .04)); }
.sn-set summary {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; cursor: pointer; list-style: none;
  font: 700 1rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; color: var(--text);
}
.sn-set summary::-webkit-details-marker { display: none; }
.sn-set summary img { width: 24px; height: 24px; }
.sn-set summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.sn-set[open] summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.sn-set-b { display: grid; gap: 10px; padding: 0 14px 14px; }
.sn-set-b h3 { margin: 4px 0 0; font: 700 .92rem/1.4 Inter, "SukhumvitSet", system-ui, sans-serif; color: var(--text); }

/* ---------- the board layer ---------- */
.sn-grid {
  position: absolute; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.sn-play .cl-top { position: relative; }
.sn-players {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0 10px; list-style: none;
}
.sn-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 3px 12px 3px 3px; border-radius: 999px;
  background: rgba(255, 253, 246, .9); color: #111111; box-shadow: 0 2px 0 rgba(17, 17, 17, .16);
  font: 700 .86rem/1.1 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; font-variant-numeric: tabular-nums;
  transition: box-shadow .2s, opacity .2s; max-width: 46vw;
}
html[data-theme="dark"] .sn-chip { background: rgba(40, 36, 32, .92); color: #f3eee3; }
.sn-chip.on { box-shadow: inset 0 0 0 3px #ff4b2b, 0 2px 0 rgba(17, 17, 17, .16); }
.sn-chip .sn-pc-mini { width: 32px; height: 32px; }
.sn-chip .sn-cn { display: grid; min-width: 0; }
.sn-chip .sn-cn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-chip .sn-cn small { font: 600 .72rem/1.2 Inter, "SukhumvitSet", system-ui, sans-serif; opacity: .75; }
/* four players on a phone: one row of narrow chips, so the board keeps its room */
@media (max-width: 520px) {
  .sn-players.n4 { flex-wrap: nowrap; gap: 4px; padding: 0 6px; }
  .sn-players.n4 .sn-chip { flex: 1 1 0; min-width: 0; max-width: none; gap: 4px; padding-right: 6px; font-size: .8rem; }
  .sn-players.n4 .sn-chip .sn-pc-mini { width: 26px; height: 26px; border-width: 2px; font-size: .8rem; }
  .sn-players.n4 .sn-chip .sn-pc-mini img { width: 20px; height: 20px; }
  .sn-players.n4 .sn-chip .sn-cn small { font-size: .66rem; white-space: nowrap; }
}

.sn-mid { position: relative; min-height: 0; display: grid; place-items: center; padding: 8px 8px 6px; }
.sn-box { position: relative; width: 300px; height: 300px; }
.sn-svg, .sn-svg svg { display: block; width: 100%; height: 100%; }
html[data-theme="dark"] .sn-box { --sn-a: #2d2925; --sn-b: #24201d; --sn-num: #a59f95; }
.sn-svg .sn-sq.hit { animation: snHit .5s ease-out; }
@keyframes snHit { 0% { opacity: .35; } 100% { opacity: 1; } }

/* the pieces: one element each, moved by transform from the top left of the board */
.sn-pcs { position: absolute; inset: 0; pointer-events: none; }
.sn-pc {
  position: absolute; left: 0; top: 0; display: grid; place-items: center; border-radius: 50%;
  border: 3px solid #111111; color: #111111; box-shadow: 0 3px 0 var(--ink-sh, #111111);
  font: 700 1rem/1 "Chakra Petch", Inter, system-ui, sans-serif; will-change: transform;
}
.sn-pc img { width: 76%; height: 76%; }
.sn-pc.on { z-index: 2; }
.sn-pc.on::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px dashed #111111; animation: snSpin 6s linear infinite; }
html[data-theme="dark"] .sn-pc.on::after { border-color: #f3eee3; }
@keyframes snSpin { to { transform: rotate(360deg); } }

/* the die: the one big button */
.sn-bottom { display: grid; justify-items: center; gap: 8px; padding: 0 12px; }
.sn-status { max-width: 92vw; }
.sn-die {
  display: inline-flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 26px 8px 10px; border-radius: 999px; border: 0;
  background: #ff4b2b; color: #111111; box-shadow: 0 5px 0 var(--ink-sh, #111111); cursor: pointer; touch-action: manipulation;
  font: 700 1.3rem/1 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
}
.sn-die:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink-sh, #111111); }
.sn-die:disabled { background: rgba(255, 253, 246, .92); box-shadow: 0 2px 0 rgba(17, 17, 17, .18); cursor: default; }
html[data-theme="dark"] .sn-die:disabled { background: rgba(40, 36, 32, .94); color: #f3eee3; }
.sn-die:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.sn-face { display: block; width: 48px; height: 48px; }
.sn-face svg { display: block; width: 100%; height: 100%; }
.sn-face.spin { animation: snRoll .46s ease-out; }
.sn-play.fast .sn-face.spin { animation-duration: .2s; }
@keyframes snRoll { 0% { transform: rotate(-30deg) scale(.8); } 60% { transform: rotate(20deg) scale(1.12); } 100% { transform: none; } }

.sn-toast { top: 46%; }
.cl-rl li span { display: block; }

/* the end card's finishing order */
.sn-rank { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; text-align: left; }
.sn-rank li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--fill, rgba(17, 17, 17, .05)); }
.sn-rank li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-rank li small { color: var(--muted, #6b655c); font-variant-numeric: tabular-nums; }
.sn-rank li:first-child { background: #ff4b2b; color: #111111; }
.sn-rank li:first-child small { color: #111111; }

@media (prefers-reduced-motion: reduce) {
  .sn-face.spin, .sn-pc.on::after, .sn-svg .sn-sq.hit { animation: none; }
  .sn-die:active:not(:disabled) { transform: none; }
  .sn-chip, .sn-set summary::after { transition: none; }
}

/* short phones: a smaller Mali on the end card so its buttons fit */
@media (max-height: 700px) {
  .sn-play .cl-endmali { width: 76px; height: 76px; }
  .sn-play .cl-card { padding: 16px; }
  .sn-rank li { padding: 6px 10px; }
}
