:root {
  --bg: #F2F1EE; --surface: #FFFFFF; --ink: #14171D; --ink-2: #454A54; --muted: #6B7079;
  --line: rgb(20 23 29 / .12); --line-2: rgb(20 23 29 / .07);
  --navy: #061021; --orange: #E8590C; --orange-soft: #FFF1E6; --ok: #1F7A4D; --bad: #C2341D;
  --r: 14px; --ease: cubic-bezier(.2, .7, .2, 1);
  --font: 'IBM Plex Sans KR', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); }
button, input { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand b { font-weight: 700; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .8125rem; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, #FCB604, #FF6A0B 50%, #EE0A06); align-self: center; }

.btn { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; transition: transform .15s var(--ease), opacity .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: progress; }
.btn-ghost { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-weight: 600; font-size: .875rem; text-decoration: none; cursor: pointer; }
.btn-ghost:hover { background: var(--line-2); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; max-width: 1440px; margin: 0 auto; padding: 24px; align-items: start; }
.panel { display: grid; gap: 14px; min-width: 0; }
.panel section { min-width: 0; overflow: hidden; }
.panel section, .check { background: var(--surface); border-radius: var(--r); padding: 18px; box-shadow: 0 0 0 1px var(--line-2); }
h2 { margin: 0 0 12px; font-size: .8125rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: .8125rem; }

.logo-card { display: grid; place-items: center; padding: 18px; border-radius: 10px; background: #FAFAF8; box-shadow: inset 0 0 0 1px var(--line-2); }
.logo-card img { display: block; width: 100%; max-width: 100%; height: auto; }

.tpls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tpl { min-width: 0; display: grid; gap: 6px; padding: 6px; border: 0; border-radius: 12px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; text-align: left; transition: box-shadow .2s var(--ease); }
.tpl[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--orange); background: var(--orange-soft); }
.tpl .thumb { display: block; min-width: 0; aspect-ratio: 9 / 5; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.tpl .thumb svg { display: block; width: 100%; height: 100%; }
.tpl b { font-size: .8125rem; padding: 0 2px 2px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields label { display: grid; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.fields .wide { grid-column: 1 / -1; }
.fields label { min-width: 0; }
.fields input { width: 100%; min-width: 0; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: #F6F5F2; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 16px; font-weight: 400; color: var(--ink); }
.fields input:focus { outline: 2px solid var(--orange); outline-offset: 1px; background: #fff; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: #F6F5F2; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--navy); color: #fff; }

.stage { display: grid; gap: 16px; position: sticky; top: 92px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-head h1 { margin: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .875rem; color: var(--ink-2); cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--orange); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cards figure { margin: 0; display: grid; gap: 8px; }
.cards figcaption { font-size: .8125rem; color: var(--muted); text-align: center; }
.card { border-radius: 4px; box-shadow: 0 18px 40px -18px rgb(6 16 33 / .45), 0 2px 6px rgb(6 16 33 / .08); background: #fff; overflow: hidden; }
.card svg { display: block; width: 100%; height: auto; }
.cards figure, .stage { min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px dashed; }
.lg-trim { color: #E5484D; } .lg-safe { color: #2F7DF6; } .lg-bleed { border-top: 8px solid #D9DBDF !important; height: 0; }

.check ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; }
.check li { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; }
.check li::before { content: "✓"; flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: #E3F2EA; color: var(--ok); font-size: .6875rem; font-weight: 700; }
.warns { margin-top: 10px !important; }
.warns li::before { content: "!"; background: #FDECE8; color: var(--bad); }
.warns li.info::before { background: #FFF4E5; color: #B25E00; }

.loading { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; padding: 10px 18px; border-radius: 999px; background: var(--navy); color: #fff; font-size: .875rem; }
.loading[hidden] { display: none; }

@media (max-width: 1100px) {
  /* 좁은 화면: 스타일 입력 → 후보·미리보기 → 로고·사람 정보·인쇄소 순서 */
  .layout { display: flex; flex-direction: column; }
  .panel { display: contents; }
  .panel section { order: 2; }
  .panel section.first { order: 0; }
  .stage { position: static; order: 1; }
}
@media (max-width: 640px) {
  .layout { padding: 16px; gap: 16px; }
  .top { padding: 10px 16px; }
  .brand small { display: none; }
  .stage-head { flex-wrap: wrap; }
  .stage-head h1 { font-size: 1.0625rem; }
  .cards { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
}

/* 스타일 입력 · 후보 */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.style-form textarea { width: 100%; min-height: 64px; padding: 10px 12px; border: 0; border-radius: 10px; background: #F6F5F2; box-shadow: inset 0 0 0 1px var(--line-2); font: 400 16px/1.5 var(--font); color: var(--ink); resize: vertical; }
.style-form textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--orange-soft); color: #9A3B06; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.chip:hover { background: #FFE2CC; }
.cands-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cands-head h2 { margin: 0; }
.cands-head .hint { margin: 0; }
.cands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cand { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-width: 0; padding: 6px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.cand:hover { transform: translateY(-1px); }
.cand[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--orange); background: var(--orange-soft); }
.cand .mini { display: block; min-width: 0; border-radius: 3px; overflow: hidden; box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.cand .mini svg { display: block; width: 100%; height: auto; }
.cand .n { position: absolute; top: -6px; left: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: .75rem; font-weight: 700; }
@media (max-width: 640px) { .cands { grid-template-columns: 1fr; } }

/* 탭 */
.top { flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: #F1EFEB; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 8px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: .9375rem; color: var(--ink-2); cursor: pointer; }
.tab i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .8125rem; background: #E2DFD9; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.tab[aria-selected="true"] i { background: var(--navy); color: #fff; }
.tab:focus-visible, .btn:focus-visible, .btn-ghost:focus-visible, .chip:focus-visible, .cand:focus-visible, .lcand:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.opt { font-weight: 400; color: var(--muted); }
.eyebrow { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .08em; color: var(--orange); }
.upload { cursor: pointer; }

/* 로고 후보 */
.lcands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.lcand { display: grid; grid-template-rows: 1fr auto; min-width: 0; padding: 0; border: 0; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; overflow: hidden; text-align: left; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.lcand:hover { transform: translateY(-1px); }
.lcand[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--orange); }
.lc-art { display: grid; place-items: center; aspect-ratio: 16 / 10; padding: 14px 18px; }
.lc-art svg { width: 100%; height: 100%; }
.lc-cap { padding: 10px 14px; font-size: .75rem; line-height: 1.45; color: var(--muted); border-top: 1px solid var(--line-2); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }   /* AI 가 쓴 «무엇을 그렸나» 한 줄이 두 줄까지 보이게 */
.chosen { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; padding: 16px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.chosen-view { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }   /* minmax(0) — 옆으로 긴 글자형 로고가 칸을 밀어 옆 글과 겹치던 것 */
.chosen-view > div { min-width: 0; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 10px; padding: 16px; box-shadow: inset 0 0 0 1px var(--line-2); }
.on-light { background: #fff; }
.chosen-view svg { width: 100%; height: 100%; }
.chosen-side { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.chosen-side h3 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.chosen-side .hint { margin: 0; }
.btn-next { margin-top: 8px; background: linear-gradient(135deg, #FF7A1A, #E8340F); }
.logo-card svg { display: block; width: 100%; height: auto; max-height: 110px; }
@media (max-width: 1100px) { .chosen { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .lcands { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 0 10px 0 6px; font-size: .875rem; }
  .chosen-view { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }

/* 로고 종류(조합형·심볼형·글자형) */
.type-pick { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.type-pick legend { margin-bottom: 8px; padding: 0; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.seg-type button { display: grid; gap: 2px; place-content: center; min-height: 56px; padding: 6px 4px; color: var(--ink); }
.seg-type b { font-size: .875rem; }
.seg-type small { font-size: .6875rem; font-weight: 500; color: var(--muted); }
.seg-type button[aria-checked="true"] small { color: rgb(255 255 255 / .75); }
.seg-type button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.type-pick .hint { margin: 8px 0 0; }
.letters-in { display: grid; gap: 4px; margin-top: 10px; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.letters-in input { width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: #F6F5F2; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 16px; font-weight: 600; letter-spacing: .04em; color: var(--ink); }
.letters-in input:focus { outline: 2px solid var(--orange); outline-offset: 1px; background: #fff; }

/* 로고에 넣을 것 · 다듬기 */
.parts-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; border: 0; }
.parts-pick legend { width: 100%; margin-bottom: 8px; padding: 0; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.tog { position: relative; display: inline-flex; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: #F1EFEB; font-weight: 600; font-size: .875rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.tog span::before { content: ""; width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px #B9B5AE; background: #fff; }
.tog input:checked + span { background: var(--navy); color: #fff; }
.tog input:checked + span::before { box-shadow: none; background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/14px no-repeat; }
.tog input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.tog.off span { opacity: .45; cursor: not-allowed; }
.edit { padding: 18px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.edit:empty { display: none; }
.edit h2 { margin-bottom: 6px; }
.edit .hint { margin: 0 0 12px; }
.ed-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.ed-row h3 { margin: 0; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 64px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: #F6F5F2; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); cursor: pointer; font-size: .75rem; font-weight: 600; }
.pick.on { box-shadow: inset 0 0 0 2px var(--orange); background: var(--orange-soft); }
.pick:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.pick svg { display: block; width: 34px; height: 34px; }
.picks.fonts .pick svg { width: 120px; height: 26px; }
.picks.rows .pick svg { width: 220px; height: 44px; }
.picks.swatches .pick i { display: block; width: 26px; height: 26px; border-radius: 50%; }
.picks.fonts .pick span, .picks.rows .pick span { font-weight: 500; color: var(--muted); }
@media (max-width: 640px) { .ed-row { grid-template-columns: 1fr; gap: 8px; } .picks.fonts .pick svg { width: 96px; } .picks.rows .pick svg { width: 160px; } }

.warn-text:empty { display: none; }
.warn-text { color: var(--bad); }

/* AI 로고 */
.opt-l { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: rgb(255 255 255 / .18); font-size: .75rem; }
.ai-status { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #F6F5F2; font-size: .8125rem; color: var(--ink-2); }
.ai-status:empty { display: none; }
.ai-status a { color: var(--orange); font-weight: 700; }
.empty { margin: 0; padding: 28px 20px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); font-size: .875rem; text-align: center; }
.empty[hidden] { display: none; }
.revise { padding: 18px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 2px var(--orange-soft), 0 0 0 1px var(--line-2); }
.revise h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.revise .hint { margin: 0 0 12px; }
.revise textarea { width: 100%; min-width: 0; padding: 10px 12px; border: 0; border-radius: 10px; background: #F6F5F2; box-shadow: inset 0 0 0 1px var(--line-2); font: 400 16px/1.5 var(--font); color: var(--ink); resize: vertical; }
.revise textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; background: #fff; }
.badge { padding: 2px 10px; border-radius: 999px; background: var(--orange-soft); color: #9A3B06; font-size: .75rem; font-weight: 700; letter-spacing: 0; }
.btn:disabled, .btn-ghost:disabled { opacity: .45; cursor: not-allowed; transform: none; }
