/* 도현 아카이브 — designus 레퍼런스 갤러리 구성(검색창 + 칩 필터 + 해시태그 카드)에
 * 토스 느낌(회색 바탕 위 흰 카드, 테두리 대신 면으로 구분, 파란 주요 버튼, 굵은 제목)을 입힌 스타일.
 * 이전 스타일 백업: tools/backup/style.before-toss.css */

:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --surface-3: #e5e8eb;
  --line: #e5e8eb;
  --line-strong: #d1d6db;
  --text: #191f28;
  --text-2: #4e5968;
  --text-3: #6b7684; /* 흰 배경 위 대비 4.5:1 이상 */
  --accent: #3182f6;
  --accent-strong: #1b64da;
  --accent-soft: #e8f3ff;
  --accent-text: #1b64da;
  --on-accent: #ffffff;
  --mark-bg: rgba(255, 195, 66, 0.4);
  --star: #b07c00; /* 흰 배경 위 아이콘 대비 3:1 이상 */
  --danger: #e42939;
  --danger-soft: #ffeeee;
  --shadow: 0 2px 8px rgba(0, 27, 55, 0.05);
  --shadow-lift: 0 4px 12px rgba(0, 27, 55, 0.06), 0 16px 40px rgba(0, 27, 55, 0.1);
  --scrim: rgba(0, 0, 0, 0.4);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --gutter: clamp(16px, 2vw, 28px);
  --maxw: none; /* 화면 좌우 끝까지 (사용자 요청) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms;
  --normal: 320ms;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17171c;
    --surface: #202027;
    --surface-2: #2c2c35;
    --surface-3: #3c3c47;
    --line: #2c2c35;
    --line-strong: #4d4d59;
    --text: #f2f2f5;
    --text-2: #c3c3c9;
    --text-3: #9e9ea4;
    --accent: #3182f6;
    --accent-strong: #4593fc;
    --accent-soft: rgba(49, 130, 246, 0.18);
    --accent-text: #64a8ff;
    --on-accent: #ffffff;
    --danger: #ff6b76;
    --danger-soft: rgba(240, 68, 82, 0.16);
    --mark-bg: rgba(255, 195, 66, 0.3);
    --star: #ffc342;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 12px 36px rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17171c;
  --surface: #202027;
  --surface-2: #2c2c35;
  --surface-3: #3c3c47;
  --line: #2c2c35;
  --line-strong: #4d4d59;
  --text: #f2f2f5;
  --text-2: #c3c3c9;
  --text-3: #9e9ea4;
  --accent: #3182f6;
  --accent-strong: #4593fc;
  --accent-soft: rgba(49, 130, 246, 0.18);
  --accent-text: #64a8ff;
  --on-accent: #ffffff;
  --danger: #ff6b76;
  --danger-soft: rgba(240, 68, 82, 0.16);
  --mark-bg: rgba(255, 195, 66, 0.3);
  --star: #ffc342;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 12px 36px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 상단바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
  height: 60px; display: flex; align-items: center; gap: 12px;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.04em; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.brand__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: translateY(-5px); }
.brand { margin-right: auto; }

/* ---------- 왼쪽 카테고리 메뉴 (접기/펼치기: html[data-sidebar]) ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns var(--normal) var(--ease); }
:root { --side-w: 240px; }
[data-sidebar="closed"] { --side-w: 0px; }
.sidebar {
  position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); height: calc(100dvh - 60px);
  overflow: hidden auto; border-right: 1px solid var(--line); background: var(--bg);
  padding: 20px 12px 24px; min-width: 0;
  transition: opacity var(--fast), visibility var(--normal);
}
[data-sidebar="closed"] .sidebar { opacity: 0; visibility: hidden; padding-left: 0; padding-right: 0; border-right-color: transparent; }
.sidebar__title { margin: 0 12px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-3); white-space: nowrap; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tab {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px;
  border: 0; background: none; cursor: pointer; white-space: nowrap; text-align: left;
  padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 600; font-size: 14.5px;
  transition: color var(--fast), background var(--fast);
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-current="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.tab[aria-current="true"]::before { content: ""; width: 3px; align-self: stretch; margin: 2px 0 2px -6px; border-radius: 3px; background: var(--accent); }
.tab__count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.sidebar-scrim { display: none; }
#sidebarToggle[aria-expanded="true"] { color: var(--text); }

.icon-btn {
  flex: none; width: 38px; height: 38px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: grid; place-items: center; color: var(--text-2);
  transition: border-color var(--fast), color var(--fast), transform var(--fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ---------- 검색 영역 ---------- */
