:root {
  --bg: #0c1018;
  --panel: #131822;
  --line: #1f2433;
  --text: #e8ecf3;
  --muted: rgba(232, 236, 243, 0.6);
}

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

html, body, #app {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple Color Emoji",
               Roboto, Oxygen, Ubuntu, Helvetica, Arial, sans-serif;
  font-size: 16px;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
}

#hud {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  flex: 0 0 auto;
}

#hud-line {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  font-size: 14px;
}
#hud-line .theme-name { font-weight: 700; font-size: 16px; }
#hud-line .player    { color: #5aa5ff; font-weight: 600; }
#hud-line .ai        { color: #ff6477; font-weight: 600; }
#hud-line .target    { color: var(--muted); }
#hud-line .status    { font-weight: 700; }

#hud-controls { display: flex; gap: 8px; flex-shrink: 0; }

button {
  font: inherit;
  background: #1c2230;
  color: var(--text);
  border: 1px solid #2a3142;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 80ms ease;
}
button:hover { background: #232a3a; }
button:active { background: #2a3242; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

#map-wrap {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
}

#hint {
  flex: 0 0 auto;
  background: var(--panel);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
}

#popup {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(19, 24, 34, 0.97);
  border: 1px solid #2a3142;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 320px;
  z-index: 10;
}

.popup-title {
  font-size: 18px;
  text-align: center;
  font-weight: 600;
}

.popup-buys {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.popup-buys .buy {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
}

.popup-buys .buy small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.send {
  background: #2a3a52;
}
.send:hover { background: #324560; }

.close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  display: grid;
  place-items: center;
}

@media (max-width: 600px) {
  #hud { padding: 8px 10px; flex-wrap: wrap; gap: 6px; }
  #hud-line { font-size: 12px; gap: 8px; }
  #popup { min-width: unset; left: 8px; right: 8px; transform: none; }
  .popup-buys { grid-template-columns: 1fr 1fr 1fr; }
}
