:root {
  --bg: #050807;
  --panel: rgba(6, 14, 12, 0.82);
  --border: rgba(40, 220, 150, 0.28);
  --emerald: #2dff9a;
  --emerald-dim: #1a9a62;
  --void: #ff4d6a;
  --void-dim: #8a2038;
  --text: #e8fff4;
  --muted: #8aa89a;
  --gold: #e8c56a;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

#canvas-host {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.hud * { pointer-events: auto; }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.75), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.brand span.sub {
  color: var(--emerald);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.top-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.top-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 999px;
}

.top-links a:hover {
  color: var(--emerald);
  border-color: var(--border);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.85rem 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0 1rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.stat {
  flex: 1 1 120px;
  min-width: 100px;
}

.stat .label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.stat .value {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat .value.emerald { color: var(--emerald); }
.stat .value.void { color: var(--void); }
.stat .value.gold { color: var(--gold); }

.war-bar-wrap {
  padding: 0.75rem 1rem 0;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.war-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.war-bar-labels .h { color: var(--emerald); }
.war-bar-labels .s { color: var(--void); }

.war-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--void-dim);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.war-bar .fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, var(--emerald-dim), var(--emerald));
  transition: width 0.8s ease;
  box-shadow: 0 0 16px rgba(45, 255, 154, 0.35);
}

.bottom-row {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem 1rem;
  max-width: 1100px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  align-items: stretch;
}

.lore-panel {
  flex: 1 1 280px;
}

.lore-panel h1 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--emerald);
  margin-bottom: 0.35rem;
}

.lore-panel p {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.events-panel {
  flex: 1 1 220px;
  max-height: 140px;
  overflow: hidden;
}

.events-panel h2 {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

#event-list {
  list-style: none;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text);
  max-height: 90px;
  overflow-y: auto;
}

#event-list li {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#event-list .buy { color: var(--emerald); }
#event-list .sell { color: var(--void); }

.badge-mock {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(232, 197, 106, 0.4);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  display: inline-block;
  margin-right: 0.35rem;
  animation: pulse 1.6s ease infinite;
}

.status-dot.off {
  background: #666;
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 640px) {
  .stat .value { font-size: 0.9rem; }
  .lore-panel p { font-size: 0.72rem; }
  .top-bar { padding: 0.5rem 0.65rem; }
}
