:root {
  --bg-a: #fff9fc;
  --bg-b: #ffeef6;
  --bg-c: #ffe2ef;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-line: #ffdbe9;
  --section-bg: linear-gradient(180deg, #fff, #fff5fa);
  --surface: #ffffff;
  --surface-soft: #ffe8f2;
  --text-main: #5c1f3f;
  --text-soft: #8c4b6a;
  --brand: #ef2d92;
  --brand-soft: #ff4fa8;
  --btn-soft-bg: #ffffff;
  --btn-soft-hover: #fff1f7;
  --input-line: #ffcde0;
  --grid-line: rgba(255, 177, 205, 0.2);
  --shadow: rgba(92, 31, 63, 0.15);
}

body[data-theme="dark"] {
  --bg-a: #040404;
  --bg-b: #0b0b0b;
  --bg-c: #151515;
  --panel-bg: rgba(14, 14, 14, 0.95);
  --panel-line: #3a3a3a;
  --section-bg: linear-gradient(180deg, #181818, #111111);
  --surface: #131313;
  --surface-soft: #242424;
  --text-main: #ffe8f4;
  --text-soft: #f1b7d6;
  --brand: #ff2f98;
  --brand-soft: #ff5bb0;
  --btn-soft-bg: #1b1b1b;
  --btn-soft-hover: #252525;
  --input-line: #494949;
  --grid-line: rgba(255, 91, 176, 0.2);
  --shadow: rgba(0, 0, 0, 0.45);
}

body[data-theme="dark"] .stage-wrap {
  background-color: rgba(10, 10, 10, 0.82);
}

body[data-theme="dark"] .ad-card {
  background: rgba(24, 24, 24, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nanum Gothic", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.35) 0%, transparent 32%),
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.2) 0%, transparent 28%),
    radial-gradient(circle at 30% 95%, rgba(255, 255, 255, 0.16) 0%, transparent 30%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b) 45%, var(--bg-c));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-line);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-mini {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.2px;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.select-wrap select {
  border: 1px solid var(--input-line);
  border-radius: 10px;
  background: var(--btn-soft-bg);
  color: var(--text-main);
  padding: 6px 9px;
}

.top-btn {
  width: auto;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 60px);
}

.panel {
  width: min(360px, 100%);
  background: var(--panel-bg);
  border-right: 1px solid var(--panel-line);
  padding: 24px 20px;
  overflow-y: auto;
  box-shadow: 8px 0 30px var(--shadow);
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand);
}

.subtitle {
  margin: 8px 0 18px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.control-section {
  margin-bottom: 14px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--panel-line);
  background: var(--section-bg);
}

.label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand-soft);
}

.ratio-row {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.ratio-row strong {
  color: var(--brand);
}

.grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.grid-fields label span {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.grid-fields input {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text-main);
  background: var(--btn-soft-bg);
}

.helper,
.note {
  margin: 10px 0 0;
  font-size: 0.76rem;
  color: var(--text-soft);
}

.tip-list {
  padding-left: 16px;
  margin-top: 8px;
}

.tip-list li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.btn {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-soft {
  color: var(--brand);
  background: var(--btn-soft-bg);
  border-color: var(--input-line);
}

.btn-soft:hover {
  background: var(--btn-soft-hover);
}

.btn-toggle-active {
  color: #fff;
  background: linear-gradient(90deg, #ff8cb8, #ff5c9a);
  border-color: transparent;
}

.btn-main {
  color: #fff;
  background: linear-gradient(90deg, #ff5c9a, #f03b84);
  box-shadow: 0 14px 24px rgba(255, 92, 154, 0.28);
}

.btn-main:hover {
  box-shadow: 0 18px 30px rgba(255, 92, 154, 0.36);
}

.workspace {
  flex: 1;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-content: start;
}

.stage-wrap {
  width: 100%;
  min-height: 480px;
  border-radius: 22px;
  border: 1px solid var(--panel-line);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-color: rgba(255, 255, 255, 0.62);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 24px;
}

.canvas-container {
  position: relative;
  background: var(--surface);
  box-shadow: 0 22px 40px var(--shadow);
  overflow: hidden;
  border-radius: 8px;
}

.photo-slot {
  position: absolute;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--surface);
  user-select: none;
  touch-action: none;
}

.photo-slot.switch-mode {
  cursor: pointer;
}

.photo-slot.swap-pick {
  outline: 3px solid var(--brand-soft);
  outline-offset: -3px;
}

.empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
}

.photo-slot img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  pointer-events: none;
  -webkit-user-drag: none;
}

.slot-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7px 8px;
  background: linear-gradient(to top, rgba(28, 12, 22, 0.58), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-slot:hover .slot-ui,
.photo-slot:focus-within .slot-ui,
.photo-slot.active .slot-ui {
  opacity: 1;
}

.slot-ui input[type="range"] {
  width: 100%;
  accent-color: #fff;
}

.content-block,
.ads-area,
.footer,
.info-layout {
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: var(--section-bg);
  padding: 16px;
}

.content-block h2,
.footer h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.content-block p,
.content-block li,
.footer p {
  margin: 0 0 8px;
  line-height: 1.5;
  color: var(--text-soft);
}

.quality-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.ads-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ad-card {
  border: 1px dashed var(--input-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  padding: 14px;
}

.ad-card h3 {
  margin: 6px 0;
  font-size: 1rem;
}

.ad-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.ad-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand-soft);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 10px;
}

.footer-links a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.policy-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  border-top: 1px solid var(--panel-line);
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
}

.policy-links {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.policy-links a {
  color: var(--text-soft);
  font-size: 0.82rem;
  text-decoration: none;
}

.policy-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.info-main {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

.info-layout h2 {
  margin: 0 0 10px;
}

.info-layout p,
.info-layout li {
  line-height: 1.65;
  color: var(--text-soft);
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }

  .panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--panel-line);
    box-shadow: 0 10px 28px var(--shadow);
  }

  .workspace {
    padding: 14px;
  }

  .stage-wrap {
    min-height: 64vh;
    padding: 14px;
  }

  .ads-area {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
