/* Arena colours, shared by the home and the game screens, on the body (the controls around the
   screen live outside it): the home's, the online match page's (body:has(.match-arcade)) and the
   private lobby's (body:has(.lobby-screen)), and the standalone training page's (body:has(.training-arcade)). In
   the cabinet's training iframe, game.pug puts .arena-theme on the stage. The theme is
   body[data-theme] (layout.pug). On the game pages they replace the old --home-* palette of
   game.css, whose screens game-arena.css redraws. */
:is(.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen)), .arena-theme) {
  --home-outline: #10162e;
  --home-panel: rgb(16 26 56 / .82);
  /* The navy slabs (shortcuts, wallet, corner controls): face top and bottom, base, edge. The theme
     (body[data-theme], Options or the home's swatches) retints them, with --home-panel and the
     scene's tint; the pastel cards keep their colours. */
  --slab-top: #42589c; --slab-bottom: #2d3d78; --slab-base: #1c2753; --slab-edge: var(--home-outline);
  --scene-tint: linear-gradient(transparent, transparent);
  /* The blocks of the other screens (players' tiles, shop cards, settings rows, panels): face top
     and bottom, base, edge and highlight; their lettering, quieter captions and accent (an online
     status, a value); the wells and rules inside them; a success green; and the veil over the
     beach behind those screens. The theme redefines them all. */
  --block-top: #fff8e8; --block-bottom: #f3e6c8; --block-base: #d4bd8f; --block-edge: #7a5c2c; --block-gloss: .6;
  --block-ink: var(--home-outline); --block-muted: #6b6f86; --block-accent: #2f6e5b;
  --block-well: rgb(255 255 255 / .55); --block-line: rgb(16 22 46 / .18); --block-offline: #bdb7a8; --block-good: #2f8a57;
  --panel-veil: linear-gradient(180deg, rgb(10 20 52 / .58), rgb(10 20 52 / .32) 30%, rgb(10 20 52 / .5));
  /* Mint, the selection and the main action, is the same in every theme. */
  --mint-top: #d4f5e8; --mint-bottom: #9fd9c3; --mint-base: #5e9a84; --mint-ink: #2f6e5b;
  --home-white: #fff;
  --home-green: #43d17a;
  --home-pink: #ff6fae;
  --home-gold: #ffc83d;
  --home-steel: #a9bce0;
  --home-mint: #8fe3c6;
  /* Button recipe, shared by every screen: a thin edge in the button's own dark tint (whole pixels,
     at least 2, so it stays crisp), a top highlight and a darker base for the relief, and a soft
     shadow under it rather than a solid drop. The cqh resolve where they are used. */
  --btn-edge: max(2px, round(.3cqh, 1px));
  --btn-soft: drop-shadow(0 .5cqh .7cqh rgb(10 20 52 / .35));
  --btn-soft-hover: drop-shadow(0 .9cqh 1cqh rgb(10 20 52 / .4));
  --btn-soft-press: drop-shadow(0 .2cqh .4cqh rgb(10 20 52 / .3));
}
/* Soleil couchant: plum slabs and a warm glow on the beach. */
:is(.arcade-home-body[data-theme='sunset'], body[data-theme='sunset']:is(:has(.match-arcade), :has(.lobby-screen)), [data-theme='sunset'] .arena-theme) {
  --home-panel: rgb(62 24 46 / .85);
  --slab-top: #8e4a6c; --slab-bottom: #6b3253; --slab-base: #47203a; --slab-edge: #2a0f22;
  /* No colour over the beach (a pink veil, then a golden sky, both read as a filter on a daytime
     scene): the sunset theme is its accent and the halo around the screen. */
  --scene-tint: linear-gradient(transparent, transparent);
  --block-top: #ffeadc; --block-bottom: #f9c9ab; --block-base: #df9775; --block-edge: #8a3f2a;
  --block-ink: #4a222c; --block-muted: #8c5a58; --block-accent: #2f6e5b;
  --block-well: rgb(255 255 255 / .5); --block-line: rgb(74 34 44 / .18); --block-offline: #c9a091;
  --panel-veil: linear-gradient(180deg, rgb(62 20 44 / .55), rgb(120 44 64 / .28) 30%, rgb(62 20 44 / .5));
}
/* Nuit: midnight slabs and a dark blue veil on the beach. */
:is(.arcade-home-body[data-theme='night'], body[data-theme='night']:is(:has(.match-arcade), :has(.lobby-screen)), [data-theme='night'] .arena-theme) {
  --home-panel: rgb(8 12 32 / .88);
  --slab-top: #2f3870; --slab-bottom: #1f2550; --slab-base: #121633; --slab-edge: #06081a;
  --scene-tint: linear-gradient(180deg, rgb(8 14 48 / .62), rgb(4 8 30 / .55));
  /* Blocks a step lighter than the veil, so they stand out from it, in white lettering. */
  --block-top: #40569a; --block-bottom: #2e3f7c; --block-base: #1c2753; --block-edge: var(--home-outline); --block-gloss: .2;
  --block-ink: var(--home-white); --block-muted: var(--home-steel); --block-accent: var(--home-mint);
  --block-well: rgb(255 255 255 / .07); --block-line: rgb(255 255 255 / .14); --block-offline: #6b7aa6; --block-good: #6ee69a;
  --panel-veil: linear-gradient(180deg, rgb(6 10 30 / .55), rgb(6 10 30 / .3) 30%, rgb(6 10 30 / .5));
}

