:root {
  --bg: #0f1114;
  --bg-elevated: #1a1d22;
  --surface: #23272e;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f5f7;
  --text-muted: #9ca3af;
  --accent: #7c5cff;
  --accent-hover: #9278ff;
  --accent-glow: rgba(124, 92, 255, 0.35);
  --success: #34d399;
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-text: #fca5a5;
  --radius: 14px;
  --radius-sm: 10px;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(52, 211, 153, 0.08), transparent);
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(1.25rem + var(--safe-top)) 1.25rem calc(2rem + var(--safe-bottom));
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #5b8def 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.logo-wave {
  display: block;
  width: 28px;
  height: 18px;
  background:
    linear-gradient(transparent 40%, white 40%, white 55%, transparent 55%) 0 0 / 7px 18px repeat-x,
    linear-gradient(transparent 55%, white 55%, white 70%, transparent 70%) 3px 0 / 7px 18px repeat-x;
  opacity: 0.95;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.125rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 38ch;
  margin-inline: auto;
}

/* Form */
.generator {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.field input {
  width: 100%;
  padding: 0.9rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder {
  color: #6b7280;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.btn-primary.is-loading .btn-text {
  visibility: hidden;
}

.btn-primary.is-loading .btn-spinner {
  display: block;
}

.btn-spinner {
  display: none;
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary {
  position: relative;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-secondary {
  margin-top: 0.5rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

/* Error */
.error-banner {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
}

/* Results */
.results {
  margin-top: 2rem;
  animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-header {
  margin-bottom: 1rem;
}

.results-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
}

.results-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.name-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.name-card__index {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-hover);
  background: rgba(124, 92, 255, 0.15);
  border-radius: 8px;
}

.name-card__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.btn-domain {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.btn-domain:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.footer {
  margin-top: 3rem;
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (min-width: 480px) {
  .page {
    padding-inline: 1.5rem;
  }

  .name-card {
    padding: 1rem 1.15rem;
  }

  .name-card__title {
    font-size: 1rem;
  }

  .btn-domain {
    font-size: 0.8125rem;
    padding: 0.55rem 0.9rem;
  }
}
