* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
  background: #0d0f14;
  color: #f3f4f8;
}

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #0d0f14;
}

button, select, input {
  font: inherit;
}

button, .file-button, select {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: #252936;
  color: #fff;
}

button {
  padding: 10px 14px;
  cursor: pointer;
}

button:hover, .file-button:hover {
  filter: brightness(1.08);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.stage-wrap {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(97, 85, 125, .16), transparent 38%),
    #090a0e;
}

.stage {
  position: relative;
  width: min(100%, calc((100vh - 40px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  box-shadow: 0 22px 80px rgba(0,0,0,.45);
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.bg-media {
  z-index: 1;
  object-fit: cover;
  transform-origin: center center;
  will-change: transform;
}

.frame-media {
  z-index: 2;
  object-fit: fill;
  pointer-events: none;
}

.placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: rgba(255,255,255,.7);
  text-align: center;
  background:
    linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%),
    linear-gradient(45deg, #111 25%, #181818 25%, #181818 75%, #111 75%);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
}

.placeholder strong,
.placeholder span {
  display: block;
}

.placeholder strong {
  margin-bottom: 8px;
  font-size: clamp(18px, 2vw, 28px);
}

.guide {
  position: absolute;
  z-index: 10;
  inset: 5%;
  border: 1px dashed rgba(255,255,255,.7);
  pointer-events: none;
}

.guide::before,
.guide::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,.4);
}

.guide::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.guide::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
}

.panel {
  height: 100vh;
  overflow: auto;
  padding: 22px;
  background: #171a22;
  border-left: 1px solid rgba(255,255,255,.08);
}

.panel-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  margin: 0 0 5px;
  font-size: 20px;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

p {
  margin: 0;
}

.panel-title p,
.hint {
  color: #aeb4c3;
  font-size: 12px;
  line-height: 1.55;
}

.group {
  padding: 16px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}

.group label:not(.file-button) {
  display: grid;
  gap: 7px;
  margin: 13px 0;
  font-size: 13px;
  color: #d8dbe4;
}

.file-button {
  display: block;
  padding: 12px 14px;
  background: #56506f;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
}

.file-button.secondary {
  background: #3e4250;
}

.file-button input {
  display: none;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.row > * {
  flex: 1;
}

select {
  width: 100%;
  padding: 9px 10px;
}

input[type="range"] {
  width: 100%;
}

output {
  float: right;
  color: #aeb4c3;
}

.ghost {
  padding: 8px 10px;
  background: transparent;
  white-space: nowrap;
  font-size: 12px;
}

.show-panel {
  position: fixed;
  z-index: 30;
  right: 16px;
  top: 16px;
  opacity: .82;
}

.hidden {
  display: none !important;
}

kbd, code {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  background: #0f1117;
  padding: 2px 5px;
  color: #e6e8ee;
}

body.output-mode .app {
  display: block;
}

body.output-mode .stage-wrap {
  width: 100vw;
  height: 100vh;
  padding: 0;
  background: #000;
}

body.output-mode .stage {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  box-shadow: none;
}

body.output-mode .panel {
  display: none;
}

@media (max-width: 920px) {
  .app {
    display: block;
  }
  .panel {
    height: auto;
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .stage-wrap {
    padding: 12px;
  }
}
