/* Tactivela · modules/tactics — scope: .tac  (app bar, segments, tools, swatches, discs: design system)
   Phone first; the three blocks at the end give tablets 44px targets, rearrange the board for PCs and
   for tablets and phones held sideways, and tighten the tools column on a phone held sideways. */
.tac .tac-views { background: transparent; border: 0; padding: 10px 12px 0; }
/* The view segment and the Opponent button sit in one box, so the landscape layout can stack them at the top of the tools column. */
.tac .tac-views__in { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--tk-space-2); }
.tac .tac-opp[aria-pressed="true"] { border-color: var(--tk-opponent); color: var(--tk-opp-text); background: var(--tk-bad-tint); }
.tac .tac-body { flex: 1; position: relative; overflow: hidden; min-height: 0; background: var(--tk-bg); }
.tac .tac-layer { position: absolute; inset: 0; }
.tac .tac-layer canvas { width: 100%; height: 100%; display: block; }
.tac .tac-players { pointer-events: none; }
.tac .tac-drawlayer { touch-action: none; }
.tac .tac-drawlayer canvas { cursor: crosshair; }
/* discs */
.tac .tac-disc { position: absolute; transform: translate(-50%, -50%); z-index: 10; pointer-events: none; user-select: none; touch-action: none;
  --kit-fill: var(--j2); --kit-edge: var(--jb); }
