/* First Humans — locked art direction (see handoff art-reference.html).
   Dark earth browns, warm parchment text, monospace everywhere, no images. */

:root {
  --bg: #1d1912;
  --panel: #262017;
  --panel-alt: #221c14;
  --card: #2b2419;
  --hairline: #4a3f30;
  --hairline-hot: #7a5a38;
  --text: #d8ccb4;
  --text-bright: #f2e6d4;
  --text-dim: #b8ab90;
  --text-muted: #9a8c70;
  --text-faint: #7a6a52;
  --amber: #e0a94e;
  --green: #8fd18f;
  --ember: #e08a6a;
  --blue: #7fb3d1;
  --tan: #d1a97f;
  --gold: #ffd97a;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------- login ---------- */
#login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
}
.loginCard {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 30px 32px 22px;
  width: 340px;
}
.loginCard h1 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: .28em;
  color: var(--text-bright);
  font-weight: 700;
}
.loginSub {
  margin: 0 0 18px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
}
.loginCard input {
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--text-bright);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.loginCard input:focus { border-color: var(--hairline-hot); }
.loginCard input::placeholder { color: var(--text-faint); }
.loginBtns { display: flex; gap: 8px; margin-top: 4px; }
.btn {
  flex: 1;
  padding: 7px 14px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.btn.primary {
  background: #3a2f22;
  border-color: var(--hairline-hot);
  color: var(--text-bright);
}
.btn:hover { border-color: var(--hairline-hot); }
#authErr {
  min-height: 18px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ember);
}
.loginHint {
  margin: 14px 0 0;
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

/* ---------- game frame ---------- */
#game {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
#hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
#hudName { color: var(--green); font-weight: 700; }
#hudHp { color: #e8e4d8; }
#hudStats { color: var(--text-muted); }
#hudLoc { margin-left: auto; color: var(--text-faint); }

#viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
}
#world {
  position: absolute;
  inset: 0;
  display: block;
  image-rendering: pixelated;
}

#bar {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
#barInv { margin-left: auto; color: var(--text-dim); }

/* ---------- overlays in the viewport ---------- */
#nightTint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(12, 18, 32, 0) 22%, rgba(9, 13, 24, .38) 62%, rgba(4, 7, 14, .62) 100%),
    rgba(10, 14, 26, .16);
  opacity: 0;
  transition: opacity 1.8s ease;
  z-index: 5;
}
#nightTint.on { opacity: 1; }

#tags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}
.nameTag {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 10px;
  color: var(--text);
  background: rgba(29, 25, 18, .74);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}
.nameTag.you { color: var(--green); }
.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--panel);
  border: 1px solid var(--hairline-hot);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text-bright);
  max-width: 230px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.bubble.yell {
  font-weight: 700;
  text-transform: uppercase;
  border-color: var(--amber);
}

#logPanel {
  position: absolute;
  left: 12px;
  bottom: 36px;
  width: 340px;
  font-size: 11.5px;
  line-height: 1.7;
  pointer-events: none;
  z-index: 7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}
.logLine { color: var(--text-dim); }
.logLine.c-dmg { color: var(--ember); }
.logLine.c-good { color: var(--green); }
.logLine.c-dim { color: var(--text-faint); }
.logLine.c-warn { color: var(--amber); }
.logLine.c-chat { color: var(--text); }
.logLine.faded { opacity: .45; }

#chatWrap {
  position: absolute;
  left: 12px;
  bottom: 8px;
  width: 340px;
  z-index: 8;
}
#chatInput {
  width: 100%;
  padding: 5px 8px;
  background: var(--panel);
  border: 1px solid var(--hairline-hot);
  border-radius: 4px;
  color: var(--text-bright);
  font: inherit;
  font-size: 12px;
  outline: none;
}
#chatInput::placeholder { color: var(--text-faint); }

