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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #06060a;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #ddd;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}

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

#hud { position: absolute; inset: 0; pointer-events: none; }

#hud-top {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-box {
  background: rgba(5, 5, 12, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 10px 14px;
  min-width: 170px;
  text-shadow: 1px 1px 2px #000;
}

#health-bar {
  width: 150px; height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}
#health-fill { height: 100%; width: 100%; background: #3fae56; transition: width 0.15s; }

#armor-bar {
  width: 150px; height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
  display: none;
}
#armor-fill { height: 100%; width: 0; background: #6f9fe8; transition: width 0.15s; }

#tokens { font-size: 13px; color: #ffd23e; }

#money { font-weight: 700; color: #9be89b; font-size: 15px; }

.wanted { color: rgba(255, 255, 255, 0.25); letter-spacing: 2px; font-size: 15px; }
.wanted.active { color: #ffd23e; }

#weapon { font-size: 13px; color: #cfd6ff; margin-top: 2px; }
#mute-note { font-size: 11px; color: #888; }

#hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

#minimap {
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: #000;
  image-rendering: pixelated;
}

#btn-settings {
  pointer-events: auto;
  background: rgba(20, 22, 40, 0.85);
  color: #cfd6ff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}
#btn-settings:hover { background: rgba(45, 50, 90, 0.9); }

#message {
  position: absolute;
  top: 38%; left: 0; right: 0;
  text-align: center;
  display: none;
  text-shadow: 0 3px 12px #000, 0 0 30px rgba(0,0,0,0.9);
}
#message.big { font-size: 64px; font-weight: 900; color: #d33; letter-spacing: 6px; }
#message.small { font-size: 24px; font-weight: 700; color: #9be89b; }

/* mission brief box (bottom center, pager-style) */
#brief {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  max-width: 60%;
  background: rgba(8, 8, 16, 0.82);
  border: 1px solid rgba(255, 210, 62, 0.5);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 15px;
  color: #ffd23e;
  text-align: center;
  display: none;
  text-shadow: 1px 1px 2px #000;
}

#frenzy {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  font: 900 22px 'Arial Black', sans-serif;
  color: #ff5050;
  text-shadow: 2px 2px 0 #000;
  display: none;
  text-align: center;
}

/* ------------- ImGui-style settings window ------------- */

#settings {
  position: absolute;
  top: 70px; left: 24px;
  width: 280px;
  background: rgba(15, 15, 24, 0.94);
  border: 1px solid #3b3b52;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  user-select: none;
  z-index: 80; /* above the frontend menu so OPTIONS works pre-game */
}

#settings-title {
  background: linear-gradient(#2e335e, #23274a);
  padding: 6px 10px;
  font-weight: 600;
  color: #dfe4ff;
  cursor: move;
  border-radius: 4px 4px 0 0;
}
#settings-close {
  float: right;
  cursor: pointer;
  color: #99a;
  padding: 0 4px;
}
#settings-close:hover { color: #fff; }

#settings-body { padding: 8px 10px; max-height: 70vh; overflow-y: auto; }

