:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #1f2133;
  --muted: #646882;
  --line: #e4e5ef;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --danger: #c2410c;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 50, .05), 0 6px 24px rgba(20, 20, 50, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131c;
    --surface: #1b1d29;
    --text: #e8e9f3;
    --muted: #a0a3ba;
    --line: #2d3042;
    --brand: #818cf8;
    --brand-ink: #10111a;
    --brand-soft: #262a45;
    --danger: #fb923c;
    --ok: #4ade80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  word-break: keep-all;
}
a { color: var(--brand); }
img, svg, canvas { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.site-nav a:hover { background: var(--brand-soft); color: var(--text); }
.site-nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; font-size: 20px; width: 42px; height: 38px; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .site-nav.open { display: flex; }
}

/* Hero */
.hero { padding: 36px 0 12px; text-align: center; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.25; margin: 0 0 10px; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 620px; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.badge { background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin: 20px 0; align-items: start; }
@media (max-width: 860px) { .tool { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2, .card h3 { margin-top: 0; }
.preview-card { position: sticky; top: 76px; text-align: center; }

.preview-box { display: flex; align-items: center; justify-content: center; min-height: 260px; background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 50% / 16px 16px; border-radius: 10px; padding: 14px; overflow: hidden; }
.preview-box canvas, .preview-box svg { max-width: 100%; height: auto !important; display: block; }
@media (max-width: 860px) {
  .preview-card { position: static; order: -1; padding: 14px; }
  .preview-box { min-height: 0; }
  .preview-card .preview-box canvas { max-width: 180px; }
  .preview-card .preview-box { padding: 8px; }
}
/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* Forms */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field small { display: block; margin-top: 4px; color: var(--muted); }
input[type=text], input[type=url], input[type=email], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[type=color] { width: 100%; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
details.options { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
details.options summary { cursor: pointer; font-weight: 800; margin-bottom: 12px; }

/* Buttons */
.btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }

.msg { font-size: 14px; margin-top: 10px; min-height: 1.4em; }
.msg.warn { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* Ads */
.ad { margin: 20px auto; text-align: center; min-height: 90px; }
.ad-placeholder { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px; }

/* Content */
.content { max-width: 760px; margin: 28px auto; }
.content h2 { font-size: 23px; margin: 36px 0 12px; letter-spacing: -.01em; }
.content h3 { font-size: 18px; margin: 24px 0 8px; }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--brand-soft); }
.table-scroll { overflow-x: auto; }
.tip { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 8px; margin: 16px 0; }
.faq details { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 10px 0 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.link-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); }
.link-card:hover { border-color: var(--brand); }
.link-card strong { display: block; margin-bottom: 4px; }
.link-card span { color: var(--muted); font-size: 14px; }

.article-meta { color: var(--muted); font-size: 14px; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-top: 20px; }
.breadcrumb a { color: var(--muted); }

/* Bulk */
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.bulk-grid figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; }
.bulk-grid img { width: 100%; height: auto; display: block; }
.bulk-grid figcaption { font-size: 11px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress { width: 100%; height: 10px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 48px; padding: 28px 0; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-nav a { color: var(--muted); }
.copy { width: 100%; }

/* Bulk groups */
.bk-group { --gc: var(--brand); border: 1px solid var(--line); border-left: 5px solid var(--gc); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bg); }
.bk-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bk-group-no { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gc); color: #fff; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.bk-group-head .bk-title { flex: 1; font-weight: 700; background: var(--surface); }
.bk-group .bk-values { background: var(--surface); min-height: 110px; }
.bk-del { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 15px; }
.bk-del:hover { color: var(--danger); border-color: var(--danger); }
.bk-count { display: block; text-align: right; margin-top: 4px; color: var(--muted); font-weight: 700; }
#bk-add-group { margin-bottom: 6px; }

.bk-rgroup { --gc: var(--brand); border: 2px solid var(--gc); border-radius: 14px; padding: 0 14px 14px; margin-top: 18px; }
.bk-rgroup h3 { margin: 0 -14px 0; padding: 10px 14px; background: var(--gc); color: #fff; border-radius: 11px 11px 0 0; font-size: 17px; display: flex; justify-content: space-between; align-items: center; }
.bk-rgroup h3 span { font-size: 13px; font-weight: 700; background: rgba(255,255,255,.22); border-radius: 999px; padding: 2px 10px; }

@media print {
  .site-header, .site-footer, .hero, .ad, .content, #bulk-tool > :not(#bk-result) { display: none !important; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0 !important; }
  .bk-rgroup { break-inside: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bk-rgroup h3 { break-after: avoid; }
  .bulk-grid figure { break-inside: avoid; }
}
