:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #f6f8fb;
  --gold: #ffb54d;
  --cyan: #62e4ff;
  --ink: #071225;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  display: grid;
  place-items: center;
  margin: 0;
  min-height: 100svh;
  min-width: 320px;
  background: #000;
}

body::before {
  content: none;
}

.shell {
  position: relative;
  width: min(1600px, calc(100% - 40px));
  width: min(1600px, calc(100% - 40px), 135svh);
  margin: 0;
  padding: 0;
}

.masthead {
  position: absolute;
  right: 0;
  bottom: calc(100% + 24px);
  left: 0;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6.7vw, 86px);
  font-weight: 850;
  letter-spacing: -.07em;
  line-height: .9;
}

.stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  border: 1px solid rgba(115, 190, 255, .2);
  border-radius: 24px;
  background: #071225;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .46), inset 0 0 0 1px rgba(255, 255, 255, .035);
}

#canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  /* Panda applies its desktop default as an inline 800x600 style.  The
     browser shell owns the displayed size; Panda keeps the drawing buffer. */
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(98, 228, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 228, 255, .05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  padding: 28px;
  text-align: center;
  background-color: #298fe4;
  background-image: url("resources/phase_3/maps/loading_bg_clouds.png");
  background-position: center;
  background-size: 100% 100%;
  transition: opacity .5s ease, visibility .5s ease;
}

.loading.is-done { opacity: 0; visibility: hidden; }

.loading.is-error {
  background-color: #661f30;
  background-image: none;
}

.boot-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 91.5%;
  height: 50%;
  filter: drop-shadow(0 9px 3px rgba(21, 44, 84, .28));
  transform: translate(-50%, -50%);
}

.boot-progress {
  position: absolute;
  right: 10%;
  bottom: 7%;
  left: 10%;
}

#status {
  margin: 0 0 9px;
  color: #172f69;
  font-family: "Arial Rounded MT Bold", "Comic Sans MS", sans-serif;
  font-size: clamp(14px, 2.1vw, 23px);
  font-weight: 900;
  letter-spacing: .03em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .65);
}

.progress {
  overflow: hidden;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .92);
  background: rgba(20, 49, 96, .33);
  box-shadow: 0 3px 0 rgba(20, 49, 96, .2);
}

.progress span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(#fff725, #ffc400 62%, #ed8f00);
  transition: width .25s ease;
}

.transfer {
  margin: 6px 0 0;
  color: #18356f;
  font-family: "Arial Rounded MT Bold", "Comic Sans MS", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

.browser-check {
  position: absolute;
  z-index: 6;
  top: 54%;
  left: 50%;
  min-width: 300px;
  padding: 16px 20px 12px;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 18px;
  background: rgba(23, 47, 105, .92);
  box-shadow: 0 8px 28px rgba(9, 30, 70, .34);
  color: white;
  font: 700 13px/1.35 "Arial Rounded MT Bold", "Comic Sans MS", sans-serif;
  transform: translate(-50%, -50%);
}

.browser-check p { margin: 8px 0 0; }
.browser-check[hidden] { display: none; }
#turnstile-widget { min-height: 0; }

footer {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  color: #7f8ca0;
  font-size: 12px;
}

.keys { text-align: right; }

@media (max-width: 700px) {
  .shell { width: min(calc(100% - 24px), 1600px); }
  .masthead { bottom: calc(100% + 16px); }
  .stage { min-height: 0; border-radius: 16px; }
  footer { justify-content: flex-start; }
  .keys { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