.page { max-width: var(--maxw); margin: 0; padding: 44px var(--gutter) 80px; }
.page-title { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.2; }
.page-desc { margin: 8px 0 0; color: var(--text-3); font-size: 15px; }

.search {
  margin-top: 24px; display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 16px 0 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); cursor: text;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { color: var(--text-3); flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search__key {
  flex: none; font-family: var(--mono); font-size: 12px; color: var(--text-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--surface-2);
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px;
  border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select-wrap select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  height: 38px; padding: 0 36px 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600;
}
.select-wrap select:hover { border-color: var(--line-strong); }

/* 분류 다중 선택 드롭다운 */
.multi { position: relative; }
.multi__btn {
  position: relative; height: 38px; max-width: 260px; padding: 0 36px 0 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.multi__btn::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px;
  border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg); transition: transform var(--fast);
}
.multi__btn[aria-expanded="true"]::after { transform: translateY(-30%) rotate(-135deg); }
.multi__btn:hover { border-color: var(--line-strong); }
.multi__btn.is-active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.multi__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 15; min-width: 260px; max-height: 360px; overflow-y: auto;
  padding: 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lift);
  animation: chat-pop var(--fast) var(--ease);
}
.multi__option {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; color: var(--text);
}
.multi__option:hover { background: var(--surface-2); }
.multi__option input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.multi__name { flex: 1; min-width: 0; }
.multi__count { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.multi__foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; padding: 8px 4px 2px; border-top: 1px solid var(--line); }
.multi__clear, .multi__done { height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 700; cursor: pointer; }
.multi__clear { border: 0; background: none; color: var(--text-2); }
.multi__clear:disabled { opacity: 0.4; cursor: default; }
.multi__done { border: 0; background: var(--text); color: var(--bg); }

