:root {
  --blue: #1e8fff;
  --blue-dark: #0d6de0;
  --ink: #1c2430;
  --gray: #6b7684;
  --line: #e4e8ee;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
}
.logo .dots {
  display: grid;
  grid-template-columns: repeat(2, 14px);
  grid-gap: 4px;
}
.logo .dots span {
  width: 14px; height: 14px; border-radius: 4px; background: var(--blue);
}
.logo .dots span:nth-child(2) { background: var(--ink); }
.logo small { color: var(--gray); font-weight: 700; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn.filled { background: var(--blue); border-color: var(--blue); color: #fff; }
@media (max-width: 420px) { .hide-on-mobile { display: none; } }

/* Step indicator */
.steps {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 28px 16px 8px;
}
.step { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.step .dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: #b9c2cf;
}
.step.done .dot { background: var(--blue); }
.step.active .dot { background: var(--blue); }
.step .label { font-weight: 700; color: var(--gray); font-size: 14px; }
.step.active .label, .step.done .label { color: var(--blue); }
.connector { width: 70px; height: 2px; background: var(--line); position: relative; }
.connector.done { background: var(--blue); }

.wizard { max-width: 720px; margin: 0 auto; padding: 20px 16px 120px; }

.add-link-btn {
  width: 100%;
  padding: 18px;
  border: 2px solid var(--blue);
  color: var(--blue);
  background: #fff;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  margin-bottom: 20px;
}
.add-link-btn:hover { background: #eef6ff; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; cursor: pointer;
}
.panel-head .swatch {
  width: 48px; height: 48px; border-radius: 12px;
  background: #f0f3f7; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--ink); flex-shrink: 0;
}
.panel-head .text h3 { margin: 0 0 2px; font-size: 18px; }
.panel-head .text p { margin: 0; color: var(--gray); font-size: 14px; }
.panel-head .chev { margin-left: auto; color: var(--gray); transition: transform .2s; }
.panel.open .chev { transform: rotate(180deg); }
.panel-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.panel.open .panel-body { max-height: 2000px; }

.social-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 4px 20px 24px;
}
@media (max-width: 520px) {
  .social-grid { grid-template-columns: repeat(4, 1fr); }
}
.social-icon {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fafbfc;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  position: relative;
}
.social-icon.linked::after {
  content: '';
}
.social-icon .count-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px;
  background: #22c55e; color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

.link-list { padding: 8px 20px 20px; }
.link-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: #fff;
}
.link-row .badge {
  width: 36px; height: 36px; border-radius: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  cursor: pointer;
}
.link-row .info { flex: 1; min-width: 0; cursor: pointer; }
.link-row .info .name { font-weight: 700; font-size: 14px; }
.link-row .info .url { color: var(--gray); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-row .remove { color: var(--gray); cursor: pointer; background: none; border: none; font-size: 18px; }

/* Modal for entering a link's URL */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,26,34,.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0; padding: 24px; animation: slideup .2s ease;
}
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 20px; }
}
@keyframes slideup { from { transform: translateY(30px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal h3 { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.modal .modal-icon { width: 36px; height: 36px; border-radius: 10px; color:#fff; display:flex;align-items:center;justify-content:center; }
.modal input, .modal textarea {
  width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; margin: 6px 0 16px; font-family: inherit;
}
.modal .actions { display: flex; gap: 10px; }
.btn { padding: 14px; border-radius: var(--radius-sm); border: none; font-weight: 800; font-size: 15px; cursor: pointer; flex: 1; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ghost { background: #eef1f5; color: var(--ink); }

.color-row { display: flex; gap: 16px; padding: 4px 20px 24px; }
.color-field { flex: 1; }
.color-field label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 6px; font-weight: 700; }
.color-field .swatch-input { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.color-field input[type=color] { width: 36px; height: 36px; border: none; padding: 0; background: none; }
.color-field input[type=text] { border: none; flex: 1; font-family: monospace; font-size: 14px; }

.footer-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--line);
  padding: 14px 16px; display: flex; gap: 12px;
  max-width: 720px; margin: 0 auto;
}
.footer-nav .btn.back { flex: 0 0 60px; background: var(--blue); color: #fff; }
.footer-nav .btn.preview { background: #fff; border: 2px solid var(--blue); color: var(--blue); }
.footer-nav .btn.next { background: var(--blue); color: #fff; flex: 1.4; }

.type-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
@media (max-width: 480px) { .type-grid { grid-template-columns: 1fr; } }
.type-card {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 20px;
  cursor: pointer; background: #fff; text-align: left;
}
.type-card.selected { border-color: var(--blue); background: #eef6ff; }
.type-card .t-icon { font-size: 26px; margin-bottom: 10px; color: var(--blue); }
.type-card h4 { margin: 0 0 4px; }
.type-card p { margin: 0; color: var(--gray); font-size: 13px; }

.design-preview {
  display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 20px;
}
#qr-canvas-wrap { padding: 16px; background: #fff; border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.dl-row { display: flex; gap: 10px; width: 100%; }
.dl-row .btn { background: var(--ink); color: #fff; }

.form-field { padding: 0 20px 18px; }
.form-field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.form-field input, .form-field textarea {
  width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit;
}

/* Shape picker */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 480px) { .shape-grid { grid-template-columns: repeat(2, 1fr); } }
.shape-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--gray);
}
.shape-btn.selected { border-color: var(--blue); color: var(--blue); background: #eef6ff; }
.shape-swatch { width: 32px; height: 32px; background: var(--ink); }
.dots-square   { border-radius: 0; }
.dots-dots     { border-radius: 50%; }
.dots-rounded  { border-radius: 8px; }
.dots-classy   { border-radius: 8px 0 8px 0; }
.dots-classy-rounded { border-radius: 10px 2px 10px 2px; }
.dots-extra-rounded  { border-radius: 14px; }
.corner-square { border-radius: 0; width: 28px; height: 28px; border: 6px solid var(--ink); background: transparent; }
.corner-dot    { border-radius: 50%; width: 28px; height: 28px; border: 6px solid var(--ink); background: transparent; }
.corner-extra-rounded { border-radius: 10px; width: 28px; height: 28px; border: 6px solid var(--ink); background: transparent; }

.hidden { display: none !important; }
