@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "KoPub Batang";
  src: url("https://cdn.jsdelivr.net/npm/font-kopub@1.0/fonts/KoPubBatang-Medium.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "KoPub Batang";
  src: url("https://cdn.jsdelivr.net/npm/font-kopub@1.0/fonts/KoPubBatang-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1c1b1f;
  --muted: #787581;
  --primary: #5d5696;
  --line: #c9c5d1;
  --panel: #fcf8fe;
  --surface: #ffffff;
  --soft: #f6f2f8;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--panel);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  border-color: var(--primary);
}

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

.panel {
  overflow: auto;
  padding: 22px 24px 28px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  position: sticky;
  top: -22px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 22px 0 18px;
  margin-top: -22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-button:hover {
  border-color: var(--primary);
}

.logo-star {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(145deg, #d9d3ff, #9f95d4);
  color: #fff;
  font-size: 22px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "KoPub Batang", "Pretendard", serif;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  font-weight: 900;
}

.subcopy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.group {
  display: grid;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid #e5e1e7;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  font-weight: 600;
  min-width: 0;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(93, 86, 150, 0.12);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
}

input[type="color"] {
  height: 42px;
  padding: 4px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.slot-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.slot-card {
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
}

.slot-card.active {
  border-color: var(--primary);
  box-shadow: inset 4px 0 0 var(--primary);
}

.slot-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sticker-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sticker-card {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 0;
  text-align: left;
}

.sticker-card.active {
  border-color: var(--primary);
  box-shadow: inset 4px 0 0 var(--primary);
}

.sticker-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.adjust {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

#selectedName {
  font-weight: 900;
}

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

.save-actions {
  grid-template-columns: 1fr 1fr;
}

.save-list {
  display: grid;
  gap: 8px;
}

.save-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
}

.save-load {
  display: grid;
  justify-items: start;
  min-width: 0;
  text-align: left;
}

.save-load span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-load small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.save-item.active .save-load {
  border-color: var(--primary);
  box-shadow: inset 4px 0 0 var(--primary);
}

.save-delete {
  min-height: 42px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-save {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.swatches {
  display: grid;
  gap: 8px;
}

.color-row {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 46px 88px 54px 48px;
  gap: 8px;
  align-items: center;
}

.color-name {
  min-width: 0;
}

.color-swatch-button {
  position: relative;
  display: block;
  width: 46px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-color: #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  overflow: hidden;
  cursor: pointer;
}

.color-swatch-button::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--swatch);
}

.color-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.hex-input {
  min-width: 0;
  text-transform: uppercase;
  font-size: 12px;
  padding-inline: 9px;
}

.color-reset,
.color-remove {
  min-height: 40px;
  padding: 0;
  font-size: 12px;
}

.color-reset {
  color: var(--muted);
}

.color-remove:disabled {
  color: #b6b1c0;
  cursor: default;
  background: #f6f2f8;
}

#deleteSticker:disabled {
  color: #b6b1c0;
  cursor: default;
  background: #f6f2f8;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.stage-wrap {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 40px;
  overflow: auto;
}

canvas {
  width: min(94%, calc((100vh - 140px) * 1.333));
  height: auto;
  max-height: calc(100vh - 140px);
  flex: 0 0 auto;
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(93, 86, 150, 0.13);
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  body {
    height: auto;
    overflow: auto;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  canvas {
    width: 100%;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .two,
  .button-row,
  .slot-list {
    grid-template-columns: 1fr;
  }

  .color-row {
    grid-template-columns: minmax(0, 1fr) 44px 84px;
  }

  .color-swatch-button {
    width: 44px;
  }

  .color-reset {
    grid-column: 2;
  }

  .color-remove {
    grid-column: 3;
  }
}
