:root {
  --panel: rgba(14, 20, 32, 0.82);
  --panel-edge: rgba(255, 255, 255, 0.12);
  --text: #eef3fb;
  --muted: #9aa8bd;
  --accent: #ffcc4d;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Top-left: city stats */
.stats {
  top: 16px;
  left: 16px;
  width: 250px;
  padding: 12px 14px;
}

.clock {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 4px;
}

.label,
.sub {
  color: var(--muted);
  font-size: 12px;
}

.sub {
  margin-top: 2px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

#money {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

#money.neg { color: var(--bad); }

#population { font-variant-numeric: tabular-nums; }

/* Top-right: buttons, then the tile inspector below them */
.top-right {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
}

.top-right button,
.toolbar button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.top-right button {
  padding: 6px 10px;
  font-size: 13px;
}

.top-right button:hover,
.toolbar button:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

.info {
  top: 60px;
  right: 16px;
  width: 260px;
  padding: 12px 14px;
}

.info-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.info-body {
  white-space: pre-line;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Bottom: build toolbar */
.toolbar {
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
}

.tool {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 88px;
  padding: 8px 10px !important;
}

.tool .name { font-weight: 600; }

.tool .cost {
  color: var(--muted);
  font-size: 12px;
}

.tool .key {
  color: var(--accent);
  font-size: 11px;
}

.tool.active {
  border-color: var(--accent) !important;
  background: rgba(255, 204, 77, 0.16) !important;
}

.help {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}

#toasts {
  position: fixed;
  bottom: 124px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: opacity 0.5s, transform 0.5s;
}

.toast.warn { color: #ffb3a7; }

.toast.out {
  opacity: 0;
  transform: translateY(-6px);
}

@media (max-width: 720px) {
  .stats { width: 200px; font-size: 13px; }
  .top-right { flex-wrap: wrap; max-width: 170px; justify-content: flex-end; }
  .info { display: none; }
  .tool { min-width: 64px; }
  .toolbar { max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
  #toasts { bottom: 150px; }
}
