/* Original ModRetro plugin artwork alignment. */
.codex-game-view .cgv-handheld {
  position: relative;
  width: 100%;
  aspect-ratio: 850 / 1440;
  overflow: clip;
  overflow-clip-margin: 12px;
  filter: drop-shadow(0 10px 16px #0005);
  user-select: none;
}
.codex-game-view .cgv-shell {
  position: absolute;
  top: -5.20833%;
  left: -44.7059%;
  width: 188.235%;
  max-width: none;
  height: 111.111%;
  pointer-events: none;
}
.codex-game-view .cgv-screen {
  position: absolute;
  top: 11.5278%;
  left: 18.3529%;
  width: 62.1177%;
  aspect-ratio: 10 / 9;
  overflow: hidden;
  background: #101922;
  line-height: 0;
}
body.codex-game-view-mounted .codex-game-view #game {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.codex-game-view-mounted .codex-game-view #game canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  object-fit: contain;
  image-rendering: pixelated;
}
.codex-game-view .cgv-device-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.codex-game-view .cgv-game-button {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
}
.codex-game-view .cgv-game-button:focus-visible {
  outline: 3px solid #e7d6ff;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #2d203e;
}
.codex-game-view .cgv-game-button:active,
.codex-game-view .cgv-game-button.pressed {
  background: #17102165;
  box-shadow: inset 1px 3px 5px #100b1680;
}
.codex-game-view [data-game-button="a"] {
  left: 76.24%;
  top: 61.39%;
  width: 13.29%;
  height: 7.85%;
  border-radius: 50%;
}
.codex-game-view [data-game-button="b"] {
  left: 59.06%;
  top: 66.04%;
  width: 13.29%;
  height: 7.85%;
  border-radius: 50%;
}
.codex-game-view [data-game-button="up"] {
  left: 19.29%;
  top: 59.31%;
  width: 9.88%;
  height: 6.18%;
  border-radius: 18% 18% 0 0;
}
.codex-game-view [data-game-button="down"] {
  left: 19.29%;
  top: 69.31%;
  width: 9.88%;
  height: 6.18%;
  border-radius: 0 0 18% 18%;
}
.codex-game-view [data-game-button="left"] {
  left: 10%;
  top: 65%;
  width: 10.47%;
  height: 5.97%;
  border-radius: 18% 0 0 18%;
}
.codex-game-view [data-game-button="right"] {
  left: 29.18%;
  top: 65%;
  width: 10.47%;
  height: 5.97%;
  border-radius: 0 18% 18% 0;
}
.codex-game-view [data-game-button="select"],
.codex-game-view [data-game-button="start"] {
  top: 82.04%;
  width: 14.94%;
  height: 2.71%;
  border-radius: 999px;
  transform: rotate(-26deg);
}
.codex-game-view [data-game-button="select"] {
  left: 32.29%;
}
.codex-game-view [data-game-button="start"] {
  left: 51.18%;
}
.codex-game-view [data-game-button="select"]::before,
.codex-game-view [data-game-button="start"]::before {
  content: "";
  position: absolute;
  inset: -14px -2px;
}

:root {
  color-scheme: light;
  font-family: ui-monospace, "Courier New", monospace;
  color: #514066;
}
body {
  color: #514066;
  font-family: ui-monospace, "Courier New", monospace;
  font-weight: 400;
  background:
    radial-gradient(#e4d7e7 1.5px, transparent 1.5px) 0 0 / 15px 15px,
    #f3eaf0;
  overflow: auto;
  touch-action: pan-y;
  min-height: 100svh;
}
* {
  box-sizing: border-box;
}
#player {
  min-height: 100svh;
  padding: 28px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
#player .cgv-handheld {
  width: min(650px, calc(100vw - 40px), calc((100svh - 215px) * 850 / 1440));
  min-width: 180px;
  overflow: hidden;
  flex: none;
  filter: none;
}
#controller {
  display: none !important;
}
.cgv-game-button {
  cursor: pointer;
}
.colors,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.colors button {
  appearance: none;
  width: 23px;
  height: 23px;
  padding: 0;
  background: var(--chip);
  border: 2px solid #604777;
  box-shadow: 3px 3px #d6cad9;
  cursor: pointer;
}
.colors button[aria-pressed="true"] {
  outline: 2px solid #604777;
  outline-offset: 4px;
}
button:focus-visible {
  outline: 3px solid #674182;
  outline-offset: 4px;
}
.toolbar button {
  appearance: none;
  width: 50px;
  height: 50px;
  background: #f7f0e7;
  border: 2px solid #604777;
  box-shadow: 4px 4px #d6cad9;
  font:
    bold 27px/1 ui-monospace,
    monospace;
  color: #604777;
  cursor: pointer;
}
.toolbar button:hover {
  background: #e7d8ed;
}
.toolbar button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px #d6cad9;
}
.toolbar button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.keyboard-hints {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 14px;
  line-height: 30px;
}
kbd {
  display: inline-block;
  padding: 0 7px;
  margin-right: 3px;
  border: 2px solid #604777;
  background: #f7f0e7;
  box-shadow: 3px 3px #d6cad9;
  font: inherit;
  color: #604777;
}
#status {
  margin: 0;
  max-width: 540px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}
#player:fullscreen {
  background: #f3eaf0;
  overflow: auto;
}
@media (max-width: 400px) {
  #player {
    padding-top: 16px;
    gap: 14px;
  }
  .keyboard-hints {
    font-size: 12px;
    gap: 4px 12px;
  }
}
@media (max-height: 480px) and (min-width: 500px) {
  #player {
    display: grid;
    grid-template-columns: auto minmax(180px, 340px);
    align-content: center;
    justify-content: center;
  }
  #player .cgv-handheld {
    grid-row: span 4;
    width: calc((100svh - 36px) * 850 / 1440);
    min-width: 140px;
  }
  .keyboard-hints {
    max-width: 340px;
  }
}
