/* ==========================================================================
   Touch pad: shown on coarse pointers and narrow viewports only
   ========================================================================== */

.touchpad {
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--panel);
  /* Stops double-tap zoom and scroll-jacking while the pad is in use. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.pad-btn {
  display: grid;
  place-items: center;
  min-height: 3rem;
  padding: 0;
  border: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1.13rem;
  font-weight: 700;
  color: var(--ink-dim);
  background: rgba(148, 197, 255, 0.07);
  cursor: pointer;
  /* The pad is the only place these styles matter; keeping transitions short
     means the pressed state feels immediate. */
  transition: background 0.1s ease, color 0.1s ease, transform 0.1s ease;
}

.pad-btn.is-pressed {
  color: #04121a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: scale(0.96);
}

.pad-btn--wide {
  font-size: 1.5rem;
}

.pad-btn--drop {
  /* Spans the full second row so it reads as the primary action. */
  grid-column: 1 / -1;
  color: #04121a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.pad-btn--drop.is-pressed {
  filter: brightness(1.2);
}

/* Coarse pointer (touch, stylus) or a phone-width screen gets the pad. */
@media (pointer: coarse), (max-width: 900px) {
  .touchpad {
    display: grid;
  }
}

@media (max-width: 460px) {
  .app {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .touchpad {
    gap: 0.3rem;
    padding: 0.4rem;
  }

  .pad-btn {
    min-height: 2.9rem;
    font-size: 1.02rem;
  }
}

/* Landscape phones are short: give the board the height and shrink the pad. */
@media (pointer: coarse) and (max-height: 520px) {
  .pad-btn {
    min-height: 2.4rem;
  }

  .hud {
    padding: 0.35rem 0.6rem;
  }
}
