/* The panels of the arena screens (home panels, private lobby, game overlays) take the screen's own
   palette (dark or sand, Options › Interface) instead of the beach's cream, and keep the skins'
   shapes: a lit face over a darker base, a thin edge, the lift on hover. The skins (*-arena.css,
   game-arena.css, arena-theme.css) paint every card, row and pill from the tokens below, so
   remapping them here restyles all the panels at once. The selection keeps the arena's light mint
   with dark ink; the main action of a screen is the theme accent. The live court and the home's
   own screen keep the beach. */
:where(.arcade-panel, .arcade-tutorial-invite, .players-screen, .player-profile-dialog, .lobby-screen,
  .lobby-system-modal .modal-content, .auth-screen-modal .auth-screen, .training-start-overlay, #pause-overlay,
  .training-tutorial-finish, .endgame-overlay, .match-options, #ragequit-confirm, .game-loading,
  .matchmaking-overlay, .warmup-card) {
  --panel-veil: var(--screen-bg);
  --home-white: var(--screen-ink);
  --home-steel: var(--screen-muted);
  --home-panel: var(--screen-panel);
  --home-mint: var(--screen-mint);
  --home-gold: var(--screen-warning);
  /* Outlines, and the ink on the mint selection: dark in both screen palettes. */
  --home-outline: #0b1411;
  /* Cards and rows. */
  --block-top: var(--screen-panel);
  --block-bottom: var(--screen-panel);
  --block-base: color-mix(in srgb, var(--screen-shadow) 55%, var(--screen-panel));
  --block-edge: var(--screen-line);
  --block-gloss: 0;
  --block-ink: var(--screen-ink); --block-muted: var(--screen-muted); --block-accent: var(--screen-accent);
  --block-well: var(--screen-bg); --block-line: var(--screen-line);
  --block-good: var(--screen-mint); --block-offline: var(--screen-muted);
  /* Pills: Retour, filters, the small arrows. */
  --slab-top: var(--screen-raised);
  --slab-bottom: var(--screen-raised);
  --slab-base: color-mix(in srgb, var(--screen-shadow) 55%, var(--screen-raised));
  --slab-edge: var(--screen-line);
}

/* The surface: the screen's background, without the blurred beach. Three id exclusions: on the
   lobby and game pages the skins load after this file, with two. */
