:root {
  --bg: #f3efe9; --panel: #fffdf9; --ink: #2b2724; --muted: #8a8178; --line: #e4ddd3;
  --accent: #6f5136; --accent-ink: #fff; --chip: #efe9e0; --danger: #b3261e;
  --radius: 14px;
}
* { box-sizing: border-box }
html { scroll-behavior: smooth }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased }
a { color: inherit }
h1 { font-size: 22px; margin: 0; letter-spacing: -.3px }
code { font-family: ui-monospace, Menlo, monospace }

/* ---------- 상단 바 ---------- */
.top { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 24px; padding: 0 24px; background: rgba(255, 253, 249, .94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line) }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; width: 196px }
.logo img { height: 30px; width: auto; display: block }
.logo span { font-size: 21px; font-weight: 800; letter-spacing: -.4px; color: var(--ink) }
.search { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 8px; background: var(--chip); border: 1px solid transparent; border-radius: 999px; padding: 0 16px; height: 42px; color: var(--muted); transition: .15s }
.search:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111, 81, 54, .12) }
.search input { flex: 1; min-width: 0; border: none; background: none; font: inherit; font-size: 15px; color: var(--ink); outline: none; height: 100% }
.search input::-webkit-search-cancel-button { cursor: pointer }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none }
.mylink { text-decoration: none; font-weight: 600; font-size: 15px; color: var(--muted); padding: 6px 2px }
.mylink:hover, .mylink.on { color: var(--ink) }
.top-av { display: flex }

/* ---------- 왼쪽 사이드바 + 본문 ---------- */
.layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); align-items: start }
.sidenav { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 18px 14px 30px 20px; border-right: 1px solid var(--line) }
.side-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 15px; color: var(--ink) }
.side-link:hover { background: var(--chip) }
.side-link.on { background: var(--ink); color: #fff }
.side-sec { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line) }
.side-title { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; font-size: 13px; font-weight: 700; color: var(--muted) }
.side-title .link { font-size: 12px; padding: 0 }
.side-hint { font-size: 11.5px; color: var(--muted); margin: 4px 4px 10px }
.cfs { display: grid; gap: 2px }
.cf { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; user-select: none }
.cf:hover { background: var(--chip) }
.cf input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); flex: none }
.cf i { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, .14) }
.cf:has(input:checked) { background: var(--chip); font-weight: 600 }
#view { min-width: 0 }

@media (max-width: 900px) {
  .top { gap: 12px; padding: 0 14px }
  .logo { width: auto }
  .logo span { display: none }
  .layout { grid-template-columns: 1fr }
  .sidenav { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 12px; align-items: center; overflow-x: auto }
  .side-link { flex: none; padding: 8px 12px; font-size: 14px }
  .side-sec { margin: 0; padding: 0; border: none; display: flex; align-items: center; gap: 6px }
  .side-title, .side-hint { display: none }
  .cfs { display: flex; gap: 6px }
  .cf { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px 5px 6px; font-size: 13px; white-space: nowrap }
  .cf input { display: none }
  .cf:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink) }
}