.chips { display: flex; gap: 6px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  flex: none; cursor: pointer; white-space: nowrap;
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip--reset { height: 38px; border-radius: var(--r-sm); color: var(--accent-text); border-color: transparent; background: var(--accent-soft); }

/* ---------- 카테고리 개요 (전체 탭) ---------- */
.overview { display: grid; gap: 32px; margin-top: 36px; }
.profile {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 20px 22px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface);
}
.profile__text { display: grid; gap: 2px; min-width: 0; }
.profile__name { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.profile__tagline { color: var(--text-2); font-size: 14.5px; }
.profile__intro { margin: 6px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 62ch; }
.profile__links { display: flex; flex-wrap: wrap; gap: 6px; }
.profile__links .chip { display: inline-flex; align-items: center; }
.profile--empty { border-style: dashed; color: var(--text-3); font-size: 14px; justify-content: flex-start; }
.profile--empty strong { color: var(--text); }
.overview__cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.section-title { margin: 0 0 10px; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.recent__list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.recent__list li + li { border-top: 1px solid var(--line); }
.recent__row {
  width: 100%; display: grid; grid-template-columns: 44px max-content max-content 1fr; align-items: center; gap: 12px;
  padding: 13px 18px; border: 0; background: none; text-align: left; cursor: pointer;
  transition: background var(--fast);
}
.recent__row:hover { background: var(--surface-2); }
.recent__date { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.recent__title { font-weight: 700; font-size: 14.5px; }
.recent__summary { min-width: 0; color: var(--text-3); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  padding: 22px 22px 20px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease);
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.cat-card__count { font-size: 40px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.cat-card__soon { font-size: 22px; letter-spacing: -0.02em; color: var(--text-3); }
.detail__image { display: block; width: 100%; margin-top: 16px; border-radius: var(--r-md); border: 1px solid var(--line); }
.detail__stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cat-card__name { margin-top: 14px; font-size: 17px; font-weight: 700; }
.cat-card__desc { margin-top: 4px; color: var(--text-3); font-size: 13.5px; }
.cat-card__arrow { position: absolute; right: 20px; top: 22px; color: var(--text-3); transition: transform var(--normal) var(--ease), color var(--fast); }
.cat-card:hover .cat-card__arrow { transform: translateX(3px); color: var(--accent); }
.cat-card--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.cat-card--primary .cat-card__desc, .cat-card--primary .cat-card__arrow { color: color-mix(in srgb, var(--bg) 65%, transparent); }

/* ---------- 결과 ---------- */
.results { margin-top: 36px; }
.results__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; color: var(--text-3); font-size: 14px; }
.results__meta strong { color: var(--text); font-size: 17px; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card-wrap { position: relative; display: flex; }
.card-wrap .card { flex: 1; min-width: 0; }
.card-wrap .card__top { padding-right: 30px; }
.card--fav { border-color: color-mix(in srgb, var(--star) 45%, var(--line)); }

.fav-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--text-3);
  transition: color var(--fast), background var(--fast), transform var(--fast);
}
.fav-btn svg { width: 18px; height: 18px; }
.fav-btn:hover { color: var(--star); background: var(--surface-2); }
.fav-btn:active { transform: scale(0.88); }
.fav-btn[aria-pressed="true"] { color: var(--star); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn--card { position: absolute; top: 12px; right: 10px; }
.fav-btn--detail { margin-left: 4px; }
.chip--fav { height: 38px; border-radius: var(--r-sm); }
.chip--fav[aria-pressed="true"] { background: var(--star); border-color: var(--star); color: #fff; }
:root[data-theme="dark"] .chip--fav[aria-pressed="true"] { color: #1b1400; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip--fav[aria-pressed="true"] { color: #1b1400; } }
.card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer;
  padding: 18px 18px 16px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease), border-color var(--fast);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.card:active { transform: translateY(0); }
.card__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card__title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  flex: none; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-3);
}
.badge--cmd { background: var(--accent-soft); color: var(--accent-text); }
.badge--src { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); }
.twins { display: grid; gap: 6px; }
.twin {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--fast), background var(--fast);
}
.twin:hover { border-color: var(--line-strong); background: var(--surface-2); }
.twin__text { min-width: 0; font-size: 14px; color: var(--text-2); }
.card__invoke { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__summary {
  margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__tags { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: auto; padding-top: 4px; }
.hashtag { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { display: grid; gap: 4px; place-items: center; padding: 72px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--text-3); text-align: center; }
.empty strong { color: var(--text); font-size: 17px; }

.more-btn {
  display: block; margin: 24px auto 0; cursor: pointer;
  height: 44px; padding: 0 28px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); font-weight: 600;
}
.more-btn:hover { border-color: var(--line-strong); }

.footer { max-width: var(--maxw); margin: 0; padding: 24px var(--gutter) 40px; color: var(--text-3); font-size: 13px; border-top: 1px solid var(--line); }

/* ---------- 상세 시트 ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet__backdrop { position: absolute; inset: 0; background: var(--scrim); animation: fade var(--normal) var(--ease); }
.sheet__panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift); padding: 28px 28px 36px;
  animation: slide-in var(--normal) var(--ease);
}
.sheet__close { position: sticky; top: 0; float: right; margin: -8px -8px 0 0; z-index: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes slide-up { from { transform: translateY(32px); opacity: 0; } }

.detail__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.detail__title { margin: 14px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.25; word-break: break-word; }
.detail__invoke {
  margin-top: 14px; display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 14px; border-radius: var(--r-md); background: var(--surface-2);
}
.detail__invoke code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; overflow-x: auto; white-space: nowrap; }
.copy-btn {
  flex: none; cursor: pointer; height: 30px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; font-weight: 700;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 700;
  transition: opacity var(--fast);
}
.link-btn:hover { opacity: 0.85; }
.detail__summary { margin: 18px 0 0; font-size: 17px; line-height: 1.6; color: var(--text); font-weight: 500; }
.detail__section { margin-top: 26px; }
.detail__section h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-3); }
.detail__section p, .detail__section li { color: var(--text-2); font-size: 15px; }
.detail__section p { margin: 0 0 8px; }
.detail__section ul { margin: 0 0 8px; padding-left: 18px; }
.detail__section code {
  font-family: var(--mono); font-size: 0.88em; padding: 1px 6px; border-radius: 5px;
  background: var(--surface-2); color: var(--text);
}
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 2px; }
.step {
  position: relative; display: grid; gap: 2px; padding: 10px 0 10px 40px; counter-increment: step;
}
.step::before {
  content: counter(step); position: absolute; left: 0; top: 10px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 800;
}
.step + .step::after {
  content: ""; position: absolute; left: 12.5px; top: -8px; width: 1px; height: 16px; background: var(--line-strong);
}
.step__skill {
  justify-self: start; padding: 2px 8px; border: 0; border-radius: 6px; cursor: pointer;
  font-family: var(--mono); font-size: 13.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.step__skill:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.step__note { color: var(--text-2); font-size: 14px; }
.detail__section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.detail__section-head h3 { margin: 0; }
.prompt-box {
  margin: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2);
  border: 1px solid var(--line); font-family: var(--font); font-size: 14.5px; line-height: 1.7;
  color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.install-box { font-family: var(--mono); font-size: 13px; line-height: 1.8; }
.detail__note { margin: 8px 0 0; font-size: 13px; color: var(--text-3); }
.detail__section .detail__en { font-size: 14px; line-height: 1.65; color: var(--text-3); }
.detail__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail__rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.detail__rows dt { color: var(--text-3); }
.detail__rows dd { margin: 0; color: var(--text-2); word-break: break-all; }
.detail__rows a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 12px);
  padding: 10px 16px; border-radius: var(--r-pill); background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity var(--fast), transform var(--normal) var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- AI 질문 (오른쪽 아래) ---------- */
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease);
}
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab:active { transform: scale(0.95); }
.chat-fab svg { width: 26px; height: 26px; grid-area: 1 / 1; transition: transform var(--normal) var(--ease), opacity var(--fast); }
.chat-fab__close { opacity: 0; transform: rotate(-90deg); }
.chat-fab.is-open .chat-fab__open { opacity: 0; transform: rotate(90deg); }
.chat-fab.is-open .chat-fab__close { opacity: 1; transform: none; }

