/* 스냅폴더 디자인 시스템 v2 — 절제된 신뢰형. 토큰 → 컴포넌트 → 유틸 순 */
:root {
  --bg: #f4f6fb; --bg-2: #eceff7; --card: #ffffff; --ink: #0f1320; --ink-2: #3b4356; --muted: #667085; --line: #e4e8f0; --line-2: #d3d9e6;
  --brand: #3557ff; --brand-2: #6d5dff; --brand-ink: #1f38c8; --brand-soft: #eaeeff; --brand-ring: rgba(53,87,255,.28);
  --ok: #1a9a5c; --ok-soft: #e3f6ec; --warn: #b8791c; --warn-soft: #fff4de; --bad: #d23b35; --bad-soft: #fde9e7;
  --radius: 16px; --radius-s: 11px;
  --shadow: 0 1px 2px rgba(15,19,32,.04), 0 10px 30px -14px rgba(15,19,32,.16);
  --shadow-lg: 0 2px 4px rgba(15,19,32,.05), 0 24px 60px -24px rgba(53,87,255,.28);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0c0f16; --bg-2: #121722; --card: #161b26; --ink: #eef1f7; --ink-2: #c3c9d6; --muted: #8e97ab; --line: #262d3c; --line-2: #333c4f; --brand: #7d8fff; --brand-2: #a08cff; --brand-ink: #b3bdff; --brand-soft: #1b2347; --brand-ring: rgba(125,143,255,.35); --ok: #45c481; --ok-soft: #12301f; --warn: #e5a83d; --warn-soft: #3a2b10; --bad: #f4736c; --bad-soft: #3e1a18; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px -14px rgba(0,0,0,.7); --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 60px -24px rgba(0,0,0,.8); }
}
:root[data-theme="dark"] { --bg: #0c0f16; --bg-2: #121722; --card: #161b26; --ink: #eef1f7; --ink-2: #c3c9d6; --muted: #8e97ab; --line: #262d3c; --line-2: #333c4f; --brand: #7d8fff; --brand-2: #a08cff; --brand-ink: #b3bdff; --brand-soft: #1b2347; --brand-ring: rgba(125,143,255,.35); --ok: #45c481; --ok-soft: #12301f; --warn: #e5a83d; --warn-soft: #3a2b10; --bad: #f4736c; --bad-soft: #3e1a18; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; font-size: 16px; font-feature-settings: "tnum"; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--brand-soft); }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; border-radius: 6px; }

/* 레이아웃 */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 56px; }
.wrap.wide { max-width: 1080px; }
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 14px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: -.01em; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; font-size: 15px; box-shadow: 0 6px 16px -6px var(--brand-ring); }
.logo small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 2px; }
nav.menu { display: flex; gap: 4px; }
nav.menu a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
nav.menu a:hover, nav.menu a[aria-current] { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 14px; }
.card.flat { box-shadow: none; }
h1 { font-size: 27px; letter-spacing: -.025em; line-height: 1.22; margin: 0 0 8px; font-weight: 800; }
h2 { font-size: 19px; margin: 0 0 10px; letter-spacing: -.015em; font-weight: 800; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); margin-bottom: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 10px; }

/* 버튼 */
.btn { appearance: none; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: var(--radius-s); padding: 12px 18px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .06s ease, background .15s, box-shadow .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--bg-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 85%, #000)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px var(--brand-ring); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn.icon { width: 40px; min-height: 40px; padding: 0; }

/* 입력 */
input[type=text], input[type=tel], input[type=date], select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--card); color: var(--ink); min-height: 48px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
label.field { display: block; font-weight: 700; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 상태 표시 */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.pill.warn .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.notice { padding: 11px 13px; border-radius: var(--radius-s); font-size: 14px; background: var(--brand-soft); color: var(--brand-ink); border: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* 단계 카드 */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: s; }
.step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.step::before { counter-increment: s; content: counter(s, decimal-leading-zero); font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--brand-ink); background: var(--brand-soft); padding: 4px 8px; border-radius: 6px; display: inline-block; margin-bottom: 10px; }

/* 코드·QR */
.code { font-family: var(--mono); font-size: 42px; letter-spacing: .16em; font-weight: 800; text-align: center; margin: 6px 0; color: var(--ink); }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.qr svg { width: min(250px, 68vw); height: auto; }

/* 프리셋 선택 */
.preset { display: grid; gap: 8px; }
.preset label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-s); cursor: pointer; background: var(--card); transition: border-color .15s, background .15s; }
.preset label:hover { border-color: var(--line-2); }
.preset input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); }
.preset label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.preset b { display: block; font-size: 15px; }
.preset span { display: block; color: var(--muted); font-size: 13px; }

/* 목록 */
.list { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--card); }
.list .it { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 14px; }
.list .it:first-child { border-top: 0; }
.list .it img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--bg-2); }
.list .it .nm { font-weight: 700; word-break: break-all; }
.list .it .sub { color: var(--muted); font-size: 12px; }
.bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .15s; border-radius: 999px; }

.hidden { display: none !important; }
.sas { font-family: var(--mono); font-weight: 800; letter-spacing: .12em; background: var(--brand-soft); color: var(--brand-ink); padding: 2px 8px; border-radius: 6px; }
.filepick { position: relative; overflow: hidden; }
.filepick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
footer.foot { color: var(--muted); font-size: 12px; text-align: center; padding-top: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.sticky-cta { position: sticky; bottom: 0; z-index: 10; padding: 10px 0 max(10px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 35%); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } h1 { font-size: 23px; } .code { font-size: 34px; } .card { padding: 18px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* PC 2단(본문 + 격리 광고 레일). 폰에서는 레일 자체를 만들지 않는다 */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side-col { position: sticky; top: 72px; }
.ad-rail iframe { width: 100%; height: 340px; border: 0; border-radius: var(--radius); background: var(--bg-2); color-scheme: light dark; }
.ad-rail.collapsed iframe { height: 0; }
.ad-rail .ad-toggle { float: right; margin-bottom: 4px; }
@media (max-width: 899px) { .two-col { grid-template-columns: 1fr; } .side-col { display: none; } }

/* v0.3 — 폰 썸네일 격자, 폴더명 빠른 입력, 크게 보기 */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin-top: 10px; max-height: 300px; overflow: auto; }
.thumb { position: relative; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
.thumb button { position: absolute; top: 3px; right: 3px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.62); color: #fff; font-size: 13px; cursor: pointer; }
button.chip { border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; min-height: 34px; padding: 6px 12px; }
.list .it img[tabindex] { cursor: zoom-in; }
.viewer { border: 0; padding: 8px; border-radius: var(--radius); background: var(--card); color: var(--muted); text-align: center; max-width: 94vw; }
.viewer img { display: block; max-width: 90vw; max-height: 82vh; border-radius: 10px; }
.viewer::backdrop { background: rgba(0,0,0,.72); }
