/* Gridworld Lab — styles. Self-contained. */

* { box-sizing: border-box; }

:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #e0e0e0;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #1a73e8;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; background: #1a2b45; color: #fff;
}
.brand-mark { font-size: 32px; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 600; }
.tagline { margin: 2px 0 0; font-size: 13px; color: #b9c4d6; }

.lab {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 20px; flex-wrap: wrap; justify-content: center;
}

/* ---- Coach panel ---- */
.coach-panel {
  flex: 0 0 250px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
}
.coach-panel h2 { margin: 0 0 12px; font-size: 16px; }
.ctrl-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 14px 0 6px; border-top: 1px solid var(--line); padding-top: 10px;
}
.ctrl { margin-bottom: 10px; }
.ctrl label { font-size: 13px; color: var(--ink); display: block; margin-bottom: 4px; }
.ctrl label em { color: var(--accent); font-style: normal; font-weight: 600; }
.ctrl.inline { display: flex; align-items: center; justify-content: space-between; }
.ctrl.inline label { margin-bottom: 0; }
.ctrl input[type="range"] { width: 100%; accent-color: var(--accent); }
.ctrl input[type="number"], .ctrl select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff;
}
.ctrl input[type="number"] { width: 80px; }

.btn-row { display: flex; gap: 8px; margin-top: 16px; }
.primary-btn {
  flex: 1; padding: 11px; border: none; border-radius: 8px;
  background: #34a853; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.primary-btn:hover { background: #2c9247; }
.ghost-btn {
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--muted); cursor: pointer; font-size: 14px;
}
.ghost-btn:hover { background: #eef1f6; }

/* ---- World / grid ---- */
.world {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
}
#grid-holder svg { border: 1px solid var(--line); border-radius: 6px; }
.gw-cell { stroke: rgba(0,0,0,.08); stroke-width: 1; }
.policy-arrow { fill: #3c4043; font-size: 20px; opacity: .75; pointer-events: none; }
.agent-token { fill: #202124; stroke: #fff; stroke-width: 2; }
.glyph { pointer-events: none; }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px;
  font-size: 12px; color: var(--muted); max-width: 370px;
}
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.sw.goal { background: #34a853; }
.sw.pit { background: #c5221f; }
.sw.agent { background: #202124; border-radius: 50%; }
.sw.hi { background: #0877bd; }
.sw.lo { background: #f59322; }

/* ---- Readout ---- */
.readout { flex: 0 0 280px; }
.stats {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.stat { flex: 1 1 70px; }
.cap { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-caption { font-size: 12px; color: var(--muted); margin: 14px 0 4px; }
#chart-holder {
  width: 280px; height: 110px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
#chart-holder .line { fill: none; stroke-width: 1.5px; }
#chart-holder .axis line, #chart-holder .axis path { display: none; }

.coach-hint {
  margin-top: 14px; padding: 14px 16px;
  background: #f1f6ff; border-left: 4px solid var(--accent); border-radius: 8px;
  font-size: 14px; line-height: 1.5; color: var(--ink); min-height: 70px;
}
