/* Small cabinet controls in the browser corner, outside the 4:3 screen: Discord, then Ko-fi. */
.corner-links {
  position: fixed; right: clamp(12px, 2vw, 28px); bottom: var(--arcade-control-bottom);
  z-index: 20; display: flex; align-items: center; gap: 8px;
}
.support-corner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 9px 6px; border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, transparent);
  border-radius: 3px;
  color: #bdc9c2;
  background: color-mix(in srgb, var(--theme-accent) 7%, #101817 93%);
  box-shadow: 0 2px 0 rgb(0 0 0 / 28%);
  font: 19px/1 'Jersey 15', sans-serif; letter-spacing: .04em;
  text-decoration: none; opacity: .86; white-space: nowrap;
  transition: color 120ms steps(2, end), border-color 120ms steps(2, end), background 120ms steps(2, end), opacity 120ms steps(2, end), transform 120ms steps(2, end);
}

.support-corner-heart {
  position: relative;
  display: grid;
  place-items: center;
  width: 16px;
  height: 14px;
  color: var(--theme-accent);
  transform-origin: 50% 58%;
  animation: support-heartbeat 6.2s ease-in-out infinite;
}
@media (min-width: 761px) {
  .support-corner { box-sizing: border-box; height: var(--arcade-control-height); }
}

.support-corner-heart svg { display: block; overflow: visible; }

/* Discord: the community's door, in Discord's own blurple so it reads at a glance. Hidden during
   training only (the home shows it the rest of the time). */
