/* ============================================================
   로컬툴즈 — style.css
   라이트/다크, PC/모바일 반응형. 외부 폰트·이미지 없이 시스템 폰트만 씁니다.
   ============================================================ */

/* ---------- 1. 색과 토큰 ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, "Apple SD Gothic Neo",
    "Malgun Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans KR", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f7f6f2;
  --bg-tint: #eef4f0;
  --surface: #ffffff;
  --surface-2: #f3f2ed;
  --surface-3: #e9e7df;
  --border: #e3e0d7;
  --border-strong: #cfcbc0;
  --text: #171a1f;
  --text-2: #3f4652;
  --muted: #6d7480;
  --accent: #0f9d76;
  --accent-strong: #0a7f5f;
  --accent-soft: #e2f5ee;
  --accent-line: #b9e6d6;
  --on-accent: #ffffff;
  --danger: #cf4444;
  --danger-soft: #fdeceb;
  --warn: #a9761a;
  --shadow-sm: 0 1px 2px rgba(23, 26, 31, .06);
  --shadow: 0 10px 30px -18px rgba(23, 26, 31, .35), 0 2px 6px rgba(23, 26, 31, .05);
  --shadow-lg: 0 24px 60px -32px rgba(23, 26, 31, .45);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --header-h: 70px;
  --wrap: 1200px;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0b0f13;
    --bg-tint: #0f1a18;
    --surface: #131a20;
    --surface-2: #182128;
    --surface-3: #1f2a33;
    --border: #243039;
    --border-strong: #33424d;
    --text: #e9eef2;
    --text-2: #c2ccd5;
    --muted: #8f9daa;
    --accent: #37d3a4;
    --accent-strong: #6ee7bf;
    --accent-soft: #122e28;
    --accent-line: #1f4a3f;
    --on-accent: #06231b;
    --danger: #f0837c;
    --danger-soft: #2b1618;
    --warn: #e6b45c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 12px 34px -20px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px -30px rgba(0, 0, 0, .9);
  }
}

html[data-theme="dark"] {
  --bg: #0b0f13;
  --bg-tint: #0f1a18;
  --surface: #131a20;
  --surface-2: #182128;
  --surface-3: #1f2a33;
  --border: #243039;
  --border-strong: #33424d;
  --text: #e9eef2;
  --text-2: #c2ccd5;
  --muted: #8f9daa;
  --accent: #37d3a4;
  --accent-strong: #6ee7bf;
  --accent-soft: #122e28;
  --accent-line: #1f4a3f;
  --on-accent: #06231b;
  --danger: #f0837c;
  --danger-soft: #2b1618;
  --warn: #e6b45c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 12px 34px -20px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -30px rgba(0, 0, 0, .9);
}

/* ---------- 2. 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 420px at 12% -8%, var(--bg-tint), transparent 70%),
    radial-gradient(700px 380px at 100% 0%, var(--accent-soft), transparent 65%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, canvas, svg { max-width: 100%; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; }

.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: fixed; top: -60px; left: 16px; z-index: 200;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  transition: top .18s ease;
}
.skip-link:focus-visible { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- 3. 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header::after {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 55%);
  opacity: .55;
}

.header-inner {
  max-width: var(--wrap); margin: 0 auto;
  min-height: var(--header-h);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--on-accent);
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  box-shadow: var(--shadow-sm);
}
.brand-mark .icon { width: 24px; height: 24px; stroke: currentColor; }
.brand-mark-sm { width: 32px; height: 32px; border-radius: 10px; }
.brand-mark-sm .icon { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16.5px; letter-spacing: -.01em; }
.brand-text small { font-size: 11.5px; color: var(--muted); letter-spacing: .01em; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.local-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px;
  font-size: 12px; font-weight: 500; line-height: 1.3;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
}
.local-badge .icon { width: 15px; height: 15px; }

.lang-switch {
  display: inline-flex; align-items: center;
  padding: 3px; gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.lang-btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.lang-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); cursor: pointer; color: var(--text-2);
  transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn .icon-moon { display: none; }
html[data-theme="dark"] .icon-btn .icon-sun { display: none; }
html[data-theme="dark"] .icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
  html:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
}

/* ---------- 4. 레이아웃 ---------- */
.layout {
  max-width: var(--wrap); margin: 0 auto;
  padding: 28px 24px 56px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.sidebar { position: sticky; top: calc(var(--header-h) + 22px); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-group {
  margin: 16px 0 6px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted);
}
.side-group:first-child { margin-top: 2px; }

.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  font-size: 14px; color: var(--text-2);
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.side-link .icon { width: 18px; height: 18px; color: var(--muted); }
.side-link:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.side-link[aria-current="page"] {
  background: var(--surface); border-color: var(--accent-line); color: var(--text);
  font-weight: 600; box-shadow: var(--shadow-sm);
}
.side-link[aria-current="page"] .icon { color: var(--accent); }

.side-note {
  margin-top: 22px; padding: 12px 13px;
  display: flex; gap: 8px;
  font-size: 11.5px; line-height: 1.45; color: var(--muted);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.side-note .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }

.main { min-width: 0; }

/* 모바일 탭 (데스크톱에서는 숨김) */
.tabstrip { display: none; }

/* ---------- 5. 패널 ---------- */
.tool-panel { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { margin-bottom: 20px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 7px;
}
.panel-head h1 {
  font-size: clamp(23px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.025em;
  line-height: 1.2;
}
.panel-desc {
  margin-top: 8px; max-width: 62ch;
  color: var(--text-2); font-size: 14.5px;
}
.panel-foot {
  margin-top: 14px; display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
}
.panel-foot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: .7;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ---------- 6. 드롭존 ---------- */
.drop-area { position: relative; }
.dropzone {
  display: block; position: relative; cursor: pointer;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface-2);
  background-image: radial-gradient(color-mix(in srgb, var(--border-strong) 55%, transparent) 1px, transparent 1px);
  background-size: 15px 15px;
  padding: 30px 20px;
  text-align: center;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.dropzone:hover { border-color: var(--accent); background-color: var(--accent-soft); }
.dropzone.is-over {
  border-color: var(--accent); background-color: var(--accent-soft);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dz-icon-wrap {
  width: 46px; height: 46px; margin-bottom: 4px;
  display: grid; place-items: center; border-radius: 14px;
  color: var(--accent); background: var(--surface);
  border: 1px solid var(--accent-line);
}
.dz-icon-wrap .icon { width: 22px; height: 22px; }
.dz-title { font-size: 15px; font-weight: 600; }
.dz-sub { font-size: 12.5px; color: var(--muted); }
.dropzone .btn { margin-top: 10px; pointer-events: none; }

.drop-area.has-files .dropzone { padding: 11px 14px; background-color: transparent; background-image: none; border-style: dashed; }
.drop-area.has-files .dz-inner { flex-direction: row; justify-content: center; gap: 9px; }
.drop-area.has-files .dz-icon-wrap,
.drop-area.has-files .dz-sub,
.drop-area.has-files .btn { display: none; }
.drop-area.has-files .dz-title { font-size: 13px; font-weight: 500; color: var(--muted); }
.drop-area.has-files .dz-title::before { content: "+ "; color: var(--accent); font-weight: 700; }

/* 파일 목록 */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-list:empty { margin-top: 0; }
.file-card {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}
.file-thumb {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: 8px;
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-index {
  flex: none; width: 18px; text-align: center;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
}
.file-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.file-name {
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-info {
  font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.file-ops { display: flex; align-items: center; gap: 4px; flex: none; }
.mini-btn {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.mini-btn .icon { width: 16px; height: 16px; }
.mini-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.mini-btn[data-act="remove"]:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); }
.mini-btn:disabled { opacity: .35; cursor: default; }

/* ---------- 7. 옵션 ---------- */
.options {
  margin-top: 20px; padding-top: 20px;
  border-top: 1px dashed var(--border);
  display: grid; gap: 16px 18px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .005em;
}
.field-value {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 6px;
}
.field-unit { font-size: 11px; color: var(--muted); font-weight: 500; }
.field-hint { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.input, .select {
  width: 100%; height: 40px;
  padding: 0 11px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea { height: auto; padding: 11px; line-height: 1.55; resize: vertical; }
.textarea-lg { min-height: 190px; font-size: 14.5px; }
.input-narrow { width: 130px; }

.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.range {
  width: 100%; height: 22px; margin: 9px 0; padding: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px; background: var(--surface-3);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
}
.range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--surface-3); }
.range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
}
.range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 999px; }

.radio-set { gap: 8px; }
.radio-set .field-label { margin-bottom: 2px; }
.radio, .check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--text-2); cursor: pointer;
}
.check.field { flex-direction: row; align-items: center; gap: 9px; }
.check.field input { flex: none; }
.radio input, .check input { accent-color: var(--accent); width: 16px; height: 16px; }

.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] {
  width: 44px; height: 40px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs); cursor: pointer;
}
.color-row .select { flex: 1 1 auto; }

