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

:root {
  --bg: #0f0f11;
  --surface: #1a1a1f;
  --surface-2: #22222a;
  --border: #2a2a32;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-contrast: #ffffff;
  --danger: #f87171;
  --success: #34d399;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --max-width: 1000px;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --border: #e5e7eb;
    --text: #111827;
    --text-muted: #4b5563;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-contrast: #ffffff;
    --danger: #dc2626;
    --success: #059669;
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  }
}

html[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #4b5563;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-contrast: #ffffff;
  --danger: #dc2626;
  --success: #059669;
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] {
  --bg: #0f0f11;
  --surface: #1a1a1f;
  --surface-2: #22222a;
  --border: #2a2a32;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-contrast: #ffffff;
  --danger: #f87171;
  --success: #34d399;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

body[dir="rtl"] {
  font-family: "Segoe UI", system-ui, -apple-system, "Tahoma", sans-serif;
}

a {
  color: var(--accent-hover);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1000;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 1rem; text-decoration: none; }

.noscript-banner {
  background: var(--danger);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header --- */

.site-header {
  width: 100%;
  padding: 1.25rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand span { color: var(--accent-hover); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(0.95); }

.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }
html[data-theme="dark"] .icon-btn .icon-sun,
:root:not([data-theme]) .icon-btn .icon-sun {
  display: block;
}
html[data-theme="dark"] .icon-btn .icon-moon,
:root:not([data-theme]) .icon-btn .icon-moon {
  display: none;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-btn .icon-sun { display: none; }
  :root:not([data-theme]) .icon-btn .icon-moon { display: block; }
}

.lang-switcher { display: flex; align-items: center; gap: 0.5rem; }
.lang-switcher select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
}

/* --- Hero --- */

.hero {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  width: 100%;
}
.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- App (generator) --- */

.app {
  display: flex;
  gap: 3rem;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  align-items: flex-start;
}
.controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.field textarea,
.field select,
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="url"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s;
  width: 100%;
}
.field textarea:focus,
.field select:focus,
.field input[type="text"]:focus,
.field input[type="tel"]:focus,
.field input[type="email"]:focus,
.field input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
}
.field-row { display: flex; gap: 1rem; }
.field-row > .field { flex: 1; min-width: 0; }

.checkbox-field { justify-content: flex-end; }
.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

/* Builder panels */

.builder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: slide-down 0.18s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Color picker */

.color-pick { display: flex; align-items: center; gap: 0.6rem; }
.color-pick input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: none;
  padding: 2px;
}
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
.color-pick span {
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Palette swatches */

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

.swatch {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.swatch:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}
.swatch span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}

/* Range */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
#size-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  display: block;
  margin-top: 0.15rem;
}

