:root {
  --brand: #6c5ce7;
  --brand-dark: #5341d6;
  --ink: #1a1a2e;
  --ink-soft: #4a4a68;
  --bg: #f6f5fb;
  --card-bg: #ffffff;
  --border: #e4e1f5;
  --ok: #1e9e6b;
  --danger: #d64545;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(26, 26, 46, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

img { max-width: 100%; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Ticker */
.ticker {
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
}
.ticker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse 2s infinite;
  flex: 0 0 auto;
}
#ticker-count { color: #b8a9ff; font-variant-numeric: tabular-nums; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--brand), #8b7bf0);
  color: #fff;
  padding: 28px 0 34px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: #fff; display: inline-flex; }
.brand-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.tagline { margin: 10px 0 0; max-width: 46em; font-size: 1.02rem; opacity: 0.95; }

main.wrap { padding-top: 22px; padding-bottom: 60px; }

/* Privacy banner */
.privacy-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #eef0ff;
  border: 1px solid #d7d9fb;
  color: #2f2f52;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.92rem;
}
.privacy-banner svg { flex: 0 0 auto; margin-top: 2px; color: var(--brand-dark); }
.privacy-banner p { margin: 0; }

/* Cards / fieldsets */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  margin: 0 0 18px;
}
fieldset.card { min-width: 0; }
legend {
  font-weight: 700;
  font-size: 1.02rem;
  padding: 0 6px;
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: 1fr 1.6fr 1.6fr 1.6fr 1fr; }

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

/* Repeatable rows */
.repeat-list { display: flex; flex-direction: column; gap: 12px; }
.repeat-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.repeat-row:last-child { border-bottom: none; padding-bottom: 0; }
.repeat-row .field { min-width: 0; }
.repeat-row .row-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.repeat-row .row-fields.inline { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.address-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

@media (max-width: 640px) {
  .repeat-row { grid-template-columns: 1fr; }
  .repeat-row .row-fields.inline, .address-fields { grid-template-columns: 1fr; }
  .row-remove { justify-self: start; }
}

.row-remove {
  align-self: center;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 4px;
  white-space: nowrap;
}
.row-remove:hover { text-decoration: underline; }

.btn-add {
  margin-top: 14px;
  background: #f1effc;
  color: var(--brand-dark);
  border: 1px dashed #c9c2f2;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn-add:hover { background: #e6e2fb; }

.hint { font-size: 0.82rem; color: #6b6b85; margin: 12px 0 0; }

/* Logo section */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-upload { display: flex; align-items: center; gap: 12px; }
.logo-upload input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}
#logoPreview {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-text {
  font: inherit;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  padding: 13px 22px;
  border: none;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary {
  background: #fff;
  color: var(--brand-dark);
  border: 1.5px solid var(--brand);
}
.btn-secondary:hover { background: #f1effc; }
.btn-text {
  background: none;
  color: var(--danger);
  padding: 8px 6px;
  font-weight: 600;
}

.generate-row { text-align: center; margin: 26px 0; }
.generate-row .btn-primary { font-size: 1.05rem; padding: 15px 34px; }
.form-error {
  color: var(--danger);
  font-weight: 600;
  margin-top: 12px;
}

/* Result */
.result-card { text-align: left; }
.result-body {
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.qr-preview-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
#qrCanvas { width: min(280px, 60vw); height: auto; display: block; }
.result-actions { display: flex; flex-direction: column; gap: 12px; max-width: 320px; }
.result-actions .btn-primary, .result-actions .btn-secondary { width: 100%; }

/* Footer */
.site-footer {
  padding: 24px 0 40px;
  text-align: center;
  color: #8a8aa3;
  font-size: 0.85rem;
}
