* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #171717;
  color: #e8e3dc;
  font-family: Arial, Helvetica, sans-serif;
}

html.is-embedded,
html.is-embedded body,
html.is-embedded #viewport {
  background: transparent !important;
  color-scheme: dark;
}

html.is-embedded canvas {
  background: transparent !important;
}

#viewport {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#status {
  position: fixed;
  left: 16px;
  bottom: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(18, 18, 18, 0.78);
  color: #d8d3cb;
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}

#status[data-ready="true"] {
  color: #aee2c0;
}

#status[data-error="true"] {
  color: #ffb4a8;
}

body.is-embedded #status {
  display: none;
}

#controls {
  position: fixed;
  top: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  width: 310px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(15, 18, 22, 0.92);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  color: #eeeae3;
  font-size: 13px;
}

#texture-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  width: 330px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(15, 18, 22, 0.92);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  color: #eeeae3;
  font-size: 13px;
}

.panel-title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
}

#controls details,
#texture-controls details {
  margin: 12px 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

#controls summary,
#texture-controls summary {
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
}

.select-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 10px 0 12px;
}

.select-row select {
  width: 100%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #0b0d10;
  color: #eeeae3;
}

.finish-search-input {
  width: 100%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #0b0d10;
  color: #eeeae3;
}

.finish-list-select {
  min-height: 230px;
  font-size: 12px;
  line-height: 1.25;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  margin: 8px 0;
}

.control-row output {
  display: none;
  text-align: right;
  color: #b9c8d8;
}

.control-row input[type="number"] {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #0b0d10;
  color: #eeeae3;
}

.control-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
}

#controls textarea,
#texture-controls textarea {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #0b0d10;
  color: #bad6ff;
  font: 12px/1.35 Consolas, "Courier New", monospace;
}

#controls button,
#texture-controls button {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 0;
  border-radius: 5px;
  background: #6d91c9;
  color: #0d1117;
  cursor: pointer;
  font-weight: 700;
}

.atlas-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.atlas-previews figure {
  margin: 0;
}

.atlas-previews figcaption {
  margin-bottom: 4px;
  color: #b9c8d8;
  font-size: 12px;
}

.atlas-previews img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #050608;
}
