/* ============================================================
   툴즈 디자인 시스템 v3
   토큰 → 프리미티브 → 레이아웃 → 컴포넌트 → 도구별 UI
   ============================================================ */

/* ── 토큰 ─────────────────────────────────────────────── */
:root {
  /* 표면 */
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e9ecf4;
  --overlay: rgba(15, 17, 26, .48);

  /* 텍스트 */
  --text: #171a26;
  --text-2: #464c5e;
  --muted: #6b7280;
  --faint: #9aa1af;

  /* 선 */
  --border: #e3e6ef;
  --border-2: #d3d8e6;

  /* 브랜드 */
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-l: #6366f1;
  --primary-soft: #eef1ff;
  --primary-ring: rgba(79, 70, 229, .32);
  --on-primary: #ffffff;

  /* 상태 */
  --ok: #15803d;    --ok-soft: #e8f6ec;
  --warn: #b45309;  --warn-soft: #fdf3e3;
  --err: #dc2626;   --err-soft: #fdeced;
  --info: #0369a1;  --info-soft: #e6f2fb;

  /* 형태 */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-full: 999px;
  --sh-1: 0 1px 2px rgba(18, 20, 40, .05);
  --sh-2: 0 2px 4px rgba(18, 20, 40, .05), 0 8px 20px rgba(18, 20, 40, .05);
  --sh-3: 0 12px 32px rgba(18, 20, 40, .12), 0 2px 8px rgba(18, 20, 40, .06);
  --sh-pop: 0 24px 60px rgba(18, 20, 40, .22);

  /* 타이포 */
  --sans: system-ui, -apple-system, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "D2Coding", monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --header-h: 60px;
}

:root[data-theme="dark"] {
  --bg: #0d0f16;
  --surface: #14171f;
  --surface-2: #1b1f29;
  --surface-3: #242936;
  --overlay: rgba(0, 0, 0, .62);

  --text: #e8eaf1;
  --text-2: #c2c7d4;
  --muted: #949bab;
  --faint: #6d7484;

  --border: #262b38;
  --border-2: #333a4a;

  --primary: #818cf8;
  --primary-d: #6366f1;
  --primary-l: #a5b4fc;
  --primary-soft: #1c2033;
  --primary-ring: rgba(129, 140, 248, .38);
  --on-primary: #10131c;

  --ok: #4ade80;    --ok-soft: #12251a;
  --warn: #fbbf24;  --warn-soft: #261e10;
  --err: #f87171;   --err-soft: #2a1518;
  --info: #38bdf8;  --info-soft: #0d1f2b;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 20px rgba(0, 0, 0, .28);
  --sh-3: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3);
  --sh-pop: 0 24px 60px rgba(0, 0, 0, .6);
}

/* ── 리셋/프리미티브 ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* hidden 속성이 항상 이기게 한다. 이 규칙이 없으면 display 를 지정하는 클래스(.stat-grid, .btn-row 등)가
   UA 의 [hidden]{display:none} 을 눌러서, hidden 을 걸어도 요소가 그대로 보인다. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.28; letter-spacing: -.02em; font-weight: 700; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary-ring); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--primary); color: var(--on-primary); padding: 10px 16px;
  border-radius: var(--r-sm); font-weight: 600; transition: top .15s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ── 헤더 ─────────────────────────────────────────────── */
.site-header {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 60;
}
.header-inner {
  display: flex; align-items: center; gap: 12px;
  height: var(--header-h); padding: 0 20px;
}
.logo {
  font-weight: 800; font-size: 1.15rem; color: var(--text);
  display: flex; align-items: center; gap: 8px; letter-spacing: -.03em;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  border-radius: 9px; font-size: .95rem; box-shadow: var(--sh-1);
}

/* ⌘K 트리거 */
.k-trigger {
  display: flex; align-items: center; gap: 8px;
  flex: 1; max-width: 380px; min-width: 0;
  height: 38px; padding: 0 8px 0 12px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-full);
  cursor: pointer; font-family: inherit; font-size: .875rem; text-align: left;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.k-trigger:hover { border-color: var(--border-2); background: var(--surface-3); }
