:root {
  --bg: #0a0c10;
  --panel: rgba(10, 12, 16, 0.92);
  --text: #e8ecf2;
  --muted: #8a94a6;
  --accent: #33f5c4;
  --accent-2: #21c8ff;
  --track: #1d222b;
  --error: #ff5a5a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#unity-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  background: var(--bg);
  outline: none;
  touch-action: none;
}

.panel {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
  text-align: center;
}

#loader {
  background:
    radial-gradient(1200px 600px at 50% 120%, rgba(51, 245, 196, 0.16), transparent 60%),
    radial-gradient(800px 400px at 50% -20%, rgba(80, 120, 255, 0.10), transparent 60%),
    var(--bg);
  z-index: 10;
  transition: opacity 0.35s ease, visibility 0.35s;
}
#loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.brand h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 84px);
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  padding-left: 0.18em; /* balance the trailing letter spacing */
}
.brand h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .sub {
  margin: 10px 0 0;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 12px;
}

#progress-wrap { width: min(420px, 80vw); }
#progress {
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: transform 0.2s ease-out;
}
#progress-text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#start {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 16px 44px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #10131a;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 30px rgba(51, 245, 196, 0.35);
  cursor: pointer;
  animation: pulse 2s ease-in-out infinite;
}
#start:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
/* Glow only: a size change makes the button "unstable" for click automation. */
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(51, 245, 196, 0.25); }
  50% { box-shadow: 0 8px 40px rgba(51, 245, 196, 0.6); }
}

#pad-hint {
  margin: -6px 0 0;
  max-width: 420px;
  color: var(--text);
  opacity: 0.85;
}

#error {
  max-width: 520px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--error);
  border-radius: 10px;
  color: var(--error);
  background: rgba(255, 90, 90, 0.08);
}

#tip {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Top centre: the bottom of the screen holds the menu status line and the flight OSD. */
#toast {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 200px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid #2a303b;
  font-size: 14px;
  z-index: 30;
  pointer-events: none;
}

#fullscreen {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(10, 12, 16, 0.55);
  color: var(--text);
  cursor: pointer;
  z-index: 20;
  opacity: 0.7;
  transition: opacity 0.2s;
}
#fullscreen:hover { opacity: 1; }
/* Mobile: the top corners belong to the in-game touch buttons (ARM, RESET), and the top centre to PAUSE and the
   time button. The time button's right edge is 1.25 x the button size (0.11 of the short side) right of centre. */
.mobile #fullscreen { right: auto; left: calc(50% + 14vmin + 8px); }
#fullscreen[hidden] { display: none; }

#rotate {
  display: none;
  z-index: 40;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
}
#rotate svg { animation: tilt 2.4s ease-in-out infinite; }
@keyframes tilt {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
.mobile #rotate p { margin: 0; }
@media (orientation: portrait) {
  .mobile #rotate { display: flex; }
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  #start, #rotate svg { animation: none; }
}
