* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e0d0a;
  color: #efe8d0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #0e0d0a;
}

canvas {
  display: block;
}

#toggleUI {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(239, 232, 208, 0.25);
  border-radius: 999px;
  background: rgba(14, 13, 10, 0.72);
  color: #efe8d0;
  font-size: 26px;
  line-height: 28px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

#toggleUI:hover {
  background: rgba(239, 232, 208, 0.12);
}

.overlay {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 10;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(239, 232, 208, 0.18);
  border-radius: 18px;
  background: rgba(14, 13, 10, 0.74);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-18px);
}

h1 {
  margin: 0 0 4px 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.subtitle {
  margin-bottom: 18px;
  color: rgba(239, 232, 208, 0.72);
  font-size: 12px;
  line-height: 1.35;
}

.panel {
  display: grid;
  gap: 12px;
}

.ctrl {
  display: grid;
  gap: 6px;
}

label {
  color: rgba(239, 232, 208, 0.7);
  font-size: 11px;
  text-transform: lowercase;
}

input,
select,
button {
  font: inherit;
}

input[type="file"],
select {
  width: 100%;
  color: #efe8d0;
  border: 1px solid rgba(239, 232, 208, 0.18);
  border-radius: 10px;
  background: rgba(239, 232, 208, 0.06);
  padding: 9px 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: #a7b36a;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

button {
  color: #efe8d0;
  border: 1px solid rgba(239, 232, 208, 0.2);
  border-radius: 999px;
  background: rgba(239, 232, 208, 0.08);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: rgba(239, 232, 208, 0.16);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

#compostBtn {
  background: rgba(151, 172, 83, 0.22);
  border-color: rgba(196, 220, 108, 0.42);
}

#thermalBtn.active {
  background: rgba(230, 96, 55, 0.24);
  border-color: rgba(255, 160, 92, 0.5);
}

#invertBtn.active {
  background: rgba(239, 232, 208, 0.18);
}

#status {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(239, 232, 208, 0.12);
  color: rgba(239, 232, 208, 0.86);
  font-size: 12px;
  line-height: 1.45;
}

.hint,
#geo-credit {
  margin-top: 8px;
  color: rgba(239, 232, 208, 0.48);
  font-size: 10px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .overlay {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    max-height: 72vh;
    padding: 14px;
  }

  h1 {
    font-size: 22px;
  }

  #toggleUI {
    top: auto;
    bottom: 14px;
    right: 14px;
  }
}
