* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  overflow: hidden;
}
main {
  height: 100dvh;
  display: grid;
  place-items: center;
}
#gameViewport {
  position: relative;
  line-height: 0;
}
#screen {
  display: block;
  width: min(100vw, 133.333dvh);
  height: min(75vw, 100dvh);
  object-fit: contain;
  background: #000;
  outline: none;
}
[hidden] {
  display: none !important;
}
button {
  font: inherit;
  color: white;
  background: linear-gradient(#283049, #131726);
  border: 1px solid #98a3bd;
  padding: 10px 20px;
  cursor: pointer;
}
button:focus-visible {
  outline: 3px solid #ffda76;
  outline-offset: 3px;
}
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #000e;
  text-align: center;
  gap: 16px;
  line-height: 1.3;
}
#loading h1 {
  font-style: italic;
  letter-spacing: 0.08em;
  font-size: clamp(24px, 5vw, 50px);
}
#loading p {
  max-width: 600px;
  color: #bbc7e2;
}
#keyboardButton {
  pointer-events: none;
  position: absolute;
  left: 21.333%;
  top: 86.6%;
  width: 4.267%;
  height: 4.5%;
  padding: 0.3%;
  line-height: 0;
  border: 1px solid #ddbbc0;
  border-radius: 3px;
  background: linear-gradient(#8e465d, #3a1626);
  box-shadow: 0 1px 2px #000b;
  transition: filter 0.12s;
}
.native #keyboardButton {
  left: 28.5%;
  width: 3.2%;
}
#keyboardButton.hand-hover {
  filter: brightness(1.5);
}
#keyboardButton svg {
  width: 100%;
  height: 100%;
  fill: #2a2438;
  stroke: #ede7df;
  stroke-width: 1.7;
}
#toolbar {
  position: fixed;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0.15;
  transition: opacity 0.2s;
}
#toolbar:hover,
#toolbar:focus-within {
  opacity: 1;
}
#toolbar button {
  padding: 6px 10px;
  font-size: 12px;
}
#stats {
  position: fixed;
  bottom: 4px;
  left: 6px;
  font-size: 11px;
  color: #ddd;
  background: #000a;
  pointer-events: none;
}
#controls {
  border: 0;
  padding: 0;
  max-width: none;
  max-height: none;
  width: min(100vw, 133.333dvh);
  height: min(75vw, 100dvh);
  margin: auto;
  background: #080914;
  color: #ecebe6;
  overflow: hidden;
}
.native-engine #controls {
  width: min(75vw, 133.333dvh);
  height: min(56.25vw, 100dvh);
}
#controls::backdrop {
  background: #000d;
}
/* These textures and the label glyphs are decoded from Melee's own HSD archives. */
.controls-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(0deg, #090921e8, #141430d9),
    var(--disc-MnSlMap-860, none) center/100% 100%;
  border-top: 2px solid #69738a;
  border-bottom: 2px solid #45485e;
}
.controls-surface:before {
  content: "";
  position: absolute;
  left: -18%;
  top: 2%;
  width: 100%;
  aspect-ratio: 1;
  opacity: 0.13;
  background: var(--disc-MnMaAll-18580, none) center/contain no-repeat;
  pointer-events: none;
}
.controls-surface:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background: var(--disc-MnMaAll-f2c0, none) repeat-x center/auto 100%;
}
#keyboardModel {
  position: absolute;
  inset: 12% 1% 20%;
  touch-action: none;
}
#keyboardModel canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.keyboard-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.tap-setting {
  position: absolute;
  z-index: 2;
  bottom: 5.5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 28px 7px 24px;
  min-width: 40%;
  cursor: pointer;
  background: linear-gradient(90deg, #454854, #202230);
  border-top: 2px solid #9b9ba4;
  border-bottom: 2px solid #646572;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
  filter: drop-shadow(2px 2px 1px #000);
}
.tap-label {
  width: auto;
  height: clamp(21px, 2.5vw, 30px);
  filter: drop-shadow(2px 2px 0 #000);
}
.tap-setting input {
  position: absolute;
  right: 18px;
  top: 0;
  width: 38%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.toggle {
  position: relative;
  display: block;
  min-width: 78px;
  width: 27%;
  height: 32px;
  background: #151620;
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}
.toggle:after {
  content: "";
  position: absolute;
  inset: 2px 14px;
  background: #e9e9e8;
  mask: var(--disc-off, none) center/contain no-repeat;
}
.tap-setting input:checked + .toggle {
  background: #171627;
}
.tap-setting input:checked + .toggle:after {
  background: #ffe073;
  mask-image: var(--disc-on, none);
}
.tap-setting:focus-within {
  background: linear-gradient(90deg, #766440, #332c24);
}
.menu-button {
  position: absolute;
  z-index: 3;
  top: 4%;
  right: 0;
  width: 19%;
  height: 6%;
  padding: 0 20px 0 30px;
  border: 0;
  background: #e8c52f;
  clip-path: polygon(17% 0, 100% 0, 100% 100%, 17% 100%, 0 50%);
}
.menu-button:before {
  content: "";
  position: absolute;
  inset: 3px 0 3px 5px;
  background: #151722;
  clip-path: polygon(16% 0, 100% 0, 100% 100%, 16% 100%, 0 50%);
}
.menu-button img {
  position: relative;
  width: auto;
  height: 43%;
  max-width: 90%;
  object-fit: contain;
  filter: sepia(1) saturate(4) drop-shadow(1px 1px #000);
}
.menu-button:hover,
.menu-button:focus-visible {
  background: #fff1a3;
  filter: brightness(1.2);
}
#qa {
  position: fixed;
  bottom: 30px;
  left: 8px;
  max-width: 96vw;
  background: #102035ed;
  font-size: 11px;
  z-index: 3;
}
#qa pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}
@media (max-width: 640px) {
  .tap-setting {
    padding: 4px 14px;
    gap: 8px;
    min-width: 55%;
  }
  .tap-label {
    height: 18px;
  }
  .toggle {
    height: 23px;
    min-width: 60px;
  }
  .menu-button {
    padding: 0 5px 0 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
.controls-open #toolbar,
.controls-open #stats {
  display: none;
}
/* Room controls occupy the space between the two native player cards. */
#roomPanel { position:absolute;left:34%;top:54%;width:32%;height:39%;box-sizing:border-box;padding:1.4% 1.8%;background:linear-gradient(#101829d9,#071323ee),var(--disc-MnSlChr-2f740, none) center/100% 100%,#081222;border:2px solid #636a79;box-shadow:inset 0 0 0 2px #101420,inset 0 0 0 3px #969da255;clip-path:polygon(4% 0,100% 0,100% 94%,96% 100%,0 100%,0 6%);display:flex;flex-direction:column;align-items:center;gap:6%;font-size:clamp(10px,1.5vw,24px);color:#ffdc76; }
#roomPanel[hidden],#roomPanel [hidden]{display:none}
#roomPanel canvas{height:1em;max-width:100%;object-fit:contain;filter:drop-shadow(1px 2px 1px #000)}
#roomPanel img{height:1em;max-width:100%;object-fit:contain;filter:drop-shadow(1px 2px 1px #000)}
#roomStatus{height:.8em!important;min-height:.8em}
.room-code{display:flex;align-items:center;justify-content:center;gap:8%;width:100%}
#roomPanel button{cursor:pointer;color:#ffe394;border:0;background:none;padding:0;font:inherit}
#copyRoom{min-width:44%;padding:2% 4%!important;background:linear-gradient(120deg,#121623,#404457,#111321)!important;box-shadow:inset 0 1px #dad7ca,inset 0 -1px #9b926f;transform:skew(-8deg)}
#copyRoom canvas{transform:skew(8deg)}
#joinRoom{display:grid;grid-template-columns:1fr 1fr 24px;align-items:center;gap:5%;width:100%}
.code-entry{position:relative;min-width:0;height:1.6em;background:#040614a8;border-bottom:2px solid #d2bc6f}
#joinCode{width:100%;height:100%;border:0;outline:none;background:none;color:transparent;caret-color:#ffe080;font:inherit;letter-spacing:.12em;padding:2px}
#typedCode{position:absolute;left:3%;top:20%;max-width:94%!important;pointer-events:none}
.code-entry:focus-within{outline:1px solid #ffe08b;box-shadow:0 0 8px #ffc55c80}
#roomPanel .room-action{background:linear-gradient(115deg,#555561,#202332 65%,#111521);clip-path:polygon(7% 0,94% 0,100% 50%,94% 100%,7% 100%,0 50%);box-shadow:inset 0 1px #ddd6b5,inset 0 -1px #898375;padding:3% 14%;min-width:65%}
#roomPanel .room-action.selected,#roomPanel button:hover{filter:brightness(1.4)}
#roomPanel button:focus-visible{outline:2px solid #ffde80;outline-offset:4px}
.online-room[data-seat="1"] .native #keyboardButton{left:76.5%}
body.controls-open #roomPanel{visibility:hidden}
#roomProbe{position:fixed;top:42px;left:8px;z-index:6;max-width:400px;font:12px monospace;background:#101b2dd9;color:white}
#roomProbe button{font-size:12px;padding:6px}
#roomReport{max-height:220px;overflow:auto;margin:4px}

.volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.volume-control input {
  width: 80px;
  accent-color: #bbc7e2;
}
