:root {
  --bg: #f4f6fb;
  --card: rgba(255, 255, 255, 0.78);
  --text: #1f2937;
  --muted: #6b7280;
  --border: rgba(255, 255, 255, 0.6);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  --radius: 20px;
}

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

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

/* fundo decorativo sutil */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 42vmax;
  height: 42vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  transition: background-color 0.5s ease;
}
body::before {
  top: -12vmax;
  left: -12vmax;
  background: #a5b4fc;
}
body::after {
  bottom: -14vmax;
  right: -14vmax;
  background: #f9a8d4;
}

.card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.6rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  animation: pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card__header {
  text-align: center;
  margin-bottom: 1.6rem;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4338ca;
  background: rgba(79, 70, 229, 0.12);
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.card__header p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 14px;
  margin-bottom: 1.4rem;
}

.preview__swatch {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(0, 0, 0, 0.12);
  transition: background-color 0.35s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.preview__info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.preview__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

#hex {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

small#rgb {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.85rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.95);
}

.card__footer {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.card__footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

@media (max-width: 480px) {
  .card { padding: 1.6rem 1.4rem 1.4rem; }
  h1 { font-size: 1.5rem; }
  #hex { font-size: 1.1rem; }
  .preview__swatch { width: 52px; height: 52px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: rgba(30, 41, 59, 0.72);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  }
  body::before { background: #312e81; }
  body::after { background: #831843; }
}