.k-trigger-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbd {
  font-family: var(--sans); font-size: .72rem; font-weight: 600;
  background: var(--surface); color: var(--faint);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
/* 카테고리 드롭다운 */
.nav-wrap { position: relative; margin-left: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); font-family: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.nav-btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.nav-btn .caret { color: var(--faint); font-size: .7rem; transition: transform .15s var(--ease); }
.nav-btn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.nav-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.topnav {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 420px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: var(--sh-3);
  animation: kpop .12s var(--ease);
}
.topnav[hidden] { display: none; }
.topnav a {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: .84rem; font-weight: 500;
  padding: 8px 10px; border-radius: var(--r-sm); white-space: nowrap;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topnav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.topnav .nav-ico { font-size: .95rem; }
.topnav .nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.topnav .nav-count { color: var(--faint); font-size: .72rem; font-weight: 700; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; font-size: 1rem; color: var(--text);
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.icon-btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.nav-toggle { display: none; }

/* ── 히어로 ───────────────────────────────────────────── */
.hero {
  position: relative; text-align: center; padding: 64px 0 40px; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto -20%; height: 520px; z-index: -1;
  background:
    radial-gradient(42% 55% at 22% 32%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%),
    radial-gradient(38% 50% at 78% 22%, color-mix(in srgb, #06b6d4 18%, transparent), transparent 70%),
    radial-gradient(40% 46% at 52% 72%, color-mix(in srgb, #a855f7 14%, transparent), transparent 70%);
  filter: blur(18px); opacity: .9; pointer-events: none;
}
.hero h1 { font-size: clamp(1.75rem, 4.4vw, 2.6rem); margin: 0 0 14px; letter-spacing: -.035em; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--primary), #06b6d4 60%, #a855f7);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--text-2); max-width: 620px; margin: 0 auto 26px; font-size: 1.02rem; }
.hero-search { max-width: 600px; margin: 0 auto; }
.hero-search .k-trigger {
  max-width: none; width: 100%; height: 54px; padding: 0 10px 0 18px;
  border-radius: var(--r-full); font-size: 1rem; background: var(--surface);
  box-shadow: var(--sh-2);
}
.hero-search .k-trigger:hover { border-color: var(--primary); }
.hero-badges {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 20px;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 5px 12px;
  font-size: .8rem; color: var(--text-2); font-weight: 500; box-shadow: var(--sh-1);
}

/* ── 랜딩: 카테고리 그리드 ────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.cat-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden;
  transition: transform .14s var(--ease), border-color .14s var(--ease), box-shadow .14s var(--ease);
}
/* 카드 썸네일 — 카드가 세로 flex 컨테이너라 aspect-ratio 로는 높이가 안 잡힌다
   (flex 아이템의 주축 크기가 콘텐츠=원본 높이로 정해져 버림). 높이를 직접 고정한다. */
.cat-card-img {
  flex: 0 0 auto;
  display: block; width: calc(100% + 36px); height: 124px; margin: -18px -18px 4px;
  max-width: none; /* 리셋의 img{max-width:100%} 가 패딩 상쇄분(+36px)을 잘라내 우측에 틈이 생긴다 */
  object-fit: cover; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

/* 카테고리 페이지 배너 */
.cat-banner {
  position: relative; margin: 16px 0 4px; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--sh-1);
}
/* height 를 직접 고정한다. img 의 width/height 속성이 프레젠테이션 힌트로 height:630px 를 걸어
   aspect-ratio 를 무력화하기 때문(두 축이 다 정해지면 aspect-ratio 는 무시됨). */
.cat-banner img { display: block; width: 100%; height: 220px; object-fit: cover; }
@media (max-width: 640px) { .cat-banner img { height: 132px; } }
.cat-card:hover {
  transform: translateY(-3px); border-color: var(--primary);
  box-shadow: var(--sh-2); text-decoration: none;
}
.cat-card-top { display: flex; align-items: center; gap: 10px; }
.cat-card-ico {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--primary-soft), var(--surface-2));
  border-radius: 11px; font-size: 1.25rem;
}
.cat-card-name { font-weight: 700; color: var(--text); font-size: 1rem; }
.cat-card:hover .cat-card-name { color: var(--primary); }
.cat-card-count { margin-left: auto; font-size: .74rem; color: var(--faint); font-weight: 700; }
.cat-card-desc { font-size: .84rem; color: var(--muted); line-height: 1.55; }
.cat-card-tools { font-size: .76rem; color: var(--faint); margin-top: 2px; }

/* ── 랜딩: 소개 섹션 ──────────────────────────────────── */
.landing-sec { margin: 56px 0; }
.landing-head { text-align: center; max-width: 620px; margin: 0 auto 26px; }
.landing-head h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); margin: 0 0 8px; letter-spacing: -.03em; }
.landing-head p { color: var(--muted); margin: 0; font-size: .95rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--sh-1);
}
.feature-ico {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px;
  background: var(--primary-soft); border-radius: 11px; font-size: 1.2rem;
}
.feature h3 { margin: 0 0 6px; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.6; }

/* 사용 흐름 */
.steps-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s3; }
.step-3 {
  position: relative; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; counter-increment: s3;
}
.step-3::before {
  content: counter(s3); display: grid; place-items: center;
  width: 26px; height: 26px; margin-bottom: 10px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--r-full); font-size: .78rem; font-weight: 800;
}
.step-3 h3 { margin: 0 0 5px; font-size: .95rem; }
.step-3 p { margin: 0; color: var(--muted); font-size: .85rem; }