/* ------------------------------------------- around the screen */
/* Music, controls and support sit on the page around the screen, on the home, the online match
   page and the private lobby. They take the home shortcuts' face: one slate-blue slab, a thin
   edge, a short base and a soft shadow (in px: they sit outside the screen's container), the icon
   in its own colour; a small lift on hover or keyboard focus, a press that flattens the base. The
   static pages in the frame (legal, 404, password reset, email check) too. */
:is(body.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen))) :is(.music-corner, .controls-corner, .support-corner, .discord-corner) {
  position: fixed; box-sizing: border-box; height: var(--arcade-control-height);
  border: 1px solid var(--screen-shortcut-edge); border-radius: 10px;
  background: var(--screen-shortcut-face);
  box-shadow: inset 0 -3px 0 var(--screen-shortcut-base);
  --drop-soft: drop-shadow(0 3px 6px rgb(0 0 0 / .35));
  /* !important: the shared control skin of game-controls.css resets filter on these controls. */
  filter: var(--drop-soft) var(--fx, ) !important;
  opacity: 1;
  transition: translate 140ms ease-out, background-color 140ms ease-out, border-color 120ms ease-out, filter 120ms ease-out;
  /* No square corner cursor of arcade-ui.css: the lift shows the focus. */
  &::after { content: none; }
  &:is(:hover, :focus-visible) {
    background: color-mix(in srgb, var(--screen-shortcut-face) 86%, var(--screen-scene-ink)); outline: 0;
    transform: none; translate: 0 -2px; --drop-soft: drop-shadow(0 5px 8px rgb(0 0 0 / .4));
  }
  &:active {
    translate: 0 1px; transition-duration: 60ms;
    box-shadow: inset 0 -1px 0 var(--screen-shortcut-base); --drop-soft: drop-shadow(0 1px 2px rgb(0 0 0 / .35));
  }
  @media (prefers-reduced-motion: reduce) { transition: none; }
}
/* Music and controls show their pixel icons (arcade-ui.css .pixel-icon; the note is crossed out when
   the music is off, support-corner.css). With its card open, the controls' white edge stays on. */
:is(body.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen))) .controls-corner.is-on {
  border-color: var(--home-white); outline: 2px solid var(--home-outline); outline-offset: 0;
}
/* Support and Discord (.corner-links): the same slate slab as music and controls, in light lettering;
   their colour sits in a chip before the label, the coral heart and Discord's blurple logo. The
   chip alone on narrow windows (support-corner.css). */