.discord-corner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px 6px; border: 1px solid #3c45a5; border-radius: 3px;
  color: #fff; background: #5865f2; box-shadow: 0 2px 0 rgb(0 0 0 / 28%);
  font: 19px/1 'Jersey 15', sans-serif; letter-spacing: .04em;
  text-decoration: none; white-space: nowrap;
  transition: background 120ms steps(2, end), transform 120ms steps(2, end);
}
.discord-corner-chip { display: grid; flex: none; place-items: center; }
.discord-corner-logo { display: block; flex: none; overflow: visible; }
.discord-corner:is(:hover, :focus-visible) { outline: none; color: #fff; background: #6a76f5; transform: translateY(-1px); }
@media (min-width: 761px) {
  .discord-corner { box-sizing: border-box; height: var(--arcade-control-height); }
}
/* Narrow windows: the logo alone, so the corner stays clear of the keyboard legend. */
@media (max-width: 1100px) {
  .discord-corner-label { display: none; }
}
body:is(.is-training-play, :has(.training-arcade)) .discord-corner { display: none; }

/* Lobby and online match: the emotes share the row under the screen, so the corner narrows sooner.
   Discord shows its logo alone in a match, and in the lobby below 1400px; Ko-fi keeps its label from
   1101px. --corner-links-room is how much each side of the row the corner needs; the match's emote
   bar stays inside it (match-arcade.css). */
body:has(.match-arcade) { --corner-links-room: 262px; }
body:has(.match-arcade) .discord-corner-label { display: none; }
@media (max-width: 1399px) {
  body:has(.lobby-screen) .discord-corner-label { display: none; }
}
@media (max-width: 1100px) {
  body:has(.match-arcade, .lobby-screen) .support-corner-label { display: none; }
  body:has(.match-arcade) { --corner-links-room: 200px; }
}

.support-corner:is(:hover, :focus-visible) {
  outline: none;
  color: #eef5f1;
  border-color: color-mix(in srgb, var(--theme-accent) 58%, transparent);
  background: color-mix(in srgb, var(--theme-accent) 13%, #101817 87%);
  opacity: 1;
  transform: translateY(-1px);
}

.support-corner:is(:hover, :focus-visible) .support-corner-heart {
  animation: support-heart-pop 900ms ease-in-out 1;
}

@keyframes support-heartbeat {
  0%, 8%, 16%, 24%, 100% { color: var(--theme-accent); transform: scale(1); filter: none; }
  4% { color: #eef5f1; transform: scale(1.16); filter: drop-shadow(0 0 2px color-mix(in srgb, var(--theme-accent) 48%, transparent)); }
  12% { color: #eef5f1; transform: scale(1.1); filter: drop-shadow(0 0 2px color-mix(in srgb, var(--theme-accent) 34%, transparent)); }
}

@keyframes support-heart-pop {
  0%, 34%, 70%, 100% { color: var(--theme-accent); transform: scale(1); filter: none; }
  17% { color: #eef5f1; transform: scale(1.16); filter: drop-shadow(0 0 2px color-mix(in srgb, var(--theme-accent) 48%, transparent)); }
  52% { color: #eef5f1; transform: scale(1.1); filter: drop-shadow(0 0 2px color-mix(in srgb, var(--theme-accent) 34%, transparent)); }
}

@media (max-width: 760px) {
  /* Stacked, Discord above Ko-fi: one square wide, the keyboard legend keeps its room. */
  .corner-links { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); flex-direction: column; }
  .support-corner { padding: 8px; font-size: 17px; }
  .discord-corner { padding: 6px; }
  .support-corner-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .support-corner,
  .support-corner-heart,
  .support-corner:is(:hover, :focus-visible) .support-corner-heart {
    animation: none;
    transition: none;
  }
}

/* Musique (menu-music.js) : une pastille carrée en miroir de « Nous soutenir », juste la double croche
   pixel (arcade-ui.css .pixel-icon), avec de l'air autour. Barrée et éteinte quand la musique est coupée. M en raccourci (infobulle). */
.music-corner {
  position: fixed; left: clamp(12px, 2vw, 28px); bottom: var(--arcade-control-bottom);
  z-index: 20; display: grid; place-items: center;
  width: var(--arcade-control-height); height: var(--arcade-control-height); padding: 0;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, transparent);
  border-radius: 3px;
  color: var(--theme-accent);
  background: color-mix(in srgb, var(--theme-accent) 7%, #101817 93%);
  box-shadow: 0 2px 0 rgb(0 0 0 / 28%);
  opacity: .86; cursor: pointer;
  animation: music-corner-in 220ms steps(4, end) backwards;
  transition: color 120ms steps(2, end), border-color 120ms steps(2, end), background 120ms steps(2, end), opacity 120ms steps(2, end), transform 120ms steps(2, end);
}
.music-corner:is(:hover, :focus-visible) {
  outline: none;
  color: #eef5f1;
  border-color: color-mix(in srgb, var(--theme-accent) 58%, transparent);
  background: color-mix(in srgb, var(--theme-accent) 13%, #101817 87%);
  opacity: 1;
  transform: translateY(-1px);
}
.music-corner.is-off { color: #7d8c84; opacity: .7; }
.music-corner.is-off .pixel-icon { --pixel-icon: url('/images/icons/music-off.png?v=3'); }
@keyframes music-corner-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 760px) {
  .music-corner { left: 8px; bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .music-corner { animation: none; transition: none; }
}

/* Bouton clavier, à droite du bouton musique : ouvre le carton des commandes (controls-card.js). */
.controls-corner {
  position: fixed; left: calc(clamp(12px, 2vw, 28px) + 52px); bottom: var(--arcade-control-bottom);
  z-index: 20; display: grid; place-items: center;
  width: var(--arcade-control-height); height: var(--arcade-control-height); padding: 0;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, transparent);
  border-radius: 3px;
  color: var(--theme-accent);
  background: color-mix(in srgb, var(--theme-accent) 7%, #101817 93%);
  box-shadow: 0 2px 0 rgb(0 0 0 / 28%);
  opacity: .86; cursor: pointer;
  animation: music-corner-in 220ms steps(4, end) backwards;
  transition: color 120ms steps(2, end), border-color 120ms steps(2, end), background 120ms steps(2, end), opacity 120ms steps(2, end), transform 120ms steps(2, end);
}
.controls-corner:is(:hover, :focus-visible) {
  outline: none; color: #eef5f1; opacity: 1; transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--theme-accent) 58%, transparent);
  background: color-mix(in srgb, var(--theme-accent) 13%, #101817 87%);
}
/* Bulle ouverte : le bouton reste allumé, sans changer de taille ni de place (même boîte que le
   bouton musique) ; seuls son liseré et son fond s'éclairent. */
.controls-corner.is-on {
  opacity: 1; border-color: color-mix(in srgb, var(--theme-accent) 58%, transparent);
  background: color-mix(in srgb, var(--theme-accent) 13%, #101817 87%);
}

.controls-corner[hidden] { display: none !important; }

/* La bulle : une pièce de la même console. Le bord d'écran de l'accueil (--arcade-bezel, arcade-ui.css)
   en version fine : lèvre noire, coque vert foncé éclairée en haut à gauche, ombre franche en bas à
   droite, et le halo de la scène en réduction (allumé comme le grand écran, sans le concurrencer).
   Dedans, la surface de l'écran : jetons --screen-*, donc sombre ou sable
   comme le grand écran (Options › Interface). La coque dépasse de SHELL px (controls-card.js). */
.controls-card[hidden] { display: none !important; }
.controls-card {
  position: fixed; z-index: 31; display: flex; flex-direction: column; gap: 12px;
  padding: 14px 12px 16px; overflow: auto; scrollbar-width: none;
  border: 0; border-radius: 6px; background: var(--screen-bg); color: var(--screen-ink);
  box-shadow:
    inset 0 0 0 2px #020403, inset 0 6px 10px #00000059,
    0 0 0 1px #030706, 0 0 0 3px #1b2925, -1px -1px 0 4px #52665e, 2px 2px 0 4px #0b1411, 0 0 0 5px #040807,
    0 0 48px 12px color-mix(in srgb, var(--scene-glow) 20%, transparent);
  font-family: 'Jersey 15', sans-serif; container-type: inline-size;
  animation: controls-card-in 180ms steps(3, end) backwards;
}
@keyframes controls-card-in { from { opacity: 0; transform: translateY(6px); } }
.controls-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--screen-line);
}
.controls-card-head h2 { margin: 0; color: var(--screen-accent); font: 21px/1 'Jersey 15', sans-serif; letter-spacing: .03em; }
.controls-card-close {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 2px 2px 4px; border: 0; border-radius: 0;
  background: none; color: var(--screen-muted); font: 24px/1 'Jersey 15', sans-serif; cursor: pointer;
}
.controls-card-close kbd { padding: 0; border: 0; background: none; color: inherit; font: 12px/1 'PixelArt', monospace; box-shadow: none; }
.controls-card-close:is(:hover, :focus-visible) { outline: none; color: var(--screen-accent); }
/* Nom à gauche, touches à droite ; empilés si la bulle est trop étroite. */
.controls-card-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.controls-card-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.controls-card-name { color: var(--screen-ink); font-size: 20px; line-height: 1; white-space: nowrap; }
.controls-card-caps { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.controls-card-caps kbd {
  min-width: 28px; padding: 5px 6px 4px; border: 0; border-radius: 2px;
  background: var(--screen-raised); color: var(--screen-accent); box-shadow: 0 3px 0 var(--screen-shadow);
  text-align: center; font: 15px/1 'PixelArt', monospace;
}
/* Lettre à la couleur du thème, comme dans les écrans COMMANDES ; pressée, la touche s'enfonce sans
   changer de couleur. */
.controls-card-caps kbd.is-pressed { box-shadow: 0 1px 0 var(--screen-shadow); transform: translateY(2px); }
.controls-card-or { color: var(--screen-muted); font-size: 17px; line-height: 1; }
@container (max-width: 250px) {
  .controls-card-list li { flex-direction: column; align-items: flex-start; gap: 6px; }
  .controls-card-caps { justify-content: flex-start; }
  .controls-card-close kbd { display: none; }
}
@media (max-width: 760px) {
  .controls-corner, .controls-card { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .controls-corner, .controls-card { animation: none; transition: none; }
}

/* Simple Analytics credit (free plan), first in the corner links. One place on every screen: above
   the buttons, in two short quiet lines aligned on their right edge (the row itself is left to the key
   hints, and to the emotes in the online match and the lobby). On one line it ran 240px left and
   over the cabinet frame's bottom-right corner at 1440×900; on two it stays outside the frame. Its rules below are the snippet from
   simpleanalytics.com/badges.md, unchanged: the link takes this box's font and colour. Keep the link
   and its UTM codes intact, they are how the badge is detected. */
.sa-credit-corner {
  position: absolute; right: 0; bottom: calc(100% + 10px); margin: 0;
  color: #5f716a; font: 10.5px/1.35 'Nunito', sans-serif; text-align: right;
  white-space: nowrap; transition: color 120ms steps(2, end);
}
.sa-credit-corner a.sa-credit > span { display: block !important; }
.sa-credit-corner:has(a:is(:hover, :focus-visible)) { color: #bdc9c2; }
/* The player profile is a modal over the whole page: the corner row (credit included) stays above it,
   outside the 4:3 screen, instead of being cut by the profile's frame. */
body.has-player-profile-open .corner-links { z-index: 1201; }
/* ...but only the credit is above it: Support and Discord let the click through to the profile's
   backdrop, like music and controls on the left, which the profile covers. */
body.has-player-profile-open .corner-links > :not(.sa-credit-corner) { pointer-events: none; }
@media (max-width: 760px) {
  .corner-links .sa-credit-corner { position: absolute; right: 0; bottom: calc(100% + 8px); margin: 0; }
}

  a.sa-credit, a.sa-credit:visited, a.sa-credit:hover, a.sa-credit:active {
    all: unset !important; display: block !important; cursor: pointer !important;
    line-height: 1.6 !important;
  }
  a.sa-credit:focus-visible {
    outline: 2px solid currentColor !important; outline-offset: 4px !important;
  }
  a.sa-credit > span { all: unset !important; }
  a.sa-credit > .sa-credit__byline { white-space: nowrap !important; }
  a.sa-credit svg {
    all: unset !important; display: inline-block !important;
    height: 0.914em !important; vertical-align: -0.2em !important;
    fill: currentColor !important;
  }
  @supports (height: 1cap) {
    a.sa-credit svg { height: 1.305714cap !important; vertical-align: -0.285714cap !important; }
  }
