/*
  Program: DirtTwister Displacement Map Terrain Editor
  File: dispmapeditor/styles.css
  Created: 2026-07-11
  Version: 1.0 (Beta) - 7/11/26
  Authors: Bruce Atkinson (DirtTwister) and Cody Mercer (the best coding assistant ever. Right out of Pluribus)
  Description:
    Visual styling for the WebGL terrain editor, controls, floating overview,
    telemetry HUD, responsive layouts, and standalone help page.
*/
:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --panel: rgb(12, 17, 14);
  --panel-edge: rgba(182, 211, 151, 0.16);
  --text: #eef3e9;
  --muted: #9eaa9b;
  --accent: #b7d46b;
  --accent-strong: #d4ee8e;
  --field: #202821;
  --danger: #d88c75;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101511;
  color: var(--text);
}

button,
select,
input { font: inherit; }

button,
select {
  color: var(--text);
  background: var(--field);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
}

button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

button:hover { border-color: rgba(183, 212, 107, 0.65); }
button:focus-visible,
select:focus-visible,
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#terrainCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.panel {
  position: fixed;
  inset: 18px auto 18px 18px;
  width: min(330px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  transition: width 160ms ease, height 160ms ease;
}

.panel.collapsed {
  width: 220px;
  height: 66px;
}

