:root {
  --ink: #eef6f8;
  --muted: rgba(238, 246, 248, 0.72);
  --panel: rgba(12, 18, 21, 0.7);
  --line: rgba(255, 255, 255, 0.16);
  --green: #8de08e;
  --gold: #f4c86b;
  --red: #ff806d;
  --cyan: #74d9e7;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #11191d;
  color: var(--ink);
  font-family: "Avenir Next", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(4, 8, 10, 0.28), rgba(4, 8, 10, 0.78)),
    radial-gradient(circle at 50% 42%, rgba(116, 217, 231, 0.22), transparent 36%);
  backdrop-filter: blur(8px);
}

.overlay.hidden,
.hidden {
  display: none !important;
}

.startPanel {
  width: min(720px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: rgba(10, 15, 18, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 0.95;
}

h2 {
  font-size: clamp(32px, 6vw, 58px);
}

.intro {
  margin: 16px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.startGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.startGrid div {
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.startGrid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.startGrid strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

#startButton,
#restartButton {
  min-width: 148px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #18201b;
  font-weight: 900;
  cursor: pointer;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hudGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(52vw, 620px);
}

.hudGroup.bars {
  justify-content: flex-end;
}

.stat,
.bars label,
#missionPanel,
#interactionBox,
#toast {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat {
  min-height: 20px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.money {
  color: var(--green);
}

.bars label {
  display: grid;
  grid-template-columns: 44px minmax(84px, 126px);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 12px;
}

meter {
  width: 100%;
  height: 10px;
}

meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: var(--green);
}

meter::-webkit-meter-suboptimum-value {
  border-radius: 999px;
  background: var(--gold);
}

meter::-webkit-meter-even-less-good-value {
  border-radius: 999px;
  background: var(--red);
}

#missionPanel {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 10;
  width: min(340px, calc(100vw - 28px));
  padding: 12px;
  pointer-events: none;
}

#missionPanel strong,
#interactionBox strong {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 13px;
}

#missionPanel p,
#interactionBox p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#interactionBox {
  position: fixed;
  left: 50%;
  bottom: 82px;
  z-index: 12;
  width: min(360px, calc(100vw - 32px));
  padding: 12px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

#toast {
  position: fixed;
  top: 92px;
  left: 50%;
  z-index: 14;
  max-width: min(520px, calc(100vw - 32px));
  min-height: 20px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

#toast.visible {
  opacity: 1;
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 18px rgba(116, 217, 231, 0.5);
}

#crosshair::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
}

@media (max-width: 720px) {
  .startPanel {
    padding: 20px;
  }

  .startGrid {
    grid-template-columns: 1fr;
  }

  #hud {
    display: grid;
  }

  .hudGroup,
  .hudGroup.bars {
    max-width: none;
    justify-content: flex-start;
  }

  .bars label {
    grid-template-columns: 38px minmax(72px, 1fr);
  }

  #toast {
    top: 150px;
  }
}
