@font-face{font-family:Prata;src:url(fonts/Prata-Regular.woff2) format("woff2");font-display:swap}
@font-face{font-family:Jost;src:url(fonts/Jost-Regular.woff2) format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:Jost;src:url(fonts/Jost-Medium.woff2) format("woff2");font-weight:500;font-display:swap}

:root{
  --ground:#12110e;
  --fg:rgb(244 241 234);
  --soft:rgb(244 241 234 / .62);
  --hair:rgb(244 241 234 / .22);
  --faint:rgb(244 241 234 / .07);
  --n:7;
  --size:min(100%,calc(100dvh - 190px),620px);
}
*{box-sizing:border-box;margin:0}
[hidden]{display:none!important}
html,body{height:100%}
body{
  background:var(--ground);color:var(--fg);
  font:400 17px/1.45 Jost,system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior:none;user-select:none;-webkit-user-select:none;
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
button:focus-visible{outline:2px solid var(--fg);outline-offset:2px}
h1,h2{font-family:Prata,Georgia,serif;font-weight:400}

.play{height:100dvh;display:grid;grid-template-rows:auto auto 1fr;justify-items:center;padding:14px 16px 14px;gap:12px;touch-action:none}
.bar,.foot{width:var(--size);min-width:min(100%,300px)}
.bar{display:flex;justify-content:space-between;align-items:baseline}
.bar h1{font-size:30px;line-height:1}
.score{display:flex;align-items:baseline;gap:14px;font-variant-numeric:tabular-nums}
#score{font-size:28px;font-weight:500;line-height:1}
.best{color:var(--soft);font-size:15px}
.stage{display:flex;justify-content:center;width:100%}

.board{
  position:relative;width:var(--size);aspect-ratio:1;border:1px solid var(--fg);
  background:
    linear-gradient(90deg,var(--hair) 1px,transparent 1px) 0 0/calc(100%/var(--n)) 100%,
    linear-gradient(var(--hair) 1px,transparent 1px) 0 0/100% calc(100%/var(--n));
  overflow:hidden;
}
.board.over .echo:not(.caught),.board.over .spark,.board.over .birth{opacity:.35}
.cell-hit{position:absolute;width:calc(100%/var(--n));height:calc(100%/var(--n));background:none;padding:0}
.cell-hit:focus,.cell-hit:focus-visible{outline:none}

/* Everything on the board is one square, moved by transform. */
.tok{
  position:absolute;left:0;top:0;width:calc(100%/var(--n));height:calc(100%/var(--n));
  transform:translate(calc(var(--x)*100%),calc(var(--y)*100%));
  transition:transform .14s ease-out,opacity .2s;pointer-events:none;
}
.tok::before{content:"";position:absolute;border-radius:50%}
.you{z-index:3}
.you::before{inset:18%;background:var(--fg)}
.echo{z-index:2}
.echo::before{inset:22%;border:2px solid var(--fg);background:var(--ground)}
.tick{position:absolute;inset:0;transform:rotate(var(--r))}
.tick::after{content:"";position:absolute;left:calc(50% - 1.25px);top:6%;width:2.5px;height:16%;background:var(--fg)}
.spark{z-index:1}
.spark::before{inset:38%;background:var(--fg);transform:rotate(45deg)}
.birth::before{inset:22%;border:1.5px dashed var(--soft)}
.new{animation:arrive .26s ease-out}
.echo.caught{z-index:4}
.echo.caught::before{inset:6%;background:none;border-width:3px}
@keyframes arrive{from{opacity:0;scale:.4}}

.foot{display:flex;flex-direction:column;height:100%}
.status{min-height:2.9em;line-height:1.35}
.controls{margin-top:auto;display:flex;justify-content:space-between;align-items:center}
.quiet{color:var(--soft);font-size:15px;min-height:44px;padding:0 4px}
.quiet:hover{color:var(--fg)}
.again{font-weight:500;color:var(--fg);text-decoration:underline;text-underline-offset:3px}

dialog{margin:auto;width:min(92vw,500px);max-height:88dvh;padding:26px;background:var(--ground);color:var(--fg);border:1px solid var(--fg)}
dialog::backdrop{background:rgb(244 241 234 / .35)}
dialog h2{font-size:34px;line-height:1}
.lede{font-size:19px;margin:8px 0 16px}
.rule-list{padding:0 0 0 1.2em;border-top:1px solid var(--hair)}
.rule-list li{padding:9px 0 9px 4px;border-bottom:1px solid var(--hair)}
.btn{display:block;width:100%;min-height:50px;margin-top:18px;border:1px solid var(--fg);background:var(--fg);color:var(--ground);font-weight:500}
.btn:hover{background:var(--soft)}

@media (prefers-reduced-motion:reduce){.tok{transition:none}.new{animation:none}}
@media (max-height:520px) and (orientation:landscape){
  .play{grid-template-columns:auto minmax(180px,1fr);grid-template-rows:auto 1fr;column-gap:24px;justify-items:stretch}
  :root{--size:calc(100dvh - 28px)}
  .stage{grid-column:1;grid-row:1/3}
  .bar,.foot{grid-column:2;width:auto}
}

/* zei.st: the dark ground, soft shapes and cards of the landing */
html{background:var(--ground);color-scheme:dark}
body{background:transparent}
body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:.06;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
a:focus-visible{border-radius:6px}
dialog{background:rgb(28 26 22 / .97);border:1px solid rgb(244 241 234 / .08);border-radius:28px;box-shadow:0 40px 80px -30px rgb(0 0 0 / .8)}
dialog::backdrop{background:rgb(8 7 6 / .55);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
.btn,.primary{border-radius:999px;border:1px solid rgb(244 241 234 / .2);background:none;color:var(--fg);transition:background .3s}
.btn:hover{background:rgb(244 241 234 / .06)}
.btn.solid,dialog .btn,.primary,.play .btn{background:var(--fg);color:var(--ground);border-color:var(--fg)}
.btn.solid:hover,dialog .btn:hover,.primary:hover,.play .btn:hover{background:#fff}
select{border-radius:12px;background:#1c1a16;border-color:rgb(244 241 234 / .14)}
.board{border-color:rgb(244 241 234 / .4);border-radius:14px}
.btn{border-radius:999px}
