/* builder — 미리보기가 본체. 옆은 짧게, 상자 없이. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #efece6;
  color: var(--ink);
}

html:not(.js) .app { display: none; }
html.js .nojs { display: none; }

/* ── 상단 ─────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 0 22px;
  background: #f7f5f1;
  border-bottom: 1px solid rgb(22 24 29 / .08);
}
.top__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  color: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.03em;
  text-decoration: none;
}
.top__brand img {
  width: 26px; height: 26px;
  display: block;
  object-fit: contain;
}
.top__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}
.top__nav a {
  position: relative;
  min-height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: color .25s ease;
}
.top__nav a:hover { color: var(--ink); }
.top__nav a::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.16,1,.3,1);
  opacity: .4;
}
.top__nav a:hover::after,
.top__nav a[aria-current="page"]::after { transform: scaleX(1); }
.top__nav a[aria-current="page"] { color: var(--ink); }
.top__nav .is-lab { color: #1f6b32; }
.top__nav .is-lab:hover { color: #146628; }
.top__nav .is-cta { color: var(--ink); font-weight: 500; }

/* ── 본체 ─────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  height: calc(100dvh - 48px);
  min-height: 0;
}

/* ── 미리보기 ─────────────────────────────────────── */

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #d8d3c9;
}
.preview__bar {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-height: 40px;
  padding: 8px 18px;
  background: #efece6;
}
.preview__name {
  margin: 0;
  min-width: 0;
  font-size: 14px;
  font-weight: 560;
  letter-spacing: -.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview__meta {
  margin: 0 auto 0 0;
  min-width: 0;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vp { display: flex; gap: 14px; }
.vp__b {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 500 12px/1.2 inherit;
  letter-spacing: -.01em;
  cursor: pointer;
}
.vp__b.is-on { color: var(--ink); }
.vp__b:hover { color: var(--ink); }
.preview__open {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}
.preview__open:hover { color: var(--ink); }

.preview__port {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #cfc9bd;
}
#fr {
  position: absolute;
  top: 0; left: 0;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
}

/* ── 조작 ─────────────────────────────────────────── */

.ctrl {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 22px 22px 28px;
  display: grid;
  align-content: start;
  gap: 22px;
  background: #f7f5f1;
  border-left: 1px solid rgb(22 24 29 / .08);
}
.ctrl__foot {
  padding-top: 4px;
}

.ctrl__head { display: grid; gap: 6px; }
.ctrl__k {
  margin: 0;
  color: #5a8a3a;
  font: 600 11px/1 inherit;
  letter-spacing: .14em;
}
.ctrl__t {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.25;
  word-break: keep-all;
}
.ctrl__d {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
  word-break: keep-all;
}
.ctrl__d b { color: var(--ink); font-weight: 560; font-variant-numeric: tabular-nums; }

.sec {
  display: grid;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid rgb(22 24 29 / .08);
}
.sec__t {
  margin: 0;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: .04em;
  color: var(--ink);
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.f { display: grid; gap: 7px; }
.f__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.f > label,
.f__row > label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -.01em;
}
.f input[type="text"],
.f select,
.f textarea {
  width: 100%;
  min-width: 0;
  padding: 6px 0 8px;
  font: inherit;
  font-size: 15px;
  letter-spacing: -.02em;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgb(22 24 29 / .16);
  border-radius: 0;
  outline: none;
}
.f input[type="text"]:focus,
.f select:focus,
.f textarea:focus {
  border-bottom-color: var(--ink);
}
.f textarea { resize: vertical; line-height: 1.5; }
.f input::placeholder { color: #9aa0a8; }
.f select { cursor: pointer; appearance: none; background-image: none; }

.tone {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tone input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgb(22 24 29 / .12);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  flex: none;
  overflow: hidden;
}
.tone input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.tone input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}
.f .tone input.hex {
  width: 6.4rem;
  flex: none;
  padding: 4px 0 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.presets { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.presets button {
  width: 16px; height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12);
  cursor: pointer;
}
.presets button.is-on {
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .2), 0 0 0 2px #f7f5f1, 0 0 0 3px var(--ink);
}

.tpl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
  max-height: min(420px, 46vh);
  overflow: auto;
  padding: 2px 2px 6px 0;
  scrollbar-width: thin;
}
.tpl__b {
  min-width: 0;
  padding: 0;
  text-align: left;
  border: 0;
  background: none;
  overflow: hidden;
  cursor: pointer;
}
.tpl__b img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
  background: #e4dfd6;
}
.tpl__n {
  display: block;
  padding: 7px 0 0;
  font-size: 11px;
  letter-spacing: -.01em;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl__b[aria-checked="true"] img {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}
.tpl__b[aria-checked="true"] .tpl__n { color: var(--ink); font-weight: 560; }

.fs__hint { margin: 0; font-size: 12px; color: var(--ink-2); }
.note { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.45; word-break: keep-all; }
.note--warn { color: var(--ink); }
.cnt { margin: 0; font-size: 11px; color: #8b9199; text-align: right; }

.mini {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}
.mini:hover { color: var(--ink); }
.filebtn {
  display: inline-flex;
  align-items: center;
  padding: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid rgb(22 24 29 / .16);
  cursor: pointer;
}
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.01em;
  cursor: pointer;
}
.btn:hover { color: var(--ink); }
.btn--solid {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.btn--solid:hover { color: #146628; border-bottom-color: #146628; }
.panel__next {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}
.panel__next a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgb(22 24 29 / .16);
}
.panel__next a:hover { color: var(--ink); }

/* ── 문의 시트 ─────────────────────────────────────── */

.sheet { border: 0; padding: 0; max-inline-size: min(560px, 92vw); }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet__in { display: grid; gap: 12px; padding: 24px; background: #fff; }
.sheet__t { font-size: 18px; }
.sheet__d { font-size: 14px; color: var(--ink-2); }
.sheet__x {
  width: 100%;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--line);
  background: #f7f6f4;
  resize: vertical;
}
.sheet__b { display: flex; gap: 16px; justify-content: flex-end; flex-wrap: wrap; }
.sheet__n { font-size: 12px; color: var(--ink-2); }
.nojs { padding: 24px; }

@media (max-width: 900px) {
  html, body { height: auto; }
  .top { flex-wrap: wrap; padding: 8px 16px; }
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .preview { min-height: 0; }
  .preview__port { height: 64vh; min-height: 380px; max-height: 620px; flex: none; }
  .ctrl { border-left: 0; border-top: 1px solid rgb(22 24 29 / .08); overflow: visible; }
  .tpl { max-height: 280px; }
}
