:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --text: #1c1e26;
  --muted: #6b7080;
  --border: #dcdfe8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --danger: #d92d3f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 6px 24px rgba(20, 24, 50, 0.08);
}

h1 { margin: 0 0 4px; font-size: 1.5rem; }
.sub { margin: 0 0 20px; color: var(--muted); font-size: 0.95rem; }

label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

.row { display: flex; gap: 8px; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 1rem; /* 16px 이상: iOS 자동 확대 방지 */
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn {
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }

.error { margin: 8px 0 0; color: var(--danger); font-size: 0.875rem; }

.colors {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}
.color-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.color-item span { font-size: 0.9rem; }
input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #fafbfd;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
#qr-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.placeholder { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 0 16px; }

.download {
  width: 100%;
  margin-top: 16px;
  background: var(--text);
  color: #fff;
}
.download:disabled { opacity: 0.35; cursor: not-allowed; }

/* 모바일 */
@media (max-width: 480px) {
  body { padding: 12px; }
  .card { padding: 18px; }
  .row { flex-direction: column; }
  .btn { width: 100%; }
  .colors { flex-direction: column; gap: 8px; }
}