/* 마무리 CTA */
.cta {
  text-align: center; padding: 44px 24px; border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--primary-soft), var(--surface-2));
  border: 1px solid var(--border);
}
.cta h2 { margin: 0 0 8px; font-size: clamp(1.2rem, 3vw, 1.6rem); }
.cta p { color: var(--muted); margin: 0 0 18px; font-size: .92rem; }

/* ── 섹션 ─────────────────────────────────────────────── */
.cat-section { margin: 44px 0; scroll-margin-top: calc(var(--header-h) + 12px); }
.cat-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cat-head-main { min-width: 0; }
.cat-head h2, .cat-head h1 {
  margin: 0 0 2px; font-size: 1.32rem; display: flex; align-items: center; gap: 9px;
}
.cat-head h2 a { color: var(--text); }
.cat-head h2 a:hover { color: var(--primary); text-decoration: none; }
.cat-icon {
  display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0;
  background: var(--primary-soft); border-radius: 9px; font-size: 1rem;
}
.cat-desc { color: var(--muted); margin: 0; font-size: .92rem; }
.cat-count {
  margin-left: auto; font-size: .8rem; color: var(--faint);
  background: var(--surface-2); border-radius: var(--r-full); padding: 3px 10px; font-weight: 600;
}

/* ── 도구 카드 ────────────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 12px; }
.tool-card {
  position: relative; display: flex; gap: 12px; padding: 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-1);
  transition: transform .14s var(--ease), border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.tool-card:hover {
  transform: translateY(-2px); border-color: var(--primary);
  box-shadow: var(--sh-2); text-decoration: none;
}
.tool-card:hover .tool-name { color: var(--primary); }
.tool-icon {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  background: var(--surface-2); border-radius: 10px; font-size: 1.15rem; line-height: 1;
  transition: background .14s var(--ease);
}
.tool-card:hover .tool-icon { background: var(--primary-soft); }
.tool-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-name { font-weight: 650; color: var(--text); font-size: .94rem; transition: color .14s var(--ease); }
.tool-desc {
  font-size: .8rem; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 즐겨찾기 별 */
