/* ==========================================================================
   QR 스튜디오 — 華而不侈 (화이불치)
   화려하되 사치스럽지 않게: 한지 바탕, 먹빛 글자, 청자 한 점.
   ========================================================================== */

:root {
  /* 바탕과 표면 */
  --paper: #f7f5f0;
  --paper-soft: #fbf9f4;
  --paper-deep: #efebe2;
  --surface: #ffffff;

  /* 글자 */
  --ink: #1a1917;
  --ink-soft: #46423a;
  --muted: #7c766a;
  --faint: #a49d8f;

  /* 선 */
  --line: #e6e1d6;
  --line-strong: #d6d0c1;

  /* 포인트 */
  --accent: #28594f;
  --accent-soft: rgba(40, 89, 79, 0.07);
  --accent-line: rgba(40, 89, 79, 0.28);
  --danger: #a8443a;

  /* 형태 */
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;
  --r-full: 999px;

  --serif: "Noto Serif KR", "Noto Serif CJK KR", "Nanum Myeongjo", "Apple SD Gothic Neo", Georgia, serif;
  --sans: "Pretendard", "Noto Sans KR", "Noto Sans CJK KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;

  --shadow-card: 0 1px 1px rgba(26, 25, 23, 0.03), 0 10px 30px -24px rgba(26, 25, 23, 0.35);
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--sans);
  background-color: var(--paper);
  background-image: radial-gradient(1100px 520px at 50% -8%, #fffdf8 0%, rgba(255, 253, 248, 0) 62%);
  background-repeat: no-repeat;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(40, 89, 79, 0.16); }

/* ── 틀 ─────────────────────────────────────────────────────────────────── */
.app-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 34px 28px 44px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── 머리말 ─────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  background: var(--surface);
  flex: none;
}

.brand-text h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--ink);
}

.brand-text h1 span {
  color: var(--accent);
  margin-left: 0.1em;
}

.header-meta { display: flex; align-items: center; gap: 10px; padding-bottom: 4px; }

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
}

.meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

/* ── 2열 배치 ───────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  grid-auto-rows: min-content;
  gap: 22px 26px;
  align-items: start;
  flex: 1;
}

.control-card { grid-column: 1; grid-row: 1; }
.preview-panel { grid-column: 2; grid-row: 1 / span 2; }
.history-card { grid-column: 1; grid-row: 2; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.control-card { padding: 22px 24px 20px; }

/* ── 탭 ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  padding: 11px 6px 13px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--ease);
}

.tab-btn svg { opacity: 0.65; transition: opacity var(--ease); }

.tab-btn::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -1px;
  height: 2px;
  background: transparent;
  transition: background var(--ease);
}

.tab-btn:hover { color: var(--ink-soft); }
.tab-btn:hover svg { opacity: 0.9; }

.tab-btn.active {
  color: var(--ink);
  font-weight: 600;
}

.tab-btn.active svg { opacity: 1; color: var(--accent); }
.tab-btn.active::after { background: var(--accent); }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: paneIn 0.24s ease-out; }

@keyframes paneIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 입력 ───────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field-note {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  text-transform: uppercase;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  font-family: inherit;
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 11px 13px;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--faint); }

.form-input:hover,
.form-textarea:hover,
.form-select:hover { border-color: var(--muted); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-textarea {
  resize: vertical;
  min-height: 92px;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c766a' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-row { display: flex; gap: 14px; }
.flex-1 { flex: 1; min-width: 0; }

.input-with-actions { position: relative; display: flex; align-items: center; }

.input-with-actions .form-input { padding-right: 72px; }

.icon-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.icon-btn:hover { color: var(--ink); background: var(--paper-deep); }

#btn-paste-url { right: 36px; }
#btn-clear-url { right: 7px; }
#btn-clear-caption { right: 7px; }

.caption-input { letter-spacing: 0.01em; }

.field-hint {
  font-size: 0.75rem;
  color: var(--faint);
  line-height: 1.55;
}

/* 빠른 선택 */
.quick-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.quick-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-right: 2px;
}

.chip-btn {
  font-family: inherit;
  font-size: 0.74rem;
  color: var(--ink-soft);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 3px 11px;
  cursor: pointer;
  transition: all var(--ease);
}

.chip-btn:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── 상단 설명 텍스트 칸 ───────────────────────────────────────────────── */
.caption-field {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.caption-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.char-counter {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--faint);
  white-space: nowrap;
}

/* ── 세부 설정 접이식 ───────────────────────────────────────────────────── */
.style-details {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.style-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.style-details > summary::-webkit-details-marker { display: none; }

.summary-main {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.summary-sub {
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}

.summary-mark {
  position: relative;
  margin-left: auto;
  width: 12px;
  height: 12px;
  flex: none;
}

.summary-mark::before,
.summary-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--muted);
  transition: transform var(--ease), opacity var(--ease);
}

