/*
 * What the three phone layouts being play tested share
 * (docs/plans/19-phone-layouts.md). Each piece of the match HUD is pinned by
 * a few variables; hud-a.css, hud-b.css and hud-c.css only set those
 * variables, once for upright and once for sideways. The squad keys are in
 * hud-squads.css, the cards in hud-cards.css, the bottom line in hud-tray.css. Nothing here touches Classic or a desktop: every
 * rule waits for data-kit='on' (js/hud-choice.js). When the test ends, these
 * files go with the layouts that lose.
 */

/* Parts only the new layouts show. */
.amount-keys,
.deck-sheet__name,
.formation-bar__step,
.formation-bar__more,
.card-ghost {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] {
  --gap: 0.25rem;
  --key: 2.75rem;
  /* One key and the gap after it. */
  --step: calc(var(--key) + var(--gap));
  --lit: color-mix(in srgb, var(--accent) 24%, var(--bg-0));
}

/* ---- Top bar: energy, shield and its cost, the Terminal; then Menu ---- */
:root[data-kit='on'][data-phone][data-orient] .hud__identity {
  top: 0;
  right: auto;
  left: var(--st-l, 0);
  height: var(--key);
  min-width: 0;
  gap: 0.375rem;
  padding: 0 var(--space-1) 0 var(--space-2);
}

:root[data-kit='on'][data-phone][data-orient] .hud__name,
:root[data-kit='on'][data-phone][data-orient] .hud__dot,
:root[data-kit='on'][data-phone][data-orient]
  .hud__identity:has(.hud__bases:not([hidden]))
  .tag:not(.hud__bases) {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] .hud__energy {
  min-width: 3ch;
  margin-left: 0;
  font-size: var(--text-lg);
}

/* The shield and its word come back: a PC player sees them all match long. */
:root[data-kit='on'][data-phone][data-orient] .hud__energy + .hud__energy-label {
  display: inline;
  margin-left: 0;
  font-size: 0.625rem;
}

:root[data-kit='on'][data-phone][data-orient] .hud__shield {
  display: inline-block;
  min-width: 0;
  font-size: var(--text-sm);
}

:root[data-kit='on'][data-phone][data-orient] .hud__terminal {
  /* As tall as the bar, so it is a full thumb's target. */
  align-self: stretch;
  min-height: 0;
  padding: 0 0.375rem;
  font-size: var(--text-xs);
}

/* What the shield costs sits under the bar, and only once it costs something. */
:root[data-kit='on'][data-phone][data-orient] .hud__upkeep {
  position: absolute;
  top: calc(100% + var(--gap));
  left: 0;
  display: block;
  min-width: 0;
  padding: 0.125rem var(--space-2);
  background: var(--bg-veil);
  border: 0;
  font-size: 0.6875rem;
  white-space: nowrap;
}

:root[data-kit='on'][data-phone][data-orient] .hud__upkeep:empty {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] .hud__menu-toggle {
  top: 0;
  right: var(--mn-r, 0);
  width: 3.75rem;
  padding: 0;
}

:root[data-kit='on'][data-phone][data-orient] .hud__buttons {
  top: var(--step);
  right: var(--mn-r, 0);
}

/* ---- The overview: its pieces are placed one by one, with no panel round them ---- */
:root[data-kit='on'][data-phone][data-orient] .hud__overview,
:root[data-kit='on'][data-phone][data-orient] .touch-tools {
  display: contents;
}

:root[data-kit='on'][data-phone][data-orient] .hud__dock {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] .minimap__canvas {
  position: absolute;
  top: var(--mm-t, auto);
  right: var(--mm-r, 0);
  bottom: var(--mm-b, auto);
  width: var(--mm-w, 8.75rem);
  max-width: none;
  background: var(--bg-veil);
  pointer-events: auto;
}

:root[data-kit='on'][data-phone][data-orient] .hud__view-buttons {
  position: absolute;
  top: var(--vw-t, auto);
  right: var(--vw-r, 0);
  bottom: var(--vw-b, auto);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: var(--gap);
  width: var(--vw-w, 8.75rem);
  pointer-events: auto;
}

:root[data-kit='on'][data-phone][data-orient] .hud__view-buttons .button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: var(--key);
  padding: 0;
  background: var(--bg-veil);
  font: 600 0.6875rem / 1 var(--font-ui);
  white-space: nowrap;
}

/* ---- The touch tools: All, Path and the amount keys keep their places ---- */
:root[data-kit='on'][data-phone][data-orient] .touch-tools > .button {
  position: absolute;
}

/* The stepping amount key gives way to the amount keys; a box is hold, then drag. */
:root[data-kit='on'][data-phone][data-orient] .touch-tools__amount,
:root[data-kit='on'][data-phone][data-orient] .touch-tools__box,
:root[data-kit='on'][data-phone][data-orient] .touch-tools__path:disabled {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] .touch-tools .touch-tools__fighters {
  top: var(--all-t, auto);
  right: var(--all-r, auto);
  bottom: var(--all-b, auto);
  left: var(--all-l, auto);
  width: var(--all-w, var(--key));
  height: var(--all-h, var(--key));
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: var(--bg-veil);
  font-size: 0;
}

:root[data-kit='on'][data-phone][data-orient] .touch-tools__fighters::before {
  content: 'All';
  font: 700 0.8125rem / 1 var(--font-mono);
}

/* Path shows above the bottom line's end while your Twin Haul is selected. */
:root[data-kit='on'][data-phone][data-orient] .touch-tools .touch-tools__path {
  right: var(--tr-r, 0);
  bottom: calc(var(--tr-b, 0px) + var(--key) + 3 * var(--gap));
  width: 4.5rem;
  min-height: var(--key);
  background: var(--bg-veil);
}

:root[data-kit='on'][data-phone][data-orient] .amount-keys {
  position: absolute;
  top: var(--am-t, auto);
  right: var(--am-r, auto);
  bottom: var(--am-b, 0);
  left: var(--am-l, 0);
  display: flex;
  flex-direction: var(--am-dir, row);
  gap: var(--gap);
  width: var(--am-w, auto);
}

:root[data-kit='on'][data-phone][data-orient] .amount-key {
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--key);
  padding: 0;
  background: var(--bg-veil);
  font-size: var(--am-font, var(--text-sm));
  /* A held key must stay held while the thumb rests on it. */
  touch-action: none;
}

:root[data-kit='on'][data-phone][data-orient] .amount-key[data-amount='1'] {
  display: none;
}

:root[data-kit='on'][data-phone][data-orient] .amount-key[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--lit);
  color: var(--accent);
}

/* Out of the match: the keys go, the notice and the overview stay. */
:root[data-kit='on'][data-phone][data-orient]
  .hud:has(.hud__out:not([hidden]))
  :is(.amount-keys, .group-strip, .touch-tools__fighters, .touch-tools__path) {
  display: none;
}
