:root {
  --void: #0A0A0F;
  --maroon: #8B0000;
  --red: #E10600;
  --panic: #FF3B3B;
  --bone: #F5E9D8;
  --bone-dim: #9d948a;
  --panel: #111118;
  --line: #26202a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--maroon);
}
.logo { font-weight: 700; letter-spacing: .18em; font-size: 18px; }
.logo .corp { color: var(--red); margin-left: 6px; }
.tag { color: var(--bone-dim); font-size: 11px; margin-left: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: .08em;
  white-space: nowrap;
}
.chip.clock { color: var(--panic); border-color: var(--maroon); }
.chip.vault { color: var(--bone); }
.chip.mood.EUPHORIA { color: #ffd87a; }
.chip.mood.CALM { color: var(--bone); }
.chip.mood.NERVOUS { color: var(--panic); }
.chip.mood.MELTDOWN { color: #fff; background: var(--red); border-color: var(--red); }

.badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 0;
}
.badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  padding: 3px 10px;
}
.badge-sub { color: var(--bone-dim); font-size: 11px; letter-spacing: .12em; }

.stage { padding: 12px 16px 4px; }
.canvas-wrap {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--void);
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: default;
  touch-action: none;   /* mobile: drag pans the office, not the page */
}
.clockz {
  border: 1px solid var(--line); background: var(--panel);
  padding: 4px 7px; font-size: 10px; letter-spacing: .04em;
  color: var(--bone-dim); margin-right: 4px; display: inline-block;
  font-variant-numeric: tabular-nums;
}
#clocks .clockz:first-child { color: var(--panic); border-color: var(--maroon); }
canvas.point { cursor: pointer; }

#bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--bone);
  color: #17120c;
  font-size: 11px;
  line-height: 1.35;
  padding: 5px 8px;
  max-width: 170px;
  border: 2px solid #17120c;
  box-shadow: 2px 2px 0 rgba(0,0,0,.6);
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -7px;
  border: 5px solid transparent;
  border-top-color: #17120c;
  transform: translateX(-50%);
}
.bubble .who { color: var(--red); font-weight: 700; margin-right: 4px; }

.modal-back[hidden] { display: none; }
.modal-back {
  position: fixed; inset: 0;
  background: rgba(5,5,8,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.modal {
  width: min(720px, 94vw);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--maroon);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--maroon);
  letter-spacing: .15em; font-size: 13px;
}
.modal-head button {
  background: none; border: 1px solid var(--line); color: var(--bone);
  cursor: pointer; font: inherit; padding: 2px 8px;
}
.modal-head button:hover { border-color: var(--panic); color: var(--panic); }
.modal-body { padding: 12px 14px; overflow-y: auto; }
.modal-foot {
  padding: 8px 14px; border-top: 1px solid var(--line);
  color: var(--bone-dim); font-size: 10.5px;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--bone-dim); font-weight: 400; font-size: 10px; letter-spacing: .12em; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }
