:root {
  --bg: #3B1342;
  --surface: #4a1a54;
  --surface-2: #2b0e31;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #ffffff;
  --muted: #e5c7da;
  --brand-icon: #bf557b;
  --brand-text: #ffffff;
  --accent: #bf557b;
  --accent-strong: #e07aa0;
  --success: #4fe3a7;
  --danger: #ff7a93;
  --bg-glow-1: #5b1d68;
  --bg-glow-2: #2c0f33;
  --card-grad-start: rgba(255, 255, 255, 0.05);
  --card-grad-end: rgba(255, 255, 255, 0.02);
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  --button-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  --secondary-bg: rgba(255, 255, 255, 0.08);
  --table-line: rgba(255, 255, 255, 0.08);
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --kbd-bg: rgba(0, 0, 0, 0.25);
  --track-bg: rgba(0, 0, 0, 0.2);
  --focus-ring: rgba(191, 85, 123, 0.25);
  --header-control-height: 36px;
}

[data-theme="light"] {
  --bg: #f7f2ea;
  --surface: #fffaf2;
  --surface-2: #f3e8d8;
  --border: rgba(112, 95, 73, 0.18);
  --border-strong: rgba(112, 95, 73, 0.3);
  --text: #2b241c;
  --muted: #6b5d4b;
  --brand-icon: #be7755;
  --brand-text: #2b241c;
  --accent: #cf8a63;
  --accent-strong: #b56f49;
  --success: #487c66;
  --danger: #b45a46;
  --bg-glow-1: rgba(223, 187, 140, 0.35);
  --bg-glow-2: rgba(180, 150, 112, 0.2);
  --card-grad-start: rgba(255, 255, 255, 0.88);
  --card-grad-end: rgba(250, 240, 227, 0.78);
  --card-shadow: 0 12px 34px rgba(95, 75, 53, 0.12);
  --button-hover-shadow: 0 12px 24px rgba(109, 82, 58, 0.2);
  --secondary-bg: rgba(214, 178, 133, 0.2);
  --table-line: rgba(112, 95, 73, 0.12);
  --overlay-bg: rgba(84, 64, 46, 0.32);
  --kbd-bg: rgba(246, 236, 221, 0.95);
  --track-bg: rgba(123, 105, 84, 0.12);
  --focus-ring: rgba(207, 138, 99, 0.32);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

body {
  font-family: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-1) 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, var(--bg-glow-2) 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  letter-spacing: 0.01em;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 34px; }

.card {
  background: linear-gradient(180deg, var(--card-grad-start), var(--card-grad-end));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(3px);
}

.step-card {
  position: relative;
}

.step2-status {
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.step-kicker {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.card-inset {
  background: var(--surface-2);
  border-color: var(--border);
}

textarea, input, select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 1rem;
  font-family: inherit;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.list-input {
  font-size: 1rem;
  line-height: 1.35;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

button {
  background: var(--accent);
  color: var(--brand-text);
  border: none;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.015em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button:hover { box-shadow: var(--button-hover-shadow); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* Slightly brighter primary action in light mode for better contrast. */
[data-theme="light"] .build-btn {
  background: #d9966f;
  color: #2b241c;
}

[data-theme="light"] .build-btn:hover {
  background: #e1a17a;
}

/* Subtle moving border highlight for the prompt helper CTA. */
.helper-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.helper-cta::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 240deg,
    var(--accent-strong) 300deg,
    transparent 360deg
  );
  animation: helperBorderSpin 3.8s linear infinite;
  z-index: -1;
}

.helper-cta::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: var(--surface);
  z-index: -1;
}

[data-theme="dark"] .helper-cta::after {
  background: rgba(20, 10, 28, 0.84);
}

@keyframes helperBorderSpin {
  to { transform: rotate(1turn); }
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { justify-content: space-between; }
.align-start { align-items: flex-start; }
.gap-14 { gap: 14px; }

.step1-controls { align-items: flex-start; }

.preset-dropdown {
  position: relative;
  margin-left: auto;
}

.preset-dropdown-toggle {
  min-height: 40px;
}

.preset-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 92vw);
  z-index: 25;
  padding: 12px;
}

.preset-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  border-radius: 10px;
}

.preset-option:hover {
  background: var(--secondary-bg);
}