.chat-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 40;
  width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 128px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  transform-origin: bottom right; animation: chat-pop var(--normal) var(--ease);
}
@keyframes chat-pop { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--line); }
.chat-head div { flex: 1; min-width: 0; display: grid; }
.chat-head strong { font-size: 15.5px; }
.chat-head span { font-size: 12px; color: var(--text-3); }
.chat-head__btn {
  height: 30px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.chat-head__btn:hover { border-color: var(--line-strong); color: var(--text); }
.chat-head__close { width: 32px; height: 32px; }

.chat-messages { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.6; word-break: break-word; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul, .chat-msg ol { margin: 4px 0 6px; padding-left: 18px; }
.chat-msg code, .chat-skill { font-family: var(--mono); font-size: 0.86em; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); color: var(--text); }
.chat-skill { border: 0; cursor: pointer; color: var(--accent-text); background: var(--accent-soft); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg pre { margin: 6px 0; padding: 10px; border-radius: 10px; background: var(--surface-3); overflow-x: auto; }
.chat-msg pre code { padding: 0; background: none; }
.chat-msg a { color: var(--accent-text); text-decoration: underline; }
.chat-msg--user { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 6px; }
.chat-msg--assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }

.chat-empty { margin: auto 0; display: grid; gap: 4px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.chat-empty strong { color: var(--text); font-size: 17px; }
.chat-examples { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; }

.chat-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: chat-dot 1s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-notice { display: grid; gap: 8px; margin: 0 12px 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.chat-code { display: flex; gap: 6px; }
.chat-code input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); }
.chat-code button { height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px; field-sizing: content;
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2);
  font-size: 14.5px; line-height: 1.5; outline: 0;
}
.chat-form textarea:focus { border-color: var(--accent); background: var(--surface); }
.chat-send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  transition: opacity var(--fast), transform var(--fast);
}
.chat-send:disabled { opacity: 0.45; cursor: default; }
.chat-send:not(:disabled):active { transform: scale(0.94); }

