/* The district view (app/js/view/district.js): each seat's District Board in its area. layout.css gives the area its
   place; this file draws the board inside it. Every position on the board is a share of the board picture, from
   app/assets/district/slots.json, so the pieces sit in the printed squares at any size. */

/* The board: the whole square on the table; upright, the grid with its letters and lane feet (x 205 to 3340 and
   y 60 to 3543 of the picture) fills the area's width (docs/UI-PLAN.md, Phone layout (b)). */
[data-district-board] { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (orientation: portrait) {
  [data-district-board] {
    --s: min(100cqw / 3135, 100cqh / 3483);
    inset: auto; width: calc(var(--s) * 3543); height: calc(var(--s) * 3543);
    left: calc(50cqw - var(--s) * 1772.5); top: calc(50cqh - var(--s) * 1801.5);
  }
}
[data-district-board] > .ground { position: absolute; inset: 0; width: 100%; height: 100%; display: block; box-shadow: var(--lift-board); }   /* UI-45 */
[data-district-board] > .plan, [data-district-board] > .marks, [data-district-board] > .pieces, [data-district-board] > .light { position: absolute; inset: 0; }
[data-district-board] .plan > *, [data-district-board] .marks > *, [data-district-board] .pieces > *, [data-district-board] .light > * { position: absolute; }
[data-district-board] .marks, [data-district-board] .plan, [data-district-board] .pieces { pointer-events: none; }

/* The Gearfolk's district plan, faint under its pieces (GEAR-19). */
.plan-tile { display: grid; place-items: center; opacity: .5; }
.plan-tile img { width: 46%; height: 46%; object-fit: contain; }
.plan-space { display: grid; place-items: center; color: #6b4a1f; opacity: .55; font: 400 clamp(18px, 7cqmin, 44px)/1 var(--display); }

/* Pieces: a tile fills its square, a Ruffian token stands on it, a Building covers its 2 by 2. Shadows are the
   drawn thickness of cardboard, never a filter (references/ui-pwa.md, Rendering rules). */
.tile img, .ruffian img, .hand img { width: 100%; height: 100%; display: block; object-fit: contain; }
.tile img { border-radius: 12%; box-shadow: 0 1px 0 #e8dcb8, 0 3px 0 #5a4526, 0 5px 6px #000a; }   /* cardboard edge and shadow, UI-45 */
.ruffian { display: grid; place-items: center; }
.ruffian img { width: 86%; height: 86%; border-radius: 18%; box-shadow: 0 2px 0 #1a1a1a, 0 5px 7px #000a; }   /* a token's edge and shadow, UI-45 */
.building > img { width: 100%; height: 100%; display: block; border-radius: 4%; box-shadow: 0 1px 0 #e8dcb8, 0 3px 0 #5a4526, 0 6px 10px #000a; }   /* UI-45 */
.hand { display: grid; place-items: center; }
.hand img { width: 70%; height: 80%; }
[data-leaving] { opacity: .35; }

/* A Building's parts: its instant badge's place (anim.js pulses it), its door mat with the meeples, and its plate. */
.building [data-instant] { position: absolute; left: 4%; width: 11%; pointer-events: none; }
.building .mat { position: absolute; right: 2%; top: 20%; width: 18%; display: flex; flex-direction: column; gap: 2%; align-items: center; }
.building .mat img { width: 100%; height: auto; filter: none; }
/* On a phone a Building's printed name is 4 px: its plate shows it in the name's lettering at 11 px over its own
   name band (UI-121). On the table the card reads as printed. */
.building .plate { display: none; }
@media (orientation: portrait) {
  .building .plate { display: block; position: absolute; left: 4%; right: 4%; padding: 1px 2px 0; background: var(--paper);
    clip-path: var(--torn); color: var(--ink); text-align: center; overflow-wrap: break-word; }
  .building .plate span { font: 400 var(--name-min)/1.05 var(--display); text-transform: uppercase; }
}

/* The light layer: picks, ghosts, the lane in play, the stamp and what a placement sets off. */
.pick { margin: 0; padding: 0; border: 0; background: #fffbe02e; border-radius: 8%; cursor: pointer; box-shadow: inset 0 0 0 2px #fffbe0cc; }
.pick[aria-pressed="true"] { background: #fffbe055; box-shadow: inset 0 0 0 3px var(--paper); }
.pick:focus-visible { outline: 3px solid var(--gold); }
.foot-pick { border-radius: 24%; }
[data-noop] { opacity: .6; }
.ghost { pointer-events: none; opacity: .82; outline: 3px dashed var(--paper); outline-offset: -3px; border-radius: 4%; }
.ghost img { box-shadow: 0 8px 12px #1a260a88; }
.hand.ghost { outline: 0; }
.lane-lit { pointer-events: none; border-radius: 8px; background: linear-gradient(#fffbe000, #fffbe055); }
.step { pointer-events: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 2px; border-radius: 50%;
  background: var(--step); color: #fff; font: 400 13px/1 var(--badge); }
.step.off { background: var(--res-tray); opacity: .7; }
[data-view="district"] [data-closed] { opacity: .9; }   /* scoped: a bare selector made the hand's closed cards see-through */

.side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 0 6px; z-index: 2; transform: translateY(-50%); }
.side[data-side="left"] { align-items: flex-end; }
.side[data-side="under"] { transform: translateX(-50%); padding: 6px 0 0; align-items: center; }
.pending { display: flex; gap: 6px; align-items: center; padding: 5px 8px 4px; background: var(--tan); clip-path: var(--torn); }
.pending span { display: flex; align-items: center; gap: 2px; }
.pending b { font: 400 14px/1 var(--vp); color: var(--ink); }
.pending img { width: 22px; height: 22px; object-fit: contain; mix-blend-mode: multiply; }

/* The stamp: the Helping Hand glove over a Lane Bonus space, the verb under it in the display face. It breathes so
   the eye finds it (UI-28); the pulse is a transform on a small element, never on the board. */
.stamp { position: relative; width: 80px; height: 80px; margin: 0 0 14px; padding: 0; border: 3px solid var(--outline); border-radius: 50%;
  background: var(--frame); box-shadow: 0 4px 0 var(--outline); cursor: pointer; overflow: visible; animation: stamp-pulse 1.1s ease-in-out infinite alternate; }
.stamp img { position: absolute; left: 18%; top: 4%; width: 64%; height: 64%; object-fit: contain; }
/* the verb hangs on a tag across the stamp's foot, as wide as its word, so a long verb ("Activate") is never cut by
   the round edge (user, 2026-11-28: "the word not fully visible") */
.stamp span { position: absolute; left: 50%; bottom: -12px; translate: -50% 0; padding: 4px 8px 3px; background: var(--outline); color: var(--paper);
  font: 400 13px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; text-align: center; white-space: nowrap;
  clip-path: var(--torn); }
@keyframes stamp-pulse { from { transform: scale(1); } to { transform: scale(1.07); } }
@media (orientation: portrait) {
  .stamp { width: 58px; height: 58px; }
  .stamp span { font-size: 11px; padding: 3px 6px 2px; bottom: -10px; }
  .step { width: 18px; height: 18px; font-size: 11px; margin: 1px; }
}
@media (prefers-reduced-motion: reduce) { .stamp { animation: stamp-pulse 2.4s ease-in-out infinite alternate; } }

/* Done for an "up to" pick, in the commit spot: a torn tan strip with the word (UI-PLAN, Control kit). */
.district-done { min-width: var(--tap); min-height: var(--tap); padding: 8px 16px; border: 0; background: var(--tan); clip-path: var(--torn);
  color: var(--ink); font: 400 16px/1 var(--display); text-transform: uppercase; cursor: pointer; }

/* a Building's spots: a gold pin at each legal 2x2's crossing, and the 2x2 itself drawn only under the pointer or
   once picked. Outlining every legal footprint at once made a yellow mesh of the whole board. */
.pick.spot-pick { background: none; box-shadow: none; outline: none; animation: none; }
.pick.spot-pick::before { content: ''; position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--outline), 0 2px 6px #0008; width: 24%; }
.pick.spot-pick::after { content: ''; position: absolute; inset: -50%; border-radius: 6%; border: 3px dashed var(--paper);
  background: #fffbe033; opacity: 0; transition: opacity .12s; pointer-events: none; }
.pick.spot-pick:hover::after, .pick.spot-pick:focus-visible::after, .pick.spot-pick[aria-pressed="true"]::after { opacity: 1; }
.pick.spot-pick[aria-pressed="true"]::before { background: var(--orange); }

/* another seat's board: its name on a torn strip across the top edge, and the way back to yours */
[data-district-board] > .whose { position: absolute; left: 50%; top: 0; translate: -50% -40%; z-index: 4; display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 16px; background: var(--solo, #6b3fa0); color: var(--paper); clip-path: var(--torn); white-space: nowrap;
  font: 400 18px/1 var(--display); text-transform: uppercase; box-shadow: 0 4px 10px #0007; }
[data-district-board] > .whose[hidden] { display: none; }
.whose-back { min-height: var(--tap); padding: 6px 12px 4px; border: 0; background: var(--paper); color: var(--ink); cursor: pointer;
  font: 400 13px/1 var(--display); text-transform: uppercase; clip-path: var(--torn); }
/* upright: the tab row already names each board and holds Your district, so the strip would only cover row A */
@media (orientation: portrait) { [data-district-board] > .whose { display: none; } }
