/* ===== Last Orbit — page chrome ===== */
/* Palette matches the in-game UI: accent #ff9e1f (UIPanel.ACCENT), deep space blues. */

/* The game's only Latin typeface — reused here for the mobile soundtrack list. */
@font-face {
  font-family: "Orbitron";
  src: url("Orbitron.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --accent: #ff9e1f;
  --accent-soft: rgba(255, 158, 31, 0.25);
  --text: #e8ecf2;
  --text-muted: #9aa3b2;
  --panel: rgba(8, 12, 22, 0.78);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% -20%, #16243f 0%, #0b1020 45%, #05070f 100%);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

/* ---- animated starfield (two parallax layers, pure CSS) ---- */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 25px 35px, #fff, transparent),
    radial-gradient(1px 1px at 120px 90px, #cfe2ff, transparent),
    radial-gradient(2px 2px at 200px 160px, #fff, transparent),
    radial-gradient(1px 1px at 310px 60px, #ffe9c9, transparent),
    radial-gradient(1.5px 1.5px at 380px 210px, #dfe8ff, transparent);
  background-repeat: repeat;
  background-size: 420px 260px;
  animation: drift 160s linear infinite, twinkle 7s ease-in-out infinite alternate;
  opacity: 0.9;
}

.stars-far {
  background-size: 290px 180px;
  animation-duration: 260s, 11s;
  opacity: 0.45;
}

@keyframes drift {
  from { background-position: 0 0; }
  to   { background-position: -1680px 520px; }
}

@keyframes twinkle {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* soft blue glow at the bottom, suggesting Earth below */
.horizon {
  position: fixed;
  left: 50%;
  bottom: -42vh;
  width: 150vw;
  height: 60vh;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(64, 140, 255, 0.28) 0%,
    rgba(40, 90, 200, 0.12) 40%,
    transparent 70%);
}

/* ---- header ---- */
.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 22px 16px 10px;
}

.site-logo {
  display: block;
  width: clamp(160px, 24vw, 260px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 0 20px rgba(120, 170, 255, 0.35))
          drop-shadow(0 0 24px rgba(255, 158, 31, 0.22));
}

.auth-bar {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  padding: 6px 12px;
  transition: background 0.15s ease;
}

.auth-link:hover {
  background: var(--accent-soft);
}

.auth-user {
  color: #fff;
  letter-spacing: 0.04em;
}

.login-wall {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 8vh auto;
  padding: 36px 28px;
  text-align: center;
  background: rgba(10, 14, 30, 0.72);
  border: 1px solid var(--accent-soft);
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(120, 170, 255, 0.18);
}

.login-wall h2 {
  margin: 0 0 12px;
  color: #fff;
  letter-spacing: 0.08em;
}

.login-wall p {
  margin: 0 0 24px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-link-big {
  display: inline-block;
  font-size: 16px;
  padding: 12px 24px;
}

/* ---- mobile fullscreen game (landscape) ---- */
/* On phones the 16:9 game runs fullscreen; page chrome is hidden and the canvas is scaled by
   height so its client box matches the rendered content (keeps libGDX touch mapping correct). */
body.mobile-game .site-header,
body.mobile-game .site-footer,
body.mobile-game .controls,
body.mobile-game .audio-hint { display: none !important; }

body.mobile-game { overflow: hidden; }   /* no page scroll → no white strip under the canvas */
body.mobile-game main { padding: 0; }

body.mobile-game .game-frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;          /* dynamic viewport: excludes the mobile address bar */
  max-width: none;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.mobile-game .corner { display: none; }

body.mobile-game #embed-html {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.mobile-game #embed-html canvas {
  height: 100vh;
  height: 100dvh;
  width: auto;
  max-width: 100vw;
  border-radius: 0;
}

/* Portrait: hide the (landscape) game and ask the player to rotate. */
#rotate-hint { display: none; }
@media (orientation: portrait) {
  body.mobile-game .game-frame { visibility: hidden; }
  body.mobile-game #rotate-hint {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 60;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 40px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 30%, #16243f 0%, #05070f 80%);
    color: var(--text);
    font-size: 18px;
    letter-spacing: 0.03em;
  }
  body.mobile-game #rotate-hint .rotate-icon {
    font-size: 64px;
    animation: rotate-nudge 1.8s ease-in-out infinite;
  }
}
@keyframes rotate-nudge {
  0%, 60%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-90deg); }
}

/* ---- mobile landing (logo + PLAY + Soundtrack) ---- */
.mobile-landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 24px;
  text-align: center;
}
.landing-logo {
  width: clamp(200px, 58vw, 340px);
  height: auto;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 20px rgba(120, 170, 255, 0.35))
          drop-shadow(0 0 24px rgba(255, 158, 31, 0.22));
}
.landing-btn {
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--text);
  background: rgba(255, 158, 31, 0.10);
  border: 1px solid rgba(255, 158, 31, 0.35);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 16px 34px;
  min-width: 240px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.landing-btn:hover,
