:root {
  color-scheme: dark;
  --text: #fff8e7;
  --muted: #dccca9;
  --ink: #111819;
  --panel: rgba(255, 249, 232, 0.92);
  --panel-soft: rgba(255, 249, 232, 0.72);
  --panel-line: rgba(255, 239, 191, 0.28);
  --dark-text: #20160f;
  --amber: #ffbd45;
  --teal: #4fd6cf;
  --green: #8ce28d;
  --coral: #ff715f;
  --violet: #a997ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 189, 69, 0.16), transparent 38%),
    linear-gradient(135deg, #201612 0%, #102227 48%, #171329 100%);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.game-app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.scene-root {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.scene-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud,
.mission-panel,
.control-panel,
.toast,
.overlay {
  position: absolute;
  z-index: 2;
}

.hud-top {
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 240px;
}

.sun-badge {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 43%),
    radial-gradient(circle, #fff5a9 0 18%, var(--amber) 19% 66%, #c45b38 67%);
  box-shadow:
    0 0 26px rgba(255, 189, 69, 0.58),
    inset 0 0 0 2px rgba(255, 247, 210, 0.46);
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.2vw, 4.5rem);
  line-height: 0.94;
}

.stat-grid {
  width: min(560px, 48vw);
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 10px;
}

.stat {
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: rgba(7, 12, 13, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 4px;
  color: #fff3bd;
  font-size: clamp(1.3rem, 2.1vw, 1.9rem);
  line-height: 1;
}

.mission-panel {
  right: 18px;
  top: 112px;
  width: min(370px, calc(100vw - 36px));
  padding: 16px;
  border: 1px solid rgba(255, 250, 226, 0.76);
  border-radius: 8px;
  background: var(--panel);
  color: var(--dark-text);
  box-shadow: var(--shadow);
}

.mission-panel h2 {
  margin: 8px 0 12px;
  font-size: 1.45rem;
  line-height: 1.1;
}

.tape-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(26px, 1fr));
  gap: 6px;
  min-height: 42px;
}

.tape-bit {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(32, 22, 15, 0.16);
  border-radius: 8px;
  background: #eddfbe;
  color: #735b3a;
  font-weight: 900;
}

.tape-bit.active {
  background: linear-gradient(135deg, #fff1a8, #8beddf);
  color: #122421;
}

.tape-bit.current {
  border-color: rgba(210, 118, 35, 0.8);
  box-shadow: inset 0 0 0 2px rgba(255, 221, 143, 0.86), 0 0 0 2px rgba(210, 118, 35, 0.12);
  color: #2f2417;
}

.daylight-block {
  margin-top: 14px;
}

.daylight-meta,
.platform-readout {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #65503b;
  font-weight: 900;
}

.daylight-meta strong,
.platform-readout strong {
  color: #11726d;
}

.daylight-track {
  height: 13px;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid rgba(32, 22, 15, 0.18);
  border-radius: 999px;
  background: linear-gradient(90deg, #44253a, #6a574b);
}

.daylight-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff725f, #ffbd45 52%, #4fd6cf);
  transition: width 120ms linear;
}

.platform-readout {
  margin-top: 13px;
}

.control-panel {
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 148px 112px;
  gap: 10px;
  align-items: center;
}

.charge-shell {
  position: relative;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: rgba(8, 13, 14, 0.72);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.charge-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--coral));
  transition: width 40ms linear;
}

.charge-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff8d3;
  box-shadow: 0 0 12px rgba(255, 248, 211, 0.8);
  z-index: 2;
}

.jump-button,
.ghost-button,
.overlay-panel button {
  min-height: 52px;
  padding: 12px 18px;
  color: #20160f;
  background: linear-gradient(180deg, #ffe28e, var(--amber));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.jump-button.charging {
  background: linear-gradient(180deg, #fff1a8, #ff725f);
}

.ghost-button {
  color: var(--text);
  background: linear-gradient(180deg, #2a3d3a, #14211f);
  border: 1px solid rgba(210, 238, 229, 0.24);
}

.overlay {
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(9, 12, 13, 0.34);
  backdrop-filter: blur(5px);
}

.overlay.visible {
  display: grid;
}

.overlay-panel {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 250, 226, 0.82);
  border-radius: 8px;
  background: var(--panel);
  color: var(--dark-text);
  box-shadow: var(--shadow);
}

.overlay-panel h2 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 0.98;
}

.overlay-panel p {
  color: #5f4a35;
  line-height: 1.5;
}

.overlay-panel button {
  margin-top: 10px;
}

.toast {
  left: 50%;
  top: 108px;
  transform: translate(-50%, -24px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 249, 232, 0.96);
  color: var(--dark-text);
  box-shadow: var(--shadow);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 170ms ease,
    transform 190ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .hud-top {
    display: grid;
  }

  .stat-grid {
    width: 100%;
  }

  .mission-panel {
    top: auto;
    right: 12px;
    bottom: 96px;
    width: min(360px, calc(100vw - 24px));
  }

  .control-panel {
    bottom: 12px;
  }
}

@media (max-width: 620px) {
  .hud-top {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 10px;
  }

  .brand-block {
    gap: 10px;
    min-width: 0;
  }

  .sun-badge {
    width: 42px;
    height: 42px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stat {
    min-height: 54px;
    padding: 8px;
  }

  .stat span {
    font-size: 0.62rem;
  }

  .stat strong {
    font-size: 1.15rem;
  }

  .mission-panel {
    padding: 12px;
    bottom: 104px;
  }

  .mission-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 9px;
  }

  .tape-row {
    grid-template-columns: repeat(8, minmax(22px, 1fr));
  }

  .control-panel {
    grid-template-columns: 1fr 96px 84px;
    gap: 7px;
    width: calc(100vw - 20px);
  }

  .jump-button,
  .ghost-button {
    min-height: 48px;
    padding: 10px 8px;
  }
}
