:root {
  color-scheme: dark;
  --cream: #f4ecd8;
  --gold: #e0cc86;
  --ink: #141a16;
  --panel: rgba(36, 48, 40, 0.9);
  --line: rgba(224, 204, 134, 0.95);
  font-family: "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #10161c;
  color: var(--cream);
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.hidden { display: none !important; }

#view {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#boot, #toast {
  position: fixed;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  margin: 0;
  pointer-events: none;
}

#boot {
  bottom: 24px;
  max-width: min(720px, 90vw);
  color: #ffb0a0;
  white-space: pre-wrap;
}

#toast {
  top: 18%;
  padding: 8px 14px;
  background: rgba(12, 16, 18, 0.72);
  border: 1px solid var(--gold);
  border-radius: 8px;
}

#lobby, #setup, #hud, #pause, #result, #help, #dossier, #buy {
  position: fixed;
  inset: 0;
}

#lobby {
  display: flex;
  flex-direction: column;
  padding: 28px 34px 22px;
  pointer-events: none;
}

#lobby h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f6f0e2;
}

#lobby h1 small, #setup h2 small {
  margin-left: 8px;
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: #d9d0b8;
}

#lobby header p {
  margin: 6px 0 18px;
  color: #ddd4c2;
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 280px));
  gap: 14px 16px;
  max-width: 920px;
  pointer-events: auto;
}

.modes button, .lobby-bottom button, .sheet button, #buy button, #hud-pause {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--cream);
}

.modes button {
  min-height: 78px;
  padding: 12px 16px;
  text-align: left;
  font-size: 18px;
}

.modes button small {
  display: block;
  margin-top: 6px;
  color: #d5ccb6;
  font-size: 12px;
  line-height: 1.4;
}

.modes button:hover, .lobby-bottom button:hover, .sheet button:hover, #buy button:hover {
  background: rgba(58, 74, 60, 0.95);
}

.lobby-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 920px;
  margin-top: auto;
  pointer-events: auto;
}

.lobby-bottom button, .sheet button, #buy button {
  min-height: 52px;
  background: rgba(24, 36, 52, 0.88);
}

.sheet {
  width: min(520px, calc(100% - 36px));
  margin: 8vh auto 0;
  padding: 22px 22px 18px;
  background: rgba(16, 22, 20, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
}

#setup { pointer-events: none; }
#setup .sheet, #pause .sheet, #result .sheet, #help .sheet, #dossier .sheet { pointer-events: auto; }

#pause, #result, #help, #dossier {
  display: grid;
  place-items: center;
  background: rgba(6, 8, 10, 0.28);
}

#pause .sheet, #result .sheet, #help .sheet, #dossier .sheet { margin: 0; }

h2 { margin: 0 0 12px; font-size: 28px; font-family: "Songti SC", "STSong", serif; }

.copy { margin: 0 0 14px; line-height: 1.55; color: #e6dcc8; }

label { display: block; margin: 10px 0; }

select, .choices { margin-top: 6px; }

select {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  background: #1c2620;
  border: 1px solid var(--gold);
  border-radius: 8px;
}

.choices { display: flex; flex-wrap: wrap; gap: 8px; }

.choice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(224, 204, 134, 0.45);
  border-radius: 8px;
}

.row { display: flex; gap: 10px; margin-top: 16px; }
.row button, #help button, #dossier button { flex: 1; }

#hud { pointer-events: none; }
#hud-pause, #buy { pointer-events: auto; }

#hud-pause {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 40px;
  padding: 0 16px;
}

#topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 18px auto 0;
  padding: 8px 16px;
  background: rgba(10, 14, 16, 0.55);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

#objective, #prompt, #down, #zonewarn, #lookname {
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

#objective { margin: 10px 16px 0; color: #f0e6cf; }

#feed {
  position: absolute;
  top: 72px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.marker {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

#lookname {
  position: absolute;
  top: 42%;
  left: 0;
  right: 0;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
}

#crosshair i {
  position: absolute;
  background: rgba(244, 236, 216, 0.9);
}

#crosshair i:nth-child(1), #crosshair i:nth-child(2) { width: 7px; height: 2px; top: 8px; }
#crosshair i:nth-child(1) { left: -6px; }
#crosshair i:nth-child(2) { right: -6px; }
#crosshair i:nth-child(3), #crosshair i:nth-child(4) { width: 2px; height: 7px; left: 8px; }
#crosshair i:nth-child(3) { top: -6px; }
#crosshair i:nth-child(4) { bottom: -6px; }

#hitmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.4);
  opacity: 0;
}

#hitmark.show { opacity: 1; transform: translate(-50%, -50%) rotate(45deg) scale(1); }

#scope {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(68vh, 68vw);
  height: min(68vh, 68vw);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(12, 12, 12, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}

#prompt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  font-size: 18px;
}

#down {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  font-size: 22px;
}

#zonewarn {
  position: absolute;
  left: 0;
  right: 0;
  top: 16%;
  color: #ffb0a0;
  font-size: 20px;
}

#hurtflash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 42%, rgba(120, 0, 0, 0.55) 100%);
  opacity: 0;
}

#bottombar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

#minimap {
  width: 150px;
  height: 150px;
  border: 1px solid rgba(224, 204, 134, 0.45);
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.4);
}

.vitals { min-width: 180px; }
.vitals b, .ammo b { font-size: 32px; font-variant-numeric: tabular-nums; }
#hpbar {
  width: 180px;
  height: 8px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  overflow: hidden;
}
#hpfill { display: block; height: 100%; width: 100%; background: #7dbe78; }
#roleline { color: #ddd4c2; }

.ammo { margin-left: auto; text-align: right; position: relative; min-width: 120px; }
.ammo small { display: block; color: #ddd4c2; }
.ammo span { margin-left: 6px; color: #c8bfa4; }
#reloadbar {
  display: block;
  height: 3px;
  width: 0;
  margin-top: 4px;
  background: var(--gold);
}

#buy {
  top: auto;
  right: auto;
  left: 50%;
  bottom: 118px;
  width: min(720px, calc(100% - 40px));
  transform: translateX(-50%);
  padding: 12px;
  background: rgba(14, 18, 16, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
}

#buy p { margin: 0 0 8px; }
#buy-list { display: flex; flex-wrap: wrap; gap: 8px; }
#buy button { min-height: 40px; padding: 0 12px; }

ul { margin: 0 0 12px; padding-left: 18px; line-height: 1.6; }

input[type="range"] { width: 100%; }

@media (max-width: 860px) {
  .modes { grid-template-columns: 1fr; }
  #lobby { padding: 16px; }
  #bottombar { flex-wrap: wrap; }
}
