:root {
  --bg: #0b0e17;
  --bg-soft: #12162a;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #eef0f8;
  --text-dim: #9aa1b9;
  --accent1: #7c5cff;
  --accent2: #00d4ff;
  --accent3: #ff5c8a;
  --grad: linear-gradient(120deg, var(--accent1), var(--accent2));
  --radius: 18px;
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Sora", var(--font);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- background glow ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(700px 500px at 90% 10%, rgba(0, 212, 255, 0.14), transparent 70%),
    radial-gradient(500px 500px at 50% 110%, rgba(255, 92, 138, 0.10), transparent 70%);
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 5vw, 56px);
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.35);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.5px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: 600 0.85rem var(--font);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn.active {
  background: var(--grad);
  color: #fff;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: clamp(28px, 6vw, 64px) 20px 8px;
  max-width: 820px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.grad-text {
  background: linear-gradient(120deg, var(--accent1), var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.6;
}

/* ---------- layout ---------- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  max-width: 1280px;
  margin: 40px auto 60px;
  padding: 0 clamp(16px, 5vw, 56px);
  align-items: start;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font: 700 0.85rem var(--font);
  flex-shrink: 0;
}

.group-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 20px 0 10px;
}

.card .group-label:first-of-type { margin-top: 0; }

/* ---------- content type grid ---------- */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-dim);
  font: 600 0.78rem var(--font);
  cursor: pointer;
  transition: all 0.18s;
}

.type-btn svg { width: 22px; height: 22px; }

.type-btn:hover { color: var(--text); border-color: rgba(124, 92, 255, 0.5); }

.type-btn.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.25), rgba(0, 212, 255, 0.18));
  border-color: var(--accent1);
}

/* ---------- fields ---------- */
.fields { display: flex; flex-direction: column; gap: 14px; }
.fields.hidden, .hidden { display: none !important; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.field > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.field-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

input[type="text"], input[type="url"], input[type="email"], input[type="tel"],
textarea, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font: 500 0.92rem var(--font);
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa1b9' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

select option { background: var(--bg-soft); color: var(--text); }

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }

.color-field { max-width: 160px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent1);
  cursor: pointer;
}

/* ---------- sliders ---------- */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
}

.slider-wrap output {
  font: 600 0.82rem var(--font);
  color: var(--text-dim);
  min-width: 38px;
  text-align: right;
}

input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grad);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent1);
  border: 3px solid #fff;
  cursor: grab;
}

/* ---------- presets ---------- */
.preset-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font: 600 0.72rem var(--font);
}

.preset-swatch {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--card-border);
  transition: transform 0.15s, border-color 0.15s;
}

.preset-btn:hover .preset-swatch {
  transform: scale(1.1);
  border-color: #fff;
}

/* ---------- logo section ---------- */
.logo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font: 600 0.9rem var(--font);
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}

.upload-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.upload-btn svg { width: 18px; height: 18px; }

.ghost-btn {
  padding: 11px 18px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid rgba(255, 92, 138, 0.5);
  color: var(--accent3);
  font: 600 0.88rem var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.ghost-btn:hover { background: rgba(255, 92, 138, 0.12); }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.icon-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn svg { width: 24px; height: 24px; }

.icon-btn:hover { color: var(--text); border-color: rgba(124, 92, 255, 0.6); }

.icon-btn.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.3), rgba(0, 212, 255, 0.2));
  border-color: var(--accent1);
}

/* ---------- export ---------- */
.dl-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.dl-btn {
  flex: 1;
  min-width: 90px;
  padding: 13px 10px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: 700 0.9rem var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.dl-btn:hover { border-color: var(--accent2); color: var(--accent2); }

.dl-btn.primary {
  background: var(--grad);
  border: none;
  color: #fff;
}

.dl-btn.primary:hover { filter: brightness(1.12); color: #fff; }

.hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---------- preview ---------- */
.preview-col { position: sticky; top: 24px; }

.preview-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  backdrop-filter: blur(12px);
}

.qr-frame {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  background:
    repeating-conic-gradient(rgba(255,255,255,0.06) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}

.qr-frame canvas, .qr-frame svg {
  width: 100% !important;
  height: 100% !important;
  border-radius: 12px;
}

.warn-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
}

.warn-box p {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #ffcf8a;
}

.hint-inline {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  line-height: 1.4;
}

.scan-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.site-footer a { color: var(--accent2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.heart { color: var(--accent3); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .preview-col {
    position: static;
    order: -1;
  }
  .preview-card { max-width: 420px; margin: 0 auto; }
}
