/* Bottom action row sizes and states, the Share button and the Share panel (src/share.js). Loaded after journey.css, so it only adds: nothing in journey.css, the tokens
   or the fonts is changed. Flat everywhere: no shadow, no radius, no plate, no scrim, sentence case. */

/* ---- Row: Race friends left, Share centre, Leaderboard right. Equal outer columns keep Share on the true centre whatever the two labels weigh. */
#actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; justify-content: stretch; gap: 0 12px; }
#actions > button { grid-row: 1; }
#actions > #mp-open, #actions > .cb-claim { grid-column: 1; justify-self: start; }
#actions > #l2p-open { grid-column: 1; justify-self: start; }
#actions > #share-open { grid-column: 2; justify-self: center; }
#actions > button.px-pbtn.lb-pill:not(.mp-pill):not(.cb-claim) { grid-column: 3; justify-self: end; margin-left: 0; }
/* Settings (src/settings.js, the old Quality toggle) is the fourth action. Mid widths: it sits centred on a second line under the three. Wide windows (1360 and up: Race friends, Share, Leaderboard and Quality are about 1290px of lettering): one line, Race friends
   and Share on the left, Leaderboard and Quality on the right (columns 4 and 5, column 3 is the spacer). */
#actions > #settings-open { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 12px; }
@media (min-width: 1600px) {
  #actions { grid-template-columns: auto auto auto 1fr auto auto; }
  #actions > #mp-open, #actions > .cb-claim { grid-column: 1; }
  #actions > #l2p-open { grid-column: 2; justify-self: start; }
  #actions > #share-open { grid-column: 3; justify-self: start; }
  #actions > button.px-pbtn.lb-pill:not(.mp-pill):not(.cb-claim) { grid-column: 5; }
  #actions > #settings-open { grid-column: 6; grid-row: 1; justify-self: end; margin-top: 0; }
}

/* Tablet (761 to 1099): the labels (Race friends alone is about 366px) do not fit three equal columns (they need about 1010px), so the row wraps instead, centred: Race friends and Share, then Leaderboard and Quality (a third line if Quality is wide). Nothing can overlap. From 1100 the three columns fit again. */
@media (min-width: 761px) and (max-width: 1599px) {
  .mp-leave { bottom: calc(260px + env(safe-area-inset-bottom, 0px)); }
  #actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 12px; }
  #actions > #mp-open, #actions > .cb-claim { order: 1; }
  #actions > #l2p-open { order: 2; }
  #actions > #share-open { order: 3; }
  #actions > button.px-pbtn.lb-pill:not(.mp-pill):not(.cb-claim) { order: 4; }
  #actions > #settings-open { order: 5; margin-top: 0; }
}

/* ---- Bigger buttons: taller, chunkier pixel steps, more side padding (desktop first, the phone block below steps it down) */
#actions > button.px-pbtn.px-pbtn { --u: 4px; min-height: 64px; padding: calc(var(--u) + 13px) calc(var(--u) + 24px) calc(var(--u) + 14px); }
.mp-leave.px-pbtn.px-pbtn { --u: 4px; min-height: 56px; padding: calc(var(--u) + 10px) calc(var(--u) + 18px) calc(var(--u) + 11px); }
#actions > button.px-pbtn--cyan, button.px-pbtn.px-pbtn.px-pbtn--cyan { --edge: var(--px-cyan-lo); --shade: var(--px-cyan-ext); }

/* ---- States. The canvas paint (ui-crt.js) reads --edge, --face, --shade, --hi and --u from each button, plus :hover, :active, :focus-visible and data-pressed, so
   these rules drive both the painted look and the plain DOM look (UI_CRT.on = false).
   hover: brighter edge and face, a light row on top, a 2px lift. pressed: dark face, darker edge, 2px drop. keyboard focus: focus colour edge and a stepped outline. */
#actions > button.px-pbtn.px-pbtn:hover, .mp-leave.px-pbtn.px-pbtn:hover { --face: var(--px-face-hover); --hi: rgba(255, 255, 255, .22); }
#actions > button.px-pbtn.px-pbtn--cyan:hover { --edge: var(--px-cyan-hi); }
#actions > button.px-pbtn.px-pbtn:focus-visible, .mp-leave.px-pbtn.px-pbtn:focus-visible { --face: var(--px-face-hover); --hi: rgba(255, 255, 255, .22); --edge: var(--px-focus); }
#actions > button.px-pbtn.px-pbtn:active, #actions > button.px-pbtn.px-pbtn[data-pressed], .mp-leave.px-pbtn.px-pbtn:active, .mp-leave.px-pbtn.px-pbtn[data-pressed] { --face: var(--px-ink-deep); --shade: var(--px-ink-deep); --hi: transparent; }
#actions > button.px-pbtn--gold:active, #actions > button.px-pbtn--gold[data-pressed] { --edge: var(--px-gold-ext); }
#actions > button.px-pbtn--pink:active, #actions > button.px-pbtn--pink[data-pressed] { --edge: var(--px-pink-ext); }
#actions > button.px-pbtn--cyan:active, #actions > button.px-pbtn--cyan[data-pressed] { --edge: var(--px-cyan-ext); }
@media (hover: hover) {
  #actions > button.px-pbtn.px-pbtn:not(.ui-crt-zone):hover { transform: translateY(-2px); }   /* plain DOM look only: the painted look lifts itself and keeps the click zone still */
}
#actions > button.px-pbtn.px-pbtn:not(.ui-crt-zone):focus-visible { outline: 3px solid var(--px-focus); outline-offset: 4px; }
#actions > button.px-pbtn.px-pbtn:not(.ui-crt-zone):active { transform: translateY(2px); }
.game-cursor.gc-hot { filter: sepia(1) saturate(7) hue-rotate(-12deg) brightness(1.15); }   /* the game's arrow turns gold over anything clickable */