.fav-btn {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 7px; cursor: pointer;
  color: var(--faint); font-size: .95rem; line-height: 1; opacity: 0;
  transition: opacity .14s var(--ease), color .14s var(--ease), background .14s var(--ease);
}
.tool-card:hover .fav-btn, .fav-btn:focus-visible { opacity: 1; }
.fav-btn:hover { background: var(--surface-2); color: var(--warn); }
.fav-btn[aria-pressed="true"] { opacity: 1; color: #f59e0b; }
@media (hover: none) { .fav-btn { opacity: .55; } }

/* 빈 상태 */
.empty-row {
  color: var(--muted); font-size: .9rem; background: var(--surface-2);
  border: 1px dashed var(--border-2); border-radius: var(--r); padding: 18px; text-align: center;
}

/* ── 커맨드 팔레트 ────────────────────────────────────── */
.k-backdrop {
  position: fixed; inset: 0; z-index: 100; background: var(--overlay);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
  animation: kfade .12s var(--ease);
}
.k-backdrop[hidden] { display: none; }
@keyframes kfade { from { opacity: 0 } to { opacity: 1 } }
@keyframes kpop { from { opacity: 0; transform: translateY(-8px) scale(.985) } to { opacity: 1; transform: none } }
.k-panel {
  width: 100%; max-width: 620px; max-height: 72vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); box-shadow: var(--sh-pop); overflow: hidden;
  animation: kpop .14s var(--ease);
}
.k-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.k-input-row .k-ico { color: var(--faint); font-size: 1rem; }
#kInput {
  flex: 1; border: 0; background: none; color: var(--text);
  font-size: 1.02rem; font-family: inherit; padding: 0; outline: none;
}
#kInput::placeholder { color: var(--faint); }
.k-list { overflow-y: auto; padding: 6px; margin: 0; list-style: none; overscroll-behavior: contain; }
.k-group-label {
  font-size: .7rem; font-weight: 700; color: var(--faint); text-transform: uppercase;
  letter-spacing: .08em; padding: 10px 10px 4px;
}
.k-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); cursor: pointer; color: var(--text);
}
.k-item:hover { text-decoration: none; }
.k-item[aria-selected="true"] { background: var(--primary-soft); }
.k-item[aria-selected="true"] .k-name { color: var(--primary); }
.k-item-ico {
  display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  background: var(--surface-2); border-radius: 8px; font-size: .95rem;
}
.k-item-body { min-width: 0; flex: 1; }
.k-name { font-weight: 600; font-size: .9rem; display: block; }
.k-sub {
  font-size: .76rem; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; display: block;
}
.k-item-tag { font-size: .7rem; color: var(--faint); background: var(--surface-2); border-radius: 5px; padding: 2px 7px; }
.k-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: .9rem; }
.k-foot {
  display: flex; gap: 14px; align-items: center; padding: 9px 14px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: .74rem; color: var(--faint);
}
.k-foot .kbd { background: var(--surface); }
mark, .k-hit { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ── 토스트 ───────────────────────────────────────────── */
.toast-host {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text); color: var(--bg); font-size: .86rem; font-weight: 600;
  padding: 9px 16px; border-radius: var(--r-full); box-shadow: var(--sh-3);
  animation: tpop .18s var(--ease);
}
.toast.err { background: var(--err); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes tpop { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* ── 빵부스러기 / 도구 페이지 ─────────────────────────── */
.breadcrumb {
  font-size: .82rem; color: var(--muted); padding: 18px 0 0;
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--faint); }
.breadcrumb .cur { color: var(--text-2); font-weight: 600; }

.tool-page { padding-bottom: 56px; }
.tool-header { display: flex; align-items: flex-start; gap: 14px; margin: 16px 0 20px; }
.tool-h1-icon {
  display: grid; place-items: center; width: 50px; height: 50px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--primary-soft), var(--surface-2));
  border: 1px solid var(--border); border-radius: var(--r); font-size: 1.5rem;
}
.tool-header-body { min-width: 0; flex: 1; }
.tool-header h1 { font-size: clamp(1.4rem, 3.4vw, 1.75rem); margin: 2px 0 5px; }
.tool-lead { color: var(--muted); margin: 0; font-size: .94rem; }
.tool-header-actions { display: flex; gap: 6px; flex-shrink: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 22px;
}
.tool-app { position: relative; }

