/* pad.css — a controller's marks on every page: the ring on the control in
   focus, the buttons drawn as the pad in hand has them (PlayStation's shapes
   or Xbox's letters, from html[data-pad]), the hints along the foot and the
   list a select opens (assets/js/ui/padnav.js, ui/gamepad.js). */

/* --- the ring, while the pad is in use ----------------------------------- */

html.is-pad {
  scroll-padding-block: 4.5rem;
}

html.is-pad :focus {
  outline: 3px solid var(--pad-ring, #8fb8ff);
  outline-offset: 3px;
}

/* --- a button, drawn ------------------------------------------------------ */

.pad-btn {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.35em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #1c1e24;
  color: #f4f4f6;
  font: 700 0.72rem/1 system-ui, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Xbox's letters, which the standard mapping follows, unless a PlayStation pad is in hand. */
[data-pad-btn='south']::before { content: 'A'; color: #7ed957; }
[data-pad-btn='east']::before { content: 'B'; color: #ff6b6b; }
[data-pad-btn='west']::before { content: 'X'; color: #6fb2ff; }
[data-pad-btn='north']::before { content: 'Y'; color: #ffd24d; }
[data-pad-btn='l1']::before { content: 'LB'; }
[data-pad-btn='r1']::before { content: 'RB'; }
[data-pad-btn='l2']::before { content: 'LT'; }
[data-pad-btn='r2']::before { content: 'RT'; }
[data-pad-btn='select']::before { content: '\29C9'; }
[data-pad-btn='start']::before { content: '\2630'; }
[data-pad-btn='home']::before { content: '\2302'; }

html[data-pad='ps'] [data-pad-btn='south']::before { content: '\2715'; color: #8fb8ff; }
html[data-pad='ps'] [data-pad-btn='east']::before { content: '\25CB'; color: #ff7a85; }
html[data-pad='ps'] [data-pad-btn='west']::before { content: '\25A1'; color: #f28fd2; }
html[data-pad='ps'] [data-pad-btn='north']::before { content: '\25B3'; color: #5fd6a8; }
html[data-pad='ps'] [data-pad-btn='l1']::before { content: 'L1'; }
html[data-pad='ps'] [data-pad-btn='r1']::before { content: 'R1'; }
html[data-pad='ps'] [data-pad-btn='l2']::before { content: 'L2'; }
html[data-pad='ps'] [data-pad-btn='r2']::before { content: 'R2'; }
html[data-pad='ps'] [data-pad-btn='home']::before { content: 'PS'; }

/* --- the hints along the foot --------------------------------------------- */

.pad-hints {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0.75rem;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.1rem;
  width: max-content;
  max-width: calc(100% - 1.5rem);
  margin-inline: auto;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(14, 15, 19, 0.88);
  color: #eceef2;
  font: 500 0.8rem/1.2 system-ui, sans-serif;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.pad-hints[hidden],
.pad-hints__item[hidden],
.is-playing .pad-hints {
  display: none;
}

.pad-hints__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

/* --- a select's list, for the pad ------------------------------------------ */

.pad-pick {
  position: fixed;
  z-index: 70;
  display: grid;
  gap: 2px;
  min-width: 12rem;
  max-width: calc(100vw - 16px);
  max-height: min(60vh, 26rem);
  overflow: auto;
  padding: 0.35rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #17191e;
  color: #f3f3f5;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.pad-pick__item {
  padding: 0.55rem 0.85rem;
  border: 0;
  border-radius: 0.4rem;
  background: none;
  color: inherit;
  font: 500 0.95rem/1.2 system-ui, sans-serif;
  text-align: start;
  cursor: pointer;
}

.pad-pick__item[aria-current='true'] {
  font-weight: 700;
}

.pad-pick__item:focus {
  background: #2a3550;
}

@media (prefers-reduced-motion: no-preference) {
  html.is-pad :focus {
    transition: outline-offset 0.12s ease-out;
  }
}
