/* Who Stands Where only: the pitch with its spots, the tray of name cards. Shared rules are in ../shared/base.css;
   the pitch's own colours there too (shared/pitch.js). */
main.ps { max-width: 980px; }
.ps #home, .ps #done { max-width: 640px; }
.age-note { margin: 0 0 14px; max-width: 36em; }
#full-wrap { font-size: 16px; }
.ps-bests { grid-template-columns: repeat(2, 1fr); }
#play { --chrome: 300px; }  /* everything on the line-up screen but the pitch, on a phone (see the wide layout below) */
.ps #play .bar { margin-bottom: 8px; }
.lineup-main { display: grid; gap: 8px; }

/* the pitch: as wide as the column, or less where the screen is short, so the cards under it still fit */
.board {
  position: relative; margin: 0 auto; aspect-ratio: var(--ar);
  width: min(100%, calc((100vh - var(--chrome)) * var(--ar)));
  width: min(100%, calc((100dvh - var(--chrome)) * var(--ar)));
  border-radius: 8px; overflow: hidden;
}
.board-pitch, .board-pitch .pitch { width: 100%; height: 100%; }
.ps-attack { fill: none; stroke: var(--text); stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; }
.ps-attack-word { fill: var(--text); font-size: 2.9px; font-weight: 600; }
.ps-ball { fill: #E8D9B0; stroke: var(--ink); stroke-width: 0.25; }
.spot {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  width: max(44px, 12%); aspect-ratio: 1; padding: 0; border-radius: 50%;
  border: 2px dashed var(--text); background: rgba(18, 26, 58, 0.88); color: var(--text);
  font: inherit; font-weight: 800; font-size: 17px; line-height: 1; cursor: pointer;
}
.spot.filled { border: 2px solid var(--muted); background: var(--raised); cursor: default; }
.spot.placed { border: 3px solid var(--right); background: var(--rugby); color: var(--ink); }
.board.choosing .spot:not(.filled) { border-color: var(--accent); border-width: 3px; }
.spot.over { background: var(--accent); }
.spot.miss { border: 3px dashed var(--wrong); }
.spot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.spot.pop { animation: spot-pop 160ms ease-out; }
@keyframes spot-pop { from { transform: translate(-50%, -50%) scale(0.85); } to { transform: translate(-50%, -50%); } }
.spot.shake { animation: spot-shake 240ms; }
@keyframes spot-shake { 25% { transform: translate(calc(-50% - 5px), -50%); } 75% { transform: translate(calc(-50% + 5px), -50%); } }

/* the job line, or what to do next: room for three lines, so the cards under it never move */
.ps-msg { margin: 0; min-height: calc(3 * 1.3em); font-size: 14px; line-height: 1.3; color: var(--text); }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.card {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 8px; text-align: left;
  border: 2px solid var(--text); border-radius: 12px; background: var(--ground); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.15; cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;  /* the drag area */
  transform: translate(var(--dx, 0px), var(--dy, 0px)); transition: transform 160ms ease-out;
}
.card .badge { flex: none; display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; background: var(--rugby); color: var(--ink); font-weight: 800; font-size: 14px; }
.card .card-name { flex: 1; overflow-wrap: break-word; }
.card .card-n { flex: none; color: var(--muted); font-weight: 800; }
.card[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 1px; }
.card[aria-pressed="true"] .card-n { color: var(--ink); }
.card.dragging { position: relative; z-index: 5; transition: none; cursor: grabbing; background: var(--raised); color: var(--text); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .spot.pop, .spot.shake { animation: none; } }
@media (forced-colors: active) {
  .spot.placed { border-style: solid; border-width: 4px; }
  .card[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* phones: the number runs into the name, so three cards fit across */
@media (max-width: 719.98px) {
  .card { display: block; padding: 4px 8px; }
  .card .badge { display: inline; min-width: 0; height: auto; padding: 0; margin-right: 4px; background: none; color: var(--rugby); }
  .card[aria-pressed="true"] .badge { color: var(--ink); }
  .card .card-n { margin-left: 4px; }
  .tray.mini .badge { display: none; }  /* a mini team's cards say the name; the spot shows its letters */
}
/* short phones: less round the pitch */
@media (max-height: 600px) { main.ps { padding-block: 8px 12px; } #play { --chrome: 301px; } }

/* wide screens: the pitch on the left, the job line and the cards beside it */
@media (min-width: 720px) {
  #play { --chrome: 150px; }
  .lineup-main { grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: 20px; align-items: start; }
  .tray { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .ps-msg { font-size: 16px; margin-bottom: 12px; min-height: calc(4 * 1.3em); }
  .card { font-size: 16px; }
  .spot { font-size: 20px; }
}

/* Who am I? */
.quiz { max-width: 640px; }