#specPanel {
  position: absolute;
  right: 14px;
  bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--hairline-hot);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11.5px;
  max-width: 250px;
  z-index: 7;
  line-height: 1.5;
}
.specTitle { color: var(--amber); font-weight: 700; }
.specSides { color: var(--text-dim); margin-top: 3px; }
.specHp { color: var(--text-muted); margin-top: 2px; font-size: 11px; }
.specHint { color: #7fd18f; margin-top: 3px; }

#toasts {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--hairline-hot);
  border-radius: 5px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-bright);
  animation: toastIn .18s ease-out;
}
.toast.t-stat { color: var(--green); }
.toast.t-codex { color: var(--amber); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

#deathOv {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(12, 7, 4, .82);
  color: var(--ember);
  font-size: 15px;
  line-height: 1.8;
  z-index: 40;
  padding: 0 20vw;
}
#connOv {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 7, 4, .66);
  color: var(--amber);
  font-size: 13px;
  z-index: 60;
}

/* ---------- battle overlay ---------- */
#battleOv {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 3, .62);
  z-index: 30;
}
.battleCard {
  width: min(940px, 94vw);
  height: min(600px, 86vh);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, .5);
  display: grid;
  grid-template-columns: 1fr 240px;
  overflow: hidden;
}
.bMain {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
  min-width: 0;
}
.bEnemies {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  gap: 24px;
  align-items: center;
  background: var(--panel);
  min-height: 66px;
}
.bEnemyGlyph { font-size: 30px; font-weight: 700; }
.bEnemyName { font-size: 13px; }
.bEnemyStats { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.bLog {
  flex: 1;
  padding: 14px 18px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-dim);
  overflow-y: auto;
  min-height: 0;
}
.bLog .lg-good { color: #7fd18f; }
.bLog .lg-dim { color: var(--text-faint); }
.bLog .lg-warn { color: var(--amber); }
.bLog .ember { color: var(--ember); }
.bTurnLine { color: var(--text-bright); }
.bTurnLine .timer { color: var(--text-faint); }
.bCmds {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  background: var(--panel);
}
.bCmd {
  padding: 7px 14px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.bCmd.active {
  background: #3a2f22;
  border-color: var(--hairline-hot);
  color: var(--text-bright);
}
.bCmd.disabled { opacity: .4; cursor: default; }
.bParty {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  background: var(--panel-alt);
  overflow-y: auto;
}
.bPartyLabel {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: .1em;
}
#bPartyCards { display: flex; flex-direction: column; gap: 10px; }
.bCard {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 8px 10px;
}
.bCardName.you { color: var(--green); }
.bCardName.c-blue { color: var(--blue); }
.bCardName.c-tan { color: var(--tan); }
.bCardName .youTag { color: var(--text-faint); }
.bCardHp { color: var(--text-dim); margin-top: 3px; }
.bSlotOpen {
  border: 1px dashed var(--hairline);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text-faint);
}
.bWatcher {
  margin-top: auto;
  padding-top: 10px;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ---------- generic modal ---------- */
#modalOv {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 3, .55);
  z-index: 25;
}
.modalCard {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  min-width: 360px;
  max-width: 500px;
  max-height: 72vh;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 12.5px;
  line-height: 1.6;
}
.modalCard h3 {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--amber);
  font-weight: 700;
}
.modalHint { color: var(--text-faint); font-size: 10.5px; margin-top: 10px; }
.recipeRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  margin-bottom: 8px;
}
.recipeName { color: var(--text-bright); }
.recipeCost { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.craftBtn {
  padding: 6px 12px;
  background: #3a2f22;
  border: 1px solid var(--hairline-hot);
  border-radius: 4px;
  color: var(--text-bright);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.craftBtn:disabled {
  background: var(--panel);
  border-color: var(--hairline);
  color: var(--text-faint);
  cursor: default;
}
.codexEntry { margin-bottom: 13px; }
.codexTitle { color: var(--text-bright); }
.codexTitle .num { color: var(--text-faint); }
.codexText { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.codexLocked { color: var(--text-faint); }
.modalBtns { display: flex; gap: 8px; margin-top: 14px; }
