*{box-sizing:border-box}body{margin:0;min-height:100svh;display:grid;place-items:center;padding:16px 8px;background:radial-gradient(ellipse at 40% 35%,#faf5e3,#dad2b9);font-family:Arial,sans-serif;color:#2e3028}
main{width:min(100%,455px);border:1px solid #ad8719;border-radius:24px 24px 56px 24px;padding:17px 19px 15px;background:linear-gradient(115deg,#ffe366,#f6c42e 65%,#efb727);box-shadow:inset 2px 3px 2px #fff0a2,inset -3px -4px #d29f21,9px 18px 26px #685e3a40}
.brand,header,.controls,.keys{display:flex;align-items:center;justify-content:space-between}.brand{padding:0 4px 10px}h1{font-size:23px;font-style:italic;letter-spacing:-1.6px;margin:0}h1 em{font-weight:500}
button{cursor:pointer;touch-action:manipulation;color:inherit}button:focus-visible{outline:3px solid #2d6386;outline-offset:3px}#sound{background:none;border:0;padding:6px;font:12px monospace}
.bezel{background:#242c2a;border:9px solid #303632;border-radius:9px 9px 19px 9px;box-shadow:inset 1px 1px #0f1615,0 2px 0 #fff09a;padding:2px;color:#283531;font-family:'Courier New',monospace}
header{padding:6px 8px;color:#f5ebbd;background:#36443a;gap:5px;font-size:clamp(10px,3vw,13px);font-weight:bold;letter-spacing:.07em}.field{position:relative;background:#f5ecc3}canvas{width:100%;display:block;image-rendering:pixelated}
.box{position:relative;margin:3px 1px 2px;padding:7px 10px 6px;min-height:91px;border:4px double #314139;border-radius:4px;background:#faf0c5;display:flex;flex-direction:column}.box b,.box span{font-size:10px;letter-spacing:.1em}.box p{margin:3px 0 5px;font:bold clamp(13px,3.5vw,16px)/1.19 'Courier New',monospace}.box span{margin-top:auto;align-self:flex-end;color:#435448;font-weight:bold;letter-spacing:0}
.controls{margin:14px 12px 4px}.pad{height:99px;width:99px;display:grid;grid-template:repeat(3,1fr)/repeat(3,1fr);filter:drop-shadow(1px 3px 1px #a88120);touch-action:none}.pad button,.pad i{background:#353b39;color:#f2dfab;border:0;font-size:14px}.pad button:active,.round:active{background:#4c5651}.pad i{grid-area:2/2}.pad i:after{content:'';display:block;margin:10px;width:12px;height:12px;border-radius:50%;background:#282d2b}.pad [data-dir=up]{grid-area:1/2;border-radius:5px 5px 0 0}.pad [data-dir=left]{grid-area:2/1;border-radius:5px 0 0 5px}.pad [data-dir=right]{grid-area:2/3;border-radius:0 5px 5px 0}.pad [data-dir=down]{grid-area:3/2;border-radius:0 0 5px 5px}.keys{gap:14px}.keys div{display:grid;justify-items:center;gap:5px}.keys div:first-child{margin-top:25px}.round{border:2px solid #4e3136;background:#773f51;color:#f9d3bb;width:45px;height:45px;border-radius:50%;font:bold italic 19px Arial;box-shadow:inset 1px 2px #9e6672,1px 3px #af8423}.keys small,footer{font:bold 10px monospace;letter-spacing:.05em}footer{text-align:center;margin:11px 0 0;font-weight:normal;font-size:10px}
#atlas{position:absolute;inset:0;background:#f7eebe;padding:8px 9%;border:4px double #364938;overflow:auto}h2{font-size:14px;margin:0 0 4px}ol{list-style:none;padding:0;margin:0}li{padding:3px 0;border-bottom:1px dotted #9caa83;font:bold clamp(10px,2.9vw,13px) monospace}li.current{background:#33493b;color:#fff4bc}
@media(max-height:700px) and (min-width:480px){main{max-width:380px}.controls{margin-top:10px}}
@media(max-width:350px){main{padding:10px}.controls{margin:10px 8px 0}.box{min-height:95px}.bezel{border-width:6px}}

/* Keep an iOS long press on the controls inside the game. */
.controls, .controls button {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.pad button {
  display: grid;
  place-items: center;
  padding: 0;
  touch-action: none;
}
.pad button::before {
  content: "";
  width: 12px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.pad [data-dir="left"]::before { transform: rotate(-90deg); }
.pad [data-dir="right"]::before { transform: rotate(90deg); }
.pad [data-dir="down"]::before { transform: rotate(180deg); }
@media (pointer: coarse) {
  .pad { width: 132px; height: 132px; }
  .pad i { display: grid; place-items: center; }
}