.summary-mark::before { width: 11px; height: 1px; transform: translate(-50%, -50%); }
.summary-mark::after { width: 1px; height: 11px; transform: translate(-50%, -50%); }

.style-details[open] .summary-mark::after { transform: translate(-50%, -50%) scaleY(0); opacity: 0; }
.style-details[open] > summary { padding-bottom: 6px; }

.details-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 2px 18px;
  animation: paneIn 0.24s ease-out;
}

.control-sublabel {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 7px;
}

.style-row,
.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.color-control { display: flex; flex-direction: column; }

.color-picker-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
}

.color-input {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  padding: 0;
  cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: var(--r-sm); }

.color-hex {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* 테마 프리셋 */
.presets-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-label {
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.theme-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.74rem;
  color: var(--ink-soft);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 3px 10px 3px 4px;
  cursor: pointer;
  transition: all var(--ease);
}

.theme-preset-btn:hover { border-color: var(--line-strong); background: #fff; }

.theme-preset-btn.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.split-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  flex: none;
}

/* 슬라이더 */
.slider-group { display: flex; flex-direction: column; }

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.slider-header .control-sublabel { margin-bottom: 0; }

.slider-value {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.custom-range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 16px;
  background: transparent;
  cursor: pointer;
}

.custom-range::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line-strong);
  border-radius: 1px;
}

.custom-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  box-shadow: 0 1px 3px rgba(26, 25, 23, 0.15);
  transition: transform var(--ease);
}

.custom-range::-webkit-slider-thumb:hover { transform: scale(1.15); }

.custom-range::-moz-range-track { height: 2px; background: var(--line-strong); }
.custom-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--accent);
}

/* 로고 */
.options-grid { display: flex; gap: 18px; align-items: flex-start; }

.logo-control-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.logo-badge-hint {
  font-size: 0.68rem;
  color: var(--faint);
  white-space: nowrap;
}

.logo-preset-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }

.logo-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 5px 9px 5px 7px;
  cursor: pointer;
  transition: all var(--ease);
}

.logo-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  transition: transform var(--ease);
}

.logo-chip-icon svg { display: block; width: 100%; height: 100%; }

.logo-chip-label { white-space: nowrap; }

.logo-chip-btn:hover { border-color: var(--line-strong); background: #fff; }

.logo-chip-btn:hover .logo-chip-icon { transform: scale(1.08); }

.logo-chip-btn.active {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  font-weight: 500;
}

.logo-chip-btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

.custom-logo-uploader { display: flex; flex-direction: column; gap: 7px; }

.btn-upload-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  font-family: inherit;
  font-size: 0.76rem;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px 10px;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-upload-logo:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

.uploaded-logo-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-soft);
}

.logo-thumb-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 2px;
  flex: none;
}

.logo-file-name {
  flex: 1;
  min-width: 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-remove-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--faint);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--ease);
  flex: none;
}

.btn-remove-logo:hover { color: var(--danger); background: rgba(168, 68, 58, 0.08); }

/* ── 버튼 ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 11px 18px;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-primary,
.btn-download-png {
  background: var(--ink);
  color: #fbf9f4;
  border-color: var(--ink);
}

.btn-primary:hover,
.btn-download-png:hover {
  background: #2c2a26;
  border-color: #2c2a26;
}

.btn-primary:active,
.btn-download-png:active { transform: translateY(1px); }

.btn-copy {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--line-strong);
}

.btn-copy:hover { background: var(--paper-soft); color: var(--ink); }

.btn-sub {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  font-size: 0.78rem;
  padding: 9px 12px;
}

.btn-sub:hover { color: var(--ink); border-color: var(--line-strong); background: var(--paper-soft); }

.action-buttons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* 토글 */
.auto-update-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  flex: none;
}

.auto-update-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 36px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--line-strong);
  transition: background var(--ease);
  flex: none;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(26, 25, 23, 0.2);
  transition: transform var(--ease);
}

.auto-update-toggle input:checked + .toggle-slider { background: var(--accent); }
.auto-update-toggle input:checked + .toggle-slider::after { transform: translateX(18px); }
.auto-update-toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px var(--accent-soft); }

.toggle-label { font-size: 0.76rem; color: var(--muted); letter-spacing: 0.02em; }

