/* a00c — a shell window on a page that explains it. Dark, cool, precise.
   Colour carries meaning: green = used / OK / primary action; red = thrown away, removed, failed; amber = digits and numbers;
   cyan = symbols and identifiers; violet = keywords and row labels.
   Text, from loud to quiet: fg, soft (explanations), dim (quiet live text, AA on bg and pane),
   faint (line numbers, the pool's offsets and resting bytes: 3:1 on pane). ink is the dark text on green.
   sel, add, del are the tinted rows — the selected row and the snippet's diff lines — as opaque colours. */
:root{
  --page:#070a0f; --bg:#0a0e14; --pane:#0c1119; --bar:#111927; --line:#1b2532;
  --fg:#c9d4e3; --soft:#9aa8bb; --dim:#7d8fa6; --faint:#566980;
  --green:#8ae99c; --red:#ff7b72; --amber:#ffcb6b; --cyan:#7dcfff; --violet:#c4a7ff; --ink:#06210d;
  --sel:#141f1f; --add:#1a2927; --del:#2c1f25;
  --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  color-scheme:dark;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--page) radial-gradient(900px 420px at 78% -120px,#8ae99c14,transparent 70%) no-repeat;color:var(--fg);font:14px/1.55 var(--mono);
  overflow-wrap:break-word;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button,select{-webkit-appearance:none;appearance:none;margin:0;font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--cyan);outline-offset:-2px}
h1,h2,h3,p{margin:0}
#fly{position:fixed;inset:0;width:100%;height:100%;z-index:9;pointer-events:none}
.sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.page{max-width:1328px;margin:0 auto;padding:0 24px}
.nojs{padding:12px 0;color:var(--amber)}
/* Until the labels are painted the page is a frame without words: it appears whole, once. */
html:not([data-ready]) main,html:not([data-ready]) .foot{visibility:hidden}
/* A page that never gets that far — a file did not arrive, the browser is too old — says so after fifteen seconds, in every language.
   The line is static (the CSP allows no inline script) and out of the flow, so nothing shifts when the page does become ready.
   With scripting off the noscript line speaks instead. */
.stuck{display:none;position:absolute;left:0;right:0;top:0;padding:12px 24px;color:var(--amber);visibility:hidden;animation:stuck 0s 15s forwards}
.stuck span{display:block;margin-bottom:8px}
html:not([data-ready]) .stuck{display:block}
@keyframes stuck{to{visibility:visible}}
@media (scripting:none){html:not([data-ready]) .stuck{display:none}}

/* ---- the first screen: the hero and the window share it; the window takes what the hero leaves ---- */
.first{display:flex;flex-direction:column;min-height:100vh;min-height:min(100svh,1040px);padding-bottom:24px}

/* ---- hero: what this is, in the visitor's language ---- */
.hero{padding:calc(12px + env(safe-area-inset-top)) 0 24px}
.bar{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px}
.mark{display:inline-flex;align-items:center;gap:10px;font-size:18px;font-weight:700}
.mark svg{width:28px;height:28px;border-radius:7px;box-shadow:0 0 0 1px var(--line)}
.langs{display:none}
.lang{min-height:44px;padding:0 12px;border:0;border-bottom:2px solid transparent;background:none;color:var(--soft);font-size:13px;white-space:nowrap;cursor:pointer}
.lang:hover{color:var(--fg)}
.lang[aria-pressed="true"]{color:var(--fg);border-bottom-color:var(--green)}
.langsel{position:relative;display:inline-flex;align-items:center;border-radius:8px;background:var(--pane);box-shadow:inset 0 0 0 1px var(--line);color:var(--soft)}
.langsel svg{position:absolute;left:11px;width:16px;height:16px;pointer-events:none}
.langsel::after{content:"";position:absolute;right:12px;top:50%;width:6px;height:6px;margin-top:-5px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);pointer-events:none}
.langsel select{min-height:44px;padding:0 30px 0 35px;border:0;border-radius:8px;background:none;font-size:16px;cursor:pointer}   /* 16 px: iOS does not zoom on focus */
.langsel option{background:var(--pane);color:var(--fg)}
h1{margin-top:20px;font:700 clamp(26px,3.9vw,36px)/1.16 var(--mono);letter-spacing:-.02em;text-wrap:balance}
h1 .hl{display:block;color:var(--green)}
.lede{margin-top:12px;max-width:86ch;color:var(--soft);font-size:15px;line-height:1.6}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0 0;padding:0;list-style:none}
.chips li{display:flex;align-items:center;gap:8px;padding:5px 13px;border:1px solid var(--line);border-radius:999px;background:var(--pane);font-size:13px;white-space:nowrap}
.chips li::before{content:"✓";color:var(--green);font-weight:700}

