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

:root {
  --bg: #0e0f15;
  --panel: #171922;
  --panel-2: #1f222e;
  --text: #e6e8ef;
  --muted: #9aa0b4;
  --accent: #5fd0a0;
  --food: #43d66b;
  --home: #4aa3ff;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  height: 100vh;
  overflow: hidden;
}

#app { display: flex; height: 100vh; }

#stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #14161f, #0a0b10);
}

#canvas {
  background: #11131b;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
}

#hud {
  position: absolute;
  top: 16px; left: 16px;
  display: flex;
  gap: 18px;
  background: rgba(15,16,22,.7);
  backdrop-filter: blur(6px);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.06);
  pointer-events: none;
}
#hud .k { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#hud > div > span:last-child { font-size: 18px; font-weight: 600; }

#panel {
  width: 320px;
  background: var(--panel);
  border-left: 1px solid rgba(255,255,255,.06);
  padding: 20px;
  overflow-y: auto;
}

#panel h1 { font-size: 18px; margin-bottom: 4px; }
.lead { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.group {
  background: var(--panel-2);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.group h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label span { color: var(--text); font-weight: 600; }
input[type=range] { width: 100%; margin-top: 4px; accent-color: var(--accent); }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
button {
  flex: 1;
  background: #2a2e3c;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
button:hover { background: #343a4c; }

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tool.active { background: var(--accent); color: #0b0d12; border-color: var(--accent); font-weight: 600; }

.legend div { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.food { background: var(--food); }
.dot.home { background: var(--home); }
.dot.ant-s { background: #e9ecf5; border-radius: 50%; }
.dot.ant-f { background: #ffb347; border-radius: 50%; }

details summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
details p { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* Narrow screens (phones, portrait tablets): stack the canvas on top and the
   panel below, instead of squeezing the canvas next to a fixed 320px sidebar. */
@media (max-width: 760px) {
  body { overflow: auto; height: auto; }
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #stage { height: 62vh; min-height: 300px; padding: 8px; }
  #panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,.06);
  }
  #canvas { touch-action: none; }  /* let us paint without the page scrolling */
}