/* ── 폼 프리미티브 ────────────────────────────────────── */
.field { margin: 14px 0; }
.field:first-child { margin-top: 0; }
.field label, .field-label {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 600; font-size: .86rem; margin-bottom: 6px; color: var(--text-2);
}
.field-label .spacer { flex: 1; }
textarea, input[type="text"], input[type="search"], input[type="number"], input[type="password"],
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="url"], select, .out-box {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font-size: 15px; font-family: inherit; line-height: 1.6;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}
textarea { resize: vertical; min-height: 84px; }
input[readonly], textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.mono { font-family: var(--mono); font-size: 13.5px; letter-spacing: -.01em; }
.out-box { min-height: 44px; white-space: pre-wrap; word-break: break-word; overflow: auto; }
pre.out-box { margin: 0; }
.num { width: auto; min-width: 84px; display: inline-block; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }
input[type="range"] { accent-color: var(--primary); width: 100%; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: var(--on-primary); border: 1px solid transparent;
  padding: 9px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: .9rem;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background .12s var(--ease), transform .06s var(--ease), border-color .12s var(--ease);
}
.btn:hover { background: var(--primary-d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn.sm { padding: 6px 11px; font-size: .8rem; }
.btn.danger { background: var(--err); color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.btn-row .spacer { flex: 1; }
.inline-controls label { font-weight: 600; font-size: .86rem; }

.copy {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 2px 9px; font-size: .75rem; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.copy:hover { color: var(--primary); border-color: var(--primary); }
.copy.copied { color: var(--ok); border-color: var(--ok); }

/* 세그먼트 스위치 */
.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: none; color: var(--muted); font-family: inherit;
  font-size: .82rem; font-weight: 600; padding: 5px 12px;
  border-radius: 6px; cursor: pointer; white-space: nowrap;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }

/* 칩 */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  border-radius: var(--r-full); padding: 4px 11px; font-size: .78rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: border-color .12s var(--ease), color .12s var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* 메시지 */
.msg { min-height: 20px; font-size: .84rem; color: var(--muted); margin: 6px 0; }
.msg.error { color: var(--err); }
.msg.ok { color: var(--ok); }
.msg.warn { color: var(--warn); }
.note {
  display: flex; gap: 9px; font-size: .85rem; color: var(--text-2);
  background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
  border-radius: var(--r-sm); padding: 10px 13px; margin: 12px 0;
}
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

/* 드롭존 */
.dropzone {
  border: 1.5px dashed var(--border-2); border-radius: var(--r);
  padding: 14px; text-align: center; color: var(--muted); font-size: .84rem;
  background: var(--surface-2); cursor: pointer;
  transition: border-color .12s var(--ease), background .12s var(--ease), color .12s var(--ease);
}
.dropzone:hover { border-color: var(--primary); color: var(--primary); }
.dz-over {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}
.dz-hint { font-size: .78rem; color: var(--faint); }

/* 레이아웃 유틸 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.hash-results, .case-results { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .case-results { grid-template-columns: 1fr 1fr; } }

/* 통계 타일 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; margin-top: 8px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 12px; text-align: center;
}
.stat-num { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary); letter-spacing: -.03em; }
.stat-label { font-size: .75rem; color: var(--muted); }

/* 테이블 */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; }
.tbl thead th { background: var(--surface-2); font-size: .78rem; color: var(--muted); font-weight: 700; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }

/* ── SEO 본문 ─────────────────────────────────────────── */
.tool-content { margin: 36px 0; max-width: 780px; }
.tool-content h2 {
  font-size: 1.3rem; margin: 40px 0 14px; letter-spacing: -.01em;
  /* 제목 앞 짧은 인디고 막대 — 텍스트만 이어질 때 섹션 시작점을 눈이 잡게 해 준다 */
  padding-left: 13px; border-left: 4px solid var(--primary); line-height: 1.35;
}
.tool-content h2:first-child { margin-top: 0; }

/* 본문 공통 — 한글은 라틴보다 줄 간격이 넉넉해야 읽힌다.
   max-width 는 줄길이(measure) 제한: 컨테이너(780~810px)를 꽉 채우면 한 줄 50자를 넘어
   눈이 다음 줄 첫 글자를 놓친다. 46em ≈ 44자 정도로 잡는다. */
.tool-content p, .guide-sec p {
  color: var(--text-2); font-size: .95rem; line-height: 1.85; max-width: 46em;
  margin: 0 0 14px;
}

/* 인트로 리드 — 400~600자 한 덩어리라 일반 문단으로 두면 글 벽이 된다 */
.tool-intro {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary-l);
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-sm);
  padding: 20px 24px; box-shadow: var(--sh-1);
  font-size: 1rem !important; line-height: 1.9 !important;
  color: var(--text-2); max-width: none !important;
}

