:root{
  /* layout: one full-bleed canvas holds the visitor. Our world's instrument readout sits small
     in the top-left, the visitor's own words bottom-left, and top-right two marks: a question mark, and on
     a computer or a tablet a full screen mark. Only the creature is loud. */
  --void:#04050a;
  --instrument:#7d91a6;
  --signal:#eef4f8;
  --leak-a:#ff3dcb;
  --leak-b:#35f5e6;
  --alarm:#ffd447;
  --gate:#ff4a3d;                        /* the way back, in the help's pictures */
  --read:#c3ced8;                        /* the instrument's colour where there is a sentence to read */
  --font-voice:"Major Mono Display",ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  --font-instrument:"Martian Mono",ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:var(--void);color:var(--signal);overflow:hidden;
  overscroll-behavior:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
  -webkit-tap-highlight-color:transparent}
#world{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair;outline:none}
/* the ring only for whoever came to it by the keyboard (input.js sets .keyed): the browsers count a focus
   that script hands it after a touch as a keyboard one, and would ring the whole page at every click */
#world.keyed:focus-visible{outline:2px solid var(--leak-b);outline-offset:-4px}

.hud{position:fixed;top:16px;left:16px;display:grid;gap:9px;margin:0;pointer-events:none;
  font:400 10px/1.2 var(--font-instrument);font-stretch:75%;letter-spacing:.14em;text-transform:uppercase;
  color:var(--instrument);font-variant-numeric:tabular-nums}
.hud p{margin:0}
.hud b{font-weight:500;color:var(--signal)}
.meters{display:grid;grid-template-columns:max-content 76px;align-items:center;gap:7px 10px;margin:0}
.meters div{display:contents}
.meters dt,.meters dd{margin:0}
.meters dd{height:2px;background:rgba(125,145,166,.24);position:relative}
.meters i{position:absolute;top:0;bottom:0;left:0;width:0;transition:width .25s linear}
#mFam{background:var(--leak-b)}
#mAgit{background:var(--leak-a)}
#mReal{background:var(--alarm)}
#mReal.low{animation:slipping .5s steps(2,jump-none) infinite}   /* its hold on this world is going */
@keyframes slipping{from{opacity:1}to{opacity:.25}}
#mLoop{background:var(--signal);transition:none}
#mLoop.rec{background:var(--leak-a)}

/* the two marks, top right, as quiet as the readout: a question mark that brings up how to handle it (help.js),
   and on computers and tablets four corner marks that put the page on the whole screen (and, turned inward,
   take it back). They are the only controls there are */
.marks{position:fixed;top:4px;right:4px;display:flex}
.marks button{width:40px;height:40px;padding:0;display:grid;place-items:center;
  background:none;border:0;border-radius:2px;color:var(--instrument);cursor:pointer;opacity:.75;
  transition:opacity .2s,color .2s}
.marks button[hidden]{display:none}
.marks svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.25;stroke-linecap:square;
  stroke-linejoin:miter;transition:transform .2s}
#helpBtn{opacity:.95}                    /* the one mark a newcomer has to find */
#helpBtn svg{width:18px;height:18px}
#full .in,#full[aria-pressed="true"] .out{display:none}
#full[aria-pressed="true"] .in{display:inline}
#full[aria-pressed="true"]{opacity:.4}
.marks button:focus-visible,.marks button:active{opacity:1;color:var(--signal)}
@media (hover:hover){                    /* only a cursor: under a finger :hover would stay stuck on */
  .marks button:hover{opacity:1;color:var(--signal)}
  .marks button:hover svg{transform:scale(1.15)}
  #full[aria-pressed="true"]:hover svg{transform:scale(.87)}
}
@media (pointer:coarse){                 /* room for a finger, the marks where they were */
  .marks{top:0;right:0}
  .marks button{width:48px;height:48px}
}
.marks button:focus-visible{outline:2px solid var(--leak-b);outline-offset:-6px}
/* iPhone only: a transparent label over the canvas hands each real tap to a hidden native switch,
   which is the one thing Safari will tick the Taptic Engine for */
