:root {
  --bg: #0c1210;
  --bg-elevated: #141c18;
  --surface: rgba(28, 42, 36, 0.72);
  --border: rgba(140, 180, 155, 0.18);
  --text: #e8f0eb;
  --muted: #8aa396;
  --accent: #3dd68c;
  --accent-dim: #24965f;
  --warn: #e8b84a;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
  --radius: 14px;
  --max: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(61, 214, 140, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 214, 140, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  width: 80vw;
  height: 50vh;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(61, 214, 140, 0.16), transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: pulse-glow 8s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  color: #062214;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: 1.25rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav a:hover { color: var(--accent); }

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3.5rem;
  text-align: center;
  animation: fade-up 0.7s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-hero {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 10vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.lede {
  margin: 1rem auto 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary {
  background: var(--accent);
  color: #062214;
}

.btn.primary:hover { background: #55e09c; }

.btn.ghost {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}

.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn.small {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.tools-section,
.about-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.tools-section h2,
.about-section h2,
.tool-page h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400;
}

.section-desc {
  margin: 0 0 1.75rem;
  color: var(--muted);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: block;
  padding: 1.35rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(8px);
  transition: border-color 0.25s, transform 0.2s, background 0.25s;
  animation: fade-up 0.6s ease both;
}

.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.1s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.2s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.3s; }

.tool-card:hover {
  border-color: rgba(61, 214, 140, 0.45);
  transform: translateY(-3px);
  background: rgba(34, 52, 44, 0.85);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 0.85rem;
  border-radius: 10px;
  background: rgba(61, 214, 140, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tool-icon[data-icon]::before {
  content: attr(data-icon);
  text-transform: uppercase;
}

.tool-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.about-section {
  padding-bottom: 4rem;
}

.about-section p {
  color: var(--muted);
  max-width: 42rem;
}

.feature-list {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.feature-list li {
  position: relative;
  padding-left: 1.35rem;
  color: var(--text);
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p { margin: 0; }

/* Tool pages */
.tool-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  animation: fade-up 0.5s ease both;
}

.tool-page .back {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.tool-page .back:hover { color: var(--accent); }

.tool-page .desc {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

label.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

textarea,
input[type="text"],
input[type="url"],
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 14, 11, 0.65);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: rgba(61, 214, 140, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.12);
}

textarea { min-height: 180px; }

.output-box {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 10px;
  background: rgba(8, 14, 11, 0.55);
  border: 1px solid var(--border);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 3rem;
  color: var(--text);
}

.msg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.msg.error { color: #f07178; }
.msg.ok { color: var(--accent); }

.hash-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hash-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.hash-row .label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.hash-row code {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(8, 14, 11, 0.55);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  overflow-x: auto;
  word-break: break-all;
}

.color-layout {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.swatch {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

#qrcode {
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  line-height: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat {
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(8, 14, 11, 0.45);
  border: 1px solid var(--border);
  text-align: center;
}

.stat .n {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.stat .l {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .hash-row {
    grid-template-columns: 1fr;
  }
  .color-layout {
    grid-template-columns: 1fr;
  }
}
