/* client.css — web MUD client for The MUD with No Name.
   Shares the landing-page palette (style.css) so it feels like one product. */

:root {
  --bg:      #0b0c10;
  --bg-alt:  #101218;
  --panel:   #161922;
  --border:  #2a2e3b;
  --text:    #d9d4c7;
  --muted:   #948f82;
  --gold:    #e8b94a;
  --cyan:    #46c7d4;
  --blood:   #c0392b;
  --green:   #6fcf6f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "EB Garamond", Georgia, serif;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---- top bar ---- */
.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.bar .brand {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--gold);
  font-size: 15px;
  white-space: nowrap;
}
.bar .brand .sub { color: var(--muted); font-weight: 500; font-size: 12px; }
.bar .spacer { flex: 1; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.status .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: background .2s, box-shadow .2s;
}
.status.on  .dot { background: var(--green); box-shadow: 0 0 8px 1px rgba(111,207,111,.6); }
.status.off .dot { background: var(--blood); }
.status.wait .dot { background: var(--gold); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn.icon { padding: 5px 9px; font-weight: 700; }

/* ---- quick-command toolbar ---- */
.quickbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.quickbar .group {
  display: flex;
  gap: 4px;
  align-items: center;
}
.quickbar .group + .group { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--border); }
.qbtn {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all .12s;
}
.qbtn:hover { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.qbtn.dir { min-width: 30px; text-align: center; }
.qbtn.dir.diag { color: var(--cyan); }

/* ---- live HUD strip (GMCP) ---- */
.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.hud .vit { display: flex; flex-direction: column; gap: 4px; min-width: 240px; flex: 1 1 260px; }
.bar { display: flex; align-items: center; gap: 8px; font-family: "JetBrains Mono", monospace; font-size: 11px; }
.bar .lbl { width: 22px; color: var(--muted); font-weight: 700; }
.bar .track {
  position: relative; flex: 1; height: 13px;
  background: #0a0b0f; border: 1px solid var(--border); border-radius: 7px; overflow: hidden;
}
.bar .fill { position: absolute; inset: 0 100% 0 0; transition: right .12s linear; border-radius: 7px 0 0 7px; }
.bar.hp .fill { background: linear-gradient(90deg, #7a2018, #c0392b); }
.bar.mp .fill { background: linear-gradient(90deg, #234e85, #5b8fd6); }
.bar.mv .fill { background: linear-gradient(90deg, #3f7a3f, #6fcf6f); }
.bar.xp .fill { background: linear-gradient(90deg, #8a6d1f, #e8b94a); }
.bar.xp .val { min-width: 0; color: var(--muted); }
.bar .val { min-width: 78px; text-align: right; color: var(--text); }
.bar.low .fill { animation: lowpulse 1s infinite; }
@keyframes lowpulse { 50% { filter: brightness(1.6); } }

.hud .meta { display: flex; flex-direction: column; gap: 4px; min-width: 200px; flex: 1 1 220px; max-width: 320px; }
.hud .who { font-family: "Cinzel", serif; font-weight: 700; color: var(--gold); font-size: 14px; }
.hud .who .dim { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 8px; font-family: "JetBrains Mono", monospace; }
.hud .who .rank {
  display: none; margin-right: 7px; padding: 1px 7px; border-radius: 4px;
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: .04em;
  color: var(--gold); background: rgba(232,185,74,.1); border: 1px solid rgba(232,185,74,.4);
}
.hud .coin { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text); }
.hud .coin .u { color: var(--muted); margin: 0 7px 0 2px; }

.hud .oppo { display: none; flex-direction: column; gap: 3px; min-width: 160px; flex: 1 1 180px; }
.hud .oppo[hidden] { display: none; }
.hud .oppo:not([hidden]) { display: flex; }
.hud .oppo .lbl { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--blood); font-weight: 700; }
.hud .oppo .track { position: relative; height: 11px; background: #0a0b0f; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.hud .oppo .fill { position: absolute; inset: 0 100% 0 0; background: linear-gradient(90deg, #7a2018, #e0503f); transition: right .2s ease; }

/* ---- main row: terminal + side panel ---- */
.mainrow { flex: 1 1 auto; min-height: 0; display: flex; }

/* ---- side panels (GMCP) ---- */
.side {
  flex: 0 0 236px;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  padding: 10px 12px 16px;
}
.side.hidden { display: none; }
.panel { margin-bottom: 16px; }
.panel h4 {
  margin: 0 0 8px; font-family: "Cinzel", serif; font-size: 12px; letter-spacing: .06em;
  color: var(--gold); text-transform: uppercase; border-bottom: 1px solid var(--border); padding-bottom: 5px;
}
.panel .empty { color: var(--muted); font-style: italic; font-size: 12px; }

.grouplist .gmember { margin-bottom: 9px; }
.gmember .gname { display: flex; justify-content: space-between; font-family: "JetBrains Mono", monospace; font-size: 11px; margin-bottom: 3px; }
.gmember .gname b { color: var(--text); font-weight: 700; }
.gmember .gname .glvl { color: var(--muted); }
.gmember .gname.self b { color: var(--gold); }
.gbar { position: relative; height: 6px; background: #0a0b0f; border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.gbar .gf { position: absolute; inset: 0 100% 0 0; transition: right .25s ease; }
.gbar.h .gf { background: #c0392b; } .gbar.m .gf { background: #5b8fd6; } .gbar.v .gf { background: #6fcf6f; }

.roomname { font-family: "EB Garamond", serif; font-size: 15px; color: var(--text); }
.dim { color: var(--muted); font-size: 12px; }
.exits { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.exits .ex {
  font-family: "JetBrains Mono", monospace; font-size: 10px; text-transform: uppercase;
  color: var(--cyan); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px;
}
.here { margin-top: 10px; font-family: "JetBrains Mono", monospace; font-size: 11px; }
.here .hentry { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.here .hentry.mob { color: var(--blood); }
.here .hentry.pc { color: var(--green); }
.here .hp { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  background: rgba(232,185,74,.08); border: 1px solid rgba(232,185,74,.35); color: var(--gold);
  border-radius: 10px; padding: 2px 8px; white-space: nowrap;
}
.chip .t { color: var(--muted); margin-left: 5px; }
.chip.res { background: rgba(192,57,43,.1); border-color: rgba(192,57,43,.4); color: #e0503f; }

/* compass quick-buttons reflect available exits */
.qbtn.dir { opacity: .35; }
.qbtn.dir.avail { opacity: 1; border-color: var(--cyan); color: var(--cyan); }
.qbtn.dir.avail:hover { color: var(--bg); background: var(--cyan); }

/* ---- terminal ---- */
.term-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px 0;
  background: var(--bg);
}
#term { width: 100%; height: 100%; }
/* xterm injects its own .xterm; let it fill the wrapper */
.term-wrap .xterm { height: 100%; }

/* ---- command line ---- */
.cmdbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg-alt), var(--bg));
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}
.cmdbar .prompt {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--gold);
  font-size: 16px;
  user-select: none;
}
.cmdbar.pw .prompt { color: var(--blood); }
#cmd {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#cmd:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,185,74,.15); }
.cmdbar.pw #cmd { border-color: var(--blood); -webkit-text-security: disc; text-security: disc; }
.cmdbar.pw #cmd:focus { box-shadow: 0 0 0 2px rgba(192,57,43,.2); }
#cmd::placeholder { color: var(--muted); opacity: .7; }
.send {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--bg);
  background: var(--gold);
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.send:hover { filter: brightness(1.1); }
.send:active { transform: translateY(1px); }

/* hide the lock unless in password mode */
.lock { display: none; color: var(--blood); font-size: 14px; }
.cmdbar.pw .lock { display: inline; }

@media (max-width: 760px) {
  .side { flex-basis: 200px; }
}
@media (max-width: 620px) {
  .bar .brand .sub { display: none; }
  .quickbar { gap: 4px; padding: 6px 8px; }
  .qbtn { font-size: 10px; padding: 4px 6px; }
  .send { padding: 9px 12px; }
  .side { display: none; }            /* hidden by default; toggle with Panels */
  .side.show { display: block; position: absolute; right: 0; top: 0; bottom: 0; z-index: 5;
               box-shadow: -8px 0 30px rgba(0,0,0,.6); }
  .hud { gap: 10px; }
  .hud .vit { min-width: 160px; }
  .hud .oppo { flex-basis: 140px; }
  .mainrow { position: relative; }
}
