/* Earthwork — deliberate early-2000s management-sim look.
   Flat colors, chunky bevels, everything legible at a glance.
   Cheap-looking is fine; the render exists to read the model. */

:root {
  --bg: #3d6b35;          /* RCT grass */
  --panel: #d4cfc0;       /* beige panel */
  --panel-dark: #b8b2a0;
  --bevel-light: #f2efe4;
  --bevel-dark: #7a7462;
  --ink: #26221a;
  --accent: #b8441f;      /* cat-machine rust/orange */
  --ok: #2f7a2f;
  --warn: #b8860b;
  --bad: #a02020;
  --mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0 6px, transparent 6px 12px);
  color: var(--ink);
  font-family: Verdana, Geneva, sans-serif;
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 3px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  padding: 10px 12px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 3px solid var(--bevel-dark);
}

.brand { font-weight: bold; font-size: 16px; letter-spacing: 1px; }
.brand .sub { font-weight: normal; font-size: 11px; color: #5a5442; letter-spacing: 0; }

.level-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.btn {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  background: var(--panel);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  cursor: pointer;
  color: var(--ink);
}
.btn:active { border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark); }
.btn:disabled { color: #8b8570; cursor: not-allowed; }
.btn.active, .level-tab.active { background: var(--accent); color: #fff; }
.level-tab.locked { color: #8b8570; }

.btn-run {
  background: var(--ok);
  color: #fff;
  font-weight: bold;
  padding: 8px 16px;
}
.btn-run:disabled { background: var(--panel-dark); color: #6b6552; }
.btn-basis { background: #2c4a6e; color: #fff; }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 10px;
  padding: 10px;
  align-items: start;
}

.briefing-panel { grid-column: 1; }
.spread-panel { grid-column: 1; }
.predict-panel { grid-column: 1; }
.sim-panel { grid-column: 2; grid-row: 1 / span 3; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sim-panel { grid-column: 1; grid-row: auto; }
}

h2, h3 { margin: 2px 0 8px; font-size: 14px; }
.briefing { margin: 4px 0; line-height: 1.45; }

.site-facts, .spread-facts {
  font-family: var(--mono);
  font-size: 12px;
  background: #efe9d8;
  border: 2px inset var(--panel-dark);
  padding: 6px 8px;
  margin-top: 8px;
  white-space: pre-wrap;
}

.spread-panel label { display: block; margin: 6px 0 2px; font-weight: bold; }
.spread-panel select, .spread-panel input[type="range"] { width: 100%; font-family: inherit; }
.ntruck-row { display: flex; align-items: center; gap: 8px; }
.ntruck-val { font-family: var(--mono); font-size: 16px; font-weight: bold; min-width: 2ch; }
.road-option { font-weight: normal; display: block; margin: 3px 0; }

.req { font-weight: normal; font-size: 11px; color: var(--bad); }
.predict-grid { display: grid; gap: 8px; }
.predict-grid label { font-weight: bold; }
.predict-grid .unit { font-weight: normal; color: #5a5442; }
.predict-grid input {
  display: block;
  width: 100%;
  font-family: var(--mono);
  font-size: 15px;
  padding: 4px 6px;
  border: 2px inset var(--panel-dark);
  background: #fffef5;
}

.run-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.speed { display: flex; align-items: center; gap: 4px; font-size: 11px; }

.sim-panel canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 2px inset var(--panel-dark);
  background: #6d5a3e;
  image-rendering: pixelated;
}

.bottleneck-banner {
  font-family: var(--mono);
  font-weight: bold;
  text-align: center;
  padding: 6px;
  margin-bottom: 8px;
  border: 2px solid var(--bevel-dark);
  background: #efe9d8;
}
.bottleneck-banner.loader { background: var(--bad); color: #fff; }
.bottleneck-banner.trucks { background: var(--warn); color: #fff; }
.bottleneck-banner.stuck { background: #000; color: #f55; }

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.gauge {
  background: #1d1a12;
  color: #7CFC00;
  font-family: var(--mono);
  border: 2px inset var(--panel-dark);
  padding: 5px 8px;
}
.gauge .label { display: block; color: #b8b2a0; font-size: 10px; }
.gauge .value { font-size: 17px; font-weight: bold; }
.gauge.alert .value { color: #ff6347; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 100%);
  background: var(--panel);
  border-left: 3px solid var(--bevel-dark);
  box-shadow: -4px 0 12px rgba(0,0,0,0.4);
  overflow-y: auto;
  padding: 12px;
  z-index: 30;
}
.drawer.hidden, .overlay.hidden { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-note { font-size: 11px; line-height: 1.4; color: #4a4436; }

.basis-entry {
  border: 2px solid var(--panel-dark);
  background: #efe9d8;
  padding: 6px 8px;
  margin-bottom: 8px;
}
.basis-entry .val { font-family: var(--mono); font-weight: bold; }
.basis-entry .src { font-size: 11px; color: #4a4436; margin-top: 2px; }
.basis-entry .note { font-size: 11px; color: #6b3410; margin-top: 3px; font-style: italic; }
.approx-badge {
  background: var(--warn);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 5px;
  margin-left: 6px;
}
.basis-group { margin: 14px 0 6px; font-weight: bold; border-bottom: 2px solid var(--bevel-dark); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 8, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
.results-card { max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto; }

.results-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.results-table th, .results-table td {
  border: 2px solid var(--panel-dark);
  padding: 5px 8px;
  text-align: right;
}
.results-table th:first-child, .results-table td:first-child { text-align: left; }
.results-table .gap-big { background: #f3c1b4; }
.results-table .gap-ok { background: #cde3c1; }

.results-verdict { font-weight: bold; margin: 10px 0; font-family: var(--mono); }
.lesson {
  background: #efe9d8;
  border-left: 6px solid var(--accent);
  padding: 8px 10px;
  line-height: 1.5;
}
.results-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.footer {
  font-size: 10px;
  color: #d4cfc0;
  text-align: center;
  padding: 10px 20px 16px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

/* --- Guided walk (explorable estimate) --- */

.btn-walk {
  display: block;
  width: 100%;
  background: #2c4a6e;
  color: #fff;
  font-weight: bold;
  padding: 8px;
  margin-bottom: 10px;
}

.walk-card, .machine-card {
  max-width: 560px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
}

.walk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.walk-progress { font-family: var(--mono); font-size: 12px; margin-right: 8px; color: #5a5442; }
.walk-story { line-height: 1.5; }

.walk-viz {
  background: #efe9d8;
  border: 2px inset var(--panel-dark);
  padding: 4px;
  margin: 8px 0;
}
.walk-viz svg { width: 100%; height: auto; display: block; }

.walk-control { margin: 10px 0; }
.walk-control label { font-weight: bold; display: block; }
.walk-control input[type="range"] { width: 100%; }
.walk-val {
  font-family: var(--mono);
  font-weight: bold;
  background: #1d1a12;
  color: #7CFC00;
  padding: 1px 8px;
  margin-left: 6px;
}
.walk-marks { font-family: var(--mono); font-size: 10px; color: #5a5442; white-space: pre-wrap; }

.walk-note {
  font-family: var(--mono);
  font-size: 12px;
  background: #1d1a12;
  color: #7CFC00;
  border: 2px inset var(--panel-dark);
  padding: 8px 10px;
  min-height: 3.2em;
  line-height: 1.45;
}
.walk-nav { display: flex; justify-content: space-between; margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; min-height: 22px; }
.chip {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border: 2px solid var(--bevel-dark);
}
.chip b { margin-right: 4px; }

/* --- Machine cards --- */
.select-row { display: flex; gap: 6px; align-items: stretch; }
.select-row select { flex: 1; min-width: 0; }
.btn-info { padding: 2px 8px; }
.machine-svg {
  background: #efe9d8;
  border: 2px inset var(--panel-dark);
  margin: 8px 0;
}
.machine-svg svg { width: 100%; max-height: 190px; display: block; }
