:root {
  --bg: #0a0f0b;
  --panel: #0e1410;
  --inset: #050705;
  --border: #1e2b22;
  --border-bright: #2f4636;
  --text: #dcefe0;
  --text-dim: #a0b5a7;
  --acc: #3fff6e;
  --acc-dim: rgba(63, 255, 110, 0.4);
  --acc-soft: rgba(63, 255, 110, 0.08);
  --amber: #ffb454;
  --red: #ff5f56;
  --link: #5ad1ff;
  --glow: 0 0 8px rgba(63, 255, 110, 0.35);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(63, 255, 110, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

/* CRT scanlines over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
}

::selection { background: var(--acc); color: #04140a; }

:focus-visible { outline: 2px dashed var(--acc); outline-offset: 2px; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* links inside text blocks must not rely on color alone (a11y) */
.prose a, .gen-desc a, .security a, .site-footer a { text-decoration: underline; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 15, 11, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-bright);
  padding: 0.75rem 0;
}

.site-header .wrap {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.logo::before { content: "$ "; color: var(--acc); }
.logo .tld { color: var(--acc); text-shadow: var(--glow); }
.logo:hover { text-decoration: none; }

.tagline {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- hero ---------- */

.hero { padding: 2.8rem 0 1rem; }

h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
}

h1::after {
  content: "▊";
  margin-left: 0.18em;
  color: var(--acc);
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hl { color: var(--acc); text-shadow: var(--glow); }

.hero p { color: var(--text-dim); margin: 0.4rem 0; max-width: 62ch; }

.hero .hint { margin-top: 0.7rem; }

.badge {
  display: inline-block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--acc);
  background: var(--acc-soft);
  border: 1px solid var(--acc-dim);
  padding: 0.2rem 0.7rem;
  margin-bottom: 1rem;
}

.badge::before { content: "[ "; }
.badge::after { content: " ]"; }

.hint {
  display: inline-block;
  font-size: 0.76rem;
  color: var(--amber);
  background: var(--inset);
  border: 1px solid var(--border-bright);
  padding: 0.22rem 0.6rem;
  white-space: nowrap;
}

/* ---------- toc ---------- */

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 1rem 0;
  list-style: none;
  margin: 0;
}

.toc a {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-bright);
  padding: 0.4rem 0.75rem;
  box-shadow: 3px 3px 0 rgba(63, 255, 110, 0.12);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.toc a:hover {
  background: var(--acc);
  color: #04140a;
  text-decoration: none;
  box-shadow: 1px 1px 0 rgba(63, 255, 110, 0.3);
  transform: translate(2px, 2px);
}

/* ---------- generator sections ---------- */

.gen {
  margin: 2.2rem 0;
  padding: 1.4rem;
  background: var(--panel);
  border: 1px solid var(--border-bright);
  box-shadow: 6px 6px 0 rgba(63, 255, 110, 0.08);
  scroll-margin-top: 4.5rem;
  transition: border-color 0.2s ease;
}

.gen:hover { border-color: var(--acc-dim); }

.gen-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border-bright);
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
}

.gen h2, .gen h1 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gen h2::before, .gen h1::before { content: "> "; color: var(--acc); }

.gen h2 a, .gen h1 a { color: var(--text); }
.gen h2 a:hover { color: var(--acc); text-decoration: none; }

.gen .gen-desc {
  margin: 0.2rem 0 1.1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* pages without gen-head keep spacing */
.gen > [data-generator]:first-child { margin-top: 0.2rem; }

/* ---------- outputs ---------- */

.out-group { margin-bottom: 0.8rem; }

.out-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.35rem;
}

.out {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--inset);
  border: 1px solid var(--border-bright);
  margin-bottom: 0.9rem;
  transition: border-color 0.15s ease;
}

.out:hover, .out:focus-within { border-color: var(--acc-dim); }

@keyframes outflash {
  from { background-color: rgba(63, 255, 110, 0.18); }
  to { background-color: var(--inset); }
}

.gen-outputs.flash .out { animation: outflash 0.45s ease-out; }

.out-text {
  flex: 1;
  margin: 0;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--acc);
  text-shadow: var(--glow);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  min-height: 1.5em;
}

.out-tall .out-text { max-height: 16rem; overflow-y: auto; font-size: 0.78rem; }

.out-err { border-color: var(--red); }
.out-err .out-text { color: var(--red); text-shadow: none; }

