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

:root {
  --blue:       #0066ff;
  --blue-dark:  #0052cc;
  --blue-light: #3b82f6;
  --bg:         #f8fafc;
  --card:       #ffffff;
  --text:       #0f172a;
  --text-muted: #64748b;
  --border:     #e2e8f0;
  --green:      #059669;
  --header-bg:  #0f172a;
  --r:          12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  font-size: 15px;
}

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  padding: 0.875rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.07);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo img { display: block; height: 38px; }
.header-back {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}
.header-back:hover { color: #fff; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  padding: 3rem 1.5rem;
  text-align: center;
}
.hero-inner { max-width: 600px; margin: 0 auto; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.15;
}
.hero p {
  color: rgba(255,255,255,0.72);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Layout ── */
.tool-section {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.col-options { display: flex; flex-direction: column; gap: 0.75rem; }
.col-preview { position: sticky; top: 5rem; }

/* ── Section Card ── */
.gen-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gen-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.gen-section-header:hover { background: #f8fafc; }
.gen-section-header input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.gen-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
}
.gen-section-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
}
.gen-section-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.15s ease;
}
.gen-section-body.open { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── Form Elements ── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.875rem;
}
.form-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-row select,
.form-row input[type="text"],
.form-row input[type="url"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  background: #f8fafc;
  transition: border-color 0.2s;
  outline: none;
}
.form-row select:focus,
.form-row input:focus { border-color: var(--blue); background: #fff; }

/* ── Redirect rows ── */
.redirect-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.875rem; }
.redirect-row {
  display: grid;
  grid-template-columns: 1fr 1fr 5rem 2rem;
  gap: 0.4rem;
  align-items: center;
}
.redirect-row input {
  padding: 0.5rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  width: 100%;
}
.redirect-row input:focus { border-color: var(--blue); background: #fff; }
.redirect-row select {
  padding: 0.5rem 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  background: #f8fafc;
  outline: none;
  width: 100%;
}
.remove-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.remove-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.add-btn {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: 7px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  justify-content: center;
}
.add-btn:hover { border-color: var(--blue); background: #eff6ff; }

/* ── Preview ── */
.preview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  flex-wrap: wrap;
}
.preview-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.preview-actions { display: flex; gap: 0.5rem; }
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  background: var(--card);
  color: var(--text);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-action:hover { background: #f1f5f9; border-color: #cbd5e1; }
.btn-action.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-action.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-action.copied { background: var(--green); color: #fff; border-color: var(--green); }

.preview-code {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  padding: 1.25rem;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 200px;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre;
  overflow-x: auto;
}
.preview-empty {
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Comment colors in preview ── */
.preview-code .cm  { color: #64748b; }
.preview-code .kw  { color: #93c5fd; }
.preview-code .val { color: #86efac; }

/* ── Footer ── */
.site-footer {
  background: var(--header-bg);
  color: rgba(255,255,255,0.75);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 0.75rem; font-size: 0.82rem; }
.footer-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s;
  white-space: nowrap;
}
.footer-cta:hover { background: var(--blue-dark); }
.footer-home {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s;
}
.footer-home:hover { color: #fff; }

@media (max-width: 860px) {
  .tool-section { grid-template-columns: 1fr; }
  .col-preview { position: static; }
}
@media (max-width: 640px) {
  .hero { padding: 2rem 1rem; }
  .redirect-row { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .redirect-row select { grid-column: 1; }
  .redirect-row .remove-btn { grid-column: 2; justify-self: end; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