:is(body.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen))) :is(.support-corner, .discord-corner) {
  position: static; gap: 9px; padding: 0 14px 0 7px;
  color: var(--screen-scene-ink); font: 16px/1 var(--game-display-font); letter-spacing: .03em;
  text-transform: uppercase;
  -webkit-text-stroke: 0; text-shadow: 0 2px 0 rgb(0 0 0 / .25);
  &:is(:hover, :focus-visible) { color: var(--screen-scene-ink); }
  :is(.support-corner-heart, .discord-corner-chip) {
    width: 28px; height: 28px; box-sizing: border-box;
    border: 2px solid var(--home-outline); border-radius: 8px;
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / .14);
    color: var(--home-white);
  }
}
:is(body.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen))) .support-corner {
  .support-corner-heart {
    background: #f27a6c;
    /* Still at rest; the heart pops once on hover / focus. */
    animation: none;
    svg { animation: none; }
  }
  &:is(:hover, :focus-visible) .support-corner-heart { animation: none; svg { animation: home-heart-pop 700ms ease-in-out 1; } }
  @media (max-width: 760px) { padding: 0 7px; }
  @media (prefers-reduced-motion: reduce) { .support-corner-heart svg { animation: none !important; } }
}
:is(body.arcade-home-body, body:has(.match-arcade), body:has(.training-arcade), body:has(.lobby-screen), body:has(:is(.legal-screen, .error-screen, .reset-screen))) .discord-corner {
  .discord-corner-chip { background: #5865f2; }
  .discord-corner-logo { width: 17px; height: 17px; }
  @media (max-width: 1100px) { justify-content: center; width: var(--arcade-control-height); padding: 0; }
}
/* Lobby and online match: both turn to squares sooner, the emotes need the row (support-corner.css). */
body:has(.match-arcade) .discord-corner { justify-content: center; width: var(--arcade-control-height); padding: 0; }
@media (max-width: 1399px) {
  body:has(.lobby-screen) .discord-corner { justify-content: center; width: var(--arcade-control-height); padding: 0; }
}
@media (max-width: 1100px) {
  :is(body:has(.match-arcade), body:has(.lobby-screen)) .support-corner { justify-content: center; width: var(--arcade-control-height); padding: 0; }
}
@keyframes home-heartbeat { 0%, 8%, 16%, 24%, 100% { scale: 1; } 4% { scale: 1.25; } 12% { scale: 1.15; } }
@keyframes home-heart-pop { 25% { scale: 1.3; } 60% { scale: 1.12; } }

/* Emotes under the screen (the cabinet's training dock, the online match's and the lobby's bars): one
   quiet tray in the screen's palette, as tall as the controls around it, rather than a row of pills.
   Inside, flat entries: the key on a small keycap, then the phrase (or its icon in the lobby); on
   hover the entry takes a tint and its keycap the theme accent. One id exclusion: match-arcade.css
   and lobby-arcade.css, loaded after this file, clear the bar's frame. */
:is(.arcade-home-body .arcade-emote-dock, body:has(.match-arcade) .match-arcade .emote-bar, body:has(.lobby-screen) .lobby-emote-bar):not(#_) {
  gap: 2px; height: var(--arcade-control-height); padding: 4px; box-sizing: border-box;
  border: 1px solid var(--screen-line); border-radius: 10px;
  background: color-mix(in srgb, var(--screen-panel) 92%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 4px 10px rgb(0 0 0 / .3);
}
:is(.arcade-home-body .arcade-emote-dock, body:has(.match-arcade) .match-arcade .emote-bar, body:has(.lobby-screen) .lobby-emote-bar) .emote-button {
  display: inline-flex; align-items: center; gap: 8px; width: auto; height: 100%; padding: 0 12px 0 5px; box-sizing: border-box;
  border: 0; border-radius: 7px; background: none; box-shadow: none;
  /* The phrases are lowercase sentences: Nunito, like the rest of the interface text; the keys keep Bungee. */
  color: var(--screen-ink); font: 800 16px/1 var(--game-text-font, 'Nunito', sans-serif); letter-spacing: 0; white-space: nowrap;
  filter: none; transition: background-color 120ms ease-out;
  &::after { content: none; }
  .emote-key {
    position: static; display: grid; place-items: center; flex: none; width: 22px; height: 22px; padding: 0 0 2px; box-sizing: border-box;
    border: 1px solid var(--screen-line); border-radius: 5px;
    background: var(--screen-raised); box-shadow: inset 0 -2px 0 var(--screen-shadow);
    color: var(--screen-accent); font: 13px/1 var(--game-display-font);
  }
  /* Pixel icons stay whole: no dimming at rest nor scaling on hover (game.css). */
  .emote-icon { color: var(--screen-muted); opacity: 1; transform: none; }
  &:is(:hover, :focus-visible):not(:disabled) {
    outline: 0; border: 0; color: var(--screen-ink); transform: none;
    background: color-mix(in srgb, var(--screen-accent) 12%, transparent);
    .emote-key { border-color: color-mix(in srgb, var(--screen-accent) 62%, #000); background: var(--screen-accent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--screen-accent) 62%, #000); color: var(--screen-accent-ink); }
    .emote-icon { color: var(--screen-ink); transform: none; }
  }
  &:active:not(:disabled) { background: color-mix(in srgb, var(--screen-accent) 20%, transparent); .emote-key { padding-bottom: 0; box-shadow: none; } }
  &:is(:disabled, .is-cooling) :is(.emote-key, .emote-label, .emote-icon) { opacity: .55; }
  @media (prefers-reduced-motion: reduce) { transition: none; }
}
/* Six match emotes need about 740px at full size: the bar (the screen's width, at most 100vw - 400px)
   gets that from 1140px wide and 730px high. Below, tighter entries keep the six default phrases
   whole (1024×640: 624px); the longest ones still end in « … ». */
@media (min-width: 761px) and (max-width: 1139px), (min-width: 761px) and (max-height: 729px) {
  :is(.arcade-home-body .arcade-emote-dock, body:has(.match-arcade) .match-arcade .emote-bar) .emote-button {
    gap: 5px; padding: 0 7px 0 3px; font-size: 14px;
    .emote-key { width: 20px; height: 20px; }
  }
}
/* Lobby: a key and an icon per entry, the phrase in the hover bubble. */
body:has(.lobby-screen) .lobby-emote-bar .emote-button.is-text { padding: 0 10px 0 5px; }

/* Sign-in / sign-up / forgot-password windows (modalPassport.pug), on the private lobby: a navy card
   over the dimmed lobby, an outlined white title, the fields as theme blocks, the main action in
   mint, the switch link as a theme pill. In px: the dialog sits outside the screen's container. */
body:has(.lobby-screen) .auth-screen-modal:not(#_) {
  .modal-content.auth-screen {
    border: 3px solid var(--slab-edge); border-radius: 22px;
    background: linear-gradient(180deg, var(--slab-top), var(--slab-bottom)) padding-box;
    box-shadow: inset 0 4px 0 rgb(255 255 255 / .2), inset 0 -12px 0 var(--slab-base), 0 18px 40px rgb(0 0 0 / .45);
    color: var(--home-white);
  }
  .auth-screen-header { border-bottom: 0; padding-bottom: 0; }
  .auth-screen-header .arcade-page-title {
    color: var(--home-white); font-family: var(--game-display-font); letter-spacing: .02em;
    -webkit-text-stroke: .16em var(--home-outline); paint-order: stroke fill; text-shadow: 0 .09em 0 var(--home-outline);
  }
  .auth-screen-header .game-brand {
    border: 0; background: none; box-shadow: none;
    filter: drop-shadow(2px 0 0 var(--home-outline)) drop-shadow(-2px 0 0 var(--home-outline))
      drop-shadow(0 2px 0 var(--home-outline)) drop-shadow(0 -2px 0 var(--home-outline)) drop-shadow(0 3px 0 var(--home-outline));
  }
  :is(.auth-screen-header .arcade-page-back, .auth-screen-switch button) {
    display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 16px; box-sizing: border-box;
    border: 2px solid var(--home-outline); border-radius: 999px; background: var(--home-panel); box-shadow: none;
    color: var(--home-white); font: 16px/1 var(--game-display-font); letter-spacing: .03em; text-transform: uppercase;
    &::after { content: none; }
    kbd { padding: 0; border: 0; background: none; color: var(--home-steel); font-size: 12px; }
    &:is(:hover, :focus-visible) { outline: 0; translate: 0 -2px; color: var(--home-white); background: var(--home-panel); filter: brightness(1.25); }
  }
  :is(.auth-screen-benefits li, .auth-screen-intro, .auth-screen-switch) { color: var(--home-white); font-family: var(--game-display-font); letter-spacing: .01em; }
  .auth-screen-intro { color: var(--home-steel); }
  .auth-screen-benefits .fa-solid { color: var(--home-gold); }
  .auth-screen-label {
    color: var(--home-white); font-family: var(--game-display-font); letter-spacing: .02em;
    -webkit-text-stroke: .16em var(--home-outline); paint-order: stroke fill;
  }
  .auth-screen-entry {
    min-height: 50px; border: 3px solid var(--block-edge); border-radius: 12px;
    background: linear-gradient(180deg, var(--block-top), var(--block-bottom)) padding-box;
    box-shadow: inset 0 3px 0 rgb(255 255 255 / var(--block-gloss)), inset 0 -6px 0 var(--block-base);
    &:focus-within { border-color: var(--mint-ink); box-shadow: inset 0 3px 0 rgb(255 255 255 / var(--block-gloss)), inset 0 -6px 0 var(--block-base), 0 0 0 3px var(--mint-bottom); }
  }
  .auth-screen-prompt, .auth-screen-entry:focus-within .auth-screen-prompt { color: var(--block-accent); font-family: var(--game-display-font); }
  .auth-screen-entry input { color: var(--block-ink); font-family: var(--game-display-font); }
  .auth-screen-message {
    border: 2px solid #9c2f22; border-radius: 12px; background: #ffd6cd; color: #6b1d14; font-family: var(--game-display-font);
  }
  .auth-screen-submit {
    min-height: 56px; border: 3px solid var(--mint-ink); border-radius: 12px;
    background: linear-gradient(180deg, var(--mint-top), var(--mint-bottom)) padding-box;
    box-shadow: inset 0 4px 0 rgb(255 255 255 / .6), inset 0 -10px 0 var(--mint-base);
    color: var(--home-outline); font: 22px/1 var(--game-display-font); letter-spacing: .03em; text-transform: uppercase;
    filter: drop-shadow(0 4px 6px rgb(10 20 52 / .35));
    &::before, &::after { content: none; display: none; }
    &:is(:hover, :focus-visible) { outline: 0; translate: 0 -2px; filter: drop-shadow(0 7px 8px rgb(10 20 52 / .4)) brightness(1.05); background: linear-gradient(180deg, var(--mint-top), var(--mint-bottom)) padding-box; }
    &:active { translate: 0 2px; box-shadow: inset 0 4px 0 rgb(255 255 255 / .6), inset 0 -5px 0 var(--mint-base); }
  }
  .auth-screen-switch { border-top: 0; }
}
body:has(.lobby-screen):has(.auth-screen-modal.show) .modal-backdrop.show { opacity: .55; background: #0a1434; }
/* The keyboard legend takes the emotes' place under the screen while a window is open. */
body:has(.lobby-screen):has(.auth-screen-modal.show) .lobby-emote-bar { visibility: hidden; }
