:root {
  --accent: #ffb02e;
  --accent2: #38d0ff;
  --ore: #ffd84a;
  --danger: #ff3b5c;
  --fuel: #46e08a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #060214;
  font-family: "Courier New", ui-monospace, monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 18px;
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(0,0,0,0.9);
}

#title {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent);
  font-size: clamp(13px, 3.4vw, 22px);
  letter-spacing: 4px;
  opacity: 0.9;
}
#subtitle {
  font-size: 10px;
  letter-spacing: 3px;
  color: #cbb3ff;
  opacity: 0.8;
  margin-top: 2px;
}

.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat.right { align-items: flex-end; }
.stat .label { font-size: 10px; opacity: 0.6; color: #cfd8ff; }
.stat span:last-child { font-size: clamp(18px, 4vw, 26px); color: #fff; }
#ore { color: var(--ore); }
#shield { color: var(--accent2); }

/* ---------- bars ---------- */
#progressWrap, #fuelWrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70vw);
  display: flex;
  align-items: center;
  gap: 8px;
}
#progressWrap { top: 62px; }
#fuelWrap { bottom: 46px; }
.barlabel {
  font-size: 9px;
  letter-spacing: 2px;
  color: #9fb0ff;
  width: 64px;
  text-align: right;
  opacity: 0.75;
}
.bar {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}
#progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7a4fd0, var(--accent));
  transition: width 0.1s linear;
}
#fuel {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2a9d6a, var(--fuel));
  box-shadow: 0 0 8px rgba(70,224,138,0.6);
  transition: width 0.25s ease;
}
#fuelNum {
  font-size: 11px;
  color: var(--fuel);
  width: 34px;
}

#banner {
  position: absolute;
  top: 24%;
  left: 0; right: 0;
  text-align: center;
  color: var(--accent);
  font-size: clamp(22px, 6vw, 44px);
  font-weight: bold;
  letter-spacing: 6px;
  text-shadow: 0 0 18px rgba(255,176,46,0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
}
#banner.show { opacity: 1; }

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  will-change: left, top;
}
#crosshair .ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(56,208,255,0.85);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(56,208,255,0.6), inset 0 0 8px rgba(56,208,255,0.4);
}
#crosshair .dot {
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 4px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #fff;
}
#crosshair.firing .ring {
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(255,59,92,0.8), inset 0 0 10px rgba(255,59,92,0.5);
}

#hint {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  text-align: center;
  color: #9fb0ff;
  font-size: clamp(10px, 2.6vw, 13px);
  opacity: 0.7;
  transition: opacity 0.6s ease;
}
#hint.hide { opacity: 0; }

/* ---------- Cockpit frame ---------- */
#cockpit {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(125% 85% at 50% 120%, rgba(20,8,40,0.0) 68%, rgba(12,5,30,0.35) 86%, rgba(8,3,22,0.6) 100%),
    radial-gradient(150% 110% at 50% -25%, rgba(20,8,40,0.0) 72%, rgba(10,4,26,0.35) 100%);
}

/* ---------- Delivery / Game over panel ---------- */
#panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(60% 60% at 50% 45%, rgba(20,8,46,0.78), rgba(4,1,14,0.94));
  backdrop-filter: blur(2px);
  text-align: center;
  transition: opacity 0.5s ease;
}
#panel.hidden { opacity: 0; pointer-events: none; }
#panel h1 {
  color: var(--accent);
  font-size: clamp(26px, 7vw, 52px);
  letter-spacing: 6px;
  text-shadow: 0 0 22px rgba(255,176,46,0.6);
}
#panelBody {
  color: #e7ecff;
  font-size: clamp(14px, 3.6vw, 19px);
  line-height: 2;
  letter-spacing: 1px;
}
#panelBody .good { color: var(--fuel); }
#panelBody .ore { color: var(--ore); }
#panelBody .bad { color: var(--danger); }
#panelBtn {
  pointer-events: auto;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 3px;
  font-size: clamp(15px, 4vw, 20px);
  color: #07210f;
  background: linear-gradient(180deg, #6cf2a6, #2fae72);
  border: none;
  border-radius: 10px;
  padding: 14px 34px;
  box-shadow: 0 0 24px rgba(70,224,138,0.5);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
#panelBtn:active { transform: scale(0.96); }
#panelBtn.danger {
  color: #2a0008;
  background: linear-gradient(180deg, #ff8aa0, #e0354f);
  box-shadow: 0 0 24px rgba(255,59,92,0.5);
}
