@font-face {
  font-family: "Gmarket Sans";
  src: url("fonts/GmarketSansTTFMedium.ttf") format("truetype");
  font-weight: 500;
}

@font-face {
  font-family: "Gmarket Sans";
  src: url("fonts/GmarketSansTTFBold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: "Gmarket Sans";
  src: url("fonts/GmarketSansTTFLight.ttf") format("truetype");
  font-weight: 300;
}

:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #fff1f8;
  --line: #ead9f1;
  --text: #3b1555;
  --muted: #765486;
  --accent: #d98be8;
  --accent-2: #ffa9c8;
  --danger: #e87592;
  --shadow: 0 18px 48px rgba(127, 86, 145, .14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Gmarket Sans", sans-serif;
  background: #fbf7ff;
  color: var(--text);
}

button,
input {
  font-family: "Gmarket Sans", sans-serif;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #fff9fd;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 4px;
}

.eyebrow,
#fileMeta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

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

.upload-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 22px;
  border: 1px dashed #dfbde8;
  border-radius: 8px;
  background: #fff2f8;
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.upload-zone:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #f8edff;
}

.upload-zone input {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #ffa9c8, #d98be8);
  font-size: 30px;
  font-weight: 700;
}

.upload-zone small,
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

button {
  min-height: 42px;
  border: 1px solid #ead9f1;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: #cf9edf;
}

button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #ffa9c8, #d98be8);
  color: #ffffff;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

label {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

.panel:nth-of-type(4) .segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button.active {
  border-color: var(--accent);
  background: #fbecff;
  color: #8b41a2;
}

.export-panel {
  margin-top: auto;
}

.export-panel button {
  width: 100%;
  margin-top: 10px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.app-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #fff9fd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 78px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff9fd;
}

#statusText {
  display: block;
  font-size: 18px;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.canvas-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
  overflow: hidden;
  background-color: #fbf2ff;
  background-image:
    linear-gradient(45deg, rgba(210, 143, 231, .14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 169, 200, .15) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(210, 143, 231, .14) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 169, 200, .15) 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0;
}

canvas {
  max-width: 100%;
  max-height: calc(100vh - 126px);
  width: auto;
  height: auto;
  border: 1px solid #ead2f2;
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 24px 70px rgba(136, 85, 154, .16);
  cursor: crosshair;
}

.empty-state {
  position: absolute;
  inset: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafe;
}

.empty-state h2 {
  margin: 18px 0 8px;
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.empty-mark {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, transparent 45%, rgba(217, 139, 232, .95) 45% 55%, transparent 55%),
    linear-gradient(45deg, #fff2f8, #f2e7ff);
  border: 1px solid #ead2f2;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .export-panel {
    margin-top: 0;
  }

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

  .stats {
    justify-content: flex-start;
  }
}
