:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-border: #e3e7f1;
  --color-text: #10162f;
  --color-text-muted: #5b6478;
  --color-accent: #3355ff;
  --color-accent-dark: #2540cc;
  --color-accent-soft: #eaefff;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 20px 45px -25px rgba(16, 22, 47, 0.35);
  --shadow-soft: 0 10px 25px -15px rgba(16, 22, 47, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--color-accent);
  background-image:
    linear-gradient(var(--color-surface) 0 100%),
    linear-gradient(var(--color-surface) 0 100%);
  background-size: 8px 8px, 8px 8px;
  background-position: 4px 4px, 12px 12px;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 3px var(--color-accent);
}

.brand__accent { color: var(--color-accent); }

.brand__tag {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.brand__tag:hover { color: var(--color-accent); }

/* Hero */

.hero {
  text-align: center;
  padding: 72px 24px 56px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.hero h1 .accent {
  color: var(--color-accent);
}

.hero__sub {
  max-width: 560px;
  margin: 0 auto 28px;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.hero__cta {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hero__cta:hover {
  background: var(--color-accent-dark);
  transform: translateY(-1px);
}

/* Generator */

.generator {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  padding-bottom: 96px;
  align-items: start;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.panel__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--color-text);
}

.panel__title--preview {
  margin-top: 28px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

#url-input {
  width: 100%;
  font-size: 1rem;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #fbfcfe;
}

#url-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
  background: #fff;
}

.field-error {
  color: #c0261f;
  font-size: 0.85rem;
  margin: 8px 2px 0;
}

.preview {
  display: flex;
  justify-content: center;
}

.preview__card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  width: min(320px, 100%);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.downloads {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

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

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

.btn--secondary {
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
}
.btn--secondary:not(:disabled):hover { background: #dce4ff; }

/* Options panel */

.option-group + .option-group {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.swatch-grid {
  display: grid;
  gap: 10px;
}

.swatch-grid--pattern {
  grid-template-columns: repeat(4, 1fr);
}

.pattern-btn {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: #fbfcfe;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pattern-btn svg {
  width: 100%;
  height: 100%;
  fill: var(--color-text);
}

.pattern-btn.is-active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.pattern-btn.is-active svg { fill: var(--color-accent); }

.swatch-grid--color {
  grid-template-columns: repeat(6, 1fr);
}

.color-btn {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(16, 22, 47, 0.08);
  cursor: pointer;
  padding: 0;
  position: relative;
}

.color-btn.is-active {
  border-color: var(--color-accent);
}

.color-btn.is-active::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px #fff;
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.custom-color-row input[type="color"] {
  width: 40px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  background: none;
}

#ecl-select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: #fbfcfe;
  font-size: 0.95rem;
  color: var(--color-text);
}

.hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 10px 2px 0;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0 40px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-note { margin: 0; }

.footer-legal {
  margin: 0;
  font-size: 0.8rem;
}

.footer-legal strong { color: var(--color-text); font-weight: 600; }

@media (max-width: 860px) {
  .generator {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .panel { padding: 22px; }
  .swatch-grid--color { grid-template-columns: repeat(5, 1fr); }
}