/* ---------- 글쓰기 (admin.js) ---------- */
.write-btn {
  flex: none; height: 38px; padding: 0 16px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
  transition: transform var(--fast), opacity var(--fast);
}
.write-btn:hover { opacity: 0.88; }
.write-btn:active { transform: scale(0.96); }
.footer { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; }
.footer__link { border: 0; background: none; padding: 4px 0; color: var(--text-3); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.footer__link:hover { color: var(--text); }
.admin-bar { display: flex; gap: 6px; margin-left: auto; }
.copy-btn--danger { color: var(--danger); }
.copy-btn--danger:hover { border-color: var(--danger); color: var(--danger); }

.editor-form { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field[hidden] { display: none; }
.field__label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--text-3); font-weight: 400; }
.field input:not([type="checkbox"]), .field textarea, .field select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text); font: inherit; font-size: 15px; padding: 10px 12px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field textarea { resize: vertical; line-height: 1.6; min-height: 88px; }
.field .select-wrap select { width: 100%; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field--check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; font-weight: 600; }
.field--check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.editor-actions { display: flex; gap: 8px; align-items: center; position: sticky; bottom: -36px; padding: 12px 0 4px; background: var(--surface); }
.editor-actions .link-btn { margin: 0; border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.editor-actions .link-btn:disabled { opacity: 0.5; cursor: progress; }
.editor-actions .copy-btn { height: auto; align-self: stretch; padding: 0 16px; }

/* ---------- 토스 느낌: 테두리 대신 흰 면 + 회색 바탕으로 구분, 파란 주요 버튼 ---------- */
.topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom-color: transparent; box-shadow: 0 1px 0 var(--line); }
.brand { font-weight: 700; letter-spacing: -0.03em; }
.icon-btn { border-color: transparent; background: transparent; }
.icon-btn:hover { background: var(--surface-2); border-color: transparent; }
.sidebar { background: var(--surface); border-right-color: var(--line); padding-top: 24px; }
.sidebar__title { letter-spacing: 0; }
.tab { color: var(--text-2); font-weight: 500; font-size: 15px; min-height: 44px; }
.tab:hover { background: var(--surface-2); }
.tab[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; font-weight: 700; }
.tab[aria-current="true"]::before { content: none; }
.tab[aria-current="true"] .tab__count { color: var(--accent-text); }

