:root {
  /* Overwritten from the SWF header once the library is loaded. */
  --stage-aspect: 1.5;
}

html, body {
  margin: 0;
  padding: 0;
  background: #101012;
  color: #cfcfd4;
  font: 13px/1.5 "Helvetica Neue", Arial, sans-serif;
  /* `overflow: hidden` stops the page scrolling but not the gestures that ride
     on top of it: a pull-down still reloads the game mid-battle on a phone, and
     the rubber-band still peels the stage off the edge. Both are refusals at
     moderation, and neither is reachable from the canvas's own handlers. The
     root element needs the same treatment as the body -- a scroll refused by
     one of them is still taken by the other. */
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

/*
 * The stage keeps the SWF's aspect ratio but is otherwise sized by the window:
 * whichever axis runs out first decides, and the other one letterboxes.
 */
#wrap {
  position: relative;
  width: min(100vw, calc(100vh * var(--stage-aspect)));
  width: min(100vw, calc(100dvh * var(--stage-aspect)));
  height: min(100vh, calc(100vw / var(--stage-aspect)));
  height: min(100dvh, calc(100vw / var(--stage-aspect)));
  background: #000;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  /* The stage handles its own pointers: no scrolling or double-tap zoom on a
     drag, and no selection popup or link callout on a press-and-hold. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

#boot[hidden] { display: none; }

.boot-title {
  font-size: 22px;
  letter-spacing: 0.28em;
  color: #6f7a55;
}

.loading-bar {
  width: 320px;
  max-width: 70%;
  height: 6px;
  background: #22242a;
  border-radius: 3px;
  overflow: hidden;
}

#loading-fill {
  height: 100%;
  width: 0;
  background: #8a9400;
  transition: width 0.12s linear;
}

#loading-label {
  font-size: 11px;
  color: #6a6a72;
}