.setting-row { padding: 3px 0; }
.setting-row label { display: flex; align-items: center; gap: 7px; cursor: pointer; color: #ccd; }
.setting-row input[type="checkbox"] { accent-color: #5865f2; }
.slider-label { flex-direction: column; align-items: flex-start !important; }
.slider-label input[type="range"] { width: 100%; accent-color: #5865f2; }

.sound-test { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.sound-test span { white-space: nowrap; font-size: 11px; color: #8fa0c0; font-family: monospace; }
.sound-test input[type="range"] { flex: 1; accent-color: #5865f2; }
.sound-test button {
  background: #2e335e; color: #dfe4ff; border: 1px solid #3b3b52;
  border-radius: 3px; cursor: pointer; padding: 1px 8px;
}

#loading.with-art { background-size: cover; background-position: center; }
#loading.with-art #load-card {
  background: rgba(5, 5, 12, 0.78);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-line {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #33334a;
  color: #8fa0c0;
  font-size: 11px;
  font-family: monospace;
}

/* ---------------- help ---------------- */

#help {
  position: absolute;
  bottom: 16px; left: 16px;
  background: rgba(5, 5, 12, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 14px 18px;
  font-size: 13px;
  z-index: 15;
}
#help h3 { margin-bottom: 8px; color: #cfd6ff; }
#help td { padding: 2px 10px 2px 0; }
#help td:first-child { color: #ffd23e; font-family: monospace; }
#help p { margin-top: 8px; color: #9be89b; }

.hidden { display: none !important; }

/* ---------------- frontend menu ---------------- */

#frontend {
  position: absolute; inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

#fe-screen {
  display: flex;
  height: min(92vh, 480px * 1.5);
  aspect-ratio: 640 / 480;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

#fe-left { flex: 278; position: relative; overflow: hidden; }
#fe-right { flex: 362; position: relative; overflow: hidden; }
#fe-right-art { position: absolute; inset: 0; }
#fe-left canvas, #fe-right-art canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: auto;
}

#fe-menu {
  position: absolute;
  left: 12%; right: 8%;
  top: 42%;
  display: flex;
  flex-direction: column;
  gap: 4vh;
}

.fe-item {
  font: 900 4.2vh 'Arial Black', 'Segoe UI', sans-serif;
  letter-spacing: 2px;
  color: #cfcfcf;
  text-transform: uppercase;
  text-shadow: 2px 3px 0 #000, -1px -1px 0 #000;
  cursor: pointer;
  transition: color 0.08s, transform 0.08s;
}
.fe-item.hot { color: #ffd23e; transform: translateX(6px) scale(1.04); }

#fe-credits {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 70;
}
#fe-credits canvas { height: 92vh; }
.fe-about {
  max-width: 640px; max-height: 88vh; overflow-y: auto;
  padding: 26px 32px; color: #dfe4ff; cursor: default;
  background: rgba(12, 14, 28, 0.9); border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px; font-size: 14px; line-height: 1.5;
}
.fe-about h2 { color: #ffd23e; letter-spacing: 2px; margin: 0 0 10px; }
.fe-about h3 { color: #9be89b; margin: 16px 0 6px; }
.fe-about ul { margin: 0; padding-left: 20px; }
.fe-about li { margin: 6px 0; }
.fe-about code { color: #cfd6ff; background: rgba(255, 255, 255, 0.08); padding: 0 3px; border-radius: 3px; }
.fe-about a { color: #ffd23e; }
.fe-about .fe-contact { margin-top: 16px; font-size: 15px; }
.fe-about .fe-dismiss { margin-top: 10px; color: #7a86b8; font-size: 12px; text-align: center; }

.fe-credit { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; }

/* ---------------- loading ---------------- */

#loading {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, #14142a, #05050a 75%);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}

#load-card { text-align: center; max-width: 520px; padding: 20px; }
#load-card h1 { font-size: 56px; letter-spacing: 4px; color: #ffd23e; text-shadow: 0 4px 0 #7a5c00, 0 8px 24px #000; }
#load-card h1 span { color: #cfd6ff; font-size: 24px; vertical-align: super; }
#district-name { margin: 6px 0 18px; font-size: 20px; color: #cfd6ff; }
#load-text { color: #9be89b; font-family: monospace; min-height: 20px; }

#district-links { margin: 18px 0; display: flex; gap: 10px; justify-content: center; }
#district-links a {
  color: #aab; text-decoration: none;
  border: 1px solid #444; border-radius: 4px; padding: 4px 10px; font-size: 13px;
}
#district-links a:hover { color: #fff; border-color: #888; }
#district-links a.current { color: #ffd23e; border-color: #ffd23e; }

.credit { margin-top: 22px; font-size: 12px; color: #778; line-height: 1.6; }
.credit a { color: #9be89b; }