#veil{position:fixed;inset:0;display:block;touch-action:none;-webkit-touch-callout:none}
#veil[hidden]{display:none}
#hxSwitch{position:fixed;left:0;top:0;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}

#say{position:fixed;left:16px;right:16px;bottom:calc(16px + 9%);margin:0;max-width:21ch;pointer-events:none;
  font:400 clamp(20px,5.6vw,34px)/1.22 var(--font-voice);color:var(--signal);
  text-shadow:-1.5px 0 var(--leak-b),1.5px 0 var(--leak-a);
  white-space:pre-wrap;overflow-wrap:anywhere;opacity:0;transition:opacity .45s}
#say.on{opacity:1;transition-duration:.08s}

#hint{position:fixed;left:16px;right:16px;bottom:16px;margin:0;pointer-events:none;
  font:400 10px/1.5 var(--font-instrument);font-stretch:75%;letter-spacing:.14em;text-transform:uppercase;
  color:var(--instrument);transition:opacity 1.2s}
#hint.gone{opacity:0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* ------------------------------------------------------------------ how to handle it
   A window of pictures (index.html has the pages, help.js turns them): our world's notes on the visitor, so in
   the instrument's hand, framed by the same four corner marks as the full screen mark. The pictures do the
   explaining, and are the one thing in it that moves */
#help{width:min(34rem,calc(100vw - 20px));max-width:none;max-height:calc(100dvh - 20px);margin:auto;padding:0;
  border:0;background:none;color:var(--signal);overflow:visible}
#help:not([open]){display:none}
#help::backdrop{background:rgba(4,5,10,.8)}
#helpDefs{position:absolute}
.hw{--c:var(--instrument);display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;
  max-height:calc(100dvh - 20px);padding:12px 16px 14px;background-color:rgba(7,9,16,.97);
  background-image:linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),
    linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),
    linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),
    linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c));
  background-repeat:no-repeat;
  background-position:left top,left top,right top,right top,left bottom,left bottom,right bottom,right bottom;
  background-size:14px 1px,1px 14px,14px 1px,1px 14px,14px 1px,1px 14px,14px 1px,1px 14px}
.hw header,.hw footer{display:flex;align-items:center;justify-content:space-between;gap:12px}
.hw header p{margin:0;font:400 10px/1.2 var(--font-instrument);font-stretch:75%;letter-spacing:.14em;
  text-transform:uppercase;color:var(--instrument);font-variant-numeric:tabular-nums}
.hw header b{margin-left:.9em;font-weight:500;color:var(--signal)}
#helpShut{width:36px;height:36px;margin:-6px -10px -6px 0;padding:0;display:grid;place-items:center;background:none;
  border:0;border-radius:2px;color:var(--instrument);cursor:pointer}
#helpShut svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.25;stroke-linecap:square}
/* the pages lie on top of one another, all but one unseen, so the window is as tall as the tallest of them and
   the buttons under it stay where they are from page to page. A page that is not for this device is left out (.off) */
#helpPages{display:grid;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-user-select:none;user-select:none}
.hp{grid-area:1/1;display:grid;gap:8px;align-content:start}
.hp[hidden]{display:grid;visibility:hidden}
.hp[hidden] .pic *{animation-play-state:paused}
.hp.off{display:none}
.hp h2{margin:6px 0 0;font:400 clamp(20px,5.6vw,28px)/1.15 var(--font-voice);color:var(--signal);
  text-shadow:-1.5px 0 var(--leak-b),1.5px 0 var(--leak-a)}
.hp p{margin:0;max-width:52ch;font:400 12.5px/1.6 var(--font-instrument);font-stretch:87.5%;color:var(--read)}
.hp p+p{color:var(--instrument)}
.hb{min-width:76px;min-height:38px;padding:0 14px;background:none;border:1px solid rgba(125,145,166,.38);border-radius:2px;
  font:500 10px/1 var(--font-instrument);font-stretch:75%;letter-spacing:.14em;text-transform:uppercase;
  color:var(--read);cursor:pointer;transition:border-color .2s,color .2s}