/* ---------- 공통 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px }
.card h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .2px }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 12px; cursor: pointer; font: inherit; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px }
.btn:hover:not(:disabled) { border-color: var(--accent) }
.btn:disabled { opacity: .5; cursor: default }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.small { padding: 6px 12px; font-size: 13px }
.btn.google { background: #fff; border-color: #dadce0; padding: 11px 18px; font-weight: 600; font-size: 15px; width: 100% }
.link { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px }
.link.danger { color: var(--danger) }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 8px 0 0 }
.av { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; vertical-align: middle; background: var(--chip) }
.av-txt { display: inline-flex; align-items: center; justify-content: center; background: #d9cbb8; color: #5b4630; font-weight: 700 }
.setup { background: #fff7e6; border: 1px solid #f0dcb0; color: #6b5316; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px; line-height: 1.6 }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #2b2724; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px) }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto }
#toast a { color: #f3d9a8 }

.modal-bg { position: fixed; inset: 0; background: rgba(30, 24, 20, .45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px }
.modal { background: var(--panel); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25) }
.modal h2 { margin: 0 0 14px; font-size: 18px; color: var(--ink) }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px }
.field { display: grid; gap: 6px; margin: 14px 0 10px; font-size: 13px; color: var(--muted) }
.field input { font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff }
.field input.err { border-color: var(--danger) }
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer }
.switch input { width: 16px; height: 16px; accent-color: var(--accent) }
.save-prev { display: flex; gap: 14px; align-items: center }
.save-prev canvas { width: 120px; height: 120px; border-radius: 10px; flex: none }
.save-cols { display: grid; gap: 5px }

/* ---------- 로그인 안내 ---------- */
.gate { min-height: calc(100vh - 140px); display: flex; align-items: center; justify-content: center; padding: 24px 16px }
.gate-card { max-width: 380px; width: 100%; text-align: center; padding: 30px 26px; display: flex; flex-direction: column; align-items: center; gap: 6px }
.gate-card h2 { font-size: 20px; color: var(--ink); margin: 4px 0 }
.gate-card p { color: var(--muted); line-height: 1.6; margin: 0 0 14px }
.gate-logo { height: 48px; width: auto; margin-bottom: 4px }

/* ---------- 페이지 / 그리드 ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 26px 32px 60px }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap }
.tabs { display: flex; gap: 4px; background: var(--chip); padding: 4px; border-radius: 10px }
.tabs button, .tabs a { border: none; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 7px 14px; border-radius: 7px; cursor: pointer; text-decoration: none }
.tabs .on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08) }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 22px }
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px } .page { padding: 20px 16px 50px } }
.more { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px }
.more a { color: var(--accent) }

.pcard { display: block; min-width: 0 }
.thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--chip); box-shadow: 0 1px 2px rgba(0, 0, 0, .06) }
.thumb img, .nothumb { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s }
.pcard:hover .thumb img { transform: scale(1.03) }
.ov { position: absolute; inset: 0; background: rgba(0, 0, 0, .58); display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 18px 22%; opacity: 0; transition: opacity .18s }
.ov.two { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 8px 12px; padding: 16px 10% }
.pcard:hover .ov, .pcard:focus-visible .ov { opacity: 1 }
.ovrow { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 13px; min-width: 0 }
.ovrow i { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1.5px solid rgba(255, 255, 255, .75) }
.ovrow.dark { color: var(--ink) }
.ovrow.dark i { border-color: rgba(0, 0, 0, .15) }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 20px }
.meta { padding: 10px 2px 0 }
.meta-top { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.pname { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; min-width: 0 }
.pname:hover { text-decoration: underline; text-underline-offset: 3px }
.sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 5px; color: var(--muted); font-size: 12px }
.sub .by { display: flex; align-items: center; gap: 6px; min-width: 0 }
.sub .by span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

/* 좋아요 하트 */
.heart { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; transition: .15s }
.heart b { font-weight: 600; font-variant-numeric: tabular-nums }
.heart:hover:not(:disabled) { border-color: #e7a3a3; color: #d7263d }
.heart.on { color: #d7263d; border-color: #f1c0c0; background: #fff5f5 }
.heart.own { cursor: default; border-color: transparent; background: none; padding-right: 0 }
.heart.big { padding: 11px; font-size: 15px; justify-content: center; border-radius: 9px }
.d-likes { text-align: center; color: var(--muted); padding: 8px; font-size: 14px }

/* 적용된 필터 칩 */
.ph-left { min-width: 0 }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px }
.fchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px 4px 6px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink) }
.fchip i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .14) }
.fchip span { color: var(--muted); margin-left: 2px }
.fchip:hover { border-color: var(--ink) }
@media (max-width: 760px) { .ov { padding: 12px 14% } .ov.two { padding: 10px 6% } .ovrow { font-size: 11px; gap: 6px } .ovrow i { width: 14px; height: 14px } }

