:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px;
}

.app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.attribution {
  margin: 8px auto 0;
  font-size: 13px;
  color: var(--muted);
}

header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.url-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.url-field input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.url-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.styles {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.styles legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.style-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.style-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

.style-option input {
  accent-color: var(--accent);
}

.style-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.swatch-classic {
  background:
    repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.swatch-dots {
  background: radial-gradient(circle at 25% 25%, #fff 2px, transparent 3px),
    radial-gradient(circle at 75% 25%, #2563eb 2px, transparent 3px),
    radial-gradient(circle at 25% 75%, #2563eb 2px, transparent 3px),
    radial-gradient(circle at 75% 75%, #fff 2px, transparent 3px);
  background-size: 16px 16px;
}

.swatch-rounded {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 50%;
}

.accent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.accent-row input[type="color"] {
  width: 44px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  cursor: pointer;
}

.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.frame {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.frame.hidden {
  display: none;
}

#qr-canvas {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 8px;
}

.preview .placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 80px 24px;
  text-align: center;
}

#download-btn {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

#download-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

#download-btn:active:not(:disabled) {
  transform: translateY(1px);
}

#download-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
