:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.center { text-align: center; }
.empty { color: var(--muted); padding: 14px 0; font-size: 14px; }

/* ----- header ----- */
.hd { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hd-in { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.logo { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.logo:hover { text-decoration: none; }
.gnb { display: flex; gap: 6px; }
.gnb a { padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 15px; }
.gnb a:hover, .gnb a.on { background: #eff6ff; color: var(--primary); text-decoration: none; }
.hd-search { display: flex; flex: 1; min-width: 180px; max-width: 360px; }
.hd-search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; padding: 8px 12px; font-size: 14px; }
.hd-search button { border: 0; background: var(--primary); color: #fff; padding: 0 14px; border-radius: 0 8px 8px 0; font-weight: 600; cursor: pointer; }
.acct { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 14px; }
.acct form { margin: 0; }
.acct .adm { color: var(--accent); font-weight: 700; }
button.lnk { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }

/* ----- buttons / forms ----- */
.btn, .btn-sm { display: inline-block; background: var(--primary); color: #fff; border: 1px solid var(--primary); padding: 9px 18px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover, .btn-sm:hover { background: var(--primary-dark); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--text); border-color: #d1d5db; }
.btn.ghost:hover { background: #f3f4f6; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.wide { width: 100%; margin-top: 16px; padding: 12px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 8px 0; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=url], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, .ed-wys:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 8px; }
.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 10px 14px; border-radius: 8px; }

/* ----- home ----- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; padding-bottom: 8px; }
.ad-col { display: none; }
@media (min-width: 1240px) {
  .home-grid { grid-template-columns: 170px minmax(0, 1fr) 170px; }
  .ad-col { display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 76px; }
}
.home-main { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.box-hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.box-hd .sub { color: var(--muted); font-size: 13px; }
.live { display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 4px; margin-right: 4px; vertical-align: 2px; }
.tabs { display: flex; gap: 4px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.tabpane { display: none; }
.tabpane.on { display: block; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: 15px; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .no { width: 22px; text-align: center; font-weight: 800; color: var(--primary); }
.rank-list li:nth-child(n+4) .no { color: var(--muted); font-weight: 600; }
.rank-list a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: 13px; }
.tag.lv1 { background: #eff6ff; color: #1d4ed8; }
.tag.lv2 { background: #dbeafe; color: #1d4ed8; font-size: 15px; font-weight: 600; }
.tag.lv3 { background: var(--primary); color: #fff; font-size: 16px; font-weight: 700; }
.tag:hover { text-decoration: none; filter: brightness(0.95); }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.prod { display: flex; flex-direction: column; gap: 4px; color: inherit; }
.prod:hover { text-decoration: none; }
.prod:hover .pname { color: var(--primary); }
.thumb { aspect-ratio: 1; background: #f3f4f6; border-radius: 8px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mall { font-size: 12px; color: var(--muted); }
.mall b { color: var(--accent); }
.pname { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.price { font-weight: 700; }
.post-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f3f4f6; flex-wrap: wrap; }
.post-list li:last-child { border-bottom: 0; }
.post-list a { flex: 1; min-width: 160px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-list .bd { font-size: 12px; background: #fff7ed; color: #c2410c; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.post-list .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.updated { color: var(--muted); font-size: 12px; text-align: right; margin: 0 0 16px; }

/* ----- ads ----- */
.ad-slot { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: hidden; text-align: center; max-width: 100%; }
.ad-slot img { display: block; margin: 0 auto; }
.ad-tag { position: absolute; top: 0; left: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 10px; padding: 0 5px; border-bottom-right-radius: 6px; z-index: 1; }
.ad-bottom { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding-top: 4px; padding-bottom: 24px; }
.ad-bottom .ad-slot { flex: 1 1 280px; max-width: 420px; }

/* ----- pages ----- */
.page { padding-top: 24px; padding-bottom: 40px; }
.narrow { max-width: 860px; }
.page-hd { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.page-hd h1 { margin-bottom: 2px; }
.inline-search { display: flex; gap: 6px; margin-bottom: 12px; max-width: 360px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 10px; border-bottom: 1px solid #f3f4f6; text-align: left; }
.tbl thead th { background: #f9fafb; color: var(--muted); font-size: 13px; }
.c-no, .c-vw { width: 64px; text-align: center !important; color: var(--muted); }
.c-au { width: 120px; } .c-dt { width: 100px; color: var(--muted); }
.c-ti a { font-weight: 600; }
.tags-inline { color: var(--primary); font-size: 12px; margin-left: 8px; }
.ico { margin-left: 6px; font-size: 12px; color: var(--muted); }
.pager { display: flex; gap: 4px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a { min-width: 34px; text-align: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager a.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.crumb { margin: 0 0 6px; color: var(--primary); font-weight: 600; font-size: 14px; }
.post { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.post h1 { font-size: 26px; }
.post-meta { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin: 0 0 18px; }
.post-body { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.post-body img { max-width: 100%; height: auto; border-radius: 6px; }
.post-body blockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid #d1d5db; color: #4b5563; }
.post-body pre { background: #f3f4f6; padding: 12px; border-radius: 8px; overflow: auto; }
.post-body table { border-collapse: collapse; } .post-body td, .post-body th { border: 1px solid var(--line); padding: 6px 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 20px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.tag-row { margin: 18px 0 0; display: flex; gap: 6px; flex-wrap: wrap; }
.post-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.post-actions form { margin: 0; }
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; line-height: 1.8; }
.doc h2 { margin: 22px 0 6px; font-size: 18px; } .doc h2:first-child { margin-top: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-top: 18px; }
.card h2 { margin-bottom: 4px; }
.card .btn { margin-top: 14px; }
.danger-zone { border-color: #fecaca; }
.auth { max-width: 420px; padding-top: 40px; padding-bottom: 40px; }
.auth form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 24px 24px; margin-bottom: 16px; }
.agree { margin-top: 12px; }
.related { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ----- editor ----- */
#editor { border: 1px solid #d1d5db; border-radius: 8px; background: #fff; overflow: hidden; }
.ed-bar { display: flex; gap: 4px; padding: 6px; background: #f9fafb; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.ed-bar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.ed-bar button:disabled { opacity: .4; cursor: not-allowed; }
.ed-bar .mode.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.ed-bar .spacer { flex: 1; }
.ed-wys { min-height: 280px; padding: 14px; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.ed-wys img { max-width: 100%; height: auto; }
.ed-src { min-height: 280px; border: 0; border-radius: 0; font-family: Consolas, "Courier New", monospace; font-size: 13px; display: block; resize: vertical; }
.ed-src[hidden], .ed-wys[hidden] { display: none; }
.img-box { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 12px; background: #fff; }
.img-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.img-list li { display: flex; flex-direction: column; gap: 4px; }
.img-list img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.img-list button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px; cursor: pointer; font-size: 12px; }

/* ----- footer (k-esco 형태: TOP / 상호·회사정보 / 정책링크·저작권 / SNS / 관리자) ----- */
.ft { background: #1f2937; color: #9ca3af; margin-top: 40px; padding: 28px 0 40px; font-size: 13px; }
.ft-top { text-align: right; } .ft-top a { color: #d1d5db; font-weight: 700; }
.ft-brand { color: #fff; font-size: 20px; font-weight: 800; margin: 6px 0 12px; }
.ft-info { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 8px; }
.ft-info span { color: #d1d5db; margin-right: 4px; font-weight: 600; }
.ft-notice { margin: 6px 0; }
.ft-links { display: flex; gap: 16px; margin: 14px 0 6px; } .ft-links a { color: #e5e7eb; }
.ft-copy { margin: 4px 0 12px; }
.ft-sns { display: flex; gap: 12px; margin-bottom: 12px; } .ft-sns a { color: #d1d5db; border: 1px solid #4b5563; border-radius: 999px; padding: 3px 12px; }
.ft-disclosure { margin: 8px 0; padding-top: 10px; border-top: 1px solid #374151; font-size: 12px; }
.ft-admin { color: #6b7280; font-size: 12px; }

@media (max-width: 720px) {
  .hd-in { gap: 10px; } .gnb { order: 3; width: 100%; overflow-x: auto; } .hd-search { order: 4; max-width: none; width: 100%; flex-basis: 100%; }
  .c-au, .c-dt { display: none; } .post { padding: 18px; } .doc { padding: 18px; }
}