.hb.go{border-color:var(--leak-b);color:var(--signal)}
.hb:disabled{visibility:hidden}
#helpShut:focus-visible,.hb:focus-visible{outline:2px solid var(--leak-b);outline-offset:2px}
@media (hover:hover){
  #helpShut:hover{color:var(--signal)}
  .hb:hover{border-color:var(--signal);color:var(--signal)}
}
#helpDots{display:flex;gap:7px}
#helpDots i{width:5px;height:5px;background:rgba(125,145,166,.4)}
#helpDots i.on{background:var(--signal)}
/* a page for the keyboard, and a line for it, only where a cursor says there is one */
.hp .keyed{display:none}
@media (hover:hover) and (pointer:fine){ .hp .keyed{display:block} }
/* a phone on its side: the picture beside its words, not over them */
@media (orientation:landscape) and (max-height:480px){
  #help{width:min(46rem,calc(100vw - 20px))}
  .hp{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);column-gap:16px}
  .hp .pic{grid-row:1/span 4}
  .hp h2{margin-top:0}
}

/* the pictures. Lines in the readout's colours; a finger is a white dot with a halo; the visitor is drawn three
   times over, a hair apart, in the two colours it leaks and in white, as its words are (that much is written
   on the drawing itself: helpDefs, in index.html) */
.pic{display:block;width:100%;height:auto;overflow:visible;fill:none;stroke:var(--signal);stroke-width:1.5;
  stroke-linecap:round;stroke-linejoin:round}
.pic .s5{stroke-width:2.7}
.pic .s7{stroke-width:2.15}
.pic .s8{stroke-width:1.85}
.pic .dim{stroke:var(--instrument)}
.pic .dash{stroke-dasharray:1 5}
.pic .a{stroke:var(--leak-a)}
.pic .b{stroke:var(--leak-b)}
.pic .y{stroke:var(--alarm)}
.pic .gate{stroke:var(--gate)}
.pic .dot{fill:var(--signal);stroke:none}
.pic .halo{fill:var(--signal);stroke:none;opacity:.22}
.pic .ring{stroke-width:1.2;opacity:.55}
.pic .track{stroke:rgba(125,145,166,.3);stroke-width:2;stroke-linecap:butt}
.pic .bar{stroke-width:2;stroke-linecap:butt}
.pic .key{stroke:var(--instrument);stroke-width:1.2}
.pic text{stroke:none;fill:var(--instrument);font:400 8.5px var(--font-instrument);font-stretch:75%;letter-spacing:.12em;text-transform:uppercase}
.pic .cap{text-anchor:middle}
.pic .num{fill:var(--signal);font-weight:600}
.pic .kt{text-anchor:middle;fill:var(--signal);letter-spacing:.04em}
.pic .kl{fill:var(--read)}
.pic .voice{text-anchor:middle;fill:var(--signal);font:400 13px var(--font-voice);letter-spacing:0;text-transform:none}
.pic .voice.big{font-size:20px}
/* how they move. Everything that moves is drawn about its own middle, so it turns and swells about that */
.pic .k-tap{animation:h-tap 1.7s infinite}
.pic .k-ring{animation:h-ring 1.7s infinite}
.pic .k-bump{animation:h-bump 1.7s infinite}
.pic .k-stroke{transform:translate(0,7px);animation:h-stroke 2.3s linear infinite alternate}
.pic .k-purr{animation:h-purr 1.15s ease-in-out infinite alternate}
.pic .k-turn{animation:h-turn 1.9s ease-in-out infinite alternate}
.pic .k-drag{animation:h-drag 1.9s ease-in-out infinite alternate}
.pic .k-fill{stroke-dasharray:88;stroke-linecap:butt;animation:h-fill 4.2s infinite}   /* butt: a round end would leave a dot where the ring has yet to begin */
.pic .k-out{animation:h-out 4.2s infinite}
.pic .k-in{opacity:0;animation:h-in 4.2s infinite}
.pic .k-reach{animation:h-reach 4.2s infinite}
.pic .k-tap3{animation:h-tap3 2.4s infinite}
.pic .k-ring3{animation:h-ring3 2.4s infinite}
.pic .d2{animation-delay:.38s}
.pic .d3{animation-delay:.76s}
.pic .k-loop{stroke-dasharray:16 84;animation:h-loop 2.4s linear infinite}
.pic .k-shake{animation:h-shake .34s ease-in-out infinite alternate}
.pic .k-slosh{animation:h-slosh .34s ease-in-out infinite alternate}
.pic .k-grow{transform:scaleX(.72);animation:h-grow 3.6s ease-in-out infinite}
.pic .k-drain{transform:scaleX(.3);animation:h-drain 3.6s ease-in-out infinite}
.pic .k-gate{opacity:.6;animation:h-gate 3.6s ease-in-out infinite}
.pic .k-sink{animation:h-sink 3.6s ease-in-out infinite}
.pic .k-jit{animation:h-jit .14s steps(2,jump-none) infinite}
.pic .k-scrub{transform:translate(-8px,8px);animation:h-scrub .5s linear infinite}
@keyframes h-tap{0%,8%{opacity:0;transform:scale(1.7)}20%,55%{opacity:1;transform:scale(1)}72%,100%{opacity:0;transform:scale(1)}}
@keyframes h-ring{0%,18%{opacity:0;transform:scale(.5)}24%{opacity:.9}62%,100%{opacity:0;transform:scale(2.7)}}
@keyframes h-bump{0%,18%,42%,100%{transform:scale(1)}25%{transform:scale(1.07)}}
@keyframes h-stroke{0%{transform:translate(-30px,22px)}25%{transform:translate(-15px,11.2px)}50%{transform:translate(0,7px)}
  75%{transform:translate(15px,9.2px)}100%{transform:translate(30px,18px)}}