/* 사용 방법 — 번호만 붙은 목록이 아니라 스텝 카드. 한 줄씩 끊겨 보여 훑기 쉽다. */
.howto { padding-left: 0; list-style: none; counter-reset: st; display: grid; gap: 8px; }
.howto li {
  position: relative; margin: 0; padding: 13px 16px 13px 48px;
  color: var(--text-2); counter-increment: st; font-size: .93rem; line-height: 1.7;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  transition: border-color .12s var(--ease);
}
.howto li:hover { border-color: var(--border-2); }
.howto li::before {
  content: counter(st); position: absolute; left: 14px; top: 12px;
  width: 24px; height: 24px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--r-full); font-size: .76rem; font-weight: 800;
}

/* 불릿 — 기본 검정 점 대신 브랜드색으로 */
.guide-list li::marker { color: var(--primary); }

.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 13px 16px; margin: 8px 0;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.faq details:hover { border-color: var(--border-2); }
.faq details[open] { border-color: var(--border-2); box-shadow: var(--sh-1); }
.faq summary {
  font-weight: 600; cursor: pointer; font-size: .93rem; list-style: none;
  display: flex; gap: 8px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q"; color: var(--primary); font-weight: 800; }
/* 접힌 상태가 눌리는 것임을 알려 주는 표시 — 없으면 그냥 제목 줄로 보인다 */
.faq summary::after {
  content: ""; margin-left: auto; flex-shrink: 0;
  width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq details[open] summary::before { color: var(--primary); }
.faq details p { color: var(--text-2); margin: 12px 0 0; font-size: .9rem; line-height: 1.8; max-width: none; }
.related { margin: 40px 0 0; }
.related h2 { font-size: 1.15rem; margin-bottom: 14px; }

/* ── 도구 심화 가이드 ─────────────────────────────────── */
/* 폭 제한은 .guide 가 아니라 .guide-body 가 갖는다 — .guide 를 820px 로 묶으면
   목차를 놓을 오른쪽 공간(.wrap 1120px 기준 약 280px)이 사라진다. */
.guide { margin: 40px 0; }
.guide-head { padding-bottom: 6px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.guide-head h2 { font-size: 1.32rem; margin: 0 0 6px; }
.guide-lead { color: var(--muted); margin: 0; font-size: .9rem; }
.guide-body { max-width: 820px; }

/* 목차 — 좁은 화면: DOM 순서대로 본문 위. 넓은 화면: 오른쪽 열에 sticky(아래 미디어쿼리) */
.toc {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px; margin-bottom: 26px;
}
.toc-title { font-weight: 700; font-size: .86rem; margin-bottom: 8px; color: var(--text-2); }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 4px 0; }
.toc a { font-size: .88rem; color: var(--text-2); }
.toc a:hover { color: var(--primary); }

@media (min-width: 1000px) {
  .guide-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 236px;
    gap: 34px;
    /* start 필수 — 기본 stretch 면 목차 칸이 본문 높이만큼 늘어나 sticky 가 안 먹는다 */
    align-items: start;
  }
  .guide-body { grid-column: 1; grid-row: 1; }
  .toc {
    grid-column: 2; grid-row: 1;
    position: sticky; top: calc(var(--header-h) + 14px);
    margin-bottom: 0;
    /* 섹션이 많아 목차가 화면보다 길어지면 목차 안에서만 스크롤 */
    max-height: calc(100vh - var(--header-h) - 34px);
    overflow-y: auto;
  }
}

/* 섹션 사이 실선 — 없으면 5~6개 섹션이 한 덩어리 글로 읽힌다 */
.guide-sec {
  margin-bottom: 0; padding: 28px 0; border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 14px);
}
.guide-sec:first-child { border-top: 0; padding-top: 4px; }
.guide-sec:last-child { padding-bottom: 4px; }
.guide-sec h3 {
  font-size: 1.12rem; margin: 0 0 12px; padding-left: 11px;
  border-left: 3px solid var(--primary); line-height: 1.4;
}
.guide-list { padding-left: 20px; margin: 12px 0; max-width: 46em; }
.guide-list li { color: var(--text-2); margin: 7px 0; font-size: .92rem; line-height: 1.75; }
.guide-sec .tbl-scroll, .guide-sec .note { margin: 14px 0; }

