/* Pachisi. The board is a 19 x 19 grid and a container, so pawns and marks
   scale with it (cqw), as in Ur. The nests and home are placed by class;
   the arm spaces fill the rest in reading order. A space is ~19px on a
   390px phone, which is enough to see but not to aim at, so "Your pawns"
   above the board carries every move in buttons a thumb can hit. */
.pa { width: min(38rem, 100%); }

/* The four colours: a strong one for pawns and a pale one for their
   squares. Each pawn also has its own shape, so colour is never the only
   cue (red/green is the commonest confusion). */
.pa-k0 { --k: var(--x); --k-pale: #f1cdc8; --k-ink: #fff; }
.pa-k1 { --k: var(--o); --k-pale: #c6d8ec; --k-ink: #fff; }
.pa-k2 { --k: #e3b62b; --k-pale: #f5e5a9; --k-ink: var(--ink); }
.pa-k3 { --k: #2e7d4f; --k-pale: #c4e2cd; --k-ink: #fff; }

.pa-pawn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  box-sizing: border-box; width: 1.5rem; height: 1.5rem; font-size: 0.85rem; font-weight: 800; line-height: 1;
  color: var(--k-ink); background: var(--k); border-radius: 50%;
  box-shadow: inset 0 0 0 0.09em rgb(0 0 0 / 0.35), 0 0.06em 0.12em rgb(0 0 0 / 0.35);
}
.pa-pawn.pa-k1 { border-radius: 18%; }
.pa-pawn.pa-k2 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); box-shadow: none; }
.pa-pawn.pa-k3 { clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); box-shadow: none; }

