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

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --shadow: 0 1px 3px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 6%);
  --radius: 14px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --border: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #1e1b4b;
    --shadow: 0 1px 3px rgb(0 0 0 / 20%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgb(79 70 229 / 12%), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.logo h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.main {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .main {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

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

textarea,
select {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

textarea:focus,
select:focus,
input[type="range"]:focus-visible,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(79 70 229 / 20%);
}

.presets {
  margin-bottom: 1rem;
}

.presets-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

.options {
  margin-bottom: 1rem;
}

.options:last-child {
  margin-bottom: 0;
}

.options summary {
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.options-hint {
  margin: -0.25rem 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.logo-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

input[type="file"] {
  font: inherit;
  font-size: 0.875rem;
  color: var(--text-muted);
}

input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.logo-preview {
  display: block;
  max-width: 4.5rem;
  max-height: 4.5rem;
  margin-top: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--bg);
}

.line-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.line-input:last-child {
  margin-bottom: 0;
}

.line-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(79 70 229 / 20%);
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
}

.options-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

output {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 4.5rem;
  text-align: right;
}

.color-field input[type="color"] {
  width: 100%;
  height: 2.5rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-card {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 1.25rem;
}

.preview-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

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

.empty-state {
  position: absolute;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: center;
  padding: 1rem;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

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

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--accent);
  text-align: center;
}

.footer {
  margin-top: 2.5rem;
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