.panel.collapsed .panel-body { display: none; }
.panel.collapsed .help-link { display: none; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 14px 11px 16px;
  border-bottom: 1px solid var(--panel-edge);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

h1 { margin: 0; font-size: 20px; font-weight: 680; }
h2 { margin: 0; font-size: 12px; font-weight: 720; letter-spacing: 0.05em; text-transform: uppercase; }

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 19px;
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.help-link { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 9px; color: var(--muted); border: 1px solid rgba(255,255,255,.12); border-radius: 7px; font-size: 12px; font-weight: 600; line-height: 1.2; text-decoration: none; }
.help-link:hover { color: var(--text); border-color: rgba(183,212,107,.65); }

.panel-body { overflow-y: auto; padding: 0 15px 18px; }

section {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

section:last-child { border-bottom: 0; }

.status {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status[data-kind="ready"] { color: var(--accent-strong); }
.status[data-kind="error"] { color: #f1a58f; }

.file-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 8px 0;
  padding: 7px 10px;
  color: #11180d;
  background: var(--accent);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.file-button.secondary {
  color: var(--text);
  background: var(--field);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.full { width: 100%; }
.stacked-button { margin-top: 8px; }
.secondary { background: var(--field); }

.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.control-row input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.control-row output { color: var(--text); font-variant-numeric: tabular-nums; }

.number-stepper { display: grid; grid-template-columns: 28px 64px 28px; }
.number-stepper button { min-height: 28px; padding: 2px; border-radius: 0; }
.number-stepper button:first-child { border-radius: 6px 0 0 6px; }
.number-stepper button:last-child { border-radius: 0 6px 6px 0; }
.number-stepper input,
.plain-number,
.point-editor input[type="number"] {
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  color: var(--text);
  background: #151b16;
  border: solid rgba(255,255,255,.12);
  border-width: 1px 0;
  border-radius: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.plain-number { border-width: 1px; border-radius: 6px; }

.select-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.select-row select { min-width: 134px; padding: 7px 8px; }
.check-row { justify-content: flex-start; cursor: pointer; }
.check-row input { accent-color: var(--accent); }

.option-description {
  min-height: 42px;
  margin: 9px 0 3px;
  padding: 8px 10px;
  color: #b5c0b1;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.45;
}

.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.compact-buttons { margin-top: 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.count { min-width: 24px; padding: 2px 7px; text-align: center; color: #12170f; background: var(--accent); border-radius: 999px; font-size: 11px; font-weight: 800; }

#overviewCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: #080b09;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  image-rendering: pixelated;
  touch-action: none;
}

.overview-panel {
  position: fixed;
  z-index: 3;
  top: 18px;
  right: 18px;
  width: 300px;
  padding: 10px;
  background: rgba(12, 17, 14, .88);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,.32);
  backdrop-filter: blur(12px);
}
.overview-panel[hidden] { display: none; }
.overview-header { display: flex; align-items: center; justify-content: space-between; padding: 1px 1px 9px 4px; }
.overview-header .eyebrow { margin-bottom: 3px; }
.overview-header .icon-button { width: 30px; min-height: 30px; }
.overview-title { display: flex; align-items: center; gap: 8px; }
.preview-status { padding: 2px 6px; color: #d9a99a; background: rgba(216,140,117,.1); border: 1px solid rgba(216,140,117,.28); border-radius: 999px; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.preview-status[data-active="true"] { color: var(--accent-strong); background: rgba(183,212,107,.1); border-color: rgba(183,212,107,.3); }
.full-grid { grid-column: 1 / -1; }

.preview-legend { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.preview-legend span { display: flex; align-items: center; gap: 4px; }
.preview-legend i { width: 9px; height: 9px; border-radius: 2px; }
.fill-key { background: rgb(54, 174, 226); }
.cut-key { background: rgb(238, 92, 67); }

.point-editor { margin-top: 12px; padding: 10px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.075); border-radius: 7px; }
.point-editor .section-heading { color: var(--muted); font-size: 12px; }
.point-editor input[type="number"] { margin: 6px 0; border-width: 1px; border-radius: 6px; text-align: left; }
.point-editor input:disabled { opacity: .45; }

body.clean-view .panel,
body.clean-view .mouse-hint { display: none; }

.danger { color: #f0b39f; }
.help p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
kbd { padding: 1px 4px; color: var(--text); background: #303a31; border: 1px solid rgba(255,255,255,.15); border-radius: 3px; font: 10px ui-monospace, monospace; }

.hud {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 7px;
  padding: 8px;
  background: rgba(11, 15, 12, 0.8);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  color: #cbd4c7;
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  backdrop-filter: blur(10px);
}

.hud span { padding: 2px 6px; white-space: nowrap; }
.hud[hidden],
.mouse-hint[hidden] { display: none; }

.mouse-hint {
  position: fixed;
  z-index: 2;
  top: 14px;
  left: 50%;
  translate: -50% 0;
  padding: 7px 12px;
  color: #eaf3dc;
  background: rgba(10, 14, 11, 0.58);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.01em;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.mouse-hint.flying {
  color: #f1f8df;
  border-color: rgba(183, 212, 107, 0.28);
}

.fatal-error {
  position: fixed;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  max-width: 520px;
  padding: 24px;
  background: #351c18;
  border: 1px solid #a95843;
  border-radius: 10px;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .panel { inset: 10px auto 64px 10px; width: min(310px, calc(100vw - 20px)); }
  .overview-panel { top: 10px; right: 10px; width: min(280px, calc(100vw - 20px)); }
  .hud { right: 10px; bottom: 10px; left: 10px; overflow-x: auto; }
  .mouse-hint { top: 8px; max-width: calc(100vw - 28px); white-space: nowrap; }
}

.help-page-root { height: auto; min-height: 100%; overflow-y: auto; }
.help-page { width: auto; height: auto; min-height: 100%; overflow: visible; background: #101511; }
.help-document { width: min(780px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 80px; color: var(--text); }
.help-document > header { padding-bottom: 26px; border-bottom: 1px solid var(--panel-edge); }
.help-document h1 { font-size: 30px; }
.help-document h2 { margin-bottom: 12px; font-size: 14px; color: var(--accent-strong); }
.help-document h3 { margin: 18px 0 6px; font-size: 14px; }
.help-document p,
.help-document li,
.help-document dd { color: #c3cec0; font-size: 14px; line-height: 1.65; }
.help-document section { padding: 24px 0; }
.help-document ol,
.help-document ul { padding-left: 22px; }
.help-document li + li { margin-top: 6px; }
.help-document dl { display: grid; grid-template-columns: 110px 1fr; gap: 9px 16px; }
.help-document dt { color: var(--accent-strong); font: 12px ui-monospace, monospace; }
.help-document dd { margin: 0; }
.help-document .warning { padding: 12px 14px; color: #f2c3b5; background: rgba(216,140,117,.09); border: 1px solid rgba(216,140,117,.25); border-radius: 8px; }