/* Leave race sat 98px up for a 70px row; keep the same gap to the taller row */
.mp-leave { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }

/* ---- Phone and narrow windows: Race friends and Leaderboard share the first line, Share sits centred on its own line under them */
@media (max-width: 760px) {
  #actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  #actions > #mp-open, #actions > .cb-claim { grid-column: 1; grid-row: 1; justify-self: stretch; }
  #actions > button.px-pbtn.lb-pill:not(.mp-pill):not(.cb-claim) { grid-column: 2; grid-row: 1; justify-self: stretch; }
  #actions > #share-open { grid-column: 1 / -1; grid-row: 2; justify-self: center; min-width: calc(50% - 4px); }
  #actions > button.px-pbtn.px-pbtn { --u: 3px; min-height: 56px; padding: calc(var(--u) + 11px) calc(var(--u) + 10px) calc(var(--u) + 12px); }
  #actions > .mp-pill, #actions > .lb-pill { flex: none; }
  .mp-leave.px-pbtn.px-pbtn { --u: 3px; min-height: 48px; }
  .mp-leave { bottom: calc(224px + env(safe-area-inset-bottom, 0px)); }
  #actions > #settings-open { grid-column: 1 / -1; grid-row: 3; justify-self: stretch; margin-top: 0; }   /* a phone: a third line, full width (its label is the longest) */
}
/* 440 to 760 wide (a big phone, a phone on its side): Race friends, Share and Leaderboard fit one line, Quality centred under them */
@media (min-width: 440px) and (max-width: 760px) {
  #actions { grid-template-columns: 1fr auto 1fr; }
  #actions > #share-open { grid-column: 2; grid-row: 1; justify-self: center; min-width: 0; }
  #actions > button.px-pbtn.lb-pill:not(.mp-pill):not(.cb-claim) { grid-column: 3; }
  #actions > #settings-open { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .mp-leave { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-height: 480px) and (orientation: landscape) {
  .mp-leave { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-height: 480px) and (min-width: 761px) { #actions > button.px-pbtn.px-pbtn { min-height: 52px; --u: 3px; } .mp-leave { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } }
@media (min-width: 761px) and (max-width: 1359px) { .mp-leave { bottom: calc(188px + env(safe-area-inset-bottom, 0px)); } }   /* two lines of actions under 1360 */
@media (min-width: 761px) and (max-width: 1359px) and (max-height: 480px) { .mp-leave { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }

/* ---- Share panel: built from the lobby's components (mp-panel px-bare, lb-head, mc-rule, mp-body, mp-link, px-pbtn mp-big), painted into the HUD canvas by
   modal-crt.js and styled by modal-pixel.css. Only what is specific to Share is here. No embed code any more (HAG-4889). Flat: no shadow, no radius, no scrim. */
.px-bare .shr-box { text-align: center; }

/* ---- Icon-only actions (ICON_ONLY in config/constants.js, action-icons.js sets html.icon-actions): the bottom actions are equal square pixel buttons (--act-size, 56px) in ONE
   row, centred and evenly spaced, with no lettering (ui-crt.js paints the icon; the old label stays as aria-label and title). Placed after the width rules above so it wins at
   any width; the few !important keep the id rules of the label layout (Share min width, Quality margin) from stretching a square. Icons at every width, no tooltips (HAG-4823, HAG-4824). */
/* Multiplayer chooser (multiplayer-chooser.js): the lobby's panel components, two options with a line under each. */
.mpc-panel .mp-body { gap: 8px; }
.mpc-panel .mp-big + .lb-hint { margin-bottom: 12px; }
html.icon-actions #actions { display: flex; flex-wrap: nowrap; justify-content: space-evenly; align-items: flex-end; gap: 0 4px; }
@media (min-width: 761px) { html.icon-actions #actions { justify-content: center; gap: 0 20px; } }   /* wider windows: one centred group, not spread over the whole width */
html.icon-actions #actions > button.px-pbtn.px-pbtn { --u: var(--act-u, 3px); flex: none; box-sizing: border-box; width: var(--act-size, 56px); height: var(--act-size, 56px); min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0; }
html.icon-actions #actions .pxl, html.icon-actions .mp-leave .pxl { display: none; }
html.icon-actions .mp-leave.px-pbtn.px-pbtn { --u: var(--act-u, 3px); box-sizing: border-box; width: var(--act-size, 56px); height: var(--act-size, 56px); min-width: 0; min-height: 0; padding: 0; bottom: calc(24px + var(--act-size, 56px) + 16px + env(safe-area-inset-bottom, 0px)) !important; }
@media (max-height: 480px) and (orientation: landscape) { html.icon-actions .mp-leave.px-pbtn.px-pbtn { bottom: calc(12px + var(--act-size, 56px) + 12px + env(safe-area-inset-bottom, 0px)) !important; } }