/* ---------- 상세보기 ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; padding: 18px 20px 40px; max-width: 1480px; margin: 0 auto; align-items: start }
@media (max-width: 1150px) { .detail { grid-template-columns: 1fr; padding: 12px 16px 40px } }
.d-side { padding: 20px }
.d-name { font-size: 24px; word-break: break-word }
.d-by { display: flex; align-items: center; gap: 10px; margin: 14px 0 18px }
.d-by b { display: block; font-size: 14px }
.d-by small { color: var(--muted); font-size: 12px }
.d-colors { display: grid; gap: 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0 }
.d-color { display: flex; align-items: center; gap: 10px }
.d-color i { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); flex: none }
.d-color code { font-size: 14px }
.d-color .th { margin-left: auto; color: var(--muted); font-size: 12px }
.tag { font-size: 11px; background: var(--chip); color: var(--muted); padding: 2px 7px; border-radius: 20px }
.d-actions { display: grid; gap: 8px; margin-top: 18px }
.d-actions .btn { padding: 11px }
.save-btn span { color: var(--muted); font-size: 13px }
.save-btn.on { border-color: #e7a3a3; color: #b3261e; background: #fff5f5 }
.d-owner { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line) }

/* ---------- 마이페이지 ---------- */
.me-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px }
.me-head > div { flex: 1; min-width: 0 }
.me-head .note { margin: 4px 0 0 }

/* ---------- 시뮬레이터 ---------- */
.sim { display: grid; grid-template-columns: 300px minmax(0, 1fr) 260px; gap: 16px; padding: 18px 20px 32px; align-items: start; max-width: 1480px; margin: 0 auto }
@media (max-width: 1380px) { .sim { grid-template-columns: 300px minmax(0, 1fr) } .sim > .side { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start } }
@media (max-width: 1100px) { .sim { grid-template-columns: 1fr; padding: 12px 16px 28px } }
.side { display: grid; gap: 16px }
.yarn { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; display: grid; grid-template-columns: 38px 1fr auto; gap: 4px 10px; align-items: center }
.yarn input[type=color] { width: 38px; height: 38px; border: none; padding: 0; background: none; cursor: pointer; grid-row: span 3; border-radius: 8px }
.yarn input[type=color]::-webkit-color-swatch-wrapper { padding: 0 }
.yarn input[type=color]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .15); border-radius: 8px }
.yarn .hex { font-family: ui-monospace, Menlo, monospace; font-size: 12px; width: 78px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; background: #fff; color: var(--ink) }
.yarn .top { display: flex; gap: 8px; align-items: center }
.yarn label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px }
.yarn .rm { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; grid-row: 1; grid-column: 3; line-height: 1 }
.row { display: flex; align-items: center; gap: 8px; grid-column: 2/4 }
.row span.lab { font-size: 12px; color: var(--muted); width: 42px; flex: none }
.row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent) }
.row output { font-size: 12px; width: 30px; text-align: right; font-variant-numeric: tabular-nums }
.addrow { display: flex; gap: 6px; margin-top: 4px }
.addrow .btn { flex: 1 }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px }
.presets .btn { justify-content: flex-start; text-align: left; font-size: 12px; padding: 8px }
.presets .dots { display: flex; flex: none }
.presets .dots i { width: 10px; height: 10px; border-radius: 50%; margin-right: -3px; border: 1px solid rgba(255, 255, 255, .7) }
.ctl { margin: 10px 0 }
.ctl .head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px }
.ctl input { width: 100%; accent-color: var(--accent) }
.stage { position: relative; border-radius: var(--radius); overflow: hidden; background: #e6e2da; border: 1px solid var(--line) }
.stage canvas { display: block; width: 100% }
.busy { position: absolute; right: 10px; top: 10px; font-size: 11px; background: rgba(0, 0, 0, .45); color: #fff; padding: 3px 8px; border-radius: 20px; opacity: 0; transition: opacity .2s }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap }
.far { width: 100%; border-radius: 9px; display: block; background: #e6e2da }
.chips { display: flex; gap: 10px; margin-top: 10px }
.chip { flex: 1; text-align: center; font-size: 11px; color: var(--muted) }
.chip div { height: 46px; border-radius: 9px; border: 1px solid rgba(0, 0, 0, .08); margin-bottom: 4px }
.chip code { display: block; color: var(--ink); font-size: 11px }
.bar { display: flex; align-items: center; gap: 6px; margin: 5px 0; font-size: 12px }
.bar i { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0, 0, 0, .1) }
.bar .track { flex: 1; height: 7px; background: var(--chip); border-radius: 4px; overflow: hidden }
.bar .fill { height: 100% }
.bar span { width: 38px; text-align: right; font-variant-numeric: tabular-nums }

/* ---------- 사이드바 숨김 (마이페이지·첫 프로필 설정) ---------- */
body.no-side .layout { grid-template-columns: minmax(0, 1fr) }
body.no-side .sidenav { display: none }
.main-col { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - 64px) }
.main-col > main { flex: 1 }

/* ---------- 하단 ---------- */
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding: 26px 16px 32px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line) }
.foot a { color: var(--muted); text-decoration: none }
.foot a:hover { color: var(--ink); text-decoration: underline }
.foot b { font-weight: 700 }

