/* Dark UI shell for LAST CONVOY. Everything here is GPU-composited DOM; the
   game itself lives in one canvas. */

:root {
  --ink: #cfd6dd;
  --dim: #7d8794;
  --edge: #2a3038;
  --panel: rgba(9, 11, 15, 0.86);
  --blood: #b2352f;
  --acid: #9fe870;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  user-select: none;
  -webkit-font-smoothing: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  cursor: none;
}

/* ---------------------------------------------------------------- HUD */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.9);
}

#topbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 340px;
  text-align: center;
}

#sectorName {
  font-size: 15px;
  letter-spacing: 0.22em;
  color: #e6edf5;
}

#objectiveText {
  margin-top: 4px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.objBar {
  margin: 6px auto 0;
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--edge);
}

#objectiveFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6f9f3f, #a7d75f);
  transition: width 0.25s ease-out;
}

#stats {
  position: absolute;
  top: 14px;
  right: 18px;
  text-align: right;
  line-height: 1.7;
}

#threat { letter-spacing: 0.18em; color: #6f8b6a; }
#threat.mid { color: #c9b45a; }
#threat.high { color: #d1813c; }
#threat.over { color: var(--blood); animation: pulse 0.8s infinite; }

@keyframes pulse { 50% { opacity: 0.35; } }

#killRow { color: var(--dim); font-size: 11px; }
#killRow b { color: #e6edf5; }

#minimapWrap {
  position: absolute;
  top: 14px;
  left: 18px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--edge);
}

#minimap { display: block; width: 176px; height: 176px; image-rendering: pixelated; opacity: 0.9; }

.miniLabel {
  margin-top: 4px;
  font-size: 9px;
  text-align: center;
  color: #5c6572;
  letter-spacing: 0.2em;
}

#vitals {
  position: absolute;
  left: 18px;
  bottom: 22px;
  width: 232px;
}

.bar {
  position: relative;
  height: 14px;
  margin-top: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--edge);
  overflow: hidden;
}

.bar > div { height: 100%; width: 100%; background: #7fbf4a; transition: width 0.15s linear; }

.bar.hp span {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10px;
  line-height: 14px;
  color: #05060a;
  text-shadow: none;
  font-weight: 700;
}

.bar.stamina { height: 7px; }
.bar.stamina > div { background: #4a86b8; }

#weaponBox {
  position: absolute;
  right: 18px;
  bottom: 22px;
  min-width: 220px;
  text-align: right;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--edge);
}

#weaponName { font-size: 14px; letter-spacing: 0.16em; color: #e6edf5; }
#weaponMag { color: var(--dim); margin-top: 2px; }
#slots { margin-top: 6px; font-size: 10px; color: #6f7b88; letter-spacing: 0.1em; }

#feed {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: 420px;
  text-align: center;
}

.toast {
  margin-top: 4px;
  font-size: 11px;
  color: #b9c3cd;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.in { opacity: 1; transform: translateY(0); }

#tip {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--acid);
}

#controls {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 10px;
  color: #4f5865;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- notes */

#notes {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(460px, 84vw);
  padding: 20px 22px;
  background: rgba(14, 12, 9, 0.95);
  border: 1px solid #3a3226;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

#notes.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

#notes h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.24em; color: #d8cfa8; }
#notes p { margin: 0; line-height: 1.7; color: #b6ad98; font-size: 13px; }
#notes .hint { display: block; margin-top: 16px; font-size: 10px; color: #6c6552; letter-spacing: 0.2em; }

/* ---------------------------------------------------------------- overlays */

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(6, 8, 12, 0.86), rgba(2, 3, 5, 0.97));
  /* No backdrop-filter: blurring the canvas underneath costs a fullscreen
     readback every frame, for a menu nobody is looking through. */
  cursor: pointer;
}

#overlay.hidden { display: none; }

.panel {
  width: min(660px, 88vw);
  padding: 34px 36px;
  border: 1px solid var(--edge);
  background: rgba(6, 8, 12, 0.9);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7), 0 24px 80px rgba(0, 0, 0, 0.8);
  animation: rise 0.35s ease-out;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.panel h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 4vw, 40px);
  letter-spacing: 0.28em;
  color: #eef3f8;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.34em;
  color: #7c8894;
  text-transform: uppercase;
}

.panel p { margin: 7px 0; line-height: 1.75; color: #a9b3bd; font-size: 13px; }

.panel .stats {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--edge);
  display: grid;
  gap: 5px;
}

.panel .stats div { display: flex; justify-content: space-between; font-size: 12px; color: #79838f; }
.panel .stats b { color: #e2e8ee; font-weight: 600; }

.panel .hint {
  margin-top: 22px;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: #6f7b88;
  animation: pulse 1.8s infinite;
}

.panel.intro h1 { color: #e8efe6; }
.panel.death { border-color: #4a1c1c; }
.panel.death h1 { color: #d05a52; }
.panel.win { border-color: #2f4a34; }
.panel.win h1 { color: #a7d75f; }
.panel.clear h1 { color: #cfe08a; }
.panel.brief h1 { letter-spacing: 0.5em; }

/* ---------------------------------------------------------------- CRT */

#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* Plain alpha-blended stripes. `mix-blend-mode` would force the compositor to
     blend a fullscreen layer against the animating canvas every frame, which is
     one of the most expensive things you can ask a browser to do at 60Hz. */
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.16) 0 1px, rgba(0, 0, 0, 0) 1px 3px);
}