/* Drop zone */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}
.drop-zone.has-file {
  border-style: solid;
  border-color: var(--success);
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-icon { color: var(--text-muted); }
.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon { color: var(--accent); }
.drop-text { font-size: 0.9rem; font-weight: 500; }
.drop-hint { font-size: 0.75rem; color: var(--text-muted); }

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Buttons */

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.btn {
  flex: 1 1 130px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):hover { border-color: var(--accent); }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:not(:disabled):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-small {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: border-color 0.15s;
  align-self: flex-start;
}
.btn-small:hover { border-color: var(--accent); color: var(--text); }

.hidden { display: none !important; }

/* Preview */

.preview {
  position: sticky;
  top: 2rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
#qr-canvas-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 300px;
  height: 300px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: background 0.2s;
}

#qr-canvas-wrapper[data-bg="light"] { background: #ffffff; }
#qr-canvas-wrapper[data-bg="dark"]  { background: #0f0f11; }
#qr-canvas-wrapper[data-bg="check"] {
  background-color: #f0f0f0;
  background-image:
    linear-gradient(45deg, #cccccc 25%, transparent 25%),
    linear-gradient(-45deg, #cccccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cccccc 75%),
    linear-gradient(-45deg, transparent 75%, #cccccc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.qr-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0;
  gap: 0;
  transition: padding 0.2s, background 0.2s, gap 0.2s;
  border-radius: 8px;
}
.qr-frame-label {
  display: none;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
  text-transform: uppercase;
}
.qr-frame.has-frame {
  padding: 10px 10px 6px;
  gap: 6px;
}
.qr-frame.has-frame .qr-frame-label { display: block; }
#qr-canvas-wrapper.fade-in #qr-image {
  animation: qr-in 0.22s ease-out;
}
@keyframes qr-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

#placeholder-msg {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
#qr-image {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* History */

.history {
  width: 300px;
  max-width: 100%;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.history-head h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.history-head .btn-small { margin-top: 0; }
.history-list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem;
  scrollbar-width: thin;
}
.history-card {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 68px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.history-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.history-card img {
  width: 54px;
  height: 54px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
}
.history-card span {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Embed panel */

.embed-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.embed-panel[open] { border-color: var(--accent); }
.embed-panel summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  list-style: none;
}
.embed-panel summary::-webkit-details-marker { display: none; }
.embed-panel summary::after {
  content: "+";
  float: right;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.embed-panel[open] summary::after { content: "−"; }
body[dir="rtl"] .embed-panel summary::after { float: left; }
.embed-body {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.embed-body textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 0.75rem;
  padding: 0.5rem 0.7rem;
  resize: vertical;
  width: 100%;
}

/* Batch panel */

.batch-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}
.batch-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.batch-upload {
  cursor: pointer;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  margin-top: 0;
}
#batch-generate { flex: 1 1 auto; }

.batch-progress {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.batch-progress.hidden { display: none; }
.batch-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.batch-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease-out;
}
#batch-progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Score badge */

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: border-color 0.2s;
}
.score-badge[data-level="high"]   { border-color: var(--success); }
.score-badge[data-level="medium"] { border-color: #f59e0b; }
.score-badge[data-level="low"]    { border-color: var(--danger); }

.score-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.score-badge[data-level="high"]   .score-dot { background: var(--success); }
.score-badge[data-level="medium"] .score-dot { background: #f59e0b; }
.score-badge[data-level="low"]    .score-dot { background: var(--danger); }
.score-badge strong { color: var(--text); font-weight: 600; }

/* Background toggle for preview */

.bg-toggle {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bg-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
}
.bg-btn:hover { color: var(--text); }
.bg-btn.is-active {
  background: var(--surface-2);
  color: var(--accent);
}

/* Paste preset button (icon-only variant) */

.preset-paste {
  padding: 0.4rem 0.65rem !important;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.preset-paste:hover { color: var(--accent); }

/* --- Content pages (about, privacy, changelog, compare) --- */

.content-page {
  width: 100%;
  padding: 2.5rem 0 3rem;
  flex: 1;
}

.content-article {
  max-width: 760px;
  margin: 0 auto;
}
.content-article h1 {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.content-article h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  margin: 2rem 0 0.6rem;
  letter-spacing: -0.01em;
}
.content-article h3 {
  font-size: 1rem;
  margin: 0.2rem 0 0.4rem;
}
.content-article p { color: var(--text-muted); margin: 0 0 0.9rem; }
.content-article .lead {
  font-size: 1.08rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.content-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.content-contact {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
}
.content-cta {
  margin-top: 1.75rem;
  text-align: center;
}
.content-cta .btn {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  flex: none;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.changelog-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.changelog-date {
  display: inline-block;
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.compare-wrap {
  margin: 1.5rem -1rem;
  padding: 0 1rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.compare-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.compare-table th,
.compare-table td {
  padding: 0.75rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.compare-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.compare-table thead th.is-ours {
  color: var(--accent);
}
.compare-table tbody th {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.compare-cell {
  text-align: center;
  color: var(--text-muted);
}
.compare-cell.is-ours {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-weight: 600;
}
.compare-cell.is-yes    { color: var(--success); font-weight: 600; }
.compare-cell.is-no     { color: var(--danger); }
.compare-cell.is-paid   { color: #f59e0b; }
.compare-cell.is-partial { color: var(--text-muted); }

@media (max-width: 560px) {
  .content-page { padding: 1.5rem 0 2rem; }
}

/* --- Content sections (SEO/GEO) --- */

.section {
  width: 100%;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  text-align: center;
}
.section p { color: var(--text-muted); }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  counter-reset: step;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}
.step h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.step p { font-size: 0.9rem; }

.use-cases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.use-case {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}
.use-case h3 {
  font-size: 0.98rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.use-case p { font-size: 0.88rem; }

.faq {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
}
.faq details[open] { border-color: var(--accent); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  color: var(--text);
  font-size: 0.96rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  float: right;
  color: var(--text-muted);
  font-weight: 400;
  transition: transform 0.2s;
}
.faq details[open] summary::after { content: "−"; }
body[dir="rtl"] .faq summary::after { float: left; }
.faq details p {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- Footer --- */

.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 2rem;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }
.footer-col { display: flex; flex-direction: column; gap: 0.2rem; }
.footer-tagline { color: var(--text); font-weight: 500; }
.footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .site-footer .container { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* --- Presets --- */

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.preset-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}
.preset-btn:hover { border-color: var(--accent); color: var(--text); }
.preset-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* --- Toast --- */

.toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translate(-50%, 1rem);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }

/* --- Responsive --- */

@media (max-width: 820px) {
  .app {
    flex-direction: column-reverse;
    align-items: center;
    gap: 1.25rem;
    padding: 0 1rem 2.5rem;
  }

  /* Keep QR preview visible while user scrolls the controls */
  .preview {
    position: sticky;
    top: 0;
    padding: 0.75rem 0 0.5rem;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    background: var(--bg);
    z-index: 5;
    width: calc(100% + 2rem);
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  .controls { width: 100%; max-width: 480px; }
  .steps { grid-template-columns: 1fr; }
  #qr-canvas-wrapper {
    width: 200px;
    height: 200px;
    box-shadow: none;
  }
  .history { width: 100%; max-width: 320px; }
  .hero { padding: 2rem 1rem 0.5rem; }

  /* Bigger tap targets (Apple/Google recommend ~44px) */
  .btn { padding: 0.85rem 1rem; font-size: 0.95rem; min-height: 44px; }
  .btn-small { padding: 0.5rem 0.85rem; font-size: 0.82rem; min-height: 36px; }
  .actions .btn { flex: 1 1 calc(50% - 0.4rem); }
  .icon-btn { width: 42px; height: 42px; }
  .preset-btn {
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    min-height: 40px;
  }
  .swatch { width: 40px; height: 40px; }
  .swatch span { width: 16px; height: 16px; }
  .color-pick input[type="color"] { width: 44px; height: 44px; }
  input[type="range"] { height: 10px; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border: 0; }

  /* 16px prevents iOS zoom on focus */
  .field textarea,
  .field select,
  .field input[type="text"],
  .field input[type="tel"],
  .field input[type="email"],
  .field input[type="url"],
  .embed-body textarea,
  #batch-input,
  #embed-code {
    font-size: 16px;
  }

  .drop-zone { padding: 1rem 0.75rem; }
  .history-card { width: 76px; }
  .history-card img { width: 60px; height: 60px; }
  .history-card span { max-width: 68px; }
}

/* Stack two-column field rows on narrow phones */
@media (max-width: 480px) {
  .field-row { flex-direction: column; gap: 0.9rem; }
  .checkbox-field { justify-content: flex-start; }
  .actions .btn { flex: 1 1 100%; }
  .batch-actions { flex-direction: column; align-items: stretch; }
  .batch-upload { justify-content: center; text-align: center; }
  .site-header .container { gap: 0.6rem; }
}

/* Remove sticky-hover on touch devices */
@media (hover: none) {
  .swatch:hover,
  .preset-btn:hover,
  .history-card:hover,
  .btn:not(:disabled):hover,
  .icon-btn:hover,
  .drop-zone:hover,
  .faq details:hover {
    transform: none;
    background: var(--surface);
    border-color: var(--border);
    color: inherit;
  }
  .preset-btn[aria-pressed="true"]:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
  }
  .btn.primary:not(:disabled):hover {
    background: var(--accent);
    border-color: var(--accent);
  }
}
