:root {
  color-scheme: dark;
  --ink: #fff8e8;
  --yellow: #ffdc36;
  --red: #ed2431;
  --black: #130c1a;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #160d23;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overscroll-behavior: none; }
body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 35%, #76398b, #190f28 75%);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.arcade {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: min(100vw, 100dvh, 640px);
  height: min(100vw, 100dvh, 640px);
  min-height: 340px;
  min-width: 0;
  /* Avoid a scroll container: focusing the canvas after replay must not
     scroll the square to its intrinsic 960px backing-buffer width. */
  overflow: clip;
  border: 3px solid var(--black);
  background: #683281;
  box-shadow: 0 25px 100px #0008;
}
.open-tab {
  position: absolute;
  z-index: 6;
  right: 18px;
  bottom: 6px;
  color: #fff8e8;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-shadow: 0 1px 3px #000, 1px 0 2px #000;
}
.open-tab:hover { text-decoration: underline; text-underline-offset: 2px; }
.home {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 0;
  text-align: center;
}
.menu-cover {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: #733981 url('/arena-art/menu-cover.png') center / cover no-repeat;
}
.home::after {
  content: '';
  position: absolute;
  inset: 65% 0 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(transparent, #1b0c2b26 45%, #170b2780);
}
.join-area {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 100%;
  max-height: 42%;
  padding: 0 clamp(18px, 6cqw, 36px) 27px;
}
.primary {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 12px;
  border: 3px solid var(--black);
  border-radius: 5px;
  background: linear-gradient(#ffe65b, #ffc329);
  color: #130c13;
  box-shadow: 3px 3px 0 var(--red), 6px 6px 0 var(--black);
  font-family: Impact, 'Arial Black', Arial, sans-serif;
  font-size: clamp(22px, 6.2cqw, 35px);
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1.1;
  text-transform: uppercase;
}
.primary:hover:not(:disabled) { background: linear-gradient(#fff68e, #ffd132); }
.primary:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--black); }
.primary:disabled { background: #ffe592; color: #312012; }
.primary.busy::before {
  content: '';
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  border: 3px solid #24112233;
  border-top-color: #bb1928;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.join-feedback { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.join-feedback:has(.notice:empty):has(.cancel[hidden]) { display: none; }
.notice {
  min-width: 0;
  max-height: 68px;
  overflow: auto;
  overflow-wrap: anywhere;
  margin: 0;
  color: #fff8e8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 1px 3px #180b22, 1px 1px 1px #180b22;
}
.notice:empty { display: none; }
.notice.error { color: #fff1a8; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: inherit; font-size: 11px; font-weight: 700; }
.cancel { flex-shrink: 0; min-height: 22px; padding: 2px 0; color: #fff; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 3px #180b22; }
.arcade.in-match { padding: 10px 14px; background: radial-gradient(ellipse at 50% 20%, #593574, #261338 80%); }
.in-match .open-tab { position: relative; right: auto; bottom: auto; align-self: flex-end; flex-shrink: 0; line-height: 18px; }
.match { display: flex; flex: 1; min-height: 0; min-width: 0; flex-direction: column; padding-top: 3px; }
.match-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 26px; font-size: 11px; flex-shrink: 0; }
.match-head p { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-head button { white-space: nowrap; color: var(--yellow); }
.game-stage { flex: 1; min-height: 0; min-width: 0; position: relative; container-type: size; border: 2px solid var(--black); border-radius: 5px; overflow: hidden; background: #08060c; box-shadow: 2px 3px 0 #a167b7; }
/* Size from the available stage, independent of SDL's canvas backing size. */
canvas { position: absolute; display: block; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100cqw, calc(100cqh * 4 / 3)); height: min(100cqh, calc(100cqw * 3 / 4)); min-width: 0; object-fit: contain; background: #000; outline: none; }
.versus, .result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse, #754a99, #271336 80%); padding: 16px; text-align: center; }
.matchup { display: flex; align-items: center; justify-content: center; width: 100%; gap: 8px; }
.versus-token { font-size: 28px; font-family: Impact, 'Arial Black', sans-serif; color: var(--yellow); font-style: italic; text-shadow: 2px 2px 0 #17101d; }
.fighter-card { width: 42%; min-width: 0; }
.fighter-card img { height: clamp(70px, 27cqw, 150px); max-width: 100%; object-fit: contain; filter: drop-shadow(0 5px 4px #0005); }
.fighter-card b { display: block; font-size: 17px; letter-spacing: -.03em; }
.fighter-card small { display: block; margin-top: 4px; font-size: 8px; font-weight: 800; letter-spacing: .12em; color: #e2c7ed; }
.versus > p:last-child { font-size: 11px; color: #ebd9f4; }
.result { background: #1f102cef; z-index: 4; }
.result h2 { font-family: Impact, 'Arial Black', sans-serif; font-size: clamp(28px, 8cqw, 48px); margin: 6px 0; text-transform: uppercase; color: var(--yellow); line-height: 1; text-shadow: 2px 3px 0 #ad2333; }
.result > p { font-size: 12px; line-height: 1.4; color: #eedaf5; max-width: 300px; }
.result .primary { max-width: 280px; margin-top: 12px; font-size: 23px; min-height: 44px; }
body.embedded .arcade { width: 100vw; height: 100dvh; min-height: 0; max-width: none; max-height: none; border: 0; }
body.embedded { min-height: 0; height: 100dvh; overflow: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 380px), (max-height: 400px) {
  .join-area { padding: 0 18px 24px; max-height: 46%; }
  .primary { min-height: 42px; font-size: 22px; }
  .join-feedback { gap: 8px; margin-top: 8px; }
  .notice { font-size: 10px; max-height: 52px; }
  .cancel { font-size: 9px; }
  .open-tab { right: 12px; bottom: 4px; font-size: 9px; }
  .arcade.in-match { padding: 6px 9px; }
  .match-head { min-height: 23px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; scroll-behavior: auto !important; }
}
.intro{position:absolute;inset:0;background:#000;z-index:5}
.intro iframe{display:block;width:100%;height:100%;border:0;background:#000}
.arcade.in-intro .open-tab{top:10px;right:12px;bottom:auto;z-index:6}