.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border);
}
.hint-inline { font-size: 12px; color: var(--muted); }

/* ---------- 8. 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px;
  font-size: 13.5px; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; border-radius: var(--radius-xs);
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn .icon { width: 17px; height: 17px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 16px -10px color-mix(in srgb, var(--accent) 80%, black);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-soft {
  background: var(--surface-2); color: var(--text);
  border-color: var(--border-strong);
}
.btn-soft:hover:not(:disabled) { background: var(--surface-3); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }

.actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 9px;
  margin-top: 20px;
}
.status { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.status[data-kind="error"] { color: var(--danger); }
.status[data-kind="ok"] { color: var(--accent-strong); }
.status[data-kind="busy"] { color: var(--text-2); }

/* ---------- 9. 결과 ---------- */
.result { margin-top: 18px; }
.result-card {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  padding: 14px 15px;
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
}
.result-badge {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--accent-line); color: var(--accent);
}
.result-body { flex: 1 1 190px; min-width: 0; }
.result-name {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-meta { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-note { font-size: 12.5px; color: var(--text-2); }

/* 썸네일 */
.thumbs {
  margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border);
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  max-height: 460px; overflow: auto;
}
.thumb {
  position: relative; display: block; width: 100%;
  padding: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); overflow: hidden; cursor: default;
}
.thumb canvas, .thumb img { display: block; width: 100%; height: auto; }
.thumb-cap {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 3px 6px; font-family: var(--font-mono); font-size: 10px;
  color: var(--text); background: color-mix(in srgb, var(--surface) 88%, transparent);
  text-align: center; letter-spacing: .03em;
}
.thumbs-rotate .thumb { cursor: pointer; transition: transform .22s ease, border-color .15s ease; }
.thumbs-rotate .thumb:hover { border-color: var(--accent); }
.thumbs-rotate .thumb.is-rotated { border-color: var(--accent-line); }
.thumb-rot {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 6px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  font-family: var(--font-mono); font-size: 9px; color: var(--accent);
  border: 1px solid var(--accent-line);
}
.thumb-rot:empty { display: none; }

