:root {
  --bg: #f6e9cf;
  --bg-deep: #f9d6a6;
  --card: #fff8ed;
  --ink: #1b1a18;
  --muted: #6b5f55;
  --accent: #f58b5d;
  --accent-2: #2c9c92;
  --accent-3: #f3c553;
  --shadow: rgba(16, 14, 12, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff6e4 0%, transparent 55%),
    radial-gradient(circle at 20% 80%, #ffe5c2 0%, transparent 45%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
}

.bg-orbit {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 380px;
  background: radial-gradient(circle at 30% 30%, rgba(245, 139, 93, 0.25), transparent 65%),
    radial-gradient(circle at 80% 30%, rgba(44, 156, 146, 0.22), transparent 70%);
  filter: blur(4px);
  z-index: -1;
  animation: float 14s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(12px);
  }
}

.hero {
  width: min(980px, 100%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.pixel-cat {
  width: 72px;
  height: 72px;
  background: #ffe9c9;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(28, 26, 23, 0.18);
  padding: 10px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  margin: 0 0 6px;
  color: var(--muted);
}

h1 {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin: 0 0 8px;
}

.subhead {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

main {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-bottom: 30px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(245, 139, 93, 0.12), transparent 50%);
  pointer-events: none;
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

select {
  border: 2px solid rgba(27, 26, 24, 0.1);
  background: #fffdf9;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(44, 156, 146, 0.2);
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.options-row label {
  margin: 0;
}

.pill {
  background: rgba(44, 156, 146, 0.12);
  color: #1d5d56;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

input[type="text"] {
  flex: 1 1 240px;
  border: 2px solid rgba(27, 26, 24, 0.1);
  background: #fffdf9;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 1rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 139, 93, 0.2);
}

button {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(27, 26, 24, 0.12);
}

.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  color: #1f120c;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(245, 139, 93, 0.14);
  color: #7b2a1b;
  font-weight: 500;
}

.result {
  margin-top: 20px;
  display: grid;
  gap: 12px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.label {
  font-weight: 600;
  min-width: 86px;
}

.link-pill {
  flex: 1;
  background: #fff4e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  word-break: break-all;
}

.link-pill.alt {
  background: #eef9f4;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.result-actions button {
  background: #fff;
  border: 1px solid rgba(27, 26, 24, 0.1);
}

.micro {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-header button {
  background: #fff;
  border: 1px solid rgba(27, 26, 24, 0.1);
  padding: 8px 14px;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.history-item {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.history-item span {
  font-weight: 600;
  word-break: break-all;
}

.history-item small {
  color: var(--muted);
}

.history-item .meta {
  font-size: 0.82rem;
  color: #85786e;
}

.analytics h2 {
  margin: 0 0 12px;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}

.stat {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  min-width: 140px;
  flex: 1 1 160px;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat strong {
  font-size: 1.4rem;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 700px;
}

@media (max-width: 720px) {
  body {
    padding: 36px 16px 28px;
  }

  .brand {
    grid-template-columns: 1fr;
  }

  .pixel-cat {
    width: 64px;
    height: 64px;
  }

  .result-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