.score { font-weight: 700; }
.score.hi { color: #ffd87a; }
.score.mid { color: var(--bone); }
.score.lo { color: var(--panic); }
.sec { font-size: 10.5px; }
.sec.ok { color: var(--bone-dim); }
.sec.bad { color: var(--panic); font-weight: 700; }
.sec.unk { color: #777; }
.pos { color: #ffd87a; }
.neg { color: var(--panic); }
.mini-cols { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.mini-cols > div { flex: 1; min-width: 220px; }
.mini-cols h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .15em; color: var(--bone-dim); }
a { color: var(--panic); }

.foot {
  color: var(--bone-dim);
  font-size: 11px;
  padding: 10px 16px 20px;
  max-width: 1200px;
  margin: 0 auto;
  line-height: 1.5;
}
.credit { display: block; margin-top: 4px; }

/* ---------- in-world UI ---------- */
.ui-btn {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--maroon);
  color: var(--bone);
  font: inherit;
  font-size: 11px;
  letter-spacing: .1em;
  padding: 7px 12px;
  cursor: pointer;
  z-index: 3;
}
.ui-btn:hover { border-color: var(--panic); color: var(--panic); }
.ui-btn.tl { top: 10px; left: 10px; }
.ui-btn.br { bottom: 10px; right: 10px; }
.ui-btn.go { position: static; background: var(--red); color: #fff; border-color: var(--red); }
.ui-btn.go:hover { background: var(--panic); }
.zoomers { position: absolute; bottom: 10px; left: 10px; display: flex; gap: 6px; z-index: 3; }
.zoomers .ui-btn { position: static; width: 36px; }
.hint {
  color: var(--bone-dim); font-size: 10.5px; letter-spacing: .06em;
  max-width: 1200px; margin: 8px auto 0; text-align: center;
}

/* ---------- live feed panel ---------- */
#feedPanel {
  position: absolute;
  right: 10px; bottom: 52px;
  width: min(340px, 86%);
  max-height: 70%;
  display: flex; flex-direction: column;
  background: rgba(17,17,24,.96);
  border: 1px solid var(--maroon);
  z-index: 4;
}
#feedPanel[hidden] { display: none; }
.feed-head {
  padding: 8px 12px; border-bottom: 1px solid var(--maroon);
  font-size: 11px; letter-spacing: .18em;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ftab {
  background: none; border: 1px solid var(--line); color: var(--bone-dim);
  font: inherit; font-size: 10px; letter-spacing: .14em;
  padding: 3px 10px; cursor: pointer;
}
.ftab.on { border-color: var(--red); color: var(--bone); background: rgba(225,6,0,.15); }
.fe.chat b { color: var(--panic); }
.bubble.talkb .who.you { color: #b8860b; }
.bubble.snark { pointer-events: auto; }
.filelink {
  display: block; margin-top: 4px; color: var(--red);
  font-size: 10px; letter-spacing: .08em; cursor: pointer;
  text-decoration: underline;
}
.chip.clock { cursor: pointer; user-select: none; }

/* ---------- pixel loading screen ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50;
  background: var(--void);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
}
.loadtrack { position: relative; width: min(360px, 78vw); height: 120px; }
.loadbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  border: 2px solid var(--maroon); background: var(--panel);
}
#loadfill {
  width: 4%; height: 100%; background: var(--red);
  transition: width .25s steps(4);
}
.loadwalk {
  position: absolute; bottom: 12px; left: 0;
  width: 48px; height: 96px;
  background: url("sprites/chars/PLAYER_M.png") no-repeat;
  background-position: 0 -96px;      /* walk row, facing right */
  image-rendering: pixelated;
  animation: walkframes .55s steps(6) infinite, walkacross 6s linear infinite;
}
@keyframes walkframes { from { background-position: 0 -96px; }
                        to { background-position: -288px -96px; } }
@keyframes walkacross { from { transform: translateX(0); }
                        to { transform: translateX(min(312px, 66vw)); } }
.mug {
  position: absolute; right: 6px; top: 46px; width: 8px; height: 7px;
  background: #8B4513; border: 2px solid #17120c;
}
.loadwalk .d {
  position: absolute; right: 2px; top: 30px;
  color: #e4a63a; font-size: 11px; font-weight: 700;
  animation: steam 1.6s linear infinite; opacity: 0;
}
.loadwalk .d2 { animation-delay: .5s; right: 8px; }
.loadwalk .d3 { animation-delay: 1s; right: -2px; }
@keyframes steam {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-26px); opacity: 0; }
}
.load-logo { font-size: 20px; font-weight: 700; letter-spacing: .22em; }
.load-logo span { color: var(--red); margin-left: 6px; }
.load-sub { color: var(--bone-dim); font-size: 11px; letter-spacing: .3em;
  animation: blinkc 1.2s steps(2) infinite; }
@keyframes blinkc { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .candles i, .load-sub { animation: none; } }
.feed-sub { color: var(--bone-dim); letter-spacing: .04em; margin-left: 6px; }
#feedBody { overflow-y: auto; padding: 6px 0; }
.fe {
  padding: 5px 12px; font-size: 11px; line-height: 1.45;
  border-bottom: 1px solid rgba(42,34,48,.6);
}
.fe.buy b { color: #ffd87a; }
.fe.sell b { color: var(--panic); }
.fe.rug { color: var(--panic); }
.fs { color: var(--bone-dim); margin-left: 6px; }
.ft { float: right; color: var(--bone-dim); }

/* ---------- agent card ---------- */
.modal.slim { width: min(400px, 94vw); }
.agent-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.agent-head canvas { image-rendering: pixelated; width: 72px; height: 90px;
  background: var(--void); border: 1px solid var(--line); }
.agent-name { font-size: 17px; font-weight: 700; letter-spacing: .12em; }
.agent-title { color: var(--panic); font-size: 11px; letter-spacing: .1em; }
.agent-desc { color: var(--bone-dim); font-size: 12px; line-height: 1.5; margin: 6px 0 10px; }
.agent-note { color: var(--bone-dim); font-size: 10px; margin: 10px 0 0; }

/* ---------- character picker ---------- */
.picker { text-align: center; }
.pick-row { display: flex; gap: 14px; justify-content: center; margin: 6px 0 14px; }
.pick-row canvas {
  image-rendering: pixelated; width: 96px; height: 120px;
  background: var(--void); border: 2px solid var(--line); cursor: pointer;
}
.pick-row canvas.sel { border-color: var(--red); }
#pickName {
  display: block; margin: 0 auto 12px; width: 200px;
  background: var(--void); border: 1px solid var(--line); color: var(--bone);
  font: inherit; font-size: 12px; padding: 7px 10px; text-align: center;
}
#pickName:focus { outline: none; border-color: var(--maroon); }
.pick-note { color: var(--bone-dim); font-size: 10px; margin: 10px 0 0; }
