:root {
  --bg: #020617;
  --surface: rgba(15, 23, 42, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: rgba(226, 232, 240, 0.7);
  --primary: #22c55e;
  --primary-strong: #14b8a6;
  --accent: #6366f1;
  --glow: rgba(99, 102, 241, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.25), transparent 50%),
    radial-gradient(circle at 80% 0%, rgba(236, 72, 153, 0.2), transparent 45%),
    linear-gradient(145deg, #020617, #040d1f 60%, #0b1125);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 3rem;
}

.page-wrapper {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero {
  text-align: center;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.landing-card {
  background: rgba(15, 23, 42, 0.72);
  padding: 1.5rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  gap: 0.75rem;
}

.landing-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.landing-card p {
  margin: 0;
  color: var(--muted);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
}

.hero h1 {
  margin: 0.25rem 0;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  background: linear-gradient(120deg, #38bdf8, #818cf8, #a855f7);
  -webkit-background-clip: text;
  color: transparent;
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero .subline {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.75rem;
  color: rgba(248, 250, 252, 0.6);
  margin: 0;
}

.adsense {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.25);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: var(--surface);
  border-radius: 28px;
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 25px 65px rgba(2, 6, 23, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 10% auto auto -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--glow), transparent 70%);
  filter: blur(20px);
  z-index: 0;
  pointer-events: none;
}

.tool-header,
.tool-form,
.tool-actions,
.tool-output,
.qr-section {
  position: relative;
  z-index: 1;
}

.tool-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.tool-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.input-label {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
  margin-bottom: 0.15rem;
}

.input-hint {
  display: block;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.7);
  margin-top: 0.35rem;
}

textarea,
input[type='text'],
input[type='password'],
input[type='number'],
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(6px);
}

textarea:focus,
input:focus,
select:focus,
input[type='range']:focus-visible {
  outline: none;
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: rgba(15, 23, 42, 0.85);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
}

#whatsappNumber {
  background: rgba(59, 130, 246, 0.15);
  color: #f8fafc;
  font-weight: 600;
  border-color: rgba(59, 130, 246, 0.5);
  text-shadow: 0 1px 1px rgba(3, 7, 18, 0.6);
}

#whatsappNumber:focus {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  margin-left: -0.15rem;
  font-size: 0.95rem;
}

button {
  border: none;
  border-radius: 18px;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #030712;
  box-shadow: 0 15px 30px rgba(34, 197, 94, 0.35);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(226, 232, 240, 0.4);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.4);
}

.secondary:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  border-color: #fff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-output {
  margin-top: 1rem;
  display: flex;
  gap: 0.55rem;
}

.tool-output input,
.tool-output textarea {
  flex: 1;
}

.stats-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.stats-grid article,
.result-grid article {
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  text-align: center;
}

.stats-grid h3,
.result-grid h3 {
  margin: 0;
  font-size: 1.5rem;
}

.stats-grid p,
.result-grid p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.image-preview {
  margin-top: 1rem;
  min-height: 200px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
}

.image-preview img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 16px;
  object-fit: contain;
}

.history-card {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-card ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  max-height: 140px;
  overflow-y: auto;
}

.qr-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
}

.qr-code {
  width: min(360px, 78vw);
  height: min(360px, 78vw);
  background: rgba(15, 23, 42, 0.75);
  padding: 1.3rem;
  border-radius: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 30px 50px rgba(15, 23, 42, 0.5);
}

.qr-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

#nameResult {
  margin-top: 0.85rem;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#nameResult.rolling {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.45);
  transform: scale(1.02);
}

#nameResult.winner {
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.65);
  transform: scale(1.08);
}

.strength-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin-top: 0.5rem;
}

.strength-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f97316, #22c55e);
  transition: width 0.3s ease;
}

.strength-criteria {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.strength-criteria li::before {
  content: '•';
  margin-right: 0.35rem;
  color: var(--muted);
}

.strength-criteria li.filled {
  color: #22c55e;
}

.palette-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.palette-swatch {
  border-radius: 18px;
  padding: 1rem;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.palette-swatch button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  align-self: flex-end;
}

.footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .tool-output {
    flex-direction: column;
  }

  .tool-actions {
    flex-direction: column;
  }
}