/* ---- the tool: a terminal window; its title bar holds the tool tabs ---- */
.win{--tabbg:var(--bg);flex:1 1 0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto;min-height:520px;
  border:1px solid #243244;border-radius:12px;overflow:hidden;background:var(--bg);box-shadow:0 30px 80px -30px #000,0 0 0 1px #ffffff06}
.titlebar{display:flex;align-items:flex-end;gap:14px;padding:6px 14px 0;background:var(--bar);border-bottom:1px solid var(--line)}
/* The strip hangs one pixel over the bar's bottom line; only the selected tab fills that pixel, so it joins the pane below. */
.tabs{display:flex;gap:4px;min-width:0;margin-bottom:-1px;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar,.fmts::-webkit-scrollbar{display:none}
.tab{flex:none;min-height:44px;margin-bottom:1px;padding:0 18px;border:1px solid transparent;border-top-width:2px;border-bottom:0;border-radius:8px 8px 0 0;background:#ffffff08;color:var(--soft);
  font-size:13px;font-weight:600;white-space:nowrap;cursor:pointer}
.tab:hover{color:var(--fg)}
.tab[aria-selected="true"]{margin-bottom:0;background:var(--tabbg);color:var(--fg);border-color:var(--line);border-top-color:var(--green)}
.wtitle{margin-left:auto;align-self:center;color:var(--dim);font-size:12px;white-space:nowrap}
/* A strip of tabs that does not fit scrolls sideways; the edge where tabs are cut off fades out. */
.clip-l{-webkit-mask-image:linear-gradient(90deg,transparent,#000 28px);mask-image:linear-gradient(90deg,transparent,#000 28px)}
.clip-r{-webkit-mask-image:linear-gradient(270deg,transparent,#000 28px);mask-image:linear-gradient(270deg,transparent,#000 28px)}
.clip-l.clip-r{-webkit-mask-image:linear-gradient(90deg,transparent,#000 28px,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(90deg,transparent,#000 28px,#000 calc(100% - 28px),transparent)}

.split{display:grid;min-height:0;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);
  grid-template-areas:"term editor" "term pool"}

/* ---- pane: the shell ---- */
.term{grid-area:term;min-width:0;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);border-right:1px solid var(--line);container:term/inline-size}
.scroll{min-height:0;overflow-y:auto;padding:14px 16px}
.ps{color:var(--green);margin-right:1ch}
.dim{color:var(--dim)} .ok{color:var(--green)}
.blk{margin-bottom:18px}
.blk:last-child{margin-bottom:0}
.blk.old{opacity:.38}   /* history, inactive: exempt from the contrast rule */
.cmd{font-weight:600;white-space:nowrap}
.cmd .ps{margin-right:0}
.info{margin:4px 0 6px;color:var(--soft)}
.info b{color:var(--fg);font-weight:600}
.try{color:var(--dim);font-size:13px}
.try code{font:inherit;color:var(--green)}
.try.rej{text-decoration:line-through #ff7b7299}
.try.rej code{color:var(--red)}
.try.rej .why{display:inline-block;color:var(--soft)}   /* the reason stays readable: an inline-block is not struck through */
.try b{color:var(--amber)}

/* A result row is a container; the copy button inside it is the control. Stacked by default: the value on top, label and note under it.
   A shell pane 700 px wide or more puts everything on one line, the label column (--kw) sized per language. The port row is always stacked. */
.row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"v v c" "k n c";align-items:center;gap:0 8px;
  width:calc(100% + 20px);min-height:44px;margin:0 -10px;padding:1px 4px 1px 10px;border-left:2px solid transparent;border-radius:0 6px 6px 0}
.row.sel{border-left-color:var(--green);background:var(--sel)}
.rk{grid-area:k;color:var(--violet);font-size:12px;white-space:nowrap}
.pick{display:none;color:var(--green)}
.sel .pick{display:inline}
.rv{grid-area:v;min-width:0;font-size:17px;line-height:1.3;font-weight:600;letter-spacing:.02em;white-space:pre-wrap;overflow-wrap:anywhere}
.ch.d{color:var(--amber)} .ch.s{color:var(--cyan)}
.rn{grid-area:n;min-width:0;color:var(--soft);font-size:11px;line-height:1.3;white-space:nowrap}
.row .rc{grid-area:c}
.row.big{grid-template-areas:"v c" "k c" "n c";grid-template-columns:minmax(0,1fr) auto;min-height:0;padding:6px 10px}
.row.big .rv{font-size:44px;line-height:1.1}
.row.big .rn{white-space:normal}
@container term (min-width:700px){
  .row:not(.big){grid-template-columns:var(--kw,11ch) minmax(0,1fr) auto auto;grid-template-areas:"k v n c";min-height:46px;padding:1px 10px}
  .row:not(.big) .rk{font-size:14px}
  .row:not(.big) .rn{font-size:12px}
}

/* ---- the reveal. The values are in the page from the tap; this only shows them arriving, and never changes where anything sits.
   The script puts these states on (data-revealing on the block, .w and .in on characters) and takes them off when the reveal ends
   or is cut short; under reduced motion it never puts them on. The durations --type, --line-in and --land come from the timeline. ---- */
.blk[data-revealing] .typed{display:inline-block;overflow:hidden;vertical-align:bottom;white-space:pre;width:0;animation:type var(--type) steps(var(--n)) forwards}
@keyframes type{to{width:calc(var(--n)*1ch)}}
.blk[data-revealing]>:not(.cmd){opacity:0;animation:line-in var(--line-in) ease var(--d,0s) forwards}
@keyframes line-in{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
/* A character is inline at rest, so a selection made by hand is exactly the value. It is a box only while it waits and while it pops. */
.ch.w,.ch.in{display:inline-block}
.ch.w{opacity:0}
.ch.in{animation:land var(--land) cubic-bezier(.2,1.5,.35,1) backwards}
@keyframes land{0%{opacity:0;transform:translateY(-5px) scale(1.7);color:var(--green)}40%{opacity:1;transform:translateY(1px) scale(.92);color:var(--green)}}
.big .ch.in:nth-child(2){animation-delay:50ms}   /* the digits of a port pop one after another */
.big .ch.in:nth-child(3){animation-delay:100ms}
.big .ch.in:nth-child(4){animation-delay:150ms}
.big .ch.in:nth-child(5){animation-delay:200ms}

/* ---- pane: the snippet you paste. One fixed height: whatever it shows, nothing around it moves ---- */
.editor{grid-area:editor;position:relative;display:flex;flex-direction:column;min-width:0;height:229px;background:var(--pane)}
.ed-head{flex:none;display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--line);font-size:12px}
.ed-label{color:var(--dim);white-space:nowrap}
.ed-toggle{display:none}
.fmts{display:flex;gap:2px;flex:1;min-width:0;padding-right:2px;overflow-x:auto;scrollbar-width:none}   /* keeps the last tab clear of a fractional edge */
.fmt{flex:none;min-width:44px;min-height:44px;padding:0 10px;border:0;border-bottom:2px solid transparent;background:none;color:var(--soft);font-size:12px;white-space:nowrap;cursor:pointer}
.fmt:hover{color:var(--fg)}
.fmt[aria-selected="true"]{color:var(--fg);border-bottom-color:var(--green)}
.ed-body{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
#pa-note{flex:none;padding:8px 14px 0;color:var(--soft);font-size:12px;line-height:1.45}   /* its own block: it wraps, it does not scroll, it is never copied */
.code{flex:1 1 0;min-height:0;margin:0;padding:12px 0;overflow:auto;font:14px/1.7 var(--mono)}
/* A line never wraps; the area scrolls sideways and the numbers stay put. A diff pair: the old line red and struck above the new one, green. */
.ln{display:flex;width:max-content;min-width:100%;background:var(--pane);white-space:pre}
.no{flex:none;position:sticky;left:0;box-sizing:content-box;width:3ch;padding:0 12px;background:inherit;color:var(--faint);text-align:right;-webkit-user-select:none;user-select:none}
.tx{padding-right:16px}
.ln.add{background:var(--add)} .ln.add .no{color:var(--green)}
.ln.del{background:var(--del)} .ln.del .no{color:var(--red)}
.ln.del .tx{text-decoration:line-through}
.ln.del .tx span{color:var(--red)}
.t-var{color:var(--cyan)}.t-str{color:var(--green)}.t-op{color:var(--dim)}.t-com{color:var(--dim)}.t-key{color:var(--violet)}.t-num{color:var(--amber)}

/* The copy control. Its box is the touch target; the chip the eye sees is drawn inside it. */
.rc{position:relative;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:44px;min-height:44px;padding:0 10px;border:0;background:none;
  color:var(--soft);font-size:12px;white-space:nowrap;cursor:pointer}
.rc::before{content:"";position:absolute;inset:6px 0;border:1px solid var(--line);border-radius:6px;pointer-events:none}
button.rc:hover{color:var(--fg)}
.ic{position:relative;display:inline-block;flex:none;width:9px;height:11px;margin:3px 0 0 3px;border:1.5px solid currentColor;border-radius:2px}   /* "copy": two sheets, drawn in CSS */
.rc.done{color:var(--green)}
.rc.fail{color:var(--red)}
.done .ic,.fail .ic{width:auto;height:auto;margin:0;border:0}   /* the sheets give way to a tick or a cross: states, not animations */
.done .ic::before,.fail .ic::before{display:none}
.done .ic::after{content:"✓"}
.fail .ic::after{content:"✕"}
.ic::before{content:"";position:absolute;left:-4.5px;top:-4.5px;width:9px;height:11px;border:1.5px solid currentColor;border-right-color:transparent;border-bottom-color:transparent;border-radius:2px}

/* ---- pane: the pool of random bytes every value is built from ---- */
.pool{grid-area:pool;min-width:0;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);background:var(--pane);border-top:1px solid var(--line)}
.pool-head{display:flow-root;padding:8px 12px 4px;color:var(--dim);font-size:12px}
.pool-head b{color:var(--fg);font-weight:600}
.src{display:none;font:inherit}
.pool-body{position:relative;min-height:0;overflow:hidden}
#pool{position:absolute;left:0;top:0}

/* ---- prompt + status line ---- */
.prompt{display:flex;gap:10px;padding:10px 14px;border-top:1px solid var(--line);background:var(--pane)}
.cmdline{flex:1;min-width:0;min-height:48px;display:flex;align-items:center;overflow:hidden;white-space:nowrap;padding:0 14px;
  border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--fg);font:600 15px var(--mono);text-align:left;cursor:pointer}
.run{min-height:48px;padding:0 24px;border:0;border-radius:8px;background:var(--green);color:var(--ink);font:700 15px var(--mono);white-space:nowrap;cursor:pointer}
.run:active{transform:translateY(1px)}
.run:focus-visible{outline-color:var(--ink);outline-offset:-4px}   /* a dark ring: cyan would vanish on green */

.tmux{position:relative;display:flex;align-items:center;gap:10px;min-height:28px;padding:0 12px;overflow:hidden;background:var(--green);color:var(--ink);font-size:13px;font-weight:600;white-space:nowrap}
.sess,.stat{flex:none}
#clock{flex:0 1 auto;min-width:0;margin-left:auto;overflow:hidden}   /* when space runs out the clock gives way, never the claim */
#status-msg{position:absolute;inset:0;display:none;align-items:center;padding:0 12px;background:var(--amber);color:var(--ink);pointer-events:none}
#status-msg.err{background:var(--red)}
.tmux.say #status-msg{display:flex}

/* ---- below the tool: how it works, questions, footer ---- */
.sec{padding-top:56px}
.sec h2{margin-bottom:18px;font:700 20px/1.25 var(--mono)}
.sec h2::before{content:"❯ ";color:var(--green)}
.steps,.faq{display:grid;gap:14px;margin:0;padding:0;list-style:none}
.steps{grid-template-columns:repeat(3,minmax(0,1fr));counter-reset:step}
.faq{grid-template-columns:repeat(2,minmax(0,1fr))}
.step,.qa{min-width:0;padding:18px;border:1px solid var(--line);border-radius:12px;background:var(--pane)}
.step{counter-increment:step;display:grid;grid-template-rows:subgrid;grid-row:span 3;row-gap:14px}   /* titles, pictures and texts line up across the three steps */
.step h3,.qa h3{font:700 15px/1.35 var(--mono)}
.step h3{display:flex;align-items:center;gap:10px}
.step h3::before{content:counter(step);flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--green);color:var(--ink);font-size:14px}
.step p,.qa p{color:var(--soft);font-size:13.5px;line-height:1.65}
.qa p{margin-top:8px}
/* The pictures: real bytes and the product's own rule, drawn once per load. */
.demo{display:flex;flex-wrap:wrap;align-items:center;gap:8px 18px;min-height:58px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--bg);font-size:13px;overflow:hidden}
.hexrow{color:var(--dim);letter-spacing:.04em;white-space:nowrap}
.pair{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}
.pair code,.mini-s{font:inherit}
.pair code{color:var(--green)}
.pair b{font-size:17px}
.pair .to{color:var(--dim)}
.pair.bad{color:var(--red)}
.pair.bad code{color:var(--red);text-decoration:line-through}
.mini{letter-spacing:.08em}
.mini-s{white-space:nowrap}
.demo .rc{min-width:0;min-height:32px;padding:0 9px;cursor:default}
.demo .rc::before{inset:0}
.foot{margin-top:56px;padding:18px 0 calc(28px + env(safe-area-inset-bottom));border-top:1px solid var(--line);color:var(--dim);font-size:12px}
.foot b{color:var(--fg)}

@media (min-width:900px){
  /* wide: the window is about two thirds of the screen and never under 480 px; shell on the left, "paste as" over the pool on the right */
  .first{padding-bottom:28px}
  .langs{display:flex;gap:2px}
  .langsel{display:none}
  .win{min-height:480px}
}
@media (min-width:1180px){
  .hero-text{display:grid;grid-template-columns:auto minmax(0,1fr);gap:0 56px;align-items:end}   /* headline and text side by side */
  .lede{margin:0 0 3px;font-size:14.5px}
  .src{display:block;float:right;margin-left:12px}   /* room for the source's name: on the caption's last line if it fits there, else under it */
}
@media (max-width:899px){
  /* one column: pool strip (two byte-rows), shell, "paste as" collapsed to its bar; the prompt row is the Generate button alone */
  .win{--tabbg:var(--pane)}
  .wtitle,.long,.cmdline{display:none}
  .split{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"pool" "term" "editor"}
  .term{border-right:0}
  .pool{border-top:0;border-bottom:1px solid var(--line)}
  .pool-head{padding:6px 14px 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .pool-body{height:48px}
  .editor{height:auto;border-top:1px solid var(--line)}
  .ed-head{padding:0 8px 0 4px;border-bottom:0}
  .ed-label{display:none}
  .ed-toggle{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 8px;border:0;background:none;color:var(--soft);white-space:nowrap;cursor:pointer}
  .ed-toggle::after{content:"▴";color:var(--green)}
  /* the snippet opens over the shell, above the bar; the bar itself never changes size */
  .ed-body{display:none;position:absolute;left:0;right:0;bottom:100%;z-index:4;height:220px;border-top:1px solid var(--line);background:var(--pane);box-shadow:0 -14px 30px -10px #000}
  .editor.open .ed-body{display:flex}
  .editor.open .ed-toggle::after{content:"▾"}
  .scroll{padding:12px 10px 8px}
  .prompt{padding:8px 14px}
  .run{flex:1}
  .steps,.faq{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:599px){
  /* phone: a compact hero — mark, language, headline, one line of facts — and the window share the screen */
  .page{padding:0 8px}
  .first{min-height:100vh;min-height:100svh;padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  .hero{padding:calc(4px + env(safe-area-inset-top)) 8px 8px}
  .mark{gap:8px;font-size:16px} .mark svg{width:24px;height:24px}
  h1{margin-top:2px;font-size:17px;line-height:1.3;letter-spacing:0}
  h1 .hl{display:inline}
  .lede,.chips li:first-child{display:none}   /* the headline already says where it is made */
  .chips{gap:0 14px;height:17px;margin-top:5px;overflow:hidden}   /* one line: a fact that does not fit wraps out of sight */
  .chips li{gap:5px;padding:0;border:0;background:none;color:var(--soft);font-size:11px;line-height:17px}
  .win{min-height:484px;border-radius:10px}   /* its chrome plus four result rows */
  .titlebar{gap:0;padding:4px 6px 0}
  .tabs{flex:1}
  .tab{flex:1 0 auto;padding:0 8px}
  .rc-t{display:none}
  .sec{padding:40px 8px 0}
  .foot{margin:40px 8px 0}
}
@media (max-width:374px){
  /* the smallest phones: a row's note gets the room of the ▸ mark (the selected row keeps its bar and its tint) and a tighter gap;
     a note that still does not fit takes a second line rather than run under the copy control */
  .row:not(.big){column-gap:6px}
  .sel .pick{display:none}
  .row:not(.big) .rk,.row:not(.big) .rn{align-self:baseline}
  .row:not(.big) .rn{white-space:normal;word-break:keep-all;text-wrap:pretty}
}
