/* The controls: game controllers (the focus ring in menus, button glyphs), the Slide button on phones,
   the FPS counter and Settings > Controls (crosshair preview and pickers). */

/* ---------------------------------------------------------------- controllers */

/* Menus driven by a controller: a thick yellow ring on the button in focus (main.js sets pad-nav). */
body.pad-nav :focus:not([tabindex="-1"]) { outline: 4px solid var(--yellow); outline-offset: 2px; }
body.pad-nav .st-range:focus { outline-offset: 6px; }

/* A phone or tablet played with a controller: the thumb controls step aside until the screen is touched. */
body.touch.pad #stick,
body.touch.pad .touch-cluster { display: none; }

/* A controller's buttons in the how-to-play card: A B X Y round in their usual colours, the rest pills. */
.pad-key {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #3a4a68;
  color: #fff;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.pad-key.pad-a, .pad-key.pad-b, .pad-key.pad-x, .pad-key.pad-y { width: 28px; padding: 0; font-family: var(--display); font-size: 15px; }
.pad-key.pad-a { background: var(--green); }
.pad-key.pad-b { background: var(--red); }
.pad-key.pad-x { background: var(--blue); }
.pad-key.pad-y { background: var(--yellow); color: var(--ink); }
.pad-key.pad-lt, .pad-key.pad-rt, .pad-key.pad-lb, .pad-key.pad-rb { border-radius: 9px 9px 6px 6px; background: #22314d; }
.pad-key.pad-leftstick, .pad-key.pad-rightstick { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 3px #b9cbe4; }
/* The Slide button's chip in the card wears its orange. */
.ht-btn.ht-slide { background: rgba(255, 138, 31, 0.92); }
.ht-pad-note { background: #e8f1ff; color: var(--blue-dark); line-height: 1.7; }
.ht-pad-note .m-ico { background: var(--blue); }
.ht-pad-note .pad-key { min-width: 24px; height: 24px; margin: 0 2px; }
.ht-pad-note .pad-key.pad-a, .ht-pad-note .pad-key.pad-b { width: 24px; font-size: 13px; }

/* ---------------------------------------------------------------- the slide on phones */

/* Slide comes up beside Jump while you sprint (main.js), in the cell Down uses while flying. */
#touch-slide { grid-area: down; width: 60px; height: 60px; background: rgba(255, 138, 31, 0.86); box-shadow: inset 0 0 0 2.5px #fff; }
body.touch[data-screen="lobby"].can-slide .touch-cluster { grid-template-columns: 64px 70px; grid-template-areas: ". use" "down jump"; }
@media (max-height: 520px) {
  #touch-slide { width: 50px; height: 50px; }
}
/* Upright phones: the cell left of Jump is over the stick, so in a match Slide takes the Use button's place
   (main.js hides it while Use is up). */
@media (max-aspect-ratio: 1/1) {
  body.touch[data-screen="play"] #touch-slide { grid-area: use; }
}

/* ---------------------------------------------------------------- FPS counter */

/* Settings > Controls > Show FPS: small, in the bottom-left corner, never in the way of a tap. */
#fps {
  position: fixed;
  left: calc(8px + env(safe-area-inset-left));
  bottom: calc(6px + env(safe-area-inset-bottom));
  z-index: 40;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(18, 32, 58, 0.72);
  color: #7dffa8;
  font: 900 11px/16px var(--ui);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  pointer-events: none;
}
/* In a match on a phone it tucks under the stick's ring. */
body.touch #fps { bottom: calc(1px + env(safe-area-inset-bottom)); line-height: 14px; }
/* Phones' lobby bar fills the bottom; the top middle, between the player card and the wallet, is free. */
body.touch[data-screen="lobby"] #fps { left: 50%; bottom: auto; top: calc(4px + env(safe-area-inset-top)); transform: translateX(-50%); }
/* Upright, the player card fills the top: the left edge, between the card and the stick. */
@media (max-aspect-ratio: 1/1) {
  body.touch[data-screen="lobby"] #fps { left: calc(8px + env(safe-area-inset-left)); top: 34%; transform: none; }
}
#fps[data-level="ok"] { color: var(--yellow); }
#fps[data-level="low"] { color: #ff8a8f; }

/* ---------------------------------------------------------------- Settings > Controls */

.ctl-xh { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px 16px; align-items: center; }
/* The preview: the crosshair at its real size over a bright sky and over a dark wall. */
.ctl-xh-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 92px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--line);
}
.ctl-xh-spot { display: grid; place-items: center; background: linear-gradient(180deg, #4aa8ff, #a9dcff 70%, #e7d9b8 70%, #d9c79c); }
.ctl-xh-spot.is-dark { background: linear-gradient(180deg, #3b3346, #2a2433 60%, #4a4036 60%, #3b332b); }
.ctl-xh-svg { display: block; overflow: visible; }
.ctl-xh-picks { display: grid; gap: 10px; min-width: 0; }
/* Room under the size slider for its thumb's shadow before the note. */
.ctl-xh-picks .st-sens { padding: 2px 0 10px; }
/* Style: four little crosshairs to pick from. */
.ctl-xs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 15px; background: #e3eaf3; box-shadow: inset 0 2px 0 rgba(18, 32, 58, 0.07); }
.ctl-xs-btn {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 2px 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ctl-xs-pic { display: grid; place-items: center; width: 34px; height: 30px; border-radius: 8px; background: #6aa9e8; }
.ctl-xs-btn.is-on { background: var(--blue); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 0 rgba(18, 32, 58, 0.22); }
.ctl-xs-btn.is-on .ctl-xs-pic { background: rgba(255, 255, 255, 0.22); }
@media (hover: hover) { .ctl-xs-btn:not(.is-on):hover { background: rgba(255, 255, 255, 0.7); } }
/* Colour: five round swatches. */
.ctl-xc { display: flex; flex-wrap: wrap; gap: 8px; }
.ctl-xc-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: #e3eaf3; }
.ctl-xc-btn i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(18, 32, 58, 0.35); }
.ctl-xc-btn.is-on { background: var(--ink); box-shadow: 0 3px 0 rgba(18, 32, 58, 0.25); }
.ctl-xc-btn.is-on i { box-shadow: inset 0 0 0 2px rgba(18, 32, 58, 0.35), 0 0 0 3px #fff; }
#panels.is-touch .ctl-xc-btn { width: 44px; height: 44px; }
@media (max-width: 600px) {
  .ctl-xh { grid-template-columns: minmax(0, 1fr); }
  .ctl-xh-view { height: 80px; }
}
