html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  color: #f4efe3;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
}

canvas {
  display: block;
}

#controls {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
  box-sizing: border-box;
  width: min(372px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(244, 239, 227, 0.14);
  border-radius: 8px;
  background: rgba(8, 8, 8, 0.76);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(18px);
  transition: width 180ms ease, padding 180ms ease;
}

.panel-title,
.panel-actions,
.button-row,
.style-grid {
  display: flex;
  align-items: center;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title strong {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0;
}

.panel-title span {
  color: rgba(244, 239, 227, 0.64);
  font: 12px/1.2 "Microsoft YaHei", sans-serif;
}

.panel-actions {
  gap: 10px;
}

#controls.is-collapsed {
  width: 168px;
  padding: 12px 14px;
}

#controls.is-collapsed .panel-title {
  margin-bottom: 0;
}

#controls.is-collapsed .panel-body {
  display: none;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: rgba(244, 239, 227, 0.72);
  font: 12px/1.2 "Microsoft YaHei", sans-serif;
}

.field span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.field b {
  color: #f4efe3;
  font-weight: 500;
}

.field-block {
  margin-bottom: 14px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 16px;
  margin-bottom: 14px;
}

.style-grid {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 13px 16px;
  margin-bottom: 14px;
}

textarea,
input,
select,
button {
  font: inherit;
}

textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 74px;
  resize: vertical;
  padding: 10px;
  border: 1px solid rgba(244, 239, 227, 0.16);
  border-radius: 6px;
  outline: none;
  color: #f4efe3;
  background: rgba(255, 255, 255, 0.055);
}

textarea:focus {
  border-color: rgba(255, 255, 255, 0.62);
}

select {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid rgba(244, 239, 227, 0.16);
  border-radius: 6px;
  color: #f4efe3;
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

select:focus {
  border-color: rgba(255, 255, 255, 0.62);
}

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

input[type="color"] {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid rgba(244, 239, 227, 0.16);
  border-radius: 6px;
  background: transparent;
}

.button-row {
  gap: 10px;
}

button {
  flex: 1;
  height: 34px;
  border: 1px solid rgba(244, 239, 227, 0.16);
  border-radius: 6px;
  color: #f4efe3;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.icon-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  line-height: 1;
  padding: 0;
  font-size: 18px;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.13);
}

@media (max-width: 680px) {
  #controls {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 52vh;
    padding: 14px;
  }
}
