@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);
  --wash:rgb(244 241 234 / .14);
  --n:6;
  --size:min(100%,calc(100dvh - 250px),560px);
}
*{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;gap:10px}
.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;flex-direction:column;align-items:center;width:100%}

/* The marks above the well: what drops next, and where. */
.next{width:var(--size);display:grid;grid-template-columns:repeat(var(--n),1fr);height:34px}
.drop{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;color:var(--soft);font-size:15px;font-variant-numeric:tabular-nums;line-height:1}
.drop::after{content:"";width:1.5px;height:8px;margin-top:4px;background:var(--soft)}
.drop:empty::after{display:none}

.board{
  position:relative;width:var(--size);aspect-ratio:1;border:1px solid var(--fg);border-top:0;
  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;outline:none;touch-action:manipulation;
}
.board:focus-visible{box-shadow:0 0 0 2px var(--ground),0 0 0 4px var(--fg)}
.board.over .tile:not(.full){opacity:.45}
.board.over .tile.full{background:var(--faint)}

.tile{
  position:absolute;left:0;top:0;width:calc(100%/var(--n));height:calc(100%/var(--n));padding:0;
  transform:translate(calc(var(--x)*100%),calc(var(--y)*100%));
  transition:transform .18s ease-in,background-color .1s,color .1s;
  display:grid;place-items:center;
  font-size:clamp(17px,calc(var(--size)/14),30px);font-weight:500;font-variant-numeric:tabular-nums;
}
.tile.lead{background:var(--fg);color:var(--ground)}
.tile.hit{background:var(--wash)}
.tile.cursor{box-shadow:inset 0 0 0 2px var(--fg)}
.tile.full{color:var(--fg)}
.tile.gone{animation:gone .26s ease-out forwards;pointer-events:none}
.tile.landed{animation:land .22s ease-in}
@keyframes gone{to{opacity:0;scale:.5}}
@keyframes land{from{translate:0 -120%;opacity:0}}

.foot{display:flex;flex-direction:column;height:100%}
.status{min-height:2.9em;line-height:1.35;font-variant-numeric:tabular-nums}
.controls{margin-top:auto;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px}
.controls>:first-child{justify-self:start}
#restart,#again{justify-self:end}
.range{color:var(--soft);font-size:15px;font-variant-numeric:tabular-nums}
.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){.tile{transition:none}.gone,.landed{animation:none}}
@media (max-height:560px) 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 - 72px)}
  .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:0 0 14px 14px}
.tile.lead{border-radius:8px}