/* ---------- buttons ---------- */

button {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: 1px solid var(--border-bright);
  background: var(--panel);
  color: var(--text);
  padding: 0.45rem 0.9rem;
  box-shadow: 3px 3px 0 rgba(63, 255, 110, 0.12);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

button:hover {
  background: var(--acc);
  color: #04140a;
  box-shadow: 1px 1px 0 rgba(63, 255, 110, 0.3);
  transform: translate(2px, 2px);
}

button:active { box-shadow: none; transform: translate(3px, 3px); }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  margin: 0.55rem 0.55rem 0 0;
  flex-shrink: 0;
  min-width: 6.4rem;
  justify-content: center;
}

.copy svg { flex-shrink: 0; }

.copy.ok { background: var(--acc); color: #04140a; }

.regen { color: var(--acc); border-color: var(--acc-dim); }
.regen:hover { color: #04140a; }

/* ---------- controls ---------- */

.gen-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: center;
  margin-bottom: 1rem;
}

.ctl {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.ctl input[type="range"] { width: 9rem; accent-color: var(--acc); }
.ctl input[type="checkbox"] { accent-color: var(--acc); width: 1rem; height: 1rem; }

.ctl select, .ctl input[type="number"], .ctl input[type="text"] {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--inset);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: 0;
  padding: 0.32rem 0.55rem;
}

.ctl select:focus, .ctl input:focus { outline: none; border-color: var(--acc); }

.ctl input[type="number"] { width: 4.5rem; }
.ctl-text { flex: 1 1 14rem; }
.ctl-text input { flex: 1; }

.ctl-val {
  font-size: 0.85rem;
  color: var(--acc);
  min-width: 2.2rem;
}

/* ---------- entropy meter (segmented LED bar) ---------- */

.gen-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.entropy { display: inline-flex; align-items: center; gap: 0.6rem; }

.meter {
  width: 88px;
  height: 10px;
  background: var(--inset);
  border: 1px solid var(--border-bright);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 5px, var(--inset) 5px 7px);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.lvl-low { background-color: var(--red); }
.lvl-mid { background-color: var(--amber); }
.lvl-high { background-color: var(--acc); }

.entropy-label {
  font-size: 0.76rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- prose (SEO copy) ---------- */

.prose { margin: 2.6rem 0; }

.prose h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.8rem 0 0.4rem;
}

.prose h2::before { content: "## "; color: var(--acc-dim); }

.prose p, .prose li { color: var(--text-dim); font-size: 0.88rem; max-width: 74ch; }

.prose code, .security code {
  font-size: 0.92em;
  color: var(--amber);
  background: var(--inset);
  border: 1px solid var(--border);
  padding: 0.08em 0.35em;
}

/* ---------- security notes ---------- */

.security {
  margin: 2.6rem 0;
  padding: 1.3rem 1.4rem;
  border: 1px dashed var(--acc-dim);
  background: var(--acc-soft);
}

.security h2 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: var(--acc);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.security h2::before { content: "[ "; }
.security h2::after { content: " ]"; }

.security ul { margin: 0; padding-left: 1.2rem; }
.security li { font-size: 0.85rem; margin: 0.4rem 0; }
.security li::marker { color: var(--acc); }

/* ---------- other tools ---------- */

.others { margin: 2.6rem 0; }

.others h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.others h2::before { content: "> "; color: var(--acc); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px dashed var(--border-bright);
  margin-top: 3.2rem;
  padding: 1.6rem 0 2.8rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.site-footer .wrap::before {
  content: "// end of transmission";
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--acc-dim);
  margin-bottom: 0.6rem;
}

.site-footer p { margin: 0.3rem 0; }

/* follow the white rabbit */
.rabbit, .rabbit:hover, .rabbit:active {
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
  padding: 0;
}

.rabbit {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--text-dim);
  cursor: pointer;
}

.rabbit:hover { color: var(--acc); text-shadow: var(--glow); }

canvas.rain {
  position: fixed;
  inset: 0;
  z-index: 998; /* under the scanlines — the rain stays CRT */
  cursor: pointer;
}

@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .gen { padding: 1rem; margin: 1.4rem 0; box-shadow: 4px 4px 0 rgba(63, 255, 110, 0.08); }
  .out-text { font-size: 0.88rem; }
  .ctl input[type="range"] { width: 7rem; }
  .hint { font-size: 0.7rem; white-space: normal; }
}
