/* MechaPaint Rock Chipper. A dark viewport tool; one committed theme. */

:root {
  --bg: #2c2f3b;
  --panel: rgba(25, 27, 35, 0.94);
  --panel-edge: #3a3e4f;
  --well: #22242e;
  --text: #e8e5dc;
  --muted: #9a9dab;
  --accent: #e2793f;
  --accent-hi: #f08c52;
  --accent-ink: #1a120c;
  --warn: #f2b45c;
  --track: #3f4356;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
}

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

#overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.is-busy #view { cursor: progress !important; }

/* ---------------------------------------------------------------- panel */

.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 300px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--panel-edge);
}

.panel h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.tagline {
  margin: 4px 0 0;
  color: var(--muted);
}

.icon-btn {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s;
}
.panel.is-collapsed .chev { transform: translateY(2px) rotate(-135deg); }
.panel.is-collapsed .panel-body { display: none; }

.panel-body {
  overflow-y: auto;
  padding: 4px 14px 14px;
}

.group {
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--panel-edge);
}
.group:last-child { border-bottom: 0; }

.group h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  margin: 8px 0 10px;
  color: var(--muted);
  min-height: 2.6em;
}
.hint-short { min-height: 0; margin: 2px 0 6px; }

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 2px;
  line-height: 1.4;
}

/* segmented tool picker */
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  overflow: hidden;
}
.seg button {
  appearance: none;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--panel-edge);
  background: var(--well);
  color: var(--text);
  font: inherit;
  padding: 7px 2px;
  cursor: pointer;
}
.seg.seg-2 { grid-template-columns: repeat(2, 1fr); margin-bottom: 10px; }
.seg.seg-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.seg.seg-tools { grid-template-columns: repeat(3, 1fr); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #2b2e3a; }
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}
.seg button[aria-pressed="true"] kbd { color: var(--accent-ink); border-color: rgba(0,0,0,0.3); }

/* slider rows */
.row {
  display: grid;
  grid-template-columns: 62px 1fr 48px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.row.is-muted { opacity: 0.4; }
.row > span { color: var(--muted); white-space: nowrap; }
.row output {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  margin: 0;
  height: 18px;
  accent-color: var(--accent);
  background: transparent;
  cursor: pointer;
}

input[type="number"], input[type="text"] {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 5px 7px;
  width: 78px;
}
input[type="text"] { width: 100%; font-family: var(--font-body); }
input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 1px;
}

.inline-num {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.inline-num.grow { flex: 1; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}
.check input { accent-color: var(--accent); margin: 0; }

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0 2px;
}
.seed-row { padding-bottom: 6px; }

.btn {
  appearance: none;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--muted); background: #2b2e3a; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-accent kbd { color: var(--accent-ink); }

/* ---------------------------------------------------------------- status */

.status {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: none;
}
.stat b {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.msg {
  margin-left: auto;
  text-align: right;
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg[data-tone="warn"] { color: var(--warn); }

@media (max-width: 520px) {
  .panel { width: calc(100vw - 32px); max-height: 55vh; }
  .status { flex-wrap: wrap; gap: 8px 16px; }
  .msg { margin-left: 0; width: 100%; text-align: left; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .chev { transition: none; }
}

/* Rows are grid, so the hidden attribute needs a hand. */
[hidden] { display: none !important; }
