
.game-shell .play .boxes-room {
  --boxes-paper:#f7f4ee;
  --boxes-ink:#26344c;
  --boxes-dot:#5b6780;
  --boxes-stroke:#3b4c69;
  --boxes-a:#996016;
  --boxes-b:#2d6668;
  --boxes-a-fill:#f6e8bb;
  --boxes-b-fill:#d7ebe6;
  color:var(--boxes-ink);
  text-align:left;
  margin:0 auto;
  max-width:1120px;
}
.boxes-desk {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(240px,.7fr);
  gap:clamp(1rem,4.5vw,4.25rem);
  align-items:center;
}
.boxes-field {
  --node:clamp(27px,4vw,40px);
  display:grid;
  grid-template-columns:var(--node) repeat(var(--columns),minmax(0,1fr) var(--node));
  grid-template-rows:var(--node) repeat(var(--rows),minmax(0,1fr) var(--node));
  width:min(100%,530px);
  aspect-ratio:calc((var(--columns) + 1) / (var(--rows) + 1));
  padding:clamp(.25rem,1vw,.95rem);
  border:1px solid #c6c7bf;
  box-shadow:0 8px 22px #17264922;
  border-radius:5px;
  background:
    repeating-linear-gradient(0deg,#294e6020,#294e6020 1px,transparent 1px,transparent 16px),
    repeating-linear-gradient(90deg,#294e6020,#294e6020 1px,transparent 1px,transparent 16px),
    var(--boxes-paper);
  overflow:hidden;
}
.box-dot {
  position:relative;
  align-self:center;
  justify-self:center;
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--boxes-dot);
  z-index:2;
  pointer-events:none;
}
.box-edge {
  display:grid;
  place-items:center;
  position:relative;
  z-index:1;
  min-width:0;
  min-height:0;
  padding:0;
  border:0;
  appearance:none;
  background:transparent;
  box-shadow:none;
  border-radius:4px;
  cursor:pointer;
  overflow:visible;
}
.box-edge[role=img] {cursor:default}
.box-edge:disabled {opacity:1;cursor:default}
.box-edge::before {
  content:"";
  position:absolute;
  width:calc(100% + var(--node));
  height:3px;
  background:repeating-linear-gradient(90deg,#8090a6 0 3px,#8090a624 3px 7px);
  opacity:.6;
  border-radius:4px;
  pointer-events:none;
}
.box-edge[data-kind=v]::before {
  height:calc(100% + var(--node));
  width:3px;
  background:repeating-linear-gradient(0deg,#8090a6 0 3px,#8090a624 3px 7px);
}
.box-edge[data-box-used=true]::before {background:var(--boxes-stroke);opacity:1}
.box-edge[data-box-last=true]::before {background:#9c6318;box-shadow:0 0 0 2px #e5c789}
.box-edge[data-box-last=true][data-kind=h]::before {height:4px}
.box-edge[data-box-last=true][data-kind=v]::before {width:4px}
button.box-edge:not(:disabled):is(:hover,:focus-visible) {background:#eadcb28c;outline:2px solid #87662c;outline-offset:-2px}
button.box-edge:not(:disabled):is(:hover,:focus-visible)::before {background:#795a23;opacity:1}
.box-cell {
  display:grid;
  place-items:center;
  isolation:isolate;
  position:relative;
  font-size:clamp(.65rem,1.7vw,.9rem);
  color:#566078;
  line-height:1;
  pointer-events:none;
}
.box-cell>span {align-self:end;margin-bottom:5px}
.box-cell[data-box-owner=empty]>span {align-self:center}
.box-cell strong {font-size:clamp(1.25rem,4vw,2.5rem)}
.box-cell[data-box-owner="0"] {color:var(--boxes-a)}
.box-cell[data-box-owner="1"] {color:var(--boxes-b)}
.box-cell[data-box-owner]::before {
  content:"";
  position:absolute;
  inset:calc(var(--node) / -2 + 5px);
  z-index:-1;
  border-radius:4px;
}
.box-cell[data-box-owner="0"]::before {background:repeating-linear-gradient(-18deg,#f9edc9 0 3px,var(--boxes-a-fill) 3px 7px)}
.box-cell[data-box-owner="1"]::before {background:repeating-linear-gradient(-18deg,#e5f0e9 0 3px,var(--boxes-b-fill) 3px 7px)}
.boxes-room[data-box-phase=playing] .box-cell[data-box-new=true] strong {animation:box-ink .22s ease-out both}
@keyframes box-ink {from{opacity:.4;transform:scale(.84)}to{opacity:1;transform:none}}
.boxes-side {min-width:0}
.game-shell .play .boxes-room h2,.game-shell .play .boxes-room h3,.game-shell .play .boxes-room p {text-align:left;max-width:none;margin:0 0 .6rem}
.game-shell .play .boxes-room h2 {font-size:clamp(1.45rem,3vw,2.55rem);line-height:1.13}
.game-shell .play .boxes-room h3 {font-size:1rem}
.game-shell .play .boxes-room .boxes-progress {font-size:.84rem;font-weight:700;color:#5b687c}
.boxes-scores {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:.65rem;
  margin:.9rem 0;
}
.boxes-scores>div {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:.6rem;
  align-items:baseline;
  padding:.55rem .75rem;
  border-left:4px solid var(--boxes-a);
  background:#f5ead4;
}
.boxes-scores>div[data-box-team="1"] {border-color:var(--boxes-b);background:#e3efeb}
.boxes-scores dd {margin:0;font-size:1.35rem;font-weight:800;font-variant-numeric:tabular-nums}
.boxes-scores dt {font-size:.84rem;overflow-wrap:anywhere}
.boxes-scores>div[data-box-active=true] dt {font-weight:750}
.game-shell .play .boxes-room .boxes-last-receipt {padding:.65rem 0;border-bottom:1px solid #d4d9da;font-size:.92rem;line-height:1.5}
.boxes-moves,.boxes-full-log {margin:1rem 0 0}
.boxes-full-log summary {min-height:44px;padding:.54rem 0;cursor:pointer;font-weight:650;color:#425477}
.boxes-ledger {margin:.3rem 0 .7rem;padding-inline-start:1.35rem;color:#43506b}
.boxes-ledger li {padding:.2rem 0;font-size:.88rem}
.boxes-ledger li b {margin-left:.45em;color:#8b5718}
.boxes-mini-team {
  display:inline-grid;
  place-items:center;
  width:1.5rem;height:1.5rem;
  margin-inline-end:.45rem;
  border-radius:50%;
  color:#fff;font-weight:750;
  background:var(--boxes-a);
}
.boxes-mini-team[data-box-team="1"] {background:var(--boxes-b)}
.game-shell .play .boxes-room .actions {justify-content:flex-start;margin:.75rem 0 0;gap:.5rem}
.game-shell .play .boxes-room .actions button {min-height:44px;overflow-wrap:anywhere}
.game-shell.wide .play .boxes-room {width:min(100%,1120px)}
@media(min-width:760px) and (max-height:790px) {
  .game-shell.wide .play .boxes-field {width:min(100%,calc(100dvh - 138px))}
}
@media(max-width:900px) {
  .boxes-desk {grid-template-columns:1fr;gap:1.2rem}
  .boxes-field {width:min(100%,520px);margin:0 auto}
}
@media(prefers-reduced-motion:reduce) {
  .boxes-room .box-cell strong {animation:none!important}
}

.boxes-example {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:clamp(.6rem,3vw,1.35rem);
  margin:1rem 0;
}
.boxes-example figure {margin:0;min-width:0}
.boxes-example-grid {
  display:grid;
  width:min(100%,10rem);
  aspect-ratio:1;
  grid-template-columns:1fr repeat(3,3fr 1fr);
  grid-template-rows:1fr repeat(3,3fr 1fr);
  place-items:center;
  border:1px solid #d6d4c8;
  border-radius:5px;
  padding:6px;
  background:#f7f4ed;
}
.boxes-example-grid .dot {
  width:5px;height:5px;border-radius:100%;z-index:2;background:#515e75;
}
.boxes-example-grid .line {
  position:relative;
  z-index:1;
  border-radius:4px;
  background:#54637c;
}
.boxes-example-grid .horizontal {width:133%;height:3px}
.boxes-example-grid .vertical {width:3px;height:133%}
.boxes-example-grid .latest {background:#a36820}
.boxes-example-grid .pending {background:repeating-linear-gradient(#97774a 0 2px,transparent 2px 5px)}
.boxes-example-grid .owner {width:100%;height:100%;background:#f6e8bb;color:#764c18;display:grid;place-items:center;font-weight:750}
.boxes-example figcaption {font-size:.85rem;line-height:1.4;margin:.4rem 0 0}

.page-game .game-shell.theme-boxes:has(.boxes-room) {
  --boxes-stage:#e9f2f8;--boxes-theme-ink:#1c3754;
  background:var(--boxes-stage);color:var(--boxes-theme-ink);
}
.page-game .game-shell.theme-boxes:has(.boxes-room) .game-toolbar {
  background:var(--boxes-stage);color:var(--boxes-theme-ink);border-color:#9eb4c5;
}
.page-game .game-shell.theme-boxes:has(.boxes-room) .game-toolbar .button,
.page-game .game-shell.theme-boxes .play .boxes-room .button.secondary {
  background:#f7fbfd;color:var(--boxes-theme-ink);border-color:#819cb3;
}
.page-game .game-shell.theme-boxes .play .boxes-room .button:not(.secondary) {
  background:#234d7b;color:white;border-color:#234d7b;
}
.game-shell.theme-boxes .play .boxes-room {
  --boxes-paper:#fffbef;--boxes-ink:var(--boxes-theme-ink);--boxes-dot:#203e5e;
  --boxes-stroke:#2c4c71;--boxes-a:#874516;--boxes-b:#185d60;
  --boxes-a-fill:#f8d8a2;--boxes-b-fill:#bce7df;
}
.game-shell.theme-boxes .play .boxes-room h2 {
  font-size:clamp(1.65rem,4vw,3.35rem);color:var(--boxes-ink);
  letter-spacing:-.035em;line-height:1.08;
}
.boxes-field {
  border-color:#8aa4bb;border-radius:.6rem;
  background:
    linear-gradient(#648ba62b 1px,transparent 1px) 0 0 / 17px 17px,
    linear-gradient(90deg,#648ba62b 1px,transparent 1px) 0 0 / 17px 17px,
    var(--boxes-paper);
  box-shadow:0 .3rem 0 #a0b8c9,0 .75rem 1.3rem #29476a28;
}
.box-edge[data-box-last=true]::before {
  background:#a44831;box-shadow:0 0 0 2px #ffc8a8;
}
button.box-edge:not(:disabled):is(:hover,:focus-visible) {
  outline-color:#a44831;background:#f6be9f75;
}
button.box-edge:not(:disabled):is(:hover,:focus-visible)::before {background:#a44831}
.box-cell[data-box-owner="0"]::before {background:var(--boxes-a-fill)}
.box-cell[data-box-owner="1"]::before {background:var(--boxes-b-fill)}
.boxes-scores>div {background:#f9e7cc}
.boxes-scores>div[data-box-team="1"] {background:#d9ede8}
.boxes-scores>div[data-box-active=true] {box-shadow:inset 0 -2px currentColor}
.boxes-scores>div[data-box-active=true][data-box-team="0"] {color:var(--boxes-a)}
.boxes-scores>div[data-box-active=true][data-box-team="1"] {color:var(--boxes-b)}
.boxes-scores dd {font-size:clamp(1.45rem,3.2vw,2.25rem);line-height:1.1}
.game-shell .play .boxes-room .actions {flex-wrap:wrap}
@media(max-width:720px) {
  .page-game .game-shell.theme-boxes.wide .play:has(.boxes-room) {
    justify-content:flex-start;min-height:0;margin-block:0;padding-block:1.15rem 2rem;
  }
  .boxes-desk {gap:.6rem}
  .boxes-side {display:contents}
  .boxes-side>:is(h2,.boxes-scores,.boxes-progress) {order:-1}
  .boxes-scores {margin:0 0 .35rem}
}