/* ---------- 기본 프사(로고) ---------- */
.av-logo { background: #fff6dc; border: 1px solid #f1e2b4; object-fit: contain; box-sizing: border-box }

/* ---------- 마이페이지 ---------- */
.me-actions { display: flex; gap: 8px; flex-wrap: wrap }
@media (max-width: 560px) { .me-head { flex-wrap: wrap } .me-actions { width: 100% } }

/* ---------- 프로필 폼 ---------- */
.onb { max-width: 420px; width: 100%; padding: 30px 26px 20px; text-align: center }
.onb h2 { margin: 6px 0 4px; font-size: 21px; color: var(--ink) }
.onb form { text-align: left }
.pf-avatar { display: flex; align-items: center; gap: 16px; margin-bottom: 6px }
.pf-preview { flex: none; width: 88px; height: 88px }
.pf-preview .av { width: 88px; height: 88px }
.pf-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px }
.pf-btns { display: flex; flex-wrap: wrap; gap: 6px }
.pf-btns .btn { cursor: pointer }
.pf-btns .btn.on { border-color: var(--ink); background: var(--chip); font-weight: 600 }
.nick-msg { font-size: 12.5px; min-height: 18px; margin: -4px 2px 8px; color: var(--muted) }
.nick-msg.good { color: #2e7d32 }
.nick-msg.good::before { content: '✓ ' }
.nick-msg.bad { color: var(--danger) }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; margin: 10px 0 4px; cursor: pointer }
.agree input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none }
.agree a { color: var(--accent) }
.btn.wide { width: 100%; padding: 12px; font-size: 15px }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff }
.danger-zone { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted) }
.warn { background: #fdf1f0; border: 1px solid #f3cfcb; color: #7a2a22; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; line-height: 1.6; margin: 0 0 6px }
.field textarea { font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; color: var(--ink) }
.radios { display: grid; gap: 4px }
.radio { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 14px }
.radio:has(input:checked) { border-color: var(--ink); background: var(--chip) }
.radio input { accent-color: var(--ink) }
.d-report { text-align: right; margin-top: 10px }
.d-report .link { font-size: 12px }

/* ---------- 약관·개인정보처리방침 ---------- */
.doc-page .top { position: static }
.doc { max-width: 760px; margin: 0 auto; padding: 36px 24px 70px; line-height: 1.75; font-size: 15px }
.doc h1 { font-size: 28px; margin-bottom: 4px }
.doc h2 { font-size: 17px; margin: 32px 0 8px }
.doc-date { color: var(--muted); margin-top: 0 }
.doc ul { padding-left: 20px }
.doc li { margin: 4px 0 }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; background: var(--panel) }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top }
.doc th { background: var(--chip); font-weight: 600 }
.doc a { color: var(--accent) }
.doc-back { margin-top: 40px }
@media (max-width: 560px) { .doc table { font-size: 12.5px } .doc th, .doc td { padding: 6px } }
