:root {
  --ink: #16110c;
  --paper: #f4ead4;
  --gold: #e0b35a;
  --gold-2: #b8883a;
  --moss: #2d4a2c;
  --blood: #9e3b28;
  --hud: rgba(18, 13, 9, 0.78);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #0c0907; color: var(--paper); font-family: "IBM Plex Sans", sans-serif; }
.hidden { display: none !important; }

#game { position: relative; height: 100%; }
#map {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #2f5a32;
  cursor: grab;
  touch-action: none;
  z-index: 0;
}
#map.drag { cursor: grabbing; }

.hud-top, .hud-bottom, .chat-dock {
  position: absolute;
  z-index: 5;
  background: var(--hud);
  border: 1px solid rgba(224, 179, 90, .28);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
}

.hud-top {
  top: 14px; left: 14px; right: 336px;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 12px;
}

.brand { display: flex; gap: 10px; align-items: center; min-width: 128px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 42% 42% 48% 48%;
  background:
    radial-gradient(circle at 35% 40%, #f4ead4 0 5px, transparent 6px),
    radial-gradient(circle at 62% 40%, #f4ead4 0 5px, transparent 6px),
    linear-gradient(#7f9a92, #4e6862);
  box-shadow: inset 0 -6px 0 #d7cbb6;
}
.brand strong {
  display: block;
  font-family: "Instrument Serif", serif;
  font-size: 20px;
  letter-spacing: .04em;
}
.brand small { color: #cbbda8; font-size: 11px; }

.phase {
  flex: 1;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 12px;
  border: 1px solid #4a3c2e;
  font-family: VT323, monospace;
}
.phase.tickets { background: linear-gradient(90deg, #1b2a1a, #243224); }
.phase.results { background: linear-gradient(90deg, #3a1c16, #4a241c); }
.phase span { font-size: 16px; letter-spacing: .1em; color: #ead9b4; }
.phase b { font-size: 32px; line-height: 1; color: var(--gold); }

.stats { display: flex; gap: 14px; font-size: 12px; }
.stats em { display: block; font-style: normal; color: #cbbda8; font-size: 9px; letter-spacing: .1em; }

#btnLogin {
  border: 1px solid var(--gold-2);
  background: linear-gradient(#e0b35a, #c8963d);
  color: #1a140c;
  font: 600 13px "IBM Plex Sans", sans-serif;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
#btnLogin:hover { filter: brightness(1.06); }
#btnLogin.out {
  background: transparent;
  color: var(--gold);
}

.chat-dock {
  top: 14px; right: 14px; bottom: 86px;
  width: 308px;
  display: flex; flex-direction: column;
}
.chat-head {
  padding: 10px 12px;
  font-family: VT323, monospace;
  letter-spacing: .12em;
  border-bottom: 1px solid #3a2f24;
  color: #ead9b4;
}
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; font-size: 13px; }
.chat-line { margin-bottom: 8px; line-height: 1.35; }
.chat-line b { color: var(--gold); }
.chat-line.sys { color: #9aa78f; font-size: 12px; }
#chatForm { display: flex; border-top: 1px solid #3a2f24; }
#chatForm input {
  width: 100%; border: 0; background: #221b16;
  color: var(--paper); padding: 10px 12px; font: inherit;
}
#chatForm button, .actions button {
  border: 0; cursor: pointer;
  background: var(--gold); color: #1a140c;
  font: 600 13px "IBM Plex Sans", sans-serif;
  padding: 10px 12px;
}
.actions button:disabled, #chatForm button:disabled {
  background: #3d3328; color: #8a7b66; cursor: not-allowed;
}

.hud-bottom {
  left: 14px; right: 336px; bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 12px;
}
.hint-pill { font-size: 13px; color: #e8dcc6; }
.actions { display: flex; gap: 10px; align-items: center; }
.wallet-pill { font-size: 12px; color: #cbbda8; text-align: right; }
.wallet-pill span { display: block; }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(10, 8, 6, .62);
}
.login-card {
  position: relative;
  width: min(420px, 92vw);
  background: #1b1510;
  border: 1px solid #5a4630;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: 0; color: #cbbda8;
  font-size: 24px; cursor: pointer;
}
.login-creature {
  width: 72px; height: 72px; margin-bottom: 14px;
  border-radius: 40% 40% 46% 46%;
  background:
    radial-gradient(circle at 35% 40%, #d7cbb6 0 8px, transparent 9px),
    radial-gradient(circle at 58% 40%, #d7cbb6 0 8px, transparent 9px),
    radial-gradient(circle at 36% 39%, #1a1410 0 4px, transparent 5px),
    radial-gradient(circle at 59% 39%, #1a1410 0 4px, transparent 5px),
    linear-gradient(#7f9a92, #5d7770);
  box-shadow: inset 0 -10px 0 #cfc3ae;
}
.eyebrow { font-family: VT323, monospace; letter-spacing: .14em; color: var(--gold); font-size: 18px; }
.login-card h1 { font-family: "Instrument Serif", serif; font-size: 30px; margin: 4px 0 8px; }
.sub, .hint, .fine { color: #cbbda8; font-size: 13px; line-height: 1.45; }
.login-card button#btnConnect {
  width: 100%; margin-top: 16px; border: 0; cursor: pointer;
  background: linear-gradient(#e0b35a, #c8963d); color: #1a140c;
  font: 600 14px "IBM Plex Sans", sans-serif; padding: 11px 14px;
}
.fine { margin-top: 12px; font-size: 11px; }
.error { margin-top: 12px; color: #e07a5f; font-size: 13px; line-height: 1.4; }

.arena-arrow {
  position: absolute; z-index: 4; pointer-events: none;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 14px solid #e0b35a;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.45));
}
.arena-arrow span {
  position: absolute; top: 16px; left: 50%;
  transform: translateX(-50%);
  font: 700 9px "IBM Plex Sans", sans-serif;
  letter-spacing: .12em;
  color: #e0b35a;
}

@media (max-width: 900px) {
  .chat-dock { display: none; }
  .hud-top, .hud-bottom { right: 14px; }
  .stats { display: none; }
}
