@import url('./input/input.css');
body:has(archive-player) > header > div {
  min-height: 2.5rem;
  padding-block: 0.25rem;
}
body:has(archive-player) > header > div,
body:has(archive-player) > footer {
  max-width: 87.5rem;
  padding-inline: 1rem;
}
.archive-page {
  max-width: 87.5rem;
  margin: auto;
  padding: 0.75rem 1rem 1rem;
}
.archive-page > a {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}
archive-player {
  --archive-aspect: 1.333333333;
  --ogh-aspect: var(--archive-aspect);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 0.75rem 1rem;
  margin: auto;
  /* Light chrome around a dark screen; fullscreen flips these to dark. */
  --ap-ink: #1e1b2e;
  --ap-soft: #5a5670;
  --ap-surface: #fbfafd;
  --ap-line: #cfcbda;
  --ap-action: #a8232d;
  --ap-on-action: #fff;
  --ap-focus: #1e4fb8;
  color: var(--ap-ink);
  font-size: 1rem;
  line-height: 1.6;
}
archive-player .archive-playfield,
archive-player .archive-sidebar {
  min-width: 0;
}
archive-player .archive-playfield {
  align-self: start;
}
archive-player .archive-stage {
  position: relative;
  background: #141024;
  border: 1px solid #141024;
  border-radius: 0.75rem;
  overflow: hidden;
  width: min(100%, calc((100svh - 11rem) * var(--archive-aspect)));
  aspect-ratio: var(--archive-aspect);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
archive-player .archive-launch {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  --ap-ink: #fbfafd;
  --ap-surface: #241e3a;
  --ap-action: #fbfafd;
  --ap-on-action: #1e1b2e;
  --ap-focus: #9db8ff;
  background: #141024;
  color: var(--ap-ink);
  text-align: center;
}
archive-player .archive-launch button {
  min-width: 10rem;
  font-size: 1.15rem;
}
archive-player [role='status'] {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  /* Whole-pixel line boxes keep the controls below on the pixel grid. */
  line-height: 1.5;
}
archive-player canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
archive-player a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
archive-player canvas:focus-visible,
archive-player a:focus-visible,
archive-player button:focus-visible {
  outline: 3px solid var(--ap-focus);
  outline-offset: 3px;
}
archive-player .archive-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0;
}
archive-player button.archive-primary {
  border-color: var(--ap-action);
  background: var(--ap-action);
  color: var(--ap-on-action);
  font-weight: 800;
}
/* Controls card: square keycaps are keys, round badges are pad buttons. */
archive-player .archive-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
archive-player .archive-icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
archive-player .archive-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
archive-player .archive-actions button span {
  text-wrap: balance;
}
/* Korean wraps between words, not inside them. */
archive-player:lang(ko) .archive-actions button {
  word-break: keep-all;
}
archive-player .archive-start {
  grid-column: 1 / -1;
}
archive-player .archive-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: archive-step;
}
archive-player .archive-steps li {
  position: relative;
  display: flex;
  counter-increment: archive-step;
}
archive-player .archive-steps button {
  flex: 1;
}
archive-player .archive-steps-numbered li::before {
  content: counter(archive-step);
  position: absolute;
  top: -0.5rem;
  left: 0.5rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 2px solid var(--ap-action);
  border-radius: 50%;
  background: var(--ap-surface);
  color: var(--ap-ink);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
}
archive-player .archive-guide {
  margin: 0.4rem 0 0;
  color: var(--ap-soft);
  font-size: 0.8rem;
  line-height: 1.4;
}
archive-player .archive-controls {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--ap-line);
  border-radius: 0.75rem;
  background: var(--ap-surface);
  font-size: 0.8rem;
  line-height: 1.4;
}
archive-player .archive-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2rem;
}
archive-player .archive-controls h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
}
archive-player .archive-device-switch {
  display: flex;
  gap: 0.25rem;
}
archive-player .archive-device-switch button {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.5rem;
  border-width: 1px;
  border-radius: 0.5rem;
  font-size: 0.75rem;
}
archive-player .archive-device-switch button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
archive-player .archive-controls-header .archive-change-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2rem;
  padding: 0.2rem 0.5rem;
  border-width: 1px;
  border-radius: 0.5rem;
  font-size: 0.75rem;
}
archive-player .archive-device-switch [aria-pressed='true'] {
  background: var(--ap-ink);
  color: var(--ap-surface);
}
archive-player .archive-cue,
archive-player .archive-controls-note {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.4rem 0 0;
}
archive-player .archive-cue {
  padding: 0.35rem 0.5rem;
  border: 1px dashed var(--ap-line);
  border-radius: 0.5rem;
  color: var(--ap-soft);
}
/* The game is running but the keyboard is still on the page. */
archive-player[data-focus='page'] .archive-cue {
  border-style: solid;
  border-color: var(--ap-action);
  color: var(--ap-action);
  font-weight: 800;
}
archive-player[data-focus='game'] .archive-stage {
  box-shadow: 0 0 0 3px var(--ap-focus);
}
archive-player .archive-controls-note {
  font-size: 0.875rem;
}
archive-player .archive-controls-note .archive-icon {
  width: 1.5rem;
  height: 1.5rem;
}
archive-player kbd {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 0.4rem;
  border: 1px solid var(--ap-ink);
  border-bottom-width: 3px;
  border-radius: 0.4rem;
  background: var(--ap-surface);
  color: var(--ap-ink);
  font: inherit;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
archive-player .archive-pad-button {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--ap-ink);
  border-radius: 50%;
  background: var(--ap-ink);
  color: var(--ap-surface);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
}
archive-player .archive-keys {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
archive-player .archive-keymap,
archive-player .archive-system-keys,
archive-player .archive-pad,
archive-player .archive-more-help ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
archive-player .archive-keymap {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 0.3rem 0.6rem;
  padding-right: 1.1rem;
}
archive-player .archive-keymap li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
/* Each keyboard row sits a little to the right of the one above it. */
archive-player .archive-keymap [data-row='1'] {
  left: 0.5rem;
}
archive-player .archive-keymap [data-row='2'] {
  left: 1.1rem;
}
archive-player .archive-move {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
}
archive-player .archive-arrows {
  display: grid;
  grid-template-columns: repeat(3, 1.9rem);
  gap: 0.2rem;
}
archive-player .archive-arrows [data-control='up'] {
  grid-column: 2;
}
archive-player .archive-arrows [data-control='left'] {
  grid-column: 1;
}
archive-player .archive-key-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
}
archive-player .archive-system-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--ap-line);
}
archive-player .archive-system-keys li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
archive-player .archive-pad {
  position: relative;
  width: min(100%, 17rem);
  height: 8.25rem;
  margin: 0.75rem auto 0;
}
/* The controller body, under the buttons. */
archive-player .archive-pad::before {
  content: '';
  position: absolute;
  inset: 1.6rem 0 0;
  border: 2px solid var(--ap-ink);
  border-radius: 2.5rem;
}
archive-player .archive-pad li {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  transform: translate(-50%, -50%);
}
archive-player .archive-pad [data-slot^='shoulder'] {
  top: 0.8rem;
}
archive-player .archive-pad [data-slot^='shoulder'] .archive-pad-button {
  width: 2.6rem;
  border-radius: 0.5rem 0.5rem 0.2rem 0.2rem;
}
archive-player .archive-pad [data-slot='shoulder-left'] {
  left: 20%;
}
archive-player .archive-pad [data-slot='shoulder-right'] {
  left: 80%;
}
archive-player .archive-pad [data-slot='dpad'] {
  top: 4.9rem;
  left: 20%;
}
archive-player .archive-pad [data-slot='dpad'] .archive-icon {
  width: 2.4rem;
  height: 2.4rem;
  stroke-width: 1.6;
}
archive-player .archive-pad [data-slot='top'] {
  top: 3.3rem;
  left: 80%;
}
archive-player .archive-pad [data-slot='bottom'] {
  top: 6.5rem;
  left: 80%;
}
archive-player .archive-pad [data-slot='left'] {
  top: 4.9rem;
  left: calc(80% - 1.6rem);
}
archive-player .archive-pad [data-slot='right'] {
  top: 4.9rem;
  left: calc(80% + 1.6rem);
}
archive-player .archive-pad [data-spare] .archive-pad-button {
  border-style: dashed;
  border-color: var(--ap-line);
  background: none;
}
/* Stacked, so long labels never run into the buttons beside them. */
archive-player .archive-pad [data-slot='select'],
archive-player .archive-pad [data-slot='start'] {
  left: 47%;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
archive-player .archive-pad [data-slot='select'] {
  top: 4rem;
}
archive-player .archive-pad [data-slot='start'] {
  top: 5.8rem;
}
archive-player .archive-pad-pill {
  width: 1.5rem;
  height: 0.6rem;
  border: 2px solid var(--ap-ink);
  border-radius: 1rem;
}
archive-player .archive-pad-caption {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
archive-player .archive-more-help {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}
archive-player .archive-more-help li {
  margin-top: 0.35rem;
  color: var(--ap-soft);
}
archive-player details {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}
archive-player summary {
  cursor: pointer;
  padding: 0.4rem 0;
}
archive-player summary:focus-visible {
  outline: 3px solid var(--ap-focus);
  outline-offset: 3px;
}
archive-player button {
  font: inherit;
  line-height: 1.3;
  background: var(--ap-surface);
  color: var(--ap-ink);
  border: 2px solid var(--ap-ink);
  border-radius: 0.75rem;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
}
archive-player button:disabled {
  opacity: 0.55;
  cursor: wait;
}
archive-player [hidden] {
  display: none !important;
}
archive-player progress {
  width: 100%;
  height: 1rem;
}
archive-player:fullscreen {
  --ap-ink: #fbfafd;
  --ap-soft: #c9c5da;
  --ap-surface: #241e3a;
  --ap-line: #3a3454;
  --ap-action: #fbfafd;
  --ap-on-action: #1e1b2e;
  --ap-focus: #9db8ff;
  background: #141024;
  overflow: auto;
  max-width: none;
  padding: 1rem;
  align-content: start;
}
archive-player:fullscreen .archive-stage {
  width: min(100%, calc((100svh - 5.5rem) * var(--archive-aspect)));
}
archive-player h2 {
  grid-column: 1 / -1;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 900;
  line-height: 1.4;
  overflow-wrap: anywhere;
  margin: 0;
}
@media (max-width: 960px) {
  archive-player {
    grid-template-columns: minmax(0, 1fr);
  }
  archive-player .archive-stage {
    width: min(100%, calc((100svh - 11rem) * var(--archive-aspect)));
  }
  archive-player .archive-actions {
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.5rem;
  }
  archive-player button {
    padding: 0.6rem 0.7rem;
    font-size: 0.875rem;
  }
  archive-player:fullscreen {
    padding: 0.75rem;
  }
}
/* Touch screens start from the Play button on the game; Coin and Start are
   drawn over the game once it runs. */
@media (pointer: coarse) {
  archive-player .archive-start {
    display: none !important;
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 540px) {
  body:has(archive-player) > header > div {
    min-height: 2.25rem;
  }
  body:has(archive-player) > header [data-play-note] {
    display: none;
  }
  body:has(archive-player) .language-switcher a {
    min-height: 1.5rem;
    font-size: 0.75rem;
  }
  .archive-page {
    padding: 0.25rem 0.5rem 0.75rem;
  }
  .archive-page > a {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
  }
  archive-player {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.375rem;
  }
  archive-player h2 {
    font-size: 1rem;
    line-height: 1.4;
  }
  archive-player .archive-stage {
    width: min(100%, calc((100svh - 9.25rem) * var(--archive-aspect)));
  }
  archive-player .archive-sidebar {
    display: flex;
    flex-direction: column;
  }
  archive-player .archive-actions {
    order: -1;
    justify-content: center;
    margin: 0 0 0.375rem;
  }
  archive-player:fullscreen {
    padding: 0.5rem;
  }
  archive-player:fullscreen .archive-stage {
    width: min(100%, calc((100svh - 6rem) * var(--archive-aspect)));
  }
}

/* Save slots, shown inside the in-game menu (slot-panel.js). */
.ogh-menu-body[hidden] {
  display: none;
}
.ogh-slots-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ogh-slots-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.ogh-menu .ogh-slots-back {
  flex: none;
  min-height: 44px;
}
.ogh-slot-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ogh-slot {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid #3a3454;
  border-radius: 12px;
}
.ogh-menu .ogh-slot-main {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 6px;
  text-align: start;
}
.ogh-menu .ogh-slot-main:disabled {
  cursor: default;
  opacity: 0.55;
}
.ogh-slot-thumb {
  display: block;
  width: 80px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, #241e3a 0 6px, #2c2546 6px 12px);
}
.ogh-slot-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.ogh-slot-text {
  display: grid;
  min-width: 0;
}
.ogh-slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ogh-slot-meta {
  color: #c9c5da;
  font-size: 13px;
  font-weight: 600;
}
.ogh-slot-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.ogh-menu .ogh-slot-tools button {
  min-height: 44px;
}
.ogh-slot-confirm {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: #211b33;
}
.ogh-slot-question {
  margin: 0;
  font-weight: 700;
}
.ogh-slot-confirm input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1.5px solid #4a4360;
  border-radius: 10px;
  background: #0f0c18;
  color: inherit;
  font: inherit;
  user-select: text;
}
.ogh-menu .ogh-danger {
  border-color: #ff8a8a;
  background: #5a1d26;
}
.ogh-menu .ogh-slot-tools .ogh-primary {
  grid-column: auto;
}
/* Wide but short screens (a phone on its side): tools beside each slot. */
@media (max-height: 500px) and (min-width: 560px) {
  .ogh-slot {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .ogh-menu .ogh-slot-main {
    grid-template-columns: 56px minmax(0, 1fr);
    min-height: 52px;
  }
  .ogh-slot-thumb {
    width: 56px;
  }
  .ogh-slot-confirm {
    grid-column: 1 / -1;
  }
}
/* Cheats, shown inside the in-game menu (cheat-panel.js). */
.ogh-cheats > .ogh-menu-note {
  margin: 0 0 10px;
}
.ogh-cheat-list[hidden],
.ogh-cheat-empty[hidden] {
  display: none;
}
.ogh-cheat-empty {
  margin: 0 0 10px;
  color: #c9c5da;
}
.ogh-menu .ogh-cheat-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  text-align: start;
}
.ogh-cheat-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
/* The switch's state is a word, not only a colour. */
.ogh-cheat-state {
  min-width: 3.5em;
  padding: 2px 10px;
  border: 1.5px solid #6c6488;
  border-radius: 999px;
  color: #c9c5da;
  text-align: center;
}
.ogh-cheat-main[aria-checked='true'] {
  border-color: #8fd6a4;
}
.ogh-cheat-main[aria-checked='true'] .ogh-cheat-state {
  border-color: #8fd6a4;
  background: #1f4a2e;
  color: #e6ffec;
}
.ogh-cheat-new:empty {
  display: none;
}
.ogh-cheat-new {
  margin-top: 8px;
}
.ogh-cheat-field {
  display: grid;
  gap: 4px;
  font-weight: 700;
}
.ogh-cheat-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1.5px solid #4a4360;
  border-radius: 10px;
  background: #0f0c18;
  color: inherit;
  font: inherit;
  font-weight: 400;
  user-select: text;
}
.ogh-cheat-field input[data-cheat-field='code'] {
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.ogh-cheat-field input[aria-invalid='true'] {
  border-color: #ff8a8a;
}
.ogh-cheat-error {
  margin: 0;
  color: #ffb3b3;
  font-weight: 700;
}
.ogh-cheat-error:empty {
  display: none;
}
.ogh-cheat-formats {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.ogh-cheat-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
/* A game kept on this device for offline play. Text, not colour, says so. */
archive-player .archive-downloaded {
  justify-self: start;
  width: fit-content;
  margin: 0 0 0.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  color: var(--ap-soft);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5rem;
}
archive-player .archive-downloaded[hidden] {
  display: none;
}
