@font-face {
  font-family: Kongtext;
  src: url("../assets/kongtext.ttf");
}
@font-face {
  font-family: Knights;
  src: url("../assets/knights.ttf");
}
@font-face {
  font-family: Scribble;
  src: url("../assets/scribble.ttf");
}
@font-face {
  font-family: Original4;
  src: url("../assets/font-4.ttf");
}
@font-face {
  font-family: Original11;
  src: url("../assets/font-11.ttf");
}
@font-face {
  font-family: Original13;
  src: url("../assets/font-13.ttf");
}
:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #c4c7d3;
  background: #080a10;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 50% 30%, #171928 0, transparent 65%);
}
main {
  max-width: 800px;
  margin: auto;
  padding: 32px 24px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
header span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #797d91;
}
.wordmark {
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #dddde9;
  text-decoration: none;
}
.play-layout {
  display: grid;
  grid-template-areas: "stage" "controls";
  gap: 12px;
}
.game-shell {
  grid-area: stage;
  position: relative;
  width: 100%;
  aspect-ratio: 3/2;
  background: black;
  box-shadow: 0 16px 70px #0008;
  border: 1px solid #292c3c;
  min-width: 0;
}
#stage {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}
#stage:focus-visible {
  outline: 2px solid #8f9fe0;
  outline-offset: 3px;
}
#stage.exploring {
  cursor: none;
}
#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #acb0cb;
  font-size: 13px;
}
#title-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#title-controls button {
  position: absolute;
  pointer-events: auto;
  left: 66.5%;
  width: 28%;
  height: 6%;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}