.thumb-grid {
  margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border);
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.shot { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.shot img { display: block; width: 100%; height: auto; background: #fff; }
.shot-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5px 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
.shot-bar a {
  color: var(--accent-strong); font-weight: 700; border-bottom: 1px solid var(--accent-line);
}

/* ---------- 10. QR ---------- */
.qr-stage {
  margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--border);
  display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap;
}
.qr-canvas-wrap {
  position: relative; flex: none;
  padding: 14px; border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%) 0 8px/16px 16px,
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%) 8px -8px/16px 16px,
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%) -8px 0/16px 16px,
    var(--surface);
  border: 1px solid var(--border);
  line-height: 0;
}
.qr-canvas-wrap canvas { width: 240px; height: 240px; border-radius: 6px; display: block; }
.qr-empty {
  position: absolute; inset: 14px;
  display: grid; place-items: center; padding: 16px;
  font-size: 12.5px; line-height: 1.4; color: var(--muted); text-align: center;
  background: var(--surface); border-radius: 6px;
}
.qr-canvas-wrap.has-code .qr-empty { display: none; }
.qr-actions { display: flex; flex-direction: column; gap: 9px; flex: 1 1 200px; min-width: 0; }

/* ---------- 11. 글자수 ---------- */
.text-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stats {
  margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--border);
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
}
.stat {
  padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-label { font-size: 11.5px; color: var(--muted); }
.stat-value {
  font-family: var(--font-mono); font-size: 21px; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat-main {
  background: var(--accent-soft); border-color: var(--accent-line);
}
.stat-main .stat-value { color: var(--accent-strong); font-size: 27px; }
.stat.is-over .stat-value { color: var(--danger); }

.limit-row {
  margin-top: 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
}
.limit-row .field-label { flex: none; }
.limit-bar {
  flex: 1 1 160px; height: 6px; min-width: 120px;
  background: var(--surface-3); border-radius: 999px; overflow: hidden;
}
.limit-bar span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 999px;
  transition: width .2s ease, background .2s ease;
}
.limit-bar.is-over span { background: var(--danger); }
.limit-msg { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.limit-msg[data-kind="error"] { color: var(--danger); }

/* ---------- 12. 광고 / 푸터 ---------- */
.ad-slot {
  margin-top: 36px; min-height: 104px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-align: center;
}
.ad-tag {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}
.ad-text { font-size: 12px; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
  padding: 34px 24px 42px;
}
.footer-inner {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start;
}
.footer-brand { display: flex; gap: 12px; max-width: 420px; }
.footer-brand strong { font-size: 14.5px; }
.footer-brand p { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.footer-meta { font-size: 11.5px; color: var(--muted); line-height: 1.7; text-align: right; }
.footer-copy { margin-top: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; }

/* ---------- 13. 토스트 / 알림 ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding: 0 16px; width: max-content; max-width: 92vw;
}
.toast {
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s ease both;
}
.toast[data-kind="error"] { background: var(--danger); color: #fff; }
.toast[data-kind="ok"] { background: var(--accent); color: var(--on-accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.notice {
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px;
}
.notice-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }

/* ---------- 14. 반응형 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 44px; gap: 18px; }
  .sidebar { display: none; }

  .site-header { position: sticky; }
  .header-inner { flex-wrap: wrap; padding: 10px 16px; gap: 10px; min-height: 0; }
  .brand-text small { display: none; }
  .header-right { display: contents; }
  .lang-switch { margin-left: auto; }
  .local-badge {
    order: 5; flex: 1 1 100%; justify-content: center;
    font-size: 11px; padding: 6px 10px;
  }
  .tabstrip {
    display: flex; gap: 6px;
    padding: 0 16px 10px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .tabstrip::-webkit-scrollbar { display: none; }
  .tab {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    padding: 7px 12px; border-radius: 999px;
    font-size: 12.5px; color: var(--text-2); white-space: nowrap;
    background: var(--surface-2); border: 1px solid var(--border);
  }
  .tab .icon { width: 15px; height: 15px; color: var(--muted); }
  .tab[aria-current="page"] {
    background: var(--accent-soft); border-color: var(--accent-line);
    color: var(--accent-strong); font-weight: 600;
  }
  .tab[aria-current="page"] .icon { color: var(--accent); }

  .panel-head h1 { font-size: 22px; }
  .card { padding: 16px; border-radius: 15px; }
  .dropzone { padding: 24px 14px; }
  .options { grid-template-columns: minmax(0, 1fr); }
  .thumbs { max-height: 380px; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .qr-stage { gap: 16px; }
  .qr-canvas-wrap { margin: 0 auto; }
  .qr-canvas-wrap canvas { width: min(240px, 62vw); height: min(240px, 62vw); }
  .footer-inner { flex-direction: column; }
  .footer-meta { text-align: left; }
  .stat-value { font-size: 19px; }
  .stat-main .stat-value { font-size: 24px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-text strong { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* 색상 선택 라벨 (QR) */
.color-field {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.color-field input[type="color"] {
  width: 40px; height: 36px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs); cursor: pointer;
}