.fav-toggle {
  background: transparent;
  border: 0;
  padding: 2px;
  min-height: 0;
  color: var(--muted);
  opacity: 0.32;
  box-shadow: none;
}

.fav-toggle:hover {
  color: var(--muted);
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.fav-toggle:active {
  transform: none;
}

.fav-toggle.is-favorite {
  color: var(--accent);
  opacity: 1;
}

.fav-toggle svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fav-toggle.is-favorite svg {
  fill: currentColor;
}

.fav-col-head,
.fav-col-cell {
  width: 44px;
  text-align: center;
}

.available-table th,
.available-table td {
  vertical-align: middle;
}

.available-table .cell-text {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.social-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  background: var(--surface-2);
}

.result-actions {
  position: relative;
  gap: 6px;
}

.result-action-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  box-shadow: none;
  opacity: 0.62;
}

.available-table button.result-action-btn,
.available-table button.result-action-btn.secondary,
.available-table button.result-action-btn:hover,
.available-table button.result-action-btn:active,
.available-table button.result-action-btn:focus,
.available-table button.result-action-btn:focus-visible {
  border: 0 !important;
  outline: none;
  box-shadow: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.result-action-btn:hover {
  background: transparent;
  border: 0;
  color: var(--text);
  opacity: 0.98;
  box-shadow: none;
}

.result-action-btn:active,
.result-action-btn:focus-visible {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.copy-icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 0;
  padding: 4px;
  border-radius: 8px;
  box-shadow: none;
  opacity: 0.58;
}

.copy-icon-btn:hover,
.copy-icon-btn:active {
  background: transparent;
  border: 0;
  color: var(--text);
  opacity: 0.98;
  box-shadow: none;
  transform: none;
}

.social-tray-wrap {
  position: relative;
}

.social-tray {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 6;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 90%, transparent);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(14px, -4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.social-tray.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(14px, 0);
}

.social-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.social-icon-btn {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 3px;
  min-height: 0;
  border-radius: 0;
  opacity: 0.56;
  transform: none;
}

.social-icon-btn:hover,
.social-icon-btn:active {
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 0.96;
  transform: none;
}

.social-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.85;
}

.social-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.social-logo-x {
  fill: currentColor;
  stroke: none;
}

.social-logo-x path {
  fill: currentColor;
  stroke: none;
}

.social-icon-btn.is-unchecked .social-icon,
.social-icon-btn.is-unknown .social-icon {
  color: var(--muted);
  opacity: 0.6;
}

.social-icon-btn.is-checking .social-icon {
  color: var(--muted);
  opacity: 0.9;
}

.social-icon-btn.is-checking .social-icon {
  animation: socialPulse 1.05s ease-in-out infinite;
}

.social-icon-btn.is-available .social-icon {
  color: var(--muted);
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(79, 227, 167, 0.45));
}

.social-icon-btn.is-taken .social-icon {
  color: var(--muted);
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(180, 90, 70, 0.42));
}

@keyframes socialPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.07); opacity: 1; }
}

.pill {
  min-height: var(--header-control-height);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--track-bg);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.pill > span {
  margin-left: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.how-btn { padding: 10px 14px; }

.brand-icon { color: var(--brand-icon); display: inline-flex; line-height: 0; }
.brand-text { color: var(--brand-text); }
.brand-mark { width: 52px; height: 52px; display: block; overflow: visible; }

.theme-switch {
  position: relative;
  --switch-pad: 4px;
  --switch-thumb-size: 28px;
  width: 62px;
  height: var(--header-control-height);
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: var(--track-bg);
  box-shadow: inset 0 0 0 1px var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
}

.theme-switch:hover {
  transform: none;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.theme-switch:active { transform: none; }

.theme-switch-icon {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  z-index: 2;
  transform: translate(-50%, -50%);
}

.theme-switch-sun { left: calc(var(--switch-pad) + (var(--switch-thumb-size) / 2)); }
.theme-switch-moon { left: calc(100% - var(--switch-pad) - (var(--switch-thumb-size) / 2)); }

.theme-switch-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switch-thumb {
  position: absolute;
  top: var(--switch-pad);
  width: var(--switch-thumb-size);
  height: var(--switch-thumb-size);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), inset 0 0 0 1px var(--border);
  transition: left 0.2s ease;
}

.theme-switch-thumb.is-light { left: var(--switch-pad); }
.theme-switch-thumb.is-dark { left: calc(100% - var(--switch-pad) - var(--switch-thumb-size)); }

[data-theme="dark"] .theme-switch-sun { color: var(--muted); }
[data-theme="dark"] .theme-switch-moon { color: var(--text); }
[data-theme="light"] .theme-switch-sun { color: var(--text); }
[data-theme="light"] .theme-switch-moon { color: var(--muted); }

.section-title { font-weight: 500; letter-spacing: -0.01em; }
.step-title { font-size: 1.62rem; line-height: 1.32; font-weight: 500; letter-spacing: -0.015em; }
.modal-title { font-weight: 500; font-size: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--table-line);
  vertical-align: top;
}