@keyframes h-purr{from{opacity:.25}to{opacity:1}}
@keyframes h-turn{from{transform:rotate(-30deg)}to{transform:rotate(30deg)}}
@keyframes h-drag{from{transform:translateX(-32px)}to{transform:translateX(32px)}}
@keyframes h-fill{0%{stroke-dashoffset:88;opacity:.9}30%,86%{stroke-dashoffset:0;opacity:.9}92%,100%{stroke-dashoffset:0;opacity:0}}
@keyframes h-out{0%,30%{opacity:1}35%,90%{opacity:0}100%{opacity:1}}
@keyframes h-in{0%,30%{opacity:0}35%,90%{opacity:1}100%{opacity:0}}
@keyframes h-reach{0%,8%{opacity:0}30%,86%{opacity:1}92%,100%{opacity:0}}
@keyframes h-tap3{0%,4%{opacity:0;transform:scale(1.7)}12%,26%{opacity:1;transform:scale(1)}38%,100%{opacity:0;transform:scale(1)}}
@keyframes h-ring3{0%,10%{opacity:0;transform:scale(.5)}14%{opacity:.9}40%,100%{opacity:0;transform:scale(2.6)}}
@keyframes h-loop{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}
@keyframes h-shake{from{transform:rotate(-9deg)}to{transform:rotate(9deg)}}
@keyframes h-slosh{from{transform:translateX(11px)}to{transform:translateX(-11px)}}
@keyframes h-grow{0%,8%{transform:scaleX(.18)}70%,100%{transform:scaleX(.94)}}
@keyframes h-drain{0%,8%{transform:scaleX(.94)}70%,100%{transform:scaleX(.1)}}
@keyframes h-gate{0%,30%{opacity:0;transform:scale(.6)}62%,100%{opacity:1;transform:scale(1)}}
@keyframes h-sink{0%,45%{opacity:1;transform:scale(1)}85%,100%{opacity:.35;transform:scale(.45)}}
@keyframes h-jit{from{transform:translate(-1.6px,1px) rotate(-3deg)}to{transform:translate(1.6px,-1px) rotate(3deg)}}
@keyframes h-scrub{0%{transform:translate(-22px,14px)}25%{transform:translate(16px,-4px)}50%{transform:translate(-14px,-10px)}
  75%{transform:translate(20px,12px)}100%{transform:translate(-22px,14px)}}

@media (prefers-reduced-motion:reduce){
  .meters i,#say,#hint,.marks button,.marks svg,.hb{transition:none}
  #mReal.low{animation:none}
  .pic *{animation:none!important}     /* each picture then stands at a moment that still shows the gesture */
}
