/* Revere's Ride — 8-bit shell. Letterboxed pixel canvas + touch controls. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a0a12; color: #fff;
  font-family: "Courier New", monospace;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }

#screen {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  /* sized by JS to keep integer-ish scale + 16:9 */
  box-shadow: 0 0 0 3px #1a1a2e, 0 0 40px #000 inset;
}

.hidden { display: none !important; }

/* ---- Loading screen ---- */
.loading-screen {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: #070a16;
  color: #fff;
}
.loading-screen::before {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(159,224,255,0.08) 0 1px, transparent 1px 6px),
    linear-gradient(#11244c, #080a16 68%);
}
.loading-card {
  position: relative;
  width: min(82vw, 420px);
  padding: 22px 24px 20px;
  background: #0d1428;
  border: 4px solid #26385f;
  box-shadow: 6px 6px 0 #02040b, inset 0 0 0 3px #111d38;
  text-align: center;
}
.loading-title {
  color: #f4d03f;
  font-size: 26px;
  font-weight: bold;
  text-shadow: 3px 3px 0 #000, 5px 5px 0 #8c1d1d;
  margin-bottom: 14px;
}
.loading-text {
  color: #9fe0ff;
  font-size: 13px;
  margin-bottom: 10px;
}
.loading-track {
  height: 18px;
  padding: 3px;
  background: #060912;
  border: 3px solid #516079;
  box-shadow: inset 0 0 0 2px #18243a;
}
.loading-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(#dcfff7, #5ff6ff 45%, #2a8dff 46%, #1f5fb8);
}
.loading-detail {
  margin-top: 10px;
  color: #cdd6e6;
  font-size: 10px;
}

/* ---- Touch controls ---- */
#touch {
  position: fixed; inset: 0; pointer-events: none; z-index: 10;
}
#dpad {
  position: absolute; left: 4vmin; bottom: 5vmin;
  width: 38vmin; height: 38vmin; max-width: 200px; max-height: 200px;
  pointer-events: none;
}
#dpad-c {
  position: absolute; left: 33%; top: 33%; width: 34%; height: 34%;
  background: #2a2a3e; border-radius: 4px;
}
.db {
  position: absolute; width: 33%; height: 33%;
  background: #c9302c; color: #fff; border: 3px solid #6e1512;
  font-size: 5vmin; font-weight: bold; border-radius: 8px;
  pointer-events: auto; box-shadow: 0 4px 0 #6e1512;
}
.db:active { background: #e0524e; transform: translateY(2px); box-shadow: 0 2px 0 #6e1512; }
.db[data-k="up"]    { left: 33%; top: 0; }
.db[data-k="left"]  { left: 0;   top: 33%; }
.db[data-k="right"] { left: 66%; top: 33%; }
.db[data-k="down"]  { left: 33%; top: 66%; }

#abtns {
  position: absolute; right: 5vmin; bottom: 7vmin;
  display: flex; gap: 4vmin; align-items: flex-end; pointer-events: none;
}
.ab {
  width: 18vmin; height: 18vmin; max-width: 92px; max-height: 92px;
  border-radius: 50%; font-size: 7vmin; font-weight: bold; color: #fff;
  pointer-events: auto;
}
.ab[data-k="gallop"] { background: #2f6fce; border: 4px solid #173a73; box-shadow: 0 5px 0 #173a73; }
.ab[data-k="turbo"]  { background: #e0a32e; border: 4px solid #7a560f; box-shadow: 0 5px 0 #7a560f; margin-bottom: 7vmin; }
.ab:active { transform: translateY(3px); filter: brightness(1.2); }

#rotate {
  position: fixed; top: 0; left: 0; right: 0;
  background: rgba(10,10,18,0.82); color: #f4d03f; z-index: 50;
  font-size: 3.4vmin; text-align: center; padding: 1.4vmin; pointer-events: none;
}
