:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020205;
  color: #f1eee9;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #020205; }
button, select, input { font: inherit; }
button, select {
  color: inherit;
  background: rgba(31, 28, 27, 0.94);
  border: 1px solid rgba(235, 218, 201, 0.22);
  border-radius: 8px;
}
button { padding: 0.5rem 0.7rem; cursor: pointer; }
button:hover, button:focus-visible { border-color: rgba(240, 152, 94, 0.9); background: rgba(69, 42, 31, 0.96); }
select { width: 100%; padding: 0.45rem 0.55rem; }
input[type="range"] { width: 100%; accent-color: #c96836; }
input[type="checkbox"] { accent-color: #c96836; }

#scene { display: block; width: 100%; height: 100%; outline: none; }
.overlay { position: absolute; z-index: 2; }
.hidden { display: none !important; }

.loading {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 2rem));
  display: grid; gap: 0.6rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(235, 218, 201, 0.18);
  border-radius: 12px;
  background: rgba(8, 7, 8, 0.92);
  box-shadow: 0 16px 50px rgba(0,0,0,0.45);
}
.loading span { color: #c9c0ba; font-size: 0.9rem; }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.08); }
.progress span { display: block; height: 100%; width: 8%; background: #c96836; transition: width 180ms ease; }

.hud {
  top: 0.8rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem;
  width: min(920px, calc(100vw - 1.5rem));
  pointer-events: none;
}
.hud div {
  display: flex; align-items: baseline; gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(235, 218, 201, 0.15);
  border-radius: 7px;
  background: rgba(7, 7, 9, 0.78);
  backdrop-filter: blur(8px);
}
.hud span { color: #a8a0a0; font-size: 0.64rem; letter-spacing: 0.12em; }
.hud strong { font-size: 0.82rem; font-weight: 650; white-space: nowrap; }

.panel {
  top: 0.8rem; right: 0.8rem;
  width: min(330px, calc(100vw - 1.6rem));
  max-height: calc(100vh - 1.6rem);
  overflow: auto;
  padding: 0.8rem;
  border: 1px solid rgba(235, 218, 201, 0.17);
  border-radius: 12px;
  background: rgba(12, 11, 12, 0.9);
  backdrop-filter: blur(10px);
}
.panel-heading { display: flex; justify-content: space-between; gap: 0.7rem; align-items: flex-start; }
.panel h1 { margin: 0; font-size: 1rem; font-weight: 700; }
.panel p { margin: 0.2rem 0 0; color: #bbb1aa; font-size: 0.78rem; line-height: 1.35; }
.panel-heading button { padding: 0.35rem 0.55rem; }
#panel-body { display: grid; gap: 0.8rem; margin-top: 0.8rem; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.panel label { display: grid; gap: 0.35rem; color: #d9d0ca; font-size: 0.79rem; }
.panel output { color: #e59b6a; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 0.7rem; }
.checks label { display: flex; align-items: center; gap: 0.4rem; }
.help { padding-top: 0.7rem; border-top: 1px solid rgba(235, 218, 201, 0.13); }
.help strong { font-size: 0.82rem; }
.status { padding-top: 0.7rem; border-top: 1px solid rgba(235, 218, 201, 0.13); }

.pointer-hint {
  left: 50%; bottom: 1.3rem; transform: translateX(-50%);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(33, 24, 22, 0.72);
  color: #d8cbc3;
  font-size: 0.78rem;
  pointer-events: none;
}

.target-label {
  transform: translate(-50%, -100%);
  display: grid;
  min-width: 120px;
  gap: 0.1rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid rgba(255, 192, 141, 0.45);
  border-radius: 7px;
  background: rgba(24, 15, 12, 0.82);
  text-align: center;
  pointer-events: none;
}
.target-label span { font-size: 0.78rem; font-weight: 700; }
.target-label small { color: #d4b29d; font-size: 0.68rem; }

@media (max-width: 760px) {
  .panel { top: auto; bottom: 0.6rem; right: 0.6rem; max-height: 55vh; }
  .hud { top: 0.45rem; }
  .hud div:nth-child(n+5) { display: none; }
}


#hud-chunks {
  min-width: 9rem;
  text-align: center;
}


.terraform-controls {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
  border: 1px solid rgba(126, 177, 199, 0.25);
  border-radius: 10px;
  background: rgba(27, 43, 48, 0.32);
}
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}
.section-heading strong { font-size: 0.86rem; }
.section-heading output { color: #8ec2d3; font-weight: 700; }
.terraform-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 0.35rem;
}
.terraform-readout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
}
.terraform-readout span {
  display: grid;
  gap: 0.1rem;
  padding: 0.42rem;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.23);
}
.terraform-readout small {
  color: #9ba5a8;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.terraform-readout strong {
  font-size: 0.72rem;
  line-height: 1.2;
}
#terraform-slider { accent-color: #5d9f78; }
#terraform-play.is-running {
  border-color: rgba(107, 190, 139, 0.9);
  background: rgba(37, 86, 59, 0.96);
}

@media (max-width: 520px) {
  .terraform-readout { grid-template-columns: 1fr; }
  .terraform-actions { grid-template-columns: 1fr 1fr; }
  .terraform-actions button:first-child { grid-column: 1 / -1; }
}