/* 코드 예시 */
.code-block {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; margin: 14px 0; background: var(--surface-2);
}
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--surface-3); border-bottom: 1px solid var(--border);
}
.code-lang {
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em; flex: 1;
}
.code-block pre {
  margin: 0; padding: 12px 14px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--text);
}
.code-block code { font-family: inherit; }

/* 광고 슬롯 */
.ad-slot { margin: 24px 0; text-align: center; min-height: 0; }

/* ── 문서/법적 페이지 ─────────────────────────────────── */
.doc { padding: 20px 0 60px; max-width: 760px; }
.doc h1 { font-size: 1.75rem; }
.doc h2 { font-size: 1.14rem; margin-top: 30px; }
.doc p, .doc li { color: var(--text-2); }
.doc-date { color: var(--faint); font-size: .84rem; margin-top: 30px; }
.contact-email { font-size: 1.15rem; font-weight: 700; }

/* 404 */
.notfound { text-align: center; padding: 80px 0; }
.notfound h1 { font-size: 4rem; margin: 0; color: var(--primary); letter-spacing: -.05em; }

/* ── 푸터 ─────────────────────────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 56px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; padding: 44px 20px 24px; }
.footer-brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.footer-desc { color: var(--muted); font-size: .87rem; margin-top: 8px; }
.footer-col h4 { margin: 0 0 10px; font-size: .9rem; }
.footer-col a { display: block; color: var(--muted); font-size: .85rem; padding: 3px 0; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  color: var(--faint); font-size: .78rem; padding: 16px 20px 30px;
  border-top: 1px solid var(--border); display: flex; gap: 12px; flex-wrap: wrap;
}

/* ── 반응형 ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 14px; }
  .header-inner { padding: 0 14px; gap: 8px; }
  .logo span:not(.logo-mark) { display: none; }
  /* 좁은 화면: 드롭다운을 화면 폭에 맞춰 펼침 */
  .nav-wrap { position: static; }
  .nav-btn { padding: 0 10px; font-size: 0; gap: 0; }
  .nav-btn .caret { font-size: .8rem; }
  .nav-btn::before { content: "☰"; font-size: 1rem; }
  .topnav { width: auto; left: 10px; right: 10px; top: calc(var(--header-h) + 2px); }
  .hero { padding: 40px 0 28px; }
  .hero-search .k-trigger { height: 48px; }
  .grid-2, .grid-3, .io-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: var(--r); }
  .cat-section { margin: 32px 0; }
  .k-backdrop { padding: 8vh 10px 10px; }
  .k-foot { display: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 18px; padding: 30px 14px 18px; }
  .btn { padding: 11px 16px; }
  .copy { padding: 5px 11px; }
}

/* ============================================================
   도구별 UI
   ============================================================ */

/* 참조 목록 (http-status, mime-types 등) */
.ref-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 520px; overflow: auto; }
.ref-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-sm);
}
.ref-item:hover { border-color: var(--border); }
.ref-code { font-family: var(--mono); font-weight: 700; color: var(--primary); min-width: 58px; }
.ref-desc { color: var(--muted); font-size: .86rem; }

