:root {
    --ink: #111111;
    --ink-2: #3f3f46;
    --sub: #71717a;
    --faint: #a1a1aa;
    --line: #e7e5e4;
    --line-2: #f0efed;
    --bg: #fafaf9;
    --card: #ffffff;
    --accent: #03c75a;
    --accent-soft: #e9faf0;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 8px 28px rgba(17, 17, 17, .07);
    --nav-h: 60px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

body.is-home .app-only, body.is-app .home-only { display: none !important; }
body.is-app { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.is-app .home { display: none; }

/* ── buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 16px;
    border-radius: 999px; border: 1px solid transparent;
    font-size: 14px; font-weight: 600; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover:not(:disabled) { background: #2b2b2b; }
.btn.line { background: var(--card); border-color: var(--line); }
.btn.line:hover { border-color: #cfccc8; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(17, 17, 17, .05); }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.link { background: none; border: 0; padding: 0; color: var(--sub); font-size: 14px; }
.link:hover { color: var(--ink); }

/* ── nav ── */
.nav {
    position: sticky; top: 0; z-index: 20;
    height: var(--nav-h); flex: none;
    display: flex; align-items: center; gap: 28px;
    padding: 0 28px;
    background: rgba(250, 250, 249, .82);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent;
}
body.is-app .nav { border-bottom-color: var(--line); background: var(--card); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand svg { width: 24px; height: 24px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--sub); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); }
.nav-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── composer ── */
.composer {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 16px 16px 12px 20px;
    transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #bdbab5; box-shadow: 0 1px 2px rgba(17, 17, 17, .05), 0 12px 36px rgba(17, 17, 17, .1); }
.composer textarea {
    display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent;
    font-size: 16px; line-height: 1.6; min-height: 52px; max-height: 220px; padding: 0;
}
.composer textarea::placeholder, .composer input::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.composer-hint { font-size: 12px; color: var(--faint); }
.send {
    flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0;
    display: grid; place-items: center;
    background: var(--ink); color: #fff; transition: background .15s, opacity .15s;
}
.send:hover:not(:disabled) { background: #2b2b2b; }
.send:disabled { opacity: .3; cursor: default; }
.send svg { width: 16px; height: 16px; }
.composer.mini { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 20px; border-radius: 999px; }
.composer.mini input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }

/* ── home ── */
.hero {
    position: relative;
    max-width: 760px; margin: 0 auto;
    padding: 96px 24px 72px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.glow {
    position: absolute; z-index: -1; left: 50%; top: 40px; width: 1100px; height: 520px; transform: translateX(-50%);
    background:
        radial-gradient(closest-side at 30% 55%, rgba(3, 199, 90, .20), transparent),
        radial-gradient(closest-side at 68% 45%, rgba(255, 196, 61, .20), transparent),
        radial-gradient(closest-side at 50% 80%, rgba(56, 132, 255, .12), transparent);
    filter: blur(24px); pointer-events: none;
}
.eyebrow {
    display: inline-block; padding: 6px 12px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line);
    font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.hero h1 { margin-top: 22px; font-size: clamp(36px, 6vw, 60px); line-height: 1.16; font-weight: 700; letter-spacing: -0.04em; word-break: keep-all; }
.lead { margin-top: 18px; font-size: 18px; line-height: 1.65; color: var(--sub); word-break: keep-all; }
.hero .slot { width: 100%; margin-top: 36px; text-align: left; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.chips button {
    word-break: keep-all; text-wrap: balance;
    border: 1px solid var(--line); background: rgba(255, 255, 255, .7); border-radius: 999px;
    padding: 8px 14px; font-size: 13.5px; color: var(--ink-2); transition: border-color .15s, background .15s;
}
.chips button:hover { border-color: #cfccc8; background: #fff; }
.hero .link { margin-top: 22px; }

.band { max-width: 1080px; margin: 0 auto; padding: 72px 24px; }
.band h2 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 700; letter-spacing: -0.035em; text-align: center; }
.band-lead { margin-top: 12px; text-align: center; color: var(--sub); font-size: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.step-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; }
.step-card .num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; }
.step-card h3 { margin-top: 18px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.step-card p { margin-top: 8px; color: var(--sub); font-size: 15px; line-height: 1.65; word-break: keep-all; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 28px; }
.tags span { padding: 7px 13px; border-radius: 999px; background: var(--line-2); font-size: 13.5px; color: var(--ink-2); }
.foot { max-width: 1080px; margin: 0 auto; padding: 28px 24px 48px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--faint); }

/* ── design thumbnails (home gallery + settings) ── */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.design-grid.wide { grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 40px; }
.design-card {
    display: block; text-align: left; padding: 0; overflow: hidden;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.design-card:hover { border-color: #cfccc8; transform: translateY(-2px); box-shadow: var(--shadow); }
.design-card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.design-card .thumb { height: 132px; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line-2); pointer-events: none; }
.design-card .thumb > div { width: 200%; padding: 18px 22px 0; transform: scale(.5); transform-origin: 0 0; }
.design-grid.wide .thumb { height: 170px; }
.design-grid.wide .thumb > div { width: 172.4%; transform: scale(.58); }
.design-card .meta { display: flex; align-items: center; gap: 7px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; }
.design-card .meta i { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ── workspace ── */
.app {
    flex: 1; min-height: 0;
    display: grid; grid-template-columns: 400px minmax(0, 1fr);
}
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-right: 1px solid var(--line); }
.messages { flex: 1; overflow-y: auto; padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--line-2); padding: 10px 15px; border-radius: 18px 18px 4px 18px; }
.msg.assistant { align-self: flex-start; padding: 2px 2px; color: var(--ink-2); }
.msg.typing { color: var(--faint); }
.msg.typing::after { content: ''; display: inline-block; width: 14px; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }
.topics { display: flex; flex-direction: column; gap: 8px; }
.topics-label { font-size: 12px; font-weight: 600; color: var(--faint); margin-bottom: -2px; }
.topic-card {
    text-align: left; padding: 13px 15px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line); transition: border-color .15s, background .15s;
}
.topic-card:hover { border-color: #cfccc8; }
.topic-card strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.topic-card span { display: block; margin-top: 4px; font-size: 13px; color: var(--sub); line-height: 1.55; }
.topic-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.chat .slot { padding: 10px 16px 16px; }
.chat .composer { display: flex; align-items: flex-end; gap: 8px; border-radius: 22px; box-shadow: none; padding: 8px 8px 8px 16px; }
.chat .composer textarea { flex: 1; min-height: 26px; font-size: 15px; margin: 5px 0; }
.chat .composer-hint { display: none; }
.chat .composer-row { margin-top: 0; }

.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.work-head { flex: none; display: flex; justify-content: center; padding: 14px 20px 0; }
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--line-2); border-radius: 999px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--sub); white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(17, 17, 17, .1); }
.seg.tabs button { padding: 8px 22px; font-size: 14px; }