.ok { color: var(--success); }
.bad { color: var(--danger); }
.warning-text { color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { font-size: 12px; color: var(--muted); }
.muted a { color: inherit; text-decoration-color: var(--border-strong); }
.muted a:hover { text-decoration-color: currentColor; }

.recent-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.site-footer {
  display: grid;
  gap: 6px;
}

.footer-separator {
  height: 1px;
  width: 100%;
  background: var(--table-line);
  margin-bottom: 8px;
}

.footer-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  opacity: 0.9;
  text-decoration: none;
  flex-shrink: 0;
}

.footer-logo:hover { opacity: 1; }

.footer-logo .icon {
  width: 32px;
  height: 32px;
  display: block;
}

.footer-logo .logo-text {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.footer-vertical-separator {
  width: 1px;
  align-self: stretch;
  background: var(--table-line);
}

.footer-meta {
  display: grid;
  gap: 4px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal {
  width: min(980px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-title-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  color: var(--accent);
}

.modal-title-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-divider {
  width: 100%;
  height: 1px;
  background: var(--table-line);
  margin-top: 12px;
  margin-bottom: 10px;
}

.modal .modal-icon-close {
  background: transparent;
  border: 0;
  padding: 4px;
  color: var(--muted);
  box-shadow: none;
  min-height: 0;
}

.modal .modal-icon-close:hover {
  background: transparent;
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.modal .modal-icon-close:active {
  transform: none;
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--kbd-bg);
  color: var(--text);
}

.btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  color: currentColor;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-icon svg path,
.btn-icon svg rect,
.btn-icon svg line,
.btn-icon svg polyline,
.btn-icon svg polygon,
.btn-icon svg circle {
  vector-effect: non-scaling-stroke;
}

.btn-icon svg.provider-icon {
  fill: currentColor;
  stroke: none;
}

.prompt-copy-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

.progress {
  width: 100%;
  height: 10px;
  margin-top: 6px;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--track-bg);
  border-radius: 999px;
}

.progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: 999px;
}

.progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: 999px;
}

.mb-14 { margin-bottom: 14px; }
.mb-10 { margin-bottom: 10px; }
.mb-8 { margin-bottom: 8px; }
.mb-6 { margin-bottom: 6px; }
.mt-14 { margin-top: 14px; }
.mt-12 { margin-top: 12px; }
.mt-10 { margin-top: 10px; }
.mt-8 { margin-top: 8px; }

.w-120 { max-width: 120px; }
.w-160 { max-width: 160px; }
.flex-1 { flex: 1; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 20px 14px 26px; }
  .card { padding: 16px; border-radius: 16px; }
  .step-title { font-size: 1.3rem; line-height: 1.36; }
  th, td { padding: 8px; }
  .available-table .cell-text { min-height: 38px; }
  .result-actions { gap: 4px; }
  .result-action-btn { padding: 6px 8px; }
  .social-tray { transform: translate(8px, -3px); }
  .social-tray.is-open { transform: translate(8px, 0); }
  .social-chip-row { gap: 8px; }
  .social-icon,
  .social-icon svg { width: 18px; height: 18px; }
  .footer-content { flex-direction: column; gap: 10px; }
  .footer-vertical-separator { width: 100%; height: 1px; }
  .step1-controls { flex-direction: column; }
  .preset-dropdown {
    margin-left: 0;
    width: 100%;
  }
  .preset-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }
  .preset-dropdown-menu {
    right: 0;
    left: 0;
    width: auto;
  }
  .clear-lists-btn {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .clear-lists-btn .clear-lists-label { display: none; }
  .clear-lists-btn .btn-icon {
    width: 18px;
    height: 18px;
    justify-content: center;
    align-items: center;
  }
}