.page { padding-top: 40px; }
.page-title { font-weight: 700; letter-spacing: -0.035em; }
.page-desc { color: var(--text-2); }
.search { border: 0; box-shadow: var(--shadow); height: 56px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.search__key { border: 0; }
.select-wrap select, .multi__btn, .chip, .more-btn { border-color: transparent; background: var(--surface); }
.select-wrap select:hover, .multi__btn:hover, .chip:hover, .more-btn:hover { border-color: transparent; background: var(--surface-3); }
.multi__btn.is-active, .chip[aria-pressed="true"] { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.chip--reset { background: transparent; color: var(--accent-text); }
.chip--reset:hover { background: var(--accent-soft); }
.chip--fav[aria-pressed="true"] { background: var(--star); }
.multi__menu { border: 0; }
.multi__done { background: var(--accent); color: var(--on-accent); }
.multi__done:hover { background: var(--accent-strong); }

.profile, .recent__list, .cat-card, .card, .twin, .profile--empty { border: 0; }
.recent__list li + li { border-top-color: var(--surface-2); }
.cat-card { box-shadow: var(--shadow); }
.cat-card:hover { transform: translateY(-2px); }
.cat-card:active, .card:active { transform: scale(0.985); }
.cat-card--primary { background: var(--accent); color: var(--on-accent); }
.cat-card--primary .cat-card__desc, .cat-card--primary .cat-card__arrow { color: rgba(255, 255, 255, 0.8); }
.cat-card--primary:hover .cat-card__arrow { color: #fff; }
.card { box-shadow: var(--shadow); padding: 20px 20px 18px; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card--fav { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--star) 55%, transparent), var(--shadow); }
.badge { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.twin { background: var(--surface-2); }
.twin:hover { background: var(--surface-3); }
.empty { border: 0; background: var(--surface); }
.more-btn { font-weight: 700; color: var(--text-2); }
.footer { border-top: 0; }

.sheet__panel { border: 0; border-radius: 24px; }
.detail__title { font-weight: 700; letter-spacing: -0.035em; }
.copy-btn { border: 0; background: var(--surface-2); color: var(--text-2); height: 32px; border-radius: 8px; }
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn--danger, .copy-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { background: var(--accent); color: var(--on-accent); border-radius: var(--r-sm); height: 40px; padding: 0 16px; font-size: 14px; }
.link-btn:hover { opacity: 1; background: var(--accent-strong); }
.prompt-box { border: 0; }

.write-btn { background: var(--accent); color: var(--on-accent); border-radius: var(--r-sm); }
.write-btn:hover { opacity: 1; background: var(--accent-strong); }
.field input:not([type="checkbox"]), .field textarea, .field select { border-color: transparent; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.field input:focus, .field textarea:focus, .field select:focus { background: var(--surface); border-color: var(--accent); box-shadow: none; }
.form-error { background: var(--danger-soft); }
.editor-actions .link-btn { flex: 1; justify-content: center; height: 54px; font-size: 16px; border-radius: 14px; }
.editor-actions .copy-btn { border-radius: 14px; padding: 0 22px; font-size: 15px; }

.toast { border-radius: 14px; padding: 12px 18px; }
.chat-panel { border: 0; border-radius: 24px; }
.chat-head, .chat-form { border-color: var(--surface-2); }
.chat-head__btn { border: 0; background: var(--surface-2); }
.chat-head__btn:hover { background: var(--surface-3); }
.chat-msg { border-radius: 18px; }
.chat-msg--user { background: var(--accent); color: var(--on-accent); }
.chat-form textarea, .chat-code input { border-color: transparent; background: var(--surface-2); }
.chat-fab { box-shadow: 0 8px 24px rgba(49, 130, 246, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12); }

@media (max-width: 640px) {
  /* 상단바 2줄: 이름·테마 버튼 / 카테고리 탭(가로 스크롤, 오른쪽 끝을 흐리게 해서 더 있음을 알림) */
  .topbar__inner { gap: 10px; }
  .brand { font-size: 17px; flex: 1; }
  .write-btn { height: 34px; padding: 0 12px; font-size: 13px; }
  .overview__cats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cat-card { padding: 16px 14px 14px; border-radius: var(--r-md); }
  .cat-card__count { font-size: 28px; }
  .cat-card__soon { font-size: 17px; }
  .cat-card__name { margin-top: 8px; font-size: 14.5px; }
  .cat-card__desc { display: none; }
  .cat-card__arrow { right: 12px; top: 14px; width: 16px; height: 16px; }
  .page { padding-top: 28px; }
  .grid { grid-template-columns: 1fr; }
  .search { height: 52px; }
  .search__key { display: none; }
  .sheet__panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 88vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 22px 18px 32px; animation-name: slide-up;
  }
  .detail__title { font-size: 24px; }
  .recent__row { grid-template-columns: 40px 1fr; row-gap: 2px; padding: 12px 14px; }
  .recent__row .badge { display: none; }
  .recent__summary { grid-column: 2; }
  .chat-fab { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .footer { padding-right: 80px; } /* 오른쪽 아래 AI 버튼에 가리지 않게 */
  .chat-panel { right: 8px; left: 8px; bottom: 80px; width: auto; height: calc(100dvh - 100px); }
}

/* 좁은 화면: 왼쪽 메뉴는 본문을 밀지 않고 위에 덮이는 서랍 */
@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; top: 60px; left: 0; bottom: 0; height: auto; width: min(280px, 84vw);
    background: var(--surface); box-shadow: var(--shadow-lift);
    transition: transform var(--normal) var(--ease), visibility var(--normal);
  }
  [data-sidebar="closed"] .sidebar { opacity: 1; transform: translateX(-100%); padding: 20px 12px 24px; }
  .sidebar-scrim { display: block; position: fixed; inset: 60px 0 0; z-index: 39; background: var(--scrim); animation: fade var(--normal) var(--ease); }
  .sidebar-scrim[hidden] { display: none; }
}

/* 손가락으로 누르는 기기: 누르는 영역을 44px 가까이로 (보이는 크기는 거의 그대로) */
@media (pointer: coarse) {
  .chip { height: 40px; padding: 0 14px; }
  .chip--fav, .chip--reset, .select-wrap select { height: 44px; }
  .fav-btn { width: 44px; height: 44px; }
  .fav-btn--card { top: 6px; right: 4px; }
  .copy-btn { height: 40px; padding: 0 14px; }
  .chat-head__btn { height: 40px; }
  .tab { min-height: 40px; }
  .icon-btn { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
