* { 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, .button-link, .obs-url {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: #252936;
  color: #fff;
}

button, .button-link {
  padding: 10px 14px;
  cursor: pointer;
}

button:hover:not(:disabled), .file-button:hover, select:hover, .button-link:hover { filter: brightness(1.08); }
button:disabled { opacity: .48; cursor: not-allowed; }

.button-link {
  display: grid;
  place-items: center;
  text-decoration: none;
  text-align: center;
}

.primary-action {
  background: #5b5379;
  border-color: rgba(198,184,255,.3);
  font-weight: 700;
}

.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;
  user-select: 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); }

.loading {
  position: absolute;
  z-index: 15;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 9px;
  background: rgba(10,12,17,.72);
  color: rgba(255,255,255,.8);
  font-size: 12px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.render-overlay {
  position: absolute;
  z-index: 25;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 6, 10, .58);
  backdrop-filter: blur(4px);
}

.render-card {
  width: min(380px, 90%);
  padding: 18px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(20, 22, 30, .93);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.render-card strong, .render-card span { display: block; }
.render-card strong { margin-bottom: 12px; font-size: 14px; }
.render-card span { margin-top: 8px; color: #bac0cf; font-size: 12px; }

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #77708f, #b4a5d8);
  transition: width .12s linear;
}

.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: calc(100% - 36px);
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  background: rgba(12,14,20,.86);
  color: #f1f2f7;
  font-size: 12px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

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

.panel-title, .group-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}
.panel-title { margin-bottom: 16px; }
.group-heading { align-items: center; margin-bottom: 12px; }
.group-heading h2 { margin: 0; }

h1 { margin: 0 0 5px; font-size: 20px; }
h2 { margin: 0 0 11px; font-size: 15px; }
p { margin: 0; }

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

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

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

.select-label {
  margin-bottom: 6px !important;
  color: #aeb4c3 !important;
  font-size: 11px !important;
}

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

.selection-meta {
  min-height: 18px;
  margin-top: 7px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.row > * { flex: 1; }
.compact-row { margin-bottom: 10px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

input[type="range"] { width: 100%; }
output { float: right; color: #aeb4c3; }

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

.file-button {
  display: block;
  margin-top: 9px;
  padding: 9px 11px;
  background: #383b49;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}
.file-button:hover { background: #424655; }
.file-button input { display: none; }
.upload-button { width: 100%; }

.render-status { margin-top: 10px; }

.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;
}
.shortcuts { margin-top: 10px; }
.obs-group { padding-bottom: 4px; }

.obs-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.obs-url {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  background: #10121a;
  color: #dfe2eb;
  font-size: 11px;
}

.obs-note { margin-top: 8px; }
.obs-note.warning { color: #e7c27e; }
.obs-note.ok { color: #9dc9ae; }


.bat-export-footer {
  padding: 11px 0 2px;
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center;
}

.bat-export-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: transparent;
  color: #9ca3b3;
  font-size: 11px;
}

.bat-export-btn:hover:not(:disabled) {
  color: #eef0f5;
  background: rgba(255,255,255,.04);
}

.bat-export-note {
  margin-top: 6px;
  color: #777e8e;
  font-size: 10px;
}

body.output-mode { overflow: hidden; }
body.output-mode .app { display: block; width: 100vw; height: 100vh; }
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, body.output-mode .show-panel { display: none !important; }
body.output-mode .render-overlay, body.output-mode .toast, body.output-mode .loading { display: none !important; }

@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; }
}

@media (max-width: 420px) {
  .action-grid { grid-template-columns: 1fr; }
}
