/* Tactics playground, on top of style.css (same tokens and soft surfaces). */
body.pg { min-height: 100%; }
.pg-nav { margin-left: auto; display: flex; gap: 8px; }
.pg-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 20px; align-items: start;
  padding-block: 20px 32px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  max-width: 1600px; margin: 0 auto; }
.pg-teams { gap: 14px; position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow: hidden; }
.pg-side { width: 100%; } .pg-side button { flex: 1; min-height: 36px; font-size: 13px; }
.field select { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2); color: var(--text); box-shadow: var(--hi); }
.pg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pg-xi-head { display: flex; align-items: center; justify-content: space-between; }
.pg-xi { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; flex: 1; padding-right: 2px; }
.pg-slot { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; align-items: center; }
.pg-slot span { font: 600 11px var(--mono); color: var(--shadow); text-align: center; padding: 6px 0; border-radius: 8px; background: var(--tint); }
.pg-slot select { min-height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--s2); color: var(--text); width: 100%; min-width: 0; }
.pg-slot.sel span { background: var(--shadow); color: var(--shadow-ink); }

.pg-stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pg-scen { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-scen button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--s1); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--elev1), var(--hi); }
.pg-scen button.on { background: var(--shadow); color: var(--shadow-ink); border-color: transparent; }
.pg-scen-text { margin: 0; color: var(--muted); font-size: 13px; min-height: 18px; }
.pg-pitch canvas { touch-action: none; cursor: grab; }
.pg-pitch canvas.dragging { cursor: grabbing; }
.pg-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pg-hint { margin-left: auto; }

.pg-side-col { display: flex; flex-direction: column; gap: 16px; }
.pg-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pg-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--s2); box-shadow: var(--hi); }
.pg-kpi span { font-size: 12px; color: var(--muted); }
.pg-kpi b { font: 600 28px var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pg-kpi em { font-style: normal; font-size: 12px; color: var(--muted); min-height: 16px; }
.pg-kpi em.up { color: var(--ok); } .pg-kpi em.down { color: var(--bad); }
.pg-meter { height: 8px; border-radius: 8px; background: var(--away); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.15); }
.pg-meter i { display: block; height: 100%; background: var(--home); border-radius: 8px 0 0 8px; transition: width .4s ease; }
.pg-moves { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.pg-moves li { font-size: 13px; } .pg-moves li b { font-weight: 600; } .pg-moves li span { color: var(--muted); display: block; font-size: 12px; }
.pg-sim { padding: 12px; border-radius: 12px; background: var(--tint); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.pg-sim b { font: 600 18px var(--display); }
.pg-player { display: flex; align-items: center; gap: 12px; }
.pg-player .av { width: 44px; height: 44px; font-size: 14px; color: #fff; }
.pg-player b { display: block; font-size: 15px; } .pg-player span { font-size: 12px; color: var(--muted); }
.field output { float: right; font: 600 12px var(--mono); color: var(--text); }
.field input[type=range] { width: 100%; accent-color: var(--shadow); }
.pg-about { gap: 8px; }

@media (max-width: 1280px) {
  .pg-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .pg-side-col { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 900px) {
  .pg-grid { grid-template-columns: minmax(0, 1fr); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 14px; }
  .pg-teams { position: static; max-height: none; order: 2; }
  .pg-stage { order: 1; } .pg-side-col { order: 3; grid-template-columns: minmax(0, 1fr); }
  .pg-hint { margin-left: 0; width: 100%; }
  .pg-tools .primary { width: 100%; }
  .match { display: none; }
}

/* Modes: Moments (scenarios + the space model) and Full match (demo/sim.js). */
body.pg:not(.mode-match) .x-only, body.pg.mode-match .m-only { display: none !important; }
.pg-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.pg-mode button { min-height: 40px; padding: 0 18px; font-size: 14px; }
.pg-score { display: flex; align-items: center; gap: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
.pg-team { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.pg-team i { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.pg-goals { font: 700 26px var(--display); letter-spacing: -0.02em; min-width: 64px; text-align: center; }
.pg-clock { font: 600 13px var(--mono); color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--s2); min-width: 54px; text-align: center; }
.pg-clock.live { color: var(--ok); }
.pg-speed button { min-height: 40px; padding: 0 12px; font: 600 12px var(--mono); }
.pg-poss { height: 8px; border-radius: 8px; background: var(--away); overflow: hidden; }
.pg-poss i { display: block; height: 100%; width: 50%; background: var(--home); transition: width .4s ease; }
.pg-stats { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pg-stats td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pg-stats tr:last-child td { border-bottom: none; }
.pg-stats td:first-child, .pg-stats td:last-child { width: 30%; font-weight: 600; }
.pg-stats td:nth-child(2) { font-size: 12px; }
.pg-stats td:last-child { text-align: right; }
.pg-stats td:nth-child(2) { text-align: center; color: var(--muted); }
.pg-stats td.lead { color: var(--shadow); }
.pg-progress { height: 6px; border-radius: 6px; background: var(--s2); overflow: hidden; }
.pg-progress i { display: block; height: 100%; width: 0; background: var(--shadow); transition: width .2s linear; }
.pg-advice { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pg-advice li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--s2); }
.pg-advice li.top { background: var(--tint); }
.pg-advice li b { font-size: 14px; } .pg-advice li span { grid-column: 1; font-size: 12px; color: var(--muted); }
.pg-advice li button { grid-row: 1 / span 2; grid-column: 2; }
.pg-advice li.now { background: transparent; border: 1px dashed var(--line); }
.pg-phase button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.card header .pg-phase { margin-left: auto; }
.pg-events { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; font-size: 13px; }
.pg-events li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; }
.pg-events li time { font: 600 12px var(--mono); color: var(--muted); }
.pg-events li.goal b { color: var(--shadow); }
.pg-events li.break { color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.pg-events li.note { display: block; }
@media (max-width: 900px) {
  .pg-score { margin-left: 0; width: 100%; justify-content: space-between; }
  .pg-tools.x-only .primary { width: auto; flex: 1; }
}

.pg-for { width: 100%; } .pg-for button { flex: 1; min-height: 40px; font-size: 13px; }
.pg-link { flex: 1 1 220px; min-width: 0; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2); color: var(--text); font: 12px var(--mono); }
.pg-link[hidden] { display: none; }
.pg-events li.sub span { color: var(--muted); }