.landing-btn:active { background: rgba(255, 158, 31, 0.20); transform: translateY(-1px); }
.landing-btn-play {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 158, 31, 0.22);
  border-color: var(--accent);
}

/* ---- mobile soundtrack player ---- */
.mobile-music {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 4vh auto 0;
  padding: 26px 22px 28px;
  text-align: center;
  background: rgba(10, 14, 30, 0.72);
  border: 1px solid var(--accent-soft);
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(120, 170, 255, 0.18);
}

.mobile-music h2 {
  margin: 0 0 8px;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 16px;
}

.mobile-note {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 14px;
}

.track-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
}
.track-list li { list-style: none; }

.track {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 158, 31, 0.35);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: rgba(255, 158, 31, 0.07);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

/* Round Play badge so each row reads as a tappable button, not just a label. */
.track-badge {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(255, 158, 31, 0.16);
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.track-badge svg { margin-left: 2px; }   /* optically centre the triangle */

.track:hover,
.track:focus {
  background: rgba(255, 158, 31, 0.18);
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.track.playing {
  border-color: var(--accent);
  background: rgba(255, 158, 31, 0.26);
}

.track.playing .track-badge {
  color: #05070f;
  background: var(--accent);
}

.track-name {
  flex: 1 1 auto;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.track-dur {
  flex: 0 0 auto;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
}

.track-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.mobile-player {
  width: 100%;
  margin-bottom: 18px;
}

.suno-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 15px;
  transition: background 0.15s ease;
}

.suno-link:hover { background: var(--accent-soft); }

/* ---- game frame ---- */
main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 8px;
}

#gwt-loading {
  position: absolute;
  inset: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(8, 11, 26, 0.92);
  border-radius: 8px;
}

#gwt-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 158, 31, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gwt-spin 0.9s linear infinite;
}

@keyframes gwt-spin { to { transform: rotate(360deg); } }

#gwt-loading-text {
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-size: 14px;
}

#gwt-bar {
  width: min(60%, 340px);
  height: 10px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  overflow: hidden;
}

#gwt-bar-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.15s ease;
}

.game-frame {
  position: relative;
  padding: 12px;
  background: var(--panel);
  border: 1px solid rgba(140, 170, 220, 0.18);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 45px rgba(255, 158, 31, 0.10),
    0 18px 70px rgba(0, 0, 0, 0.75);
  max-width: calc(100vw - 24px);
}

/* sci-fi corner brackets, matching the in-game panels */
.corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--accent);
  pointer-events: none;
}
.corner.tl { top: -3px;    left: -3px;   border-right: none;  border-bottom: none; border-radius: 8px 0 0 0; }
.corner.tr { top: -3px;    right: -3px;  border-left: none;   border-bottom: none; border-radius: 0 8px 0 0; }
.corner.bl { bottom: -3px; left: -3px;   border-right: none;  border-top: none;    border-radius: 0 0 0 8px; }
.corner.br { bottom: -3px; right: -3px;  border-left: none;   border-top: none;    border-radius: 0 0 8px 0; }

#embed-html canvas {
  display: block;
  max-width: 100%;
  height: auto;       /* CSS-downscale on small screens; game is keyboard-driven so coords are unaffected */
  cursor: default;
  outline: none;
  border-radius: 4px;
}

.audio-hint {
  margin: 14px 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ---- controls ---- */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
  max-width: 1100px;
}

.controls-group {
  background: var(--panel);
  border: 1px solid rgba(140, 170, 220, 0.15);
  border-top: 2px solid var(--accent-soft);
  border-radius: 8px;
  padding: 14px 22px 10px;
  min-width: 250px;
  flex: 1 1 250px;
  max-width: 340px;
}

.controls-group h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}

.controls-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.controls-group li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 14px;
  color: var(--text);
}

.controls-group small { color: var(--text-muted); }

.keys {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 3px 7px;
  text-align: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #ffd9a0;
  background: linear-gradient(#2a3242, #1a2030);
  border: 1px solid rgba(255, 158, 31, 0.35);
  border-bottom-width: 3px;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---- footer ---- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px 16px 26px;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer p { margin: 4px 0; }
.site-footer .tech { font-size: 11.5px; opacity: 0.7; letter-spacing: 0.06em; }

/* ---- superdev recompile button (dev only), tucked into a corner ---- */
.superdev {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  line-height: 36px;
  font-size: 18pt;
  text-align: center;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(40, 46, 60, 0.55);
  border: 1px solid rgba(140, 170, 220, 0.2);
  border-radius: 50%;
  opacity: 0.5;
}

.superdev:hover { opacity: 1; color: #fff; }