body :where(.arcade-panel, .arcade-tutorial-invite, .players-screen, .player-profile-dialog, .lobby-screen,
  .lobby-system-modal .modal-content, .auth-screen-modal .auth-screen, .training-start-overlay, #pause-overlay,
  .training-tutorial-finish, .endgame-overlay, .match-options, #ragequit-confirm, .game-loading,
  .matchmaking-overlay, .warmup-card):not(#_):not(#_):not(#_) {
  background: var(--screen-bg); color: var(--screen-ink);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  &::before { content: none; }

  /* Containers are surfaces, not oversized buttons. Keep their geometry and
     selected states, but remove the bevel and the shadow beneath each block. */
  :is(.character-preview, .shop-detail, .challenge-card, .challenges-chest,
    .character-name-entry, .look-row, .character-emotes-link, .animation-row,
    .emote-slot, .arcade-system-row, .arcade-key-row, .players-character, .players-spotlight,
    .account-field-entry) {
    --block-ink: var(--screen-ink); --block-muted: var(--screen-muted);
    --block-accent: var(--screen-accent);
    border: 1px solid var(--screen-line);
    background: var(--screen-panel); box-shadow: none; filter: none;
    color: var(--screen-ink);
    /* :where() so the accent tint of the selection below wins over this plain hover face
       (:has(input:focus) would otherwise outrank it). */
    &:where(:hover, .is-selected, :focus-visible, :has(input:focus)) {
      --block-ink: var(--screen-ink); --block-muted: var(--screen-muted);
      --block-accent: var(--screen-accent);
      background: var(--screen-raised); box-shadow: none; filter: none; translate: none;
    }
  }
  /* A little colour around the character and the section labels keeps the
     interior screens welcoming, without bringing back glossy bevels. */
  .character-preview {
    background: color-mix(in srgb, var(--screen-mint) 12%, var(--screen-panel));
    border-color: color-mix(in srgb, var(--screen-mint) 30%, var(--screen-line));
  }
  :is(.look-row, .character-emotes-link, .animation-row, .arcade-system-row, .arcade-key-row):is(.is-selected, :focus-visible) {
    border-color: color-mix(in srgb, var(--screen-accent) 70%, var(--screen-line));
    background: color-mix(in srgb, var(--screen-accent) 14%, var(--screen-panel));
  }
  /* A chosen thing: the player shown on the right takes a mint edge and tint (like a chosen card in
     the shop), the account form's mode a mint chip. */
  .players-character[aria-pressed='true'] {
    border-color: var(--screen-mint); background: color-mix(in srgb, var(--screen-mint) 14%, var(--screen-panel));
    &:is(:hover, .is-selected, :focus-visible) { background: color-mix(in srgb, var(--screen-mint) 20%, var(--screen-panel)); }
  }
  .account-mode {
    border: 1px solid var(--screen-line); border-radius: 999px;
    background: var(--screen-panel); box-shadow: none; filter: none;
    &:is(:hover, .is-selected, :focus-visible) { background: var(--screen-raised); box-shadow: none; filter: none; translate: none; }
  }
  .account-mode-option.is-active { background: var(--mint-bottom); box-shadow: none; color: var(--home-outline); }
  /* COMMANDES: the move the demo is playing, in the mint of the demo's lettering. */
  .arcade-key-row.is-demo {
    border-color: color-mix(in srgb, var(--screen-mint) 75%, var(--screen-line));
    background: color-mix(in srgb, var(--screen-mint) 24%, var(--screen-panel)); color: var(--screen-mint);
    dt { color: var(--screen-mint); }
  }

  :is(.arcade-page-title, .character-section-heading h3, .character-name-label,
    .emote-screen-heading, .animation-card-title, .team h2) {
    -webkit-text-stroke: 0; text-shadow: none; color: var(--screen-ink);
  }

  :is(.character-section-heading h3, .character-name-label, .emote-screen-heading) {
    color: var(--screen-mint);
  }

  /* Buttons stay quiet: a flat face, a thin edge and a small base, no gloss nor drop shadow; a
     one-pixel lift on hover, a press that flattens the base. The lists are :where() so that the
     states below, and the main action's colours, take over by order. */
  :where(.arcade-page-back, .shop-filter, .challenges-tab, .shop-pager-step, .players-filters button, .players-pagination button,
    .btn-launch-game, .wardrobe-done, .character-done, .account-submit, .auth-screen-submit,
    .join-lobby-submit, .shop-buy, .shop-launch-go, .arcade-tutorial-invite-start, .players-profile-button,
    .lobby-modal-action, #training-start-play, #training-start-commands-back,
    .game-modal-button:not(.game-modal-button-secondary), .endgame-button.is-primary,
    .character-profile-trigger, .character-prestige-button, .character-guest-login, .emote-guest-cta) {
    --btn-face: var(--screen-raised); --btn-face-hover: color-mix(in srgb, var(--screen-accent) 10%, var(--screen-raised));
    --btn-edge-color: var(--screen-line); --btn-base: var(--slab-base); --btn-ink: var(--screen-ink);
    border: 1px solid var(--btn-edge-color); border-radius: 8px;
    background: var(--btn-face) padding-box;
    box-shadow: inset 0 -2px 0 var(--btn-base);
    color: var(--btn-ink); filter: none; text-shadow: none; -webkit-text-stroke: 0;
    transition: translate 140ms ease-out, background-color 120ms ease-out;
    &:is(:hover, :focus-visible, .is-selected):not(:disabled, .disabled, .is-disabled, [aria-disabled='true']) {
      background: var(--btn-face-hover) padding-box; color: var(--btn-ink); filter: none; translate: 0 -1px;
    }
    &:active:not(:disabled, .disabled, .is-disabled, [aria-disabled='true']) {
      translate: 0 1px; box-shadow: inset 0 -1px 0 var(--btn-base); transition-duration: 60ms;
    }
    @media (prefers-reduced-motion: reduce) { transition: none; }
  }
  /* The chosen filter: the arena's mint, the one coloured face among them. */
  :is(.shop-filter[aria-selected='true'], .challenges-tab[aria-selected='true'], .players-filters button[aria-pressed='true']) {
    --btn-face: var(--mint-bottom); --btn-face-hover: color-mix(in srgb, var(--mint-bottom) 85%, #fff);
    --btn-edge-color: var(--mint-ink); --btn-base: var(--mint-base); --btn-ink: var(--home-outline);
  }
  .shop-pager-step .look-pixel-arrow { background: var(--btn-ink); }
  /* The guest banner's call to sign up: the theme accent, as the banner's own edge. */
  .emote-guest-cta {
    --btn-face: var(--screen-accent); --btn-face-hover: color-mix(in srgb, var(--screen-accent) 88%, #fff);
    --btn-edge-color: color-mix(in srgb, var(--screen-accent) 62%, #000);
    --btn-base: color-mix(in srgb, var(--screen-accent) 62%, #000); --btn-ink: var(--screen-accent-ink);
  }
  /* Prestige (back to level 1 for an emblem) keeps the arena's mint: a rare, deliberate step. */
  .character-prestige-button {
    --btn-face: var(--mint-bottom); --btn-face-hover: color-mix(in srgb, var(--mint-bottom) 85%, #fff);
    --btn-edge-color: var(--mint-ink); --btn-base: var(--mint-base); --btn-ink: var(--home-outline);
  }

  /* The look arrows (MON PERSO, Animations, the lobby's wardrobe): small keys like the buttons. On
     hover they take the accent and their arrow points a step further; a click, or a ←/→ step from the
     keys or the pad (look-carousel.js .is-stepping), presses them in. */
  .look-row-arrow:not(.look-row-arrow-spacer) {
    display: grid; place-items: center; width: clamp(32px, 4.4cqh, 40px); height: clamp(32px, 4.4cqh, 40px); min-width: 0; padding: 0; box-sizing: border-box;
    border: 1px solid var(--slab-edge); border-radius: 8px;
    background: var(--slab-bottom) padding-box;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), inset 0 -3px 0 var(--slab-base);
    filter: none; cursor: pointer;
    transition: translate 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out, box-shadow 80ms ease-out;
    .look-pixel-arrow { background: var(--home-white); translate: 1px 0; transition: translate 140ms cubic-bezier(0.22, 1, 0.36, 1), background-color 120ms ease-out; }
    .look-pixel-arrow-left { translate: -1px 0; }
    &:hover {
      border-color: color-mix(in srgb, var(--screen-accent) 55%, var(--slab-edge));
      background-color: color-mix(in srgb, var(--screen-accent) 20%, var(--slab-bottom)); translate: 0 -1px;
      .look-pixel-arrow { background: var(--screen-accent); translate: 3px 0; }
      .look-pixel-arrow-left { translate: -3px 0; }
    }
    &:active { translate: 0 1px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), inset 0 -1px 0 var(--slab-base); transition-duration: 60ms; }
    &.is-stepping { animation: look-arrow-step 200ms ease-out; .look-pixel-arrow { animation: look-arrow-glow 200ms ease-out; } }
    @media (prefers-reduced-motion: reduce) {
      transition: none; .look-pixel-arrow { transition: none; }
      &.is-stepping, &.is-stepping .look-pixel-arrow { animation: none; }
    }
  }
  .players-search { border-width: 1px; border-color: var(--screen-line); border-radius: 8px; background: var(--screen-panel) padding-box; filter: none; }

  /* The main action, in the theme accent, a little taller. */
  :where(.btn-launch-game, .wardrobe-done, .character-done, .account-submit, .auth-screen-submit,
    .join-lobby-submit, .shop-buy, .shop-launch-go, .arcade-tutorial-invite-start, .players-profile-button,
    .lobby-modal-action, #training-start-play, #training-start-commands-back,
    .game-modal-button:not(.game-modal-button-secondary), .endgame-button.is-primary) {
    --btn-face: var(--screen-accent); --btn-face-hover: color-mix(in srgb, var(--screen-accent) 88%, #fff);
    --btn-edge-color: color-mix(in srgb, var(--screen-accent) 62%, #000);
    --btn-base: color-mix(in srgb, var(--screen-accent) 62%, #000); --btn-ink: var(--screen-accent-ink);
    min-height: clamp(44px, 7.6cqh, 60px); padding: 8px clamp(14px, 2cqw, 24px);
    font-size: clamp(18px, 3.2cqh, 26px); line-height: 1.15;
    .fa-solid, .shop-price, .shop-price-full { color: inherit; }
    .coin-icon { opacity: 1; filter: none; }
    &:is(:disabled, .disabled, .is-disabled, [aria-disabled='true']) {
      --btn-face: var(--screen-raised); --btn-edge-color: var(--screen-line); --btn-base: var(--screen-line); --btn-ink: var(--screen-muted);
    }
  }

}
/* Keyboard and gamepad: no cursor, so the chosen button says it itself, with a clearer face, its
   edge in the accent and a small lift. The mouse keeps the quiet hover above. */
body:not([data-ui-input='pointer']) :where(.arcade-panel, .arcade-tutorial-invite, .players-screen, .player-profile-dialog, .lobby-screen,
  .lobby-system-modal .modal-content, .auth-screen-modal .auth-screen, .training-start-overlay, #pause-overlay,
  .training-tutorial-finish, .endgame-overlay, .match-options, #ragequit-confirm, .game-loading,
  .matchmaking-overlay, .warmup-card):not(#_):not(#_):not(#_)
  :where(.arcade-page-back, .shop-filter, .challenges-tab, .shop-pager-step, .players-filters button,
    .players-pagination button, .btn-launch-game, .wardrobe-done, .character-done, .account-submit, .auth-screen-submit,
    .join-lobby-submit, .shop-buy, .shop-launch-go, .arcade-tutorial-invite-start, .players-profile-button,
    .lobby-modal-action, #training-start-play, #training-start-commands-back,
    .game-modal-button:not(.game-modal-button-secondary), .endgame-button.is-primary,
    .character-profile-trigger, .character-prestige-button, .character-guest-login, .emote-guest-cta
  ):is(.is-selected, .console-selected, :focus-visible,
    /* The training card's buttons take the focus from the script, without :focus-visible. */
    :is(#training-start-play, #training-start-commands-back):focus
  ):not(:disabled, .disabled, .is-disabled, [aria-disabled='true']) {
  --btn-edge-color: var(--screen-accent);
  background: color-mix(in srgb, var(--btn-face) 78%, var(--screen-ink)) padding-box;
  translate: 0 -2px;
}
/* Keyboard and gamepad: the home menu cards' double ring and breath (home-arena.css). */
body:not([data-ui-input='pointer']) .arcade-tutorial-invite:not(#_):not(#_):not(#_)
  .arcade-tutorial-invite-start:is(.is-selected, :focus-visible):not(:active) {
  box-shadow: inset 0 -2px 0 var(--btn-base), 0 0 0 3px var(--screen-scene-shadow), 0 0 0 6px var(--screen-scene-ink);
  animation: home-card-breathe 1.1s ease-in-out infinite alternate;
  @media (prefers-reduced-motion: reduce) { animation: none; }
}
/* Sand screens (body[data-ui-mode='light']): their dark titles lose the dark outline. */
body[data-ui-mode='light'] :where(.arcade-panel, .players-screen, .player-profile-dialog, .lobby-screen):not(#_):not(#_):not(#_)
  :is(.arcade-page-title, .character-section-heading h3, .character-name-label, .emote-screen-heading, .animation-card-title, .team h2) {
  -webkit-text-stroke: 0; text-shadow: none;
}

/* Touch: every control of a panel at least a finger high. */
@media (pointer: coarse) {
  body :is(.arcade-panel, .lobby-screen, .players-screen, .auth-screen-modal):not(#_):not(#_):not(#_)
    :is(button, .arcade-page-back, .ready-toggle, .look-row-arrow:not(.look-row-arrow-spacer)) {
    min-height: 44px;
  }
  body :is(.arcade-panel, .lobby-screen):not(#_):not(#_):not(#_)
    :is(.card-action, .bot-difficulty-step, .look-row-arrow:not(.look-row-arrow-spacer)) { min-width: 44px; }
}
@keyframes look-arrow-step {
  0%, 45% {
    translate: 0 1px; background-color: color-mix(in srgb, var(--screen-accent) 30%, var(--slab-bottom));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .08), inset 0 -1px 0 var(--slab-base);
  }
}
@keyframes look-arrow-glow { 0%, 45% { background-color: var(--screen-accent); } }