.tac .tac-disc.movable { pointer-events: all; cursor: grab; }
.tac .tac-disc.is-selected { cursor: grabbing; box-shadow: var(--tk-shadow-drag); }
.tac .tac-x { width: 60%; height: 60%; stroke-width: 2.25; color: var(--tk-opp-text); }   /* 3 before design system 0.6 (Proposed, keeps the same weight against the 1.5 icons) */
/* tools */
.tac .tac-tools { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px calc(14px + var(--tk-safe-bottom)); background: var(--tk-surface); border-top: var(--tk-border) solid var(--tk-line); }
.tac .tac-row2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tac .tac-lines > button { width: 42px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.tac .tac-lines > button[aria-pressed="true"] { background: var(--tk-card-raised); color: var(--tk-now); }
.tac .tac-widths { display: flex; align-items: center; gap: 2px; }
.tac .tac-widths button { width: 26px; height: 40px; border: 0; background: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tac .tac-widths span { display: block; border-radius: 50%; background: var(--tk-text-subtle); }
.tac .tac-widths button[aria-pressed="true"] span { background: var(--tk-now); }
.tac .tac-swatches { margin-left: auto; gap: 8px; }
.tac .tac-check { display: flex; align-items: center; gap: 10px; min-height: var(--tk-touch); cursor: pointer; font-size: var(--tk-fs-body); }
.tac .tac-check input { width: 22px; height: 22px; accent-color: var(--tk-purple); }
/* ── Tablets and up (700px): every tool is a full 44px touch target (design system 6.6) ──
   The phone strip keeps its tighter sizes. Line style, width and ink grow to --tk-touch
   (the row still fits on one line from 700px). In Move mode a press within half of --tac-reach of a
   disc's centre picks it up (grabNear() in tactics.js; the nearest disc wins, and a drawn disc always
   takes its own press), so a disc drawn smaller than 44px is still a 44px target. */
@media (min-width: 700px) {
  .tac .tac-lines > button { width: var(--tk-touch); min-height: var(--tk-touch); }
  .tac .tac-widths button { width: var(--tk-touch); height: var(--tk-touch); }
  .tac .tac-swatches .tk-swatch { width: var(--tk-touch); height: var(--tk-touch); }
  .tac .tac-body { --tac-reach: var(--tk-touch); }
}
/* ── PCs, and tablets and phones held sideways (design system 6.6) ──────────
   The pitch screens' shared landscape rule (the same as the Formation builder): 1100px and up, or
   700px and up held sideways (a tablet, a foldable or a phone). The screen becomes a grid: the app bar
   spans the top, the board takes the whole height below it on the left, and the column on the
   right holds every control. The view (Full field / Goal mouth) and the Opponent toggle head the
   column, where the phone has them in a bar above the board, then come the drawing tools. The
   pitch stays upright. layout() re-fits the pitch when Shell.watchSize sees the board's new size
   (on rotating, and when the controls change places), and drawing reads the canvas position
   afresh on every pointer event. Tablet portrait keeps the phone arrangement. */
@media (min-width: 1100px), (min-width: 700px) and (orientation: landscape) {
  .tac.screen { --tac-tools-w: var(--tk-side-w); }   /* the tools column */
  .tac#s-tactics.active { display: grid; grid-template-columns: minmax(0, 1fr) var(--tac-tools-w); grid-template-rows: auto auto minmax(0, 1fr); }
  .tac.screen > .tk-appbar { grid-row: 1; grid-column: 1 / -1; }
  /* The board stops above the home indicator (no tools strip underneath it here to take the inset). A margin,
     not padding, so layout() still measures only the space it can use; the screen's --tk-bg shows below. */
  .tac.screen > .tac-body { grid-row: 2 / -1; grid-column: 1; min-width: 0; margin-bottom: var(--tk-safe-bottom); }
  /* One panel: the view and Opponent on top (they stay in place), the tools below them (they scroll if short).
     It runs to the right edge, so its colour is painted out into the notch strip of a phone held sideways
     (the screen pads by --tk-safe-right; paint only, as the app bar does: design system "Held sideways"). */
  .tac.screen > .tac-views, .tac.screen > .tac-tools { grid-column: 2; background: var(--tk-surface); border-left: var(--tk-border) solid var(--tk-line);
    box-shadow: var(--tk-safe-right) 0 0 var(--tk-surface); }
  .tac.screen > .tac-views { grid-row: 2; padding: var(--tk-space-4) var(--tk-space-4) 0; }
  .tac .tac-views__in { flex-direction: column; align-items: stretch; gap: var(--tk-space-2); }
  .tac .tac-views__in > .tac-opp { min-height: var(--tk-touch); }
  .tac.screen > .tac-tools { grid-row: 3; min-height: 0; overflow-y: auto; gap: var(--tk-space-3);
    padding: var(--tk-space-3) var(--tk-space-4) calc(var(--tk-space-4) + var(--tk-safe-bottom)); border-top: 0; }
  /* Draw · Move · Erase on one row, Undo · Clear on the next; line style beside width, then the ink */
  .tac .tac-tools .tk-tools { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--tk-space-2); }
  .tac .tac-tools .tk-tool { grid-column: span 2; min-height: calc(var(--tk-btn-h) + var(--tk-space-2)); }   /* roomier than the phone strip */
  .tac .tac-tools .tk-tool:nth-child(n + 4) { grid-column: span 3; }
  .tac .tac-row2 { row-gap: var(--tk-space-3); }
  .tac .tac-swatches { margin-left: 0; flex: 1 0 100%; justify-content: space-between; }   /* the ink on its own row, edge to edge with the tools */
}
/* ── A phone held sideways, or any short landscape screen (design system 6.6) ──
   About 340px under the one-line app bar: the five tools share one row at 44px, as on the phone,
   so the whole column (view, Opponent, tools, line, width, ink) fits without scrolling.
   Always inside the rule above (700px wide and 500px or less tall is landscape). */
@media (min-width: 700px) and (max-height: 500px) {
  .tac.screen > .tac-views { padding-top: var(--tk-space-3); }
  .tac .tac-tools .tk-tools { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tac .tac-tools .tk-tool, .tac .tac-tools .tk-tool:nth-child(n + 4) { grid-column: auto; min-height: var(--tk-touch); }
  .tac.screen > .tac-tools { padding-bottom: calc(var(--tk-space-3) + var(--tk-safe-bottom)); }
}