/* The throw, what's left of it, Roll. */
.pa-dice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin: 0 0 0.6rem; }
.pa-thrown { display: flex; flex-direction: column; gap: 0.1rem; }
.pa-thrown-who { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.pa-thrown-dice { display: flex; gap: 0.2rem; }
/* Between rolls it is the last mover's throw, not the next one's. */
.pa-thrown.past .pa-thrown-dice { opacity: 0.5; }
.pa-thrown .pa-die { width: 2.6rem; height: 2.6rem; color: var(--k); }
.pa-thrown .pa-die.pa-k2 { color: #a37b07; }
.pa-left { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.pa-left-label { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.pa-amount {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; min-height: 2.4rem;
  padding: 0 0.4rem; box-sizing: border-box; border-radius: 8px; font: inherit; font-size: 1.1rem; font-weight: 700;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line);
}
.pa-amounts {
  display: inline-flex; gap: 0.2rem; padding: 0.15rem; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 2px solid var(--edge); border-radius: 10px;
}
.pa-amounts .pa-amount { border: 0; background: none; min-width: 2rem; min-height: 2rem; }
.pa-amounts:hover { background: #fff; }
.pa-amounts:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pa-amount.chosen { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Nothing can use it yet; it may once another pawn has moved, so it is
   dimmed, not struck out. */
.pa-amount.unusable { color: var(--ink-soft); opacity: 0.6; }
.pa-rollbtn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 2rem; font: inherit; font-size: 1.2rem; font-weight: 700;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; min-height: 3rem;
}
.pa-rollbtn .gn-icon { width: 1.4em; height: 1.4em; }
.pa-rollbtn:hover { filter: brightness(1.08); }
.pa-rollbtn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Your pawns: a button for each that can move, saying where it would go. */
.pa-mine { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin: 0 0 0.7rem; }
.pa-mypawn {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 0;
  padding: 0.35rem 0.2rem; border-radius: 8px; border: 1px solid var(--line); background: var(--paper);
  font: inherit; font-size: 0.8rem; line-height: 1.2; color: var(--ink-soft); text-align: center;
}
.pa-mypawn .pa-pawn { width: 1.7rem; height: 1.7rem; font-size: 0.95rem; }
button.pa-mypawn { cursor: pointer; color: var(--ink); border: 2px solid var(--good); box-shadow: 0 0 0 2px rgb(58 138 92 / 0.25); }
button.pa-mypawn:hover { background: #fff; }
button.pa-mypawn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pa-to { font-weight: 800; color: var(--good); }

/* The board. */
.pa-board {
  container-type: inline-size;
  display: grid; grid-template-columns: repeat(19, 1fr);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  user-select: none; -webkit-user-select: none; background: #e9dcbb;
}
.pa-at0 { grid-area: 12 / 12 / 20 / 20; }
.pa-at1 { grid-area: 1 / 12 / 9 / 20; }
.pa-at2 { grid-area: 1 / 1 / 9 / 9; }
.pa-at3 { grid-area: 12 / 1 / 20 / 9; }

.pa-nest {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5cqw;
  margin: 1.2cqw; min-width: 0; min-height: 0; overflow: hidden; border-radius: 3cqw;
  background: var(--k-pale); border: 0.5cqw solid var(--k); font: inherit; color: var(--ink); padding: 1cqw;
}
.pa-nest.unused { background: rgb(0 0 0 / 0.04); border-color: transparent; }
/* The nest carries its colour's shape, large, a shade darker than its
   ground, behind the name and the waiting pawns (Jason, 2026-10-08: "in
   the big square to have the player's shape, in a slightly darker
   shade, fill up most of the square"). The same shapes as the pawns. */
.pa-nest:not(.unused) { position: relative; isolation: isolate; }
.pa-nest:not(.unused)::before {
  content: ""; position: absolute; inset: 8%; z-index: -1;
  background: color-mix(in srgb, var(--k) 24%, var(--k-pale)); border-radius: 50%;
}
.pa-nest.pa-k1::before { border-radius: 18%; }
.pa-nest.pa-k2::before { inset: 3%; border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.pa-nest.pa-k3::before { border-radius: 0; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.pa-nest.turn { box-shadow: 0 0 0 1cqw var(--accent); }
.pa-nest-name {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(0.7rem, 3.4cqw, 1rem); font-weight: 700;
}
.pa-you { font-weight: 400; color: var(--ink-soft); }
.pa-nest-pawns { display: grid; grid-template-columns: repeat(2, auto); gap: 1.5cqw; min-height: 13cqw; align-content: center; }
.pa-nest .pa-pawn { width: 5.5cqw; height: 5.5cqw; font-size: 3.2cqw; }
button.pa-nest { cursor: pointer; animation: pa-glow 1.4s ease-in-out infinite; box-shadow: inset 0 0 0 1.2cqw var(--good); }
button.pa-nest.turn { box-shadow: inset 0 0 0 1.2cqw var(--good), 0 0 0 1cqw var(--accent); }
button.pa-nest:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.pa-home {
  grid-area: 9 / 9 / 12 / 12; position: relative; aspect-ratio: 1; min-width: 0;
  background: var(--paper);
}
.pa-home-side { position: absolute; inset: 0; background: var(--k-pale); }
/* Each colour's triangle points in from its own arm. */
.pa-home-side.pa-s0 { clip-path: polygon(0 100%, 100% 100%, 50% 50%); }
.pa-home-side.pa-s1 { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.pa-home-side.pa-s2 { clip-path: polygon(0 0, 100% 0, 50% 50%); }
.pa-home-side.pa-s3 { clip-path: polygon(0 0, 0 100%, 50% 50%); }
.pa-home-pawns { position: absolute; display: flex; gap: 0.3cqw; z-index: 1; }
.pa-home-pawns.pa-s0 { left: 50%; bottom: 0.8cqw; transform: translateX(-50%); }
.pa-home-pawns.pa-s2 { left: 50%; top: 0.8cqw; transform: translateX(-50%); }
.pa-home-pawns.pa-s1 { right: 0.8cqw; top: 50%; transform: translateY(-50%); flex-direction: column; }
.pa-home-pawns.pa-s3 { left: 0.8cqw; top: 50%; transform: translateY(-50%); flex-direction: column; }
.pa-home .pa-pawn { width: 2.4cqw; height: 2.4cqw; font-size: 0; }

.pa-sq {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 0.2cqw;
  aspect-ratio: 1; box-sizing: border-box; min-width: 0;
  margin: 0; padding: 0; border: 0; font: inherit; color: inherit; line-height: 1;
  background-color: #f6eedb; box-shadow: inset 0 0 0 0.12cqw #a28d62;
}
.pa-sq.safe { background-color: #d9c38f; }
/* A safe space's mark, under any pawn. */
.pa-sq.safe::after {
  content: ""; position: absolute; inset: 22%; border-radius: 50%;
  border: 0.35cqw solid rgb(90 70 30 / 0.45); pointer-events: none;
}
.pa-sq.row { background-color: var(--k-pale, #e6dcc4); }
.pa-sq.entry { background-color: color-mix(in srgb, var(--k) 45%, var(--k-pale)); }
.pa-sq.entry::after { border-color: var(--k); }
.pa-sq .pa-pawn { width: 4.1cqw; height: 4.1cqw; font-size: 2.6cqw; z-index: 1; }
.pa-sq.two .pa-pawn { width: 2.5cqw; height: 2.5cqw; font-size: 1.7cqw; }
.pa-sq.last { box-shadow: inset 0 0 0 0.12cqw #a28d62, inset 0 0 0 0.6cqw var(--accent); }
.pa-sq.target { box-shadow: inset 0 0 0 0.12cqw #a28d62, inset 0 0 0 0.5cqw var(--good); background-image: radial-gradient(circle, rgb(58 138 92 / 0.35) 0 25%, transparent 30%); }
.pa-sq.legal {
  cursor: pointer; box-shadow: inset 0 0 0 0.6cqw var(--good);
  animation: pa-glow 1.4s ease-in-out infinite;
}
button.pa-sq:hover { filter: brightness(1.1); }
button.pa-sq:focus-visible { outline: 3px solid var(--ink); outline-offset: -2px; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .pa-sq.legal, button.pa-nest { animation: none; } }
@keyframes pa-glow { 50% { filter: brightness(1.15); } }

.pa-key { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.pa-log {
  margin: 0.6rem 0 0; padding: 0.4rem 0.7rem; list-style: none; font-size: 0.85rem; line-height: 1.35;
  max-height: 11rem; overflow-y: auto;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.pa-log li:first-child { font-weight: 700; }