/* ── 미리보기 ───────────────────────────────────────────────────────────── */
.preview-panel { display: flex; flex-direction: column; gap: 20px; }.preview-card {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-header {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.preview-label {
  font-family: var(--serif);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.ecl-indicator {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.qr-canvas-container {
  position: relative;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.qrcode-box {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.qrcode-box canvas,
.qrcode-box img {
  display: block;
  max-width: 100%;
  height: auto !important;
  border-radius: 1px;
  box-shadow: 0 10px 26px -18px rgba(26, 25, 23, 0.55);
}

.preview-zoom-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--ease);
}

.preview-zoom-btn:hover { color: var(--accent); border-color: var(--accent-line); }

/* 내용 요약 */
.content-summary-card {
  width: 100%;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.char-count {
  color: var(--faint);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.summary-value {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.79rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-caption {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 내보내기 */
.download-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.export-main-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 8px;
}

.export-sub-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

/* ── 최근 기록 ──────────────────────────────────────────────────────────── */
.history-card { padding: 18px 22px 16px; }

.history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.history-header h3 {
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.btn-clear-history {
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--faint);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--ease);
}

.btn-clear-history:hover { color: var(--danger); }

.history-list {
  display: flex;
  flex-direction: column;
  max-height: 186px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--ease);
}

.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--accent-soft); }

.history-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.history-type-badge {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.history-text {
  font-size: 0.79rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.history-caption {
  font-family: var(--serif);
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.history-time {
  font-size: 0.68rem;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.empty-history-text {
  font-size: 0.78rem;
  color: var(--faint);
  text-align: center;
  padding: 22px 0;
}

/* ── 바닥글 ─────────────────────────────────────────────────────────────── */
.app-footer {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.app-footer p {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--faint);
}

/* ── 확대 모달 ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 25, 23, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-overlay.active { display: flex; animation: overlayIn 0.2s ease-out; }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 70px -30px rgba(26, 25, 23, 0.6);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}

.modal-close-btn {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  transition: all var(--ease);
}

.modal-close-btn:hover { color: var(--ink); background: var(--paper-deep); }

.modal-body {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.modal-body canvas { max-width: 100%; height: auto; display: block; }

.modal-footer {
  padding-top: 12px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  word-break: break-all;
}

/* ── 토스트 ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 44px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  font-size: 0.81rem;
  color: #f7f5f0;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 0 14px 30px -18px rgba(26, 25, 23, 0.8);
  pointer-events: auto;
  animation: toastIn 0.25s ease-out, toastOut 0.3s ease-in forwards 2.8s;
}

.toast-icon { flex: none; opacity: 0.85; }
.toast-success .toast-icon { color: #a7c9be; }
.toast-info .toast-icon { color: #c9c2b3; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }

/* ── 스크롤바 ───────────────────────────────────────────────────────────── */
.history-list::-webkit-scrollbar { width: 8px; }
.history-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-full); border: 2px solid var(--surface); }
.history-list::-webkit-scrollbar-track { background: transparent; }

/* ── 인쇄 ───────────────────────────────────────────────────────────────── */
@media print {
  body { background: #fff !important; background-image: none !important; }

  .app-header,
  .control-card,
  .history-card,
  .preview-header,
  .download-group,
  .content-summary-card,
  .preview-zoom-btn,
  .app-footer,
  .modal-overlay,
  .toast-container { display: none !important; }

  .app-shell { max-width: 100%; padding: 0; display: block; min-height: 0; }

  .layout { display: block; }

  .preview-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0;
  }

  .qr-canvas-container {
    border: none !important;
    background: transparent !important;
    padding: 0;
    min-height: 0;
  }

  .qrcode-box canvas { box-shadow: none !important; }
}

/* ── 반응형 ─────────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .control-card,
  .preview-panel,
  .history-card { grid-column: 1; grid-row: auto; }
  .app-shell { padding: 26px 20px 36px; }
  .qrcode-box { max-width: 420px; }
  .qrcode-box canvas { max-width: 100%; }
}

@media (max-width: 620px) {
  .app-shell { padding: 20px 14px 32px; }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .header-meta { padding-bottom: 0; }
  .brand-text h1 { font-size: 1.42rem; }

  .control-card { padding: 18px 16px 16px; }
  .preview-card { padding: 16px 14px 18px; }
  .history-card { padding: 16px 16px 12px; }

  .tab-btn { gap: 5px; font-size: 0.78rem; padding: 10px 2px 12px; }
  .tab-btn svg { width: 12px; height: 12px; }

  .form-row { flex-direction: column; gap: 0; }
  .style-row, .sliders-grid { grid-template-columns: 1fr; gap: 14px; }
  .options-grid { flex-direction: column; gap: 16px; }
  .options-grid > .form-group.flex-1 { width: 100%; }

  .logo-preset-chips { gap: 4px; }
  .logo-chip-btn { gap: 4px; font-size: 0.7rem; padding: 5px 7px 5px 6px; }
  .logo-chip-icon { width: 15px; height: 15px; flex-basis: 15px; }

  .action-buttons-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .btn-primary { width: 100%; }
  .auto-update-toggle { align-self: flex-start; order: -1; }

  .export-main-actions { grid-template-columns: 1fr; }
  .qr-canvas-container { padding: 14px; }
  .history-text, .history-caption { max-width: 190px; }

  .toast-container { right: 14px; bottom: 14px; }
}
