:root {
  --ink: #1a221c;
  --ink-soft: #3d4a40;
  --muted: #6b7870;
  --paper: #f3f6f2;
  --panel: rgba(255, 255, 255, 0.72);
  --line: rgba(26, 34, 28, 0.12);
  --accent: #0f6b4c;
  --accent-ink: #ffffff;
  --warn: #9a3412;
  --ok: #0f6b4c;
  --err: #b42318;
  --shadow: 0 24px 60px rgba(26, 34, 28, 0.08);
  --radius: 14px;
  --font-sans: "DM Sans", "Segoe UI", sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(15, 107, 76, 0.18), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(180, 140, 60, 0.14), transparent 55%),
    linear-gradient(180deg, #eef3ec 0%, var(--paper) 45%, #e8efe6 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(26, 34, 28, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 34, 28, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, black 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 20%, black 20%, transparent 75%);
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 5.5rem) 0 3rem;
}

.hero {
  margin-bottom: 2.25rem;
  animation: rise 0.7s ease both;
}

.brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 8vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.tagline {
  margin: 0 0 0.75rem;
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  font-weight: 500;
  color: var(--ink-soft);
}

.lede {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
}

.lede code {
  color: var(--accent);
  background: rgba(15, 107, 76, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.tool {
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 0.7s ease 0.08s both;
}

.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.field-row {
  display: flex;
  gap: 0.65rem;
}

#url-input {
  flex: 1;
  min-width: 0;
  height: 3rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#url-input:focus {
  border-color: rgba(15, 107, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

#clean-btn {
  flex-shrink: 0;
  height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

#clean-btn:hover:not(:disabled) {
  background: #0c5840;
  transform: translateY(-1px);
}

#clean-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.loading {
  color: var(--ink-soft);
}

.status.success {
  color: var(--ok);
}

.status.error {
  color: var(--err);
}

.results {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.85rem;
  animation: rise 0.55s ease both;
}

.result-block {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.result-primary {
  border-color: rgba(15, 107, 76, 0.28);
  background: rgba(15, 107, 76, 0.06);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0.01em;
}

.result-url {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.95rem;
  color: var(--ink);
}

.result-url.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.copy-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.copy-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.chain {
  margin-top: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.chain summary {
  cursor: pointer;
  font-weight: 600;
}

.chain ol {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.chain li + li {
  margin-top: 0.4rem;
}

.foot {
  margin-top: 2.5rem;
  animation: rise 0.7s ease 0.16s both;
}

.foot p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .field-row {
    flex-direction: column;
  }

  #clean-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
