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

:root {
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --primary: #4299e1;
  --primary-hover: #3182ce;
  --secondary: #48bb78;
  --secondary-hover: #38a169;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --preview-bg: #f7fafc;
  --error: #e53e3e;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.app-container {
  width: 100%;
  max-width: 460px;
}

.app-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.app-header h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.subtitle {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

/* ── Field groups ── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.15s;
  outline: none;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--primary);
}

select {
  cursor: pointer;
}

/* ── Color row ── */
.color-row {
  display: flex;
  gap: 2rem;
}

.color-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-start;
}

input[type="color"] {
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 3px;
  background: var(--card-bg);
}

/* ── Range slider ── */
input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
}

/* ── Error message ── */
.error-msg {
  font-size: 0.85rem;
  color: var(--error);
  margin-top: 0.2rem;
}

/* ── QR Preview ── */
.preview-section {
  background: var(--preview-bg);
  border-radius: 12px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

#qr-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-container canvas,
#qr-container img {
  border-radius: 4px;
  display: block;
}

.placeholder-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Buttons ── */
.action-row {
  display: flex;
  gap: 0.75rem;
}

.btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
