:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: rgba(17, 19, 24, 0.82);
  --surface-strong: rgba(14, 16, 20, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f2ee;
  --muted: #acb0ba;
  --muted-strong: #d2d5dd;
  --accent: #e64a44;
  --accent-soft: rgba(230, 74, 68, 0.14);
  --success: #71d59d;
  --success-soft: rgba(113, 213, 157, 0.16);
  --warning: #ffc771;
  --warning-soft: rgba(255, 199, 113, 0.14);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --header-height: 84px;
  --max-width: 1220px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 32px);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(230, 74, 68, 0.16), transparent 32%),
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.035), transparent 30%),
    linear-gradient(180deg, #090909 0%, #090a0d 48%, #0d1015 100%);
  color: var(--text);
  font-family: "Syne", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.9;
  z-index: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 70;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.section,
.site-footer {
  position: relative;
  z-index: 2;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  padding: 20px clamp(16px, 3vw, 32px) 0;
  z-index: 30;
  pointer-events: none;
}

.site-nav {
  max-width: var(--max-width);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(11, 12, 16, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  pointer-events: auto;
}

.site-nav.scrolled,
.site-nav.is-open {
  background: rgba(11, 12, 16, 0.9);
  border-color: var(--border-strong);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.brand__logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-panel {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-links a {
  position: relative;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 0;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.nav-toggle span:first-child {
  transform: translateY(-4px);
}

.nav-toggle span:last-child {
  transform: translateY(4px);
}

.site-nav.is-open .nav-toggle span:first-child {
  transform: rotate(45deg);
}

.site-nav.is-open .nav-toggle span:last-child {
  transform: rotate(-45deg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
}

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

.btn--solid {
  background: linear-gradient(135deg, #f05f57, #c9252b 72%);
  color: #fff;
  box-shadow: 0 14px 26px rgba(201, 37, 43, 0.24);
}

.btn--solid:hover {
  box-shadow: 0 18px 32px rgba(201, 37, 43, 0.3);
}

.btn--ghost {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: rgba(230, 74, 68, 0.4);
  background: rgba(255, 255, 255, 0.06);
}

.btn--soft {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--muted-strong);
}

.mag-btn {
  will-change: transform;
}

main {
  padding-top: calc(var(--header-height) + 36px);
}

section[id] {
  scroll-margin-top: calc(var(--header-height) + 30px);
}

.section {
  padding: clamp(64px, 9vw, 120px) clamp(16px, 3vw, 32px);
}

.section--hero {
  padding-top: clamp(78px, 10vw, 138px);
}

.container {
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 18px;
  color: #ff9c96;
  font-family: "DM Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.tool-hero__title {
  margin: 0;
  width: fit-content;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(4.4rem, 11vw, 8.6rem);
  line-height: 0.88;
  letter-spacing: 0.04em;
}

.tool-hero__title span {
  display: block;
  color: transparent;
  background: linear-gradient(135deg, #ffffff 0%, #ffafa9 32%, #e64a44 72%, #850b10 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.tool-hero__lede {
  margin: 24px 0 0;
  max-width: 42rem;
  color: var(--muted-strong);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero__meta span {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.84rem;
}

.hero-panel,
.tool-panel,
.insight-card,
.site-footer__shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 19, 24, 0.88), rgba(9, 10, 13, 0.94));
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  display: grid;
  gap: 14px;
  padding: clamp(22px, 3vw, 32px);
  overflow: hidden;
  isolation: isolate;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 40%),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.hero-panel__glow {
  position: absolute;
  right: -14%;
  top: -18%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 74, 68, 0.38), rgba(230, 74, 68, 0.08) 48%, transparent 72%);
  filter: blur(8px);
  pointer-events: none;
}

.hero-panel__block {
  position: relative;
  z-index: 1;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(10, 11, 14, 0.76);
}

.hero-panel__label,
.panel-kicker,
.stat-card__label,
.preset-group__label {
  margin: 0 0 10px;
  color: #ff9c96;
  font-family: "DM Mono", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-panel__text,
.tool-panel p,
.insight-card p {
  margin: 0;
  color: var(--muted-strong);
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.tool-panel {
  padding: 28px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel-title {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  line-height: 1.15;
}

.panel-copy {
  margin-top: 8px;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-badge--success {
  border-color: rgba(113, 213, 157, 0.34);
  background: var(--success-soft);
  color: var(--success);
}

.status-badge--warning {
  border-color: rgba(255, 199, 113, 0.34);
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge--error {
  border-color: rgba(230, 74, 68, 0.3);
  background: var(--accent-soft);
  color: #ff9c96;
}

.password-display,
.result-block,
.editor-shell {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(10, 11, 14, 0.72);
}

.password-display__value {
  min-height: 72px;
  display: flex;
  align-items: center;
  word-break: break-all;
  font-family: "DM Mono", monospace;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  color: var(--text);
}

.password-display__meta,
.helper-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.tool-actions,
.preset-grid,
.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.strength-meter {
  margin-top: 18px;
}

.strength-meter__bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.strength-meter__bars span {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, transform 0.2s ease;
}

.strength-meter__bars span.is-on {
  background: linear-gradient(135deg, #f05f57, #c9252b);
  transform: scaleX(1.02);
}

.strength-meter__label {
  margin-top: 10px;
  color: var(--muted-strong);
  font-weight: 600;
}

.field-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.field-row,
.field-group {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--muted-strong);
  font-weight: 600;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.range-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-output,
.select-field,
.code-input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.toggle-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.toggle-card input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.toggle-card__title {
  margin: 0;
  font-weight: 700;
}

.toggle-card__copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.stat-card,
.insight-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.stat-card__value {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 1.05rem;
  color: var(--text);
}

.preset-grid {
  margin-top: 18px;
}

.preset-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.preset-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 74, 68, 0.28);
  background: rgba(255, 255, 255, 0.05);
}

.alert {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
}

.alert[hidden] {
  display: none;
}

.alert--success {
  border-color: rgba(113, 213, 157, 0.34);
  background: var(--success-soft);
  color: var(--success);
}

.alert--error {
  border-color: rgba(230, 74, 68, 0.3);
  background: var(--accent-soft);
  color: #ffb3ad;
}

.editor-grid {
  display: grid;
  gap: 18px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.editor-textarea,
.result-pre {
  width: 100%;
  min-height: 420px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: "DM Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
}

.editor-textarea:focus,
.result-pre:focus {
  outline: none;
}

.result-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-footer {
  padding: 0 clamp(16px, 3vw, 32px) 28px;
}

.site-footer__shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 24px 24px 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: transparent;
  box-shadow: none;
}

.site-footer__inner {
  padding-top: 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-footer__copy,
.site-footer__nav a {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer__nav a {
  transition: color 0.2s ease;
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--text);
}

.reveal-up {
  opacity: 0;
  transform: translateY(24px);
}

.reveal-fade {
  opacity: 0;
  transform: translateY(12px);
}

@media (max-width: 1100px) {
  .tool-hero,
  .tool-shell {
    grid-template-columns: 1fr;
  }

  .tool-hero__copy {
    max-width: 46rem;
  }
}

@media (max-width: 860px) {
  :root {
    --header-height: 74px;
  }

  .site-header {
    padding: 16px 16px 0;
  }

  .site-nav {
    padding: 0 16px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: calc(16px + var(--header-height) + 12px);
    margin-left: 0;
    padding: 22px;
    border: 1px solid var(--border-strong);
    border-radius: 28px;
    background: rgba(12, 13, 17, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.36);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition:
      opacity 0.22s ease,
      transform 0.22s ease,
      visibility 0.22s ease;
  }

  .site-nav.is-open .nav-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links,
  .nav-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    gap: 10px;
  }

  .nav-links a {
    display: block;
    padding: 10px 0;
    font-size: 0.84rem;
    color: var(--text);
  }

  .nav-actions .btn {
    width: 100%;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .section {
    padding-inline: 16px;
  }

  .toggle-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .hero__actions {
    align-items: stretch;
  }

  .hero__actions .btn,
  .tool-actions .btn,
  .editor-toolbar .btn {
    width: 100%;
  }

  .tool-panel,
  .hero-panel {
    padding: 22px;
  }

  .panel-head {
    flex-direction: column;
  }

  .editor-textarea,
  .result-pre {
    min-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  #bg-canvas {
    display: none;
  }

  .reveal-up,
  .reveal-fade {
    opacity: 1;
    transform: none;
  }
}