#title-controls button span {
  display: none;
}
#title-controls button:hover {
  background: #fff1;
}
#start {
  top: 79.3%;
}
#help {
  top: 87.3%;
}
button {
  font: inherit;
  color: inherit;
  border: 1px solid #34384d;
  background: #161925;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (hover: hover) {
  button:enabled:hover {
    background: #24283b;
  }
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #a8b5ff;
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
  color: #787f98;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 62px;
}
.toolbar p {
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
  color: #9a9eb4;
}
.toolbar button {
  font-size: 11px;
}
.touch-controls {
  display: none;
}
.direction-pad {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: 168px;
  aspect-ratio: 1;
  gap: 4px;
  padding: 3px;
  border-radius: 28px;
  background: #0d101a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.direction-pad button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 26px;
  border-radius: 13px;
  touch-action: none;
}
.direction-pad [data-direction="Up"] {
  grid-area: 1 / 2;
}
.direction-pad [data-direction="Left"] {
  grid-area: 2 / 1;
}
.direction-pad [data-direction="Right"] {
  grid-area: 2 / 3;
}
.direction-pad [data-direction="Down"] {
  grid-area: 3 / 2;
}
.pad-center {
  grid-area: 2 / 2;
  align-self: center;
  justify-self: center;
  color: #454e77;
  font-size: 14px;
  pointer-events: none;
}
.direction-pad button[aria-pressed="true"] {
  background: #43558f;
  border-color: #afbeff;
  color: #fff;
  box-shadow: 0 0 18px #617bc333;
}
.direction-pad[aria-disabled="true"] {
  opacity: 0.4;
}
.pad-hint {
  line-height: 12px;
  text-align: center;
  font-size: 10px;
  color: #838aa4;
  margin: 8px 0 0;
}
.face-controls {
  justify-self: end;
}
.face-buttons {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: var(--controller-size);
  aspect-ratio: 1;
  gap: 4px;
  padding: 3px;
}
.face-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-weight: 750;
  font-size: 24px;
  border: 2px solid;
  background: radial-gradient(circle at 35% 25%, #313849, #131722);
  box-shadow: 0 4px 0 #060810;
}
.button-y {
  grid-area: 1 / 2;
  color: #f5ce53;
  border-color: #b49a48;
  touch-action: none;
}
.button-x {
  grid-area: 2 / 1;
  color: #70b6ff;
  border-color: #4f85b5;
}
.button-b {
  grid-area: 2 / 3;
}
.button-a {
  grid-area: 3 / 2;
}
.face-button.button-a:disabled {
  color: #649c78;
  border-color: #3b5b45;
}
.face-button.button-b:disabled {
  color: #b16d76;
  border-color: #68404a;
}
.face-button:disabled {
  opacity: 0.5;
}
.face-button:enabled:active,
.button-y[aria-pressed="true"] {
  background: #3a435e;
  box-shadow: 0 1px 0 #060810;
  transform: translateY(3px);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.help {
  max-width: 650px;
  font-size: 14px;
  line-height: 1.7;
  color: #a7adc5;
}
footer {
  margin-top: 24px;
  font-size: 11px;
  line-height: 1.9;
  color: #62677d;
}
footer a {
  color: #8b92b2;
  text-underline-offset: 3px;
}

/* Touch console: one visible viewport, with the stage between both thumbs. */
#safe-area-probe {
  position: fixed;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#rotate-prompt {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background: #0b0f1b;
}
.rotate-icon {
  width: 92px;
  height: 92px;
  color: #a1b7ff;
  margin-bottom: 12px;
}
#rotate-prompt h1 {
  font-size: clamp(22px, 5vw, 30px);
  margin: 0;
  color: #f2f3fa;
}
#rotate-prompt p {
  max-width: 360px;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #a8b1ca;
}
html[data-touch="true"] #rotate-prompt {
  left: var(--mobile-left, 0px);
  top: var(--mobile-top, 0px);
  right: auto;
  bottom: auto;
  width: var(--mobile-width, 100vw);
  height: var(--mobile-height, 100vh);
}
html[data-rotate-required="true"] main {
  visibility: hidden;
  pointer-events: none;
}
html[data-touch="true"],
html[data-touch="true"] body {
  overflow: hidden;
  overscroll-behavior: none;
}
html[data-touch="true"] main {
  position: fixed;
  left: var(--mobile-left, 0px);
  top: var(--mobile-top, 0px);
  width: var(--mobile-width, 100vw);
  height: var(--mobile-height, 100vh);
  max-width: none;
  margin: 0;
  padding: calc(env(safe-area-inset-top) + var(--mobile-edge, 8px))
    calc(env(safe-area-inset-right) + var(--mobile-edge, 8px))
    calc(env(safe-area-inset-bottom) + var(--mobile-edge, 8px))
    calc(env(safe-area-inset-left) + var(--mobile-edge, 8px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--toolbar-height, 44px);
  gap: 8px;
}
html[data-touch="true"] header,
html[data-touch="true"] footer {
  display: none;
}
html[data-touch="true"] .play-layout {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-areas: "pad stage buttons";
  grid-template-columns:
    var(--controller-size, 148px) var(--stage-width, 240px)
    var(--controller-size, 148px);
  gap: var(--control-gap, 8px);
  justify-content: space-between;
  align-content: center;
  align-items: center;
}
html[data-touch="true"] .game-shell {
  width: var(--stage-width, 240px);
  height: var(--stage-height, 160px);
  max-width: none;
  border: 0;
  border-radius: 0;
}
html[data-touch="true"] .touch-controls {
  display: contents;
}
html[data-touch="true"] #movement-controls {
  grid-area: pad;
  justify-self: start;
}
html[data-touch="true"] .face-controls {
  grid-area: buttons;
  justify-self: end;
}
html[data-touch="true"] .direction-pad {
  width: var(--controller-size, 148px);
}
html[data-touch="true"][data-compact="true"] .pad-hint {
  display: none;
}
html[data-touch="true"][data-toolbar="false"] main {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}
html[data-touch="true"][data-toolbar="false"] .toolbar {
  display: none;
}
html[data-touch="true"] #title-controls {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 4% 3% 48%;
}
html[data-touch="true"] #title-controls button {
  position: static;
  width: 100%;
  height: auto;
  min-height: 44px;
  border: 1px solid #617cb6;
  background: #283b5c;
  font-size: 12px;
  padding: 8px 2px;
  border-radius: 8px;
}
html[data-touch="true"] #title-controls button span {
  display: inline;
}
html[data-touch="true"] #start {
  background: #3c5481;
}
html[data-touch="true"] .toolbar {
  min-height: 0;
  height: var(--toolbar-height, 44px);
  gap: 8px;
}
html[data-touch="true"] .toolbar p {
  font-size: 11px;
  margin: 0;
}
html[data-touch="true"] #restart {
  min-height: 44px;
  min-width: 64px;
}
html[data-touch="true"] .help {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 16px;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 24px);
  overflow: auto;
  border: 1px solid #6475a6;
  border-radius: 12px;
  background: #151c30;
  box-shadow: 0 8px 60px #000b;
  font-size: 14px;
}
html[data-touch="true"] .help p {
  margin-top: 0;
}
html[data-touch="true"] #help-close {
  min-height: 44px;
}
@media (max-width: 560px) {
  html:not([data-touch="true"]) main {
    padding: 20px 10px;
  }
  header span {
    font-size: 8px;
  }
  .wordmark {
    font-size: 12px;
  }
  .pad-hint {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body {
    background: #080a10;
  }
}
html[data-touch="true"] #movement-controls,
html[data-touch="true"] .face-controls {
  min-width: 0;
  width: var(--controller-size, 148px);
}
html[data-touch="true"] .pad-hint {
  max-width: var(--controller-size, 148px);
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
