:root {
  font-family: Pretendard, SUIT, "Noto Sans KR", Arial, sans-serif;
  color-scheme: light;
  font-size: clamp(16px, min(0.833333vw, 1.481481vh), 32px);
}

* {
  box-sizing: border-box;
}

html,
body,
.tuning-lab {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #f5f6f6;
}

.tuning-preview {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.tuning-panel {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: clamp(0.75rem, 1.5vw, 1.5rem);
  width: clamp(19rem, 22vw, 26rem);
  max-height: calc(100svh - 2rem);
  overflow: auto;
  border: 1px solid rgb(17 17 17 / 12%);
  border-radius: 0.5rem;
  background: rgb(250 251 250 / 94%);
  box-shadow: 0 1.25rem 4rem rgb(25 32 29 / 18%);
  color: #161a18;
  transform: translateY(-50%);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.tuning-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid rgb(17 17 17 / 9%);
  background: rgb(250 251 250 / 95%);
}

.tuning-heading p,
.tuning-heading h1,
.tuning-actions p,
.tuning-hint {
  margin: 0;
}

.tuning-heading p {
  color: #747b78;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.tuning-heading h1 {
  margin-top: 0.24rem;
  font-size: 1rem;
  letter-spacing: -0.035em;
}

.tuning-heading button,
.tuning-actions button,
.panel-reopen {
  border: 1px solid rgb(17 17 17 / 14%);
  border-radius: 999px;
  background: #fff;
  color: #29302d;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 720;
}

.tuning-heading button {
  padding: 0.42rem 0.72rem;
}

.tuning-groups {
  display: grid;
  gap: 0;
}

.tuning-groups fieldset {
  min-width: 0;
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  border: 0;
  border-bottom: 1px solid rgb(17 17 17 / 8%);
}

.tuning-groups legend {
  padding: 0;
  color: #2f7462;
  font-size: 0.66rem;
  font-weight: 820;
  letter-spacing: -0.02em;
}

.tuning-groups legend span {
  color: #1d2521;
}

.tuning-hint {
  margin-top: 0.55rem;
  color: #747d79;
  font-size: 0.58rem;
  line-height: 1.45;
}

.tuning-groups label {
  display: grid;
  gap: 0.42rem;
  margin-top: 0.75rem;
}

.tuning-groups label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  color: #505956;
  font-size: 0.68rem;
}

.tuning-groups output {
  color: #171b19;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.tuning-groups input[type="range"] {
  width: 100%;
  accent-color: #2f7462;
  cursor: ew-resize;
}

.scene-reset {
  width: 100%;
  min-height: 2rem;
  margin-top: 0.85rem;
  border: 1px solid rgb(17 17 17 / 12%);
  border-radius: 0.3rem;
  background: rgb(255 255 255 / 72%);
  color: #59625e;
  cursor: pointer;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 720;
}

.tuning-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
}

.tuning-actions button {
  min-height: 2.35rem;
}

.tuning-actions button.is-primary {
  border-color: #2f7462;
  background: #2f7462;
  color: #fff;
}

.tuning-actions p {
  min-height: 0.9rem;
  grid-column: 1 / -1;
  color: #65706c;
  font-size: 0.62rem;
  text-align: right;
}

.tuning-heading button:hover,
.tuning-actions button:hover,
.scene-reset:hover,
.panel-reopen:hover {
  border-color: #2f7462;
}

.tuning-heading button:focus-visible,
.tuning-actions button:focus-visible,
.scene-reset:focus-visible,
.panel-reopen:focus-visible,
.tuning-groups input:focus-visible {
  outline: 2px solid #2f7462;
  outline-offset: 2px;
}

.panel-reopen {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  box-shadow: 0 0.8rem 2rem rgb(25 32 29 / 14%);
  transform: translateY(-50%);
}

@media (max-width: 52rem) {
  .tuning-panel {
    top: auto;
    right: 0.65rem;
    bottom: 0.65rem;
    left: 0.65rem;
    width: auto;
    max-height: 56svh;
    transform: none;
  }

  .tuning-groups {
    grid-template-columns: 1fr;
  }

  .tuning-groups fieldset {
    border-right: 0;
  }

  .panel-reopen {
    top: auto;
    bottom: 0.75rem;
    transform: none;
  }
}