/* settings */
.pane { flex: 1; overflow-y: auto; padding: 24px 32px 28px; width: 100%; max-width: 860px; margin: 0 auto; }
.field + .field { margin-top: 34px; }
.label { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.label .no { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.hint { margin-top: 8px; font-size: 13px; color: var(--faint); }
.input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; background: var(--card); font-size: 15px; outline: 0; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, .06); }
.input.lg { padding: 14px 16px; font-size: 17px; font-weight: 600; }
.input.lg::placeholder { font-weight: 400; color: var(--faint); }
textarea.input { resize: vertical; line-height: 1.6; margin-top: 10px; }

.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.option {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 12px 14px 12px 40px; border-radius: 12px;
    background: var(--card); border: 1px solid var(--line); transition: border-color .15s, background .15s;
}
.option::before { content: ''; position: absolute; left: 14px; top: 14px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #cfccc8; background: #fff; }
.option:hover { border-color: #cfccc8; }
.option.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.option.selected::before { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3px #fff; }
.option strong { display: block; font-size: 14.5px; font-weight: 600; }
.option span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--sub); line-height: 1.5; word-break: keep-all; }
.option .badge { position: absolute; top: 10px; right: 10px; margin: 0; font-size: 11px; font-weight: 700; color: #067a3a; background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }

.tune { margin-top: 12px; }
.tune summary { display: inline-block; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--sub); list-style: none; padding: 4px 0; }
.tune summary::-webkit-details-marker { display: none; }
.tune summary::after { content: ' ＋'; }
.tune[open] summary::after { content: ' －'; }
.knobs { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 10px; align-items: center; }
.knobs label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--sub); white-space: nowrap; }
.knobs select, .pick select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--card); color: var(--ink); font-size: 13px; }
.knobs input[type="color"] { width: 32px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.knobs .check { cursor: pointer; }
.design-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 4px; max-height: 280px; overflow: hidden; background: #fff; }

.rows { display: flex; flex-direction: column; gap: 10px; }
.row-opt { display: flex; align-items: center; gap: 14px; }
.row-opt > span { width: 48px; flex: none; font-size: 14px; color: var(--sub); }

.actionbar {
    flex: none; display: flex; align-items: center; gap: 16px;
    padding: 14px 32px; border-top: 1px solid var(--line); background: rgba(250, 250, 249, .9); backdrop-filter: blur(8px);
}
.summary { flex: 1; min-width: 0; font-size: 13.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary b { color: var(--ink); font-weight: 600; }

/* result */
#result { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar { flex: none; padding: 14px 32px 12px; border-bottom: 1px solid var(--line); }
.title-row, .tool-row { display: flex; align-items: center; gap: 8px; }
.tool-row { margin-top: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.title-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 21px; font-weight: 700; letter-spacing: -0.03em; padding: 4px 0; border-bottom: 1px solid transparent; }
.title-input:focus { border-bottom-color: var(--line); }
.pick { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--sub); }
.notice { flex: none; margin: 12px 32px 0; background: #fff8e6; border: 1px solid #f5e1a4; border-radius: 12px; padding: 10px 14px; font-size: 14px; color: #6b5310; }
.canvas { flex: 1; overflow-y: auto; padding: 28px 24px 24px; }
.paper { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 44px 40px; }
.preview { transition: opacity .2s; }
.preview.busy { opacity: .4; }
.imagebox { max-width: 760px; margin: 20px auto 0; }
.imagebox h3 { font-size: 15px; font-weight: 700; }
.image-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.image-list a { display: block; width: 112px; font-size: 12px; text-align: center; color: var(--sub); text-decoration: none; }
.image-list a:hover { color: var(--ink); }
.image-list img { width: 112px; height: 112px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; margin-bottom: 5px; }
#reviseForm { flex: none; width: auto; max-width: 760px; margin: 0 auto 18px; align-self: stretch; }
#result > #reviseForm { margin-left: 24px; margin-right: 24px; }
@media (min-width: 1300px) { #result > #reviseForm { margin-left: auto; margin-right: auto; width: 760px; } }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px 20px; color: var(--faint); text-align: center; }
.empty svg { width: 44px; height: 44px; margin-bottom: 8px; }
.empty p { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.empty span { font-size: 14px; }

.progress { flex: 1; overflow: hidden; padding: 30px 24px; display: flex; flex-direction: column; align-items: center; }
.psteps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.psteps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--faint); }
.psteps li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #d6d3d1; }
.psteps li + li::before { margin-left: 14px; }
.psteps li.done { color: var(--ink-2); }
.psteps li.done::before { background: var(--accent); }
.psteps li.now { color: var(--ink); font-weight: 700; }
.psteps li.now::before { background: var(--accent); box-shadow: 0 0 0 4px rgba(3, 199, 90, .2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(3, 199, 90, .08); } }
.ptext { margin: 14px 0 24px; font-size: 15px; color: var(--sub); }
.skeleton { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.skeleton i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #f1f0ee 25%, #e7e5e4 37%, #f1f0ee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skeleton i.h { height: 20px; }
.skeleton i.gap { height: 0; margin: 8px 0; background: none; }
.skeleton .w30 { width: 30%; } .skeleton .w40 { width: 40%; } .skeleton .w50 { width: 50%; } .skeleton .w70 { width: 70%; } .skeleton .w80 { width: 80%; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; z-index: 40; max-width: 90vw; text-align: center; box-shadow: 0 8px 28px rgba(17, 17, 17, .25); }

.mobile-tabs { display: none; }

/* ── small screens ── */
@media (max-width: 900px) {
    .nav { padding: 0 16px; gap: 14px; }
    .nav-links { display: none; }
    .hero { padding: 56px 18px 48px; }
    .lead { font-size: 16px; }
    .lead br { display: none; }
    .composer-hint { display: none; }
    .composer-row { justify-content: flex-end; }
    .band { padding: 52px 18px; }
    .steps { grid-template-columns: 1fr; }
    .design-grid.wide { grid-template-columns: repeat(2, 1fr); }

    .app { grid-template-columns: 1fr; position: relative; padding-bottom: 52px; }
    .app[data-view="chat"] .work, .app[data-view="work"] .chat { display: none; }
    .chat { border-right: 0; }
    .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; position: absolute; left: 0; right: 0; bottom: 0; height: 52px; background: var(--card); border-top: 1px solid var(--line); }
    .mobile-tabs button { border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--faint); }
    .mobile-tabs button.active { color: var(--ink); box-shadow: inset 0 2px 0 var(--ink); }
    .pane { padding: 20px 16px; }
    .actionbar { padding: 12px 16px; }
    .summary { display: none; }
    .actionbar .btn { flex: 1; }
    .toolbar { padding: 12px 16px; }
    .title-input { font-size: 18px; }
    .tool-row .grow { display: none; }
    .tool-row .pick { width: 100%; }
    .tool-row .pick select { flex: 1; }
    .tool-row .btn { flex: 1; padding: 0 8px; }
    .canvas { padding: 16px 12px; }
    .paper { padding: 28px 18px; border-radius: 14px; }
    .notice { margin: 12px 16px 0; }
    #result > #reviseForm { margin-left: 12px; margin-right: 12px; margin-bottom: 12px; }
    .toast { bottom: 70px; }
}