/* diff */
.diff-out { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.diff-line { padding: 1px 8px; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 13px; display: flex; gap: 10px; }
.diff-line .ln { color: var(--faint); min-width: 34px; text-align: right; user-select: none; flex-shrink: 0; }
.diff-line.add { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.diff-line.del { background: color-mix(in srgb, var(--err) 16%, transparent); }
.diff-line ins, .diff-line del { text-decoration: none; border-radius: 3px; padding: 0 1px; }
.diff-line ins { background: color-mix(in srgb, var(--ok) 34%, transparent); }
.diff-line del { background: color-mix(in srgb, var(--err) 34%, transparent); }

/* 마크다운 프리뷰 */
.md-preview { min-height: 220px; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: .7em 0 .35em; }
.md-preview pre { background: var(--surface-3); padding: 12px; border-radius: var(--r-sm); overflow: auto; }
.md-preview code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.md-preview pre code { background: none; padding: 0; }
.md-preview blockquote { border-left: 3px solid var(--primary); margin: .5em 0; padding-left: 12px; color: var(--muted); }
.md-preview ul, .md-preview ol { padding-left: 22px; }
.md-preview table { border-collapse: collapse; width: 100%; }
.md-preview th, .md-preview td { border: 1px solid var(--border); padding: 6px 10px; }
.md-preview img { border-radius: var(--r-sm); }

/* chmod */
.chmod-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.chmod-table th, .chmod-table td { border: 1px solid var(--border); padding: 8px; text-align: center; }
.chmod-table thead th { background: var(--surface-2); font-size: .82rem; }
.chmod-table tbody th { text-align: left; font-weight: 600; }
.chmod-table input { width: auto; }

/* 색상 도구 */
.color-top { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
#color-picker { width: 64px; height: 64px; padding: 0; border: none; background: none; cursor: pointer; flex-shrink: 0; }
.color-preview {
  flex: 1; min-width: 140px; height: 64px; border-radius: var(--r);
  border: 1px solid var(--border); background: #4f46e5;
  display: grid; place-items: center; font-weight: 700; font-family: var(--mono);
}
.swatch-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 6px; }
.swatch {
  height: 46px; border-radius: var(--r-sm); border: 1px solid var(--border);
  cursor: pointer; position: relative; transition: transform .1s var(--ease);
}
.swatch:hover { transform: scale(1.06); }
.swatch-label { font-size: .66rem; color: var(--muted); text-align: center; display: block; margin-top: 3px; font-family: var(--mono); }
.contrast-badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-full);
  padding: 3px 10px; font-size: .76rem; font-weight: 700;
}
.contrast-badge.pass { background: var(--ok-soft); color: var(--ok); }
.contrast-badge.fail { background: var(--err-soft); color: var(--err); }

/* 비밀번호 */
.pw-opts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.pw-opts label { font-weight: 500; font-size: .88rem; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pw-output { display: flex; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.pw-output input { flex: 1; min-width: 200px; font-size: 17px; font-family: var(--mono); }
.pw-strength { height: 8px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.pw-bar { height: 100%; width: 0; background: var(--err); transition: width .25s var(--ease), background .25s var(--ease); }

/* 계산 블록 */
.calc-block { padding: 14px 0; border-bottom: 1px solid var(--border); }
.calc-block:last-child { border-bottom: none; }
.calc-block h3 { margin: 0 0 8px; font-size: .98rem; }
.calc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calc-out { color: var(--primary); font-size: 1.08rem; font-weight: 700; min-width: 40px; }

/* JSON 트리뷰 */
.tree { font-family: var(--mono); font-size: 13px; line-height: 1.75; overflow: auto; max-height: 460px; }
.tree ul { list-style: none; margin: 0; padding-left: 17px; border-left: 1px dotted var(--border-2); }
.tree li { position: relative; }
.tree .tw {
  cursor: pointer; user-select: none; color: var(--faint);
  display: inline-block; width: 13px; text-align: center;
}
.tree .tw:hover { color: var(--primary); }
.tree .tk { color: var(--primary); }
.tree .ts { color: var(--ok); }
.tree .tn { color: var(--warn); }
.tree .tb { color: var(--info); font-weight: 700; }
.tree .tnull { color: var(--faint); font-style: italic; }
.tree .tmeta { color: var(--faint); font-size: .88em; }
.tree li.collapsed > ul { display: none; }
.tree .tmeta-c { display: none; color: var(--faint); }
.tree li.collapsed > .tmeta-c { display: inline; }
