/*
 * Touch screens, any size: the map takes fingers, not the browser, and the
 * buttons that stand in for keys and modifier clicks show. Nothing here
 * applies to a mouse-only screen. Plan: docs/plans/13-phone-play.md.
 */

/* The map handles every touch itself: no browser scroll, zoom or long-press menu. */
.match__canvas {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Taps on buttons and fields never wait to see if they are a double-tap zoom. */
:root[data-touch='true'] body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Hidden unless this is a touch screen, or unless it is a phone. */
.hud__touch-only,
.touch-tools,
.hud__menu-toggle,
.card__short {
  display: none;
}

:root[data-touch='true'] .hud__touch-only {
  display: inline-flex;
}

:root[data-touch='true'] .touch-tools {
  display: flex;
}

/* A touch screen with room (a tablet) keeps the desktop layout; the tools
   sit at the bottom, in the middle. */
.touch-tools {
  grid-area: 3 / 2;
  align-self: end;
  justify-self: center;
  gap: var(--space-1);
  padding: var(--space-1);
}

.touch-tools .button {
  min-width: var(--target);
  min-height: var(--target);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

/* The amount shows its label above the number, in one fixed size. */
.touch-tools__amount {
  display: grid;
  align-content: center;
  justify-items: center;
  width: 4.5rem;
  line-height: 1.1;
  gap: 0;
}

.touch-tools__label {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.touch-tools__value {
  font-weight: 700;
}

.touch-tools__amount[data-many='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.touch-tools__box,
.touch-tools__fighters,
.touch-tools__path {
  width: 4.5rem;
}

/* "Fighters" is the longest word of the four: a size smaller keeps it in the same box. */
.touch-tools .touch-tools__fighters {
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
}

/* Path reads Done while on, in the same box: the accent says a route is being laid. */
.touch-tools__box[aria-pressed='true'],
.touch-tools__path[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Every control a finger uses is at least 44 px each way. */
:root[data-touch='true'] .deck__panel .segment,
:root[data-touch='true'] .deck__panel .stepper__button,
:root[data-touch='true'] .deck__panel .option__pick,
:root[data-touch='true'] .formation-bar .segment,
:root[data-touch='true'] .formation-bar__clear {
  min-height: var(--target);
}

:root[data-touch='true'] .deck__panel .stepper__button {
  min-width: var(--target);
}

:root[data-touch='true'] .deck__panel .segment {
  min-width: var(--target);
}
