@font-face {
  font-family: Galmuri9;
  src: url("./fonts/Galmuri9.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Galmuri11;
  src: url("./fonts/Galmuri11.woff2") format("woff2");
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: Galmuri9, "Gulim", "Dotum", monospace;
  background: #12110c;
  color: #e2dfc8;
  font-synthesis: none;
  --panel: #201f18;
  --edge-light: #4a4734;
  --edge-dark: #13120b;
  --ink-dim: #a9a688;
  --accent: #f6e45c;
  --accent-edge: #8a8348;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
::selection {
  background: #f6e45c;
  color: #12110c;
}
html {
  scrollbar-color: #3a382c #12110c;
  scrollbar-width: thin;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #12110c;
}
::-webkit-scrollbar-thumb {
  background: #3a382c;
  border: 2px solid #12110c;
}
[hidden] {
  display: none !important;
}
#game {
  width: min(100%, 864px);
  margin: 0 auto;
}
header,
.utilities,
nav,
.status-row,
form,
footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
header {
  justify-content: space-between;
  margin-bottom: 8px;
}
h1 {
  margin: 0;
  font-family: Galmuri11, Galmuri9, "Gulim", "Dotum", monospace;
  font-size: 18px;
  font-weight: 400;
  color: #f6e45c;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}
button,
input {
  font: inherit;
  font-size: 13px;
  border-radius: 0;
}
button {
  color: #e2dfc8;
  background: #262418;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  min-height: 34px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover {
  color: #fff;
  background: #323024;
}
button:active,
button.pressed {
  background: #3a3620;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}
button[aria-pressed="true"],
button[aria-current="true"] {
  color: #f6e45c;
  background: #33301a;
  border-color: var(--accent-edge) #221e0c #221e0c var(--accent-edge);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
:focus-visible {
  outline: 2px solid #f6e45c;
  outline-offset: 2px;
}
.utilities button {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 12px;
  color: #a9a688;
  background: #1d1c14;
}
nav {
  gap: 6px;
}
form {
  padding-top: 10px;
}
input {
  background: #0d0c08;
  color: #f6e45c;
  caret-color: #f6e45c;
  width: 11ch;
  min-height: 34px;
  border: 1px solid;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
  padding: 4px 8px;
  text-transform: uppercase;
}
.status-row {
  min-height: 40px;
  gap: 8px;
  font-size: 13px;
}
#status {
  flex: 1;
  margin: 8px 0;
  min-width: 120px;
  color: #e2dfc8;
}
#ping {
  color: #a9a688;
  font-variant-numeric: tabular-nums;
}
.status-row button {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 12px;
}
.code-chip {
  min-height: 26px;
  padding: 1px 8px;
  font-size: 13px;
  letter-spacing: 1px;
  color: #f6e45c;
  background: #0d0c08;
  border: 1px solid;
  border-color: var(--accent-edge) #221e0c #221e0c var(--accent-edge);
  cursor: copy;
}
.code-chip:hover {
  color: #fff;
  background: #1c1a10;
}
.code-chip:active {
  border-color: #221e0c var(--accent-edge) var(--accent-edge) #221e0c;
}
#arena {
  position: relative;
  width: 100%;
}
.bezel {
  position: relative;
  background: #201f18;
  border: 1px solid;
  border-color: #3b382a #15140e #15140e #3b382a;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}
.led {
  position: absolute;
  right: 9px;
  bottom: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #332a1c;
}
#arena.on .led {
  background: #ff6b57;
  box-shadow: 0 0 4px rgba(255, 107, 87, 0.55);
}
.screen {
  position: relative;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.13) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 1;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 432 / 304;
  background: #000;
  image-rendering: pixelated;
}
#arena.on .screen {
  animation: crt-on 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
#attract {
  position: absolute;
  inset: auto 0 32%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.attract-main {
  margin: 0;
  font-family: Galmuri11, Galmuri9, "Gulim", "Dotum", monospace;
  font-size: 16px;
  color: #f6e45c;
  text-shadow:
    2px 0 0 #000,
    -2px 0 0 #000,
    0 2px 0 #000,
    0 -2px 0 #000,
    2px 2px 0 #000;
  animation: blink 1.3s steps(1) infinite;
}
.attract-sub {
  margin: 0;
  font-size: 11px;
  color: #e2dfc8;
  text-shadow: 1px 1px 0 #000;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
#arena.attract canvas {
  cursor: pointer;
}
@keyframes crt-on {
  0% {
    filter: brightness(0);
  }
  55% {
    filter: brightness(1.9);
  }
  100% {
    filter: brightness(1);
  }
}
#result {
  position: absolute;
  inset: auto 0 14%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}
#result-text {
  margin: 0;
  color: #fff;
  background: #14130c;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  padding: 4px 10px;
  font-size: 14px;
}
#result button {
  color: #f6e45c;
  background: #14130c;
}
#error {
  color: #ffcf91;
  font-size: 13px;
  line-height: 1.6;
  margin: 10px 0;
}
#touch {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 864px;
  margin: 0 auto;
  padding: 0 max(8px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#stick {
  position: relative;
  width: min(44vw, 168px);
  aspect-ratio: 1;
  border: 1px solid;
  border-color: rgba(255, 255, 255, 0.16) rgba(0, 0, 0, 0.45) rgba(0, 0, 0, 0.45) rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(24, 23, 16, 0.72);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#stick [data-knob] {
  position: absolute;
  left: 27%;
  top: 27%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #3a3620;
  border: 1px solid;
  border-color: #57543f #1e1d15 #1e1d15 #57543f;
  pointer-events: none;
}
#smash {
  width: min(28vw, 116px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: #f6e45c;
  background: rgba(30, 28, 16, 0.78);
  border-color: var(--accent-edge) #221e0c #221e0c var(--accent-edge);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-size: 15px;
}
#help {
  margin-top: 14px;
  max-width: 70ch;
  font-size: 12px;
  line-height: 2;
  color: #a9a688;
}
#help p {
  margin: 6px 0;
}
#help kbd {
  display: inline-block;
  min-width: 14px;
  margin: 0 1px;
  padding: 0 5px;
  font: inherit;
  font-size: 11px;
  text-align: center;
  color: #e2dfc8;
  background: #1c1b12;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  border-radius: 3px;
  line-height: 1.7;
}
footer {
  justify-content: flex-end;
  gap: 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--edge-light);
  font-size: 11px;
}
a {
  color: #a9a688;
  text-underline-offset: 3px;
}
#game:fullscreen {
  padding: 8px;
  background: #12110c;
  width: 100%;
  height: 100%;
  overflow: auto;
}
#game:fullscreen #arena {
  max-width: min(1296px, calc((100dvh - 190px) * 432 / 304));
  margin: auto;
}
@media (pointer: coarse) {
  #touch {
    display: flex;
  }
  [data-mode="local"] {
    display: none;
  }
  #help {
    display: none;
  }
  button {
    min-height: 44px;
  }
  .utilities button {
    min-height: 38px;
  }
}
@media (max-width: 480px) {
  header {
    gap: 4px;
  }
  .utilities {
    gap: 1px;
  }
  nav {
    gap: 4px;
  }
  nav button {
    padding: 6px 8px;
    font-size: 12px;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  #game {
    max-width: 660px;
  }
  #arena {
    width: min(100%, calc((100dvh - 170px) * 432 / 304));
    margin: auto;
  }
  footer {
    display: none;
  }
  #touch {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  #stick {
    width: 120px;
  }
  #smash {
    width: 88px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
  }
}
