/* Mancala (scripts/games-mancala.mjs). Our own wooden board drawn in CSS: warm wood with grain, round pits,
   glossy seeds, the number of seeds written on every pit (never colour alone). Tokens from style.css.
   Wide screens: the classic sideways board (stores at the ends). Phones: the same board turned upright
   (store at top and bottom, the pits in two columns) so every pit is a big target. */
.mc { display: grid; gap: var(--s2); justify-items: center; }
.mc-score { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; align-items: center; font-weight: 700; }
.mc-who { padding: 4px 12px; border-radius: 999px; border: 2px solid transparent; }
.mc-who.turn { border-color: var(--ink); background: #fff3c4; }
.mc-whose { color: var(--muted); }
.mc-side { margin: 0; font-size: .95rem; color: var(--muted); font-weight: 700; }
.mc-board {
  --wood: #b5763c; --wood-2: #9a5f2c; --pit: #6e3f17;
  display: grid; gap: 10px; padding: 14px; width: min(100%, 860px); box-sizing: border-box;
  grid-template-columns: 1.15fr repeat(6, 1fr) 1.15fr; grid-template-rows: auto auto;
  border-radius: 48px; border: 3px solid #5a3412;
  background:
    repeating-linear-gradient(97deg, rgba(255,255,255,.06) 0 3px, rgba(0,0,0,.05) 3px 7px, rgba(255,255,255,0) 7px 15px),
    radial-gradient(ellipse at 30% 20%, #cf9356 0%, var(--wood) 45%, var(--wood-2) 100%);
  box-shadow: 0 6px 0 #5a3412, 0 10px 24px rgba(60, 30, 5, .25);
}
.mc-pit, .mc-store { position: relative; box-sizing: border-box; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #8a5426 0%, var(--pit) 70%); box-shadow: inset 0 6px 10px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.25); }
.mc-pit { all: unset; -webkit-tap-highlight-color: transparent; position: relative; box-sizing: border-box; border-radius: 50%; aspect-ratio: 1; cursor: pointer; grid-column: var(--c); grid-row: var(--r);
  background: radial-gradient(circle at 50% 35%, #8a5426 0%, var(--pit) 70%); box-shadow: inset 0 6px 10px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.25); border: 3px solid transparent; }
.mc-store { grid-row: 1 / 3; border-radius: 999px; min-height: 120px; }
.mc-s1 { grid-column: 1; }
.mc-s0 { grid-column: 8; }
.mc-pit[aria-disabled="true"] { cursor: default; }
.mc-turn:not([aria-disabled="true"]) { border-color: #ffe9a8; }
.mc-turn:not([aria-disabled="true"]):hover { border-color: #fff; }
.mc-pit:focus-visible { outline: 4px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 8px var(--focus), inset 0 6px 10px rgba(0,0,0,.45); }
.mc-hint { border-color: #fff !important; border-style: dashed !important; }
.mc-hot { box-shadow: inset 0 6px 10px rgba(0,0,0,.45), 0 0 0 4px #ffe066; }
.mc-seeds { position: absolute; inset: 0; pointer-events: none; }
.mc-seeds i { position: absolute; width: 17%; aspect-ratio: 1; margin: -8.5% 0 0 -8.5%; border-radius: 50%; box-shadow: inset -2px -2px 3px rgba(0,0,0,.35), 0 1px 1px rgba(0,0,0,.4); }
.mc-store .mc-seeds i { width: 22%; margin: -11% 0 0 -11%; }
.mc-seeds .c0 { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #e2533f 40%); }
.mc-seeds .c1 { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #2f8f5b 40%); }
.mc-seeds .c2 { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #2c6fd1 40%); }
.mc-seeds .c3 { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #f2b632 40%); }
.mc-seeds .c4 { background: radial-gradient(circle at 35% 30%, #fff 0 12%, #8c5bd6 40%); }
.mc-n { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); min-width: 1.9em; padding: 1px 5px; box-sizing: border-box; border-radius: 999px; background: #fff8e6; color: var(--ink); border: 2px solid #5a3412; font: 800 .95rem/1.2 var(--font); text-align: center; }
.mc-store .mc-n { bottom: 8px; font-size: 1.2rem; }
.mc-rules { margin: var(--s2) auto 0; max-width: 40em; text-align: center; }
.mc-print { margin: var(--s2) auto 0; max-width: 40em; text-align: center; }
.mc-end { text-align: center; padding: 12px 16px; border-radius: var(--radius); background: var(--blue-soft, #e9f1ff); max-width: 36em; }
.mc-end-h { font-weight: 800; font-size: 1.15rem; margin: 0; }
.gm-done .mc-print { text-align: left; margin: 0 0 var(--s2); }

/* Phones: the board turned upright. Player 2 / computer store on top, yours at the bottom; your pits in the left
   column going down, theirs in the right column going up, so sowing still runs anticlockwise. */
@media (max-width: 600px) {
  .mc-board { grid-template-columns: 1fr 1fr; grid-template-rows: auto repeat(6, auto) auto; width: min(100%, 360px); border-radius: 40px; gap: 8px 14px; padding: 12px 16px; }
  .mc-pit { grid-column: var(--vc); grid-row: var(--vr); aspect-ratio: auto; height: 62px; border-radius: 999px; }
  .mc-pit .mc-seeds { left: 18%; right: 18%; }
  .mc-store { grid-row: auto; min-height: 66px; grid-column: 1 / 3; }
  .mc-s1 { grid-row: 1; }
  .mc-s0 { grid-row: 8; }
  .mc-store .mc-seeds { left: 25%; right: 25%; }
  .mc-n { bottom: auto; top: 50%; left: auto; right: -4px; transform: translateY(-50%); }
  .mc-store .mc-n { bottom: auto; right: 10px; }
}
.gm-big .mc-n { font-size: 1.25rem; }
.gm-big .mc-store .mc-n { font-size: 1.5rem; }
.gm-big .mc-score, .gm-big .mc-side { font-size: 1.2rem; }
@media (max-width: 600px) { .gm-big .mc-pit { height: 74px; } }
/* Big screen: high contrast, black board, white rings and yellow seeds. */
.gm-huge .mc-board { --wood: #111; --wood-2: #000; --pit: #222; background: #000; border-color: #fff; box-shadow: none; }
.gm-huge .mc-pit, .gm-huge .mc-store { background: #222; box-shadow: none; border: 3px solid #fff; }
.gm-huge .mc-seeds i { background: #ffd400 !important; box-shadow: none; }
.gm-huge .mc-n { background: #fff; color: #000; border-color: #000; font-size: 1.5rem; }
.gm-huge .mc-turn:not([aria-disabled="true"]) { border-color: #ffd400; border-width: 5px; }
@media (prefers-reduced-motion: no-preference) { .mc-hot { transition: box-shadow .12s; } }
