html {
  background-repeat: repeat;  
}
body  {
    margin: 0;
    display: grid;
    height: 100vh;
}
html.back {
    background: repeating-conic-gradient(#fefefe 0 25%, #e7e7e7 0 50%) 0 0/80px 80px;
}
body > section {
    display: grid;
    grid-area: 1/1;
    min-height: 100vh;
    margin: 0;
}
body footer {
  grid-column: 1/-1;
  text-align: center;
  margin-bottom: 5px;
}
#initial > article {
    margin: auto;
    padding: calc(var(--block-spacing-vertical)/4) var(--block-spacing-horizontal);
    max-width: 690px;
    text-align: center;
}
#initial > article h1 {
    margin: 0;
}
#initial > article p {
    margin-bottom: 10px;
}
#initial > article p code {
    display: inline;
}
#initial textarea {
    padding: .8rem;
    font-size: 14px;
    line-height: 1.5;
    background: #edf0f3;
    min-height: 200px;
}
#initial button {
    font-size: 1.2rem;
}
#result {
    grid-template-columns: 1fr 400px;
}
#result .layers {
    display: grid;
    counter-reset: num;
    overflow: auto;
    position: relative;
}
#result .layers label {
    position: absolute;
    gap:.5rem;
    inset: auto 1rem 0;
    background: #fff;
    box-shadow: 0 0 0 100px #fff;
    clip-path: inset(-10px -1rem -100vmax);
}
#result .layers label input{
  flex:1;
}
#result .layers > div:after {
    content: counter(num);
    display: block;
    width: fit-content;
    font-size: 2em;
    counter-increment: num;
    font-family: monospace;
    font-weight: bold;
    padding: 0 15px;
    margin: 10px 10px 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 1rem #0005;
    z-index: 2;
}
#result .layers > div {
    aspect-ratio: 1;
    outline: 1px solid;
    cursor: pointer;
    z-index: var(--tz);
    position: relative;
}
#result .detail {
    margin: 0;
    border-radius: 0;
    padding: 1.2rem;
}
#result .view {
    top: 5px;
    position: absolute;
    z-index: 999;
    margin: 0;
    padding: .5rem 1rem;
    display: flex;
    gap: 1rem;
    inset: 5px 400px auto 0;
    margin: auto;
    width: fit-content;
    opacity: .6;
    transition: .3s;
}
#result .view label {
    cursor: pointer;
}
#result .view:hover {
    opacity: 1;
}
#result .layers label {
    display: none;
}
#result .view:has(.one:checked) + .layers {
    grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
    align-content: start;
    gap: 10px;
    padding: 4rem 10px 0;
}
#result .view:has(.two:checked) + .layers {
    perspective: 1000px;
    transform-style: preserve-3d
}
#result .view:has(.two:checked) + .layers label {
    display: flex;
}
#result .view:has(.two:checked) + .layers > div {
  grid-area: 1/1;
  width: min(100%,100vh);
  transform: translateZ(-800px) rotateY(var(--angle,0deg)) translateZ(calc(var(--tz,0)*var(--distance,0px)));
  z-index: var(--tz);
  margin: auto;
}
#result .view:has(.three:checked) + .layers > div {
    grid-area: 1/1;
    aspect-ratio: initial;
}
#result .view:has(.three:checked) + .layers > div:before {
    content: "";
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: var(--w);
    height: var(--h);
    transform: translate(calc(var(--px,0)*var(--x)),calc(var(--py,0)*var(--y)));
    outline: 2px dashed #fff;
    border: 2px dashed #000;
}
#result .layers div:nth-last-of-type(1) {--tz:1}
#result .layers div:nth-last-of-type(2) {--tz:2}
#result .layers div:nth-last-of-type(3) {--tz:3}
#result .layers div:nth-last-of-type(4) {--tz:4}
#result .layers div:nth-last-of-type(5) {--tz:5}
#result .layers div:nth-last-of-type(6) {--tz:6}
#result .layers div:nth-last-of-type(7) {--tz:7}
#result .layers div:nth-last-of-type(8) {--tz:8}
#result .layers div:nth-last-of-type(9) {--tz:9}
#result .layers div:nth-last-of-type(10) {--tz:10}
#result .layers div:nth-last-of-type(11) {--tz:11}
#result .layers div:nth-last-of-type(12) {--tz:12}
#result .layers div:nth-last-of-type(13) {--tz:13}
#result .layers div:nth-last-of-type(14) {--tz:14}
#result .layers div:nth-last-of-type(15) {--tz:15}
#result .layers div:nth-last-of-type(16) {--tz:16}
#result .layers div:nth-last-of-type(17) {--tz:17}
#result .layers div:nth-last-of-type(18) {--tz:18}
#result .layers div:nth-last-of-type(19) {--tz:19}
#result .layers div:nth-last-of-type(20) {--tz:20}
#result .layers div:nth-last-of-type(21) {--tz:21}

#result:has(details[open]) .layers div {
    opacity: 0.15;
}

#result:has(details[open]) .view:has(.three:checked) + .layers div {
    opacity: 0;
}

#result:has(details[open]:nth-of-type(1)) .layers div:nth-of-type(1),
#result:has(details[open]:nth-of-type(2)) .layers div:nth-of-type(2),
#result:has(details[open]:nth-of-type(3)) .layers div:nth-of-type(3),
#result:has(details[open]:nth-of-type(4)) .layers div:nth-of-type(4),
#result:has(details[open]:nth-of-type(5)) .layers div:nth-of-type(5),
#result:has(details[open]:nth-of-type(6)) .layers div:nth-of-type(6),
#result:has(details[open]:nth-of-type(7)) .layers div:nth-of-type(7),
#result:has(details[open]:nth-of-type(8)) .layers div:nth-of-type(8),
#result:has(details[open]:nth-of-type(9)) .layers div:nth-of-type(9),
#result:has(details[open]:nth-of-type(10)) .layers div:nth-of-type(10),
#result:has(details[open]:nth-of-type(11)) .layers div:nth-of-type(11),
#result:has(details[open]:nth-of-type(12)) .layers div:nth-of-type(12),
#result:has(details[open]:nth-of-type(13)) .layers div:nth-of-type(13),
#result:has(details[open]:nth-of-type(14)) .layers div:nth-of-type(14),
#result:has(details[open]:nth-of-type(15)) .layers div:nth-of-type(15),
#result:has(details[open]:nth-of-type(16)) .layers div:nth-of-type(16),
#result:has(details[open]:nth-of-type(17)) .layers div:nth-of-type(17),
#result:has(details[open]:nth-of-type(18)) .layers div:nth-of-type(18),
#result:has(details[open]:nth-of-type(19)) .layers div:nth-of-type(19),
#result:has(details[open]:nth-of-type(20)) .layers div:nth-of-type(20),
#result:has(details[open]:nth-of-type(21)) .layers div:nth-of-type(21){
    outline: 2px solid red;
    opacity: 1!important;
}

pre > code {
    font-size: 12px;
    padding: calc(var(--spacing)/2);
}

a.tweet {
    vertical-align: middle;
    padding: 4px 12px;
    background-color: #1d9bf0;
    color: #fff;
    border-radius: 9999px;
    display: inline-flex;
    margin-left: 15px;
    text-decoration: none;
    gap: 5px;
    align-items: center;
    font-size: 1.1em;
}
.credit {
    position: fixed;
    z-index: 99;
    top: 0;
    left: 0;
    transform-origin: right top;
    transform: translate(-30%) rotate(-45deg);
    background: #08769b;
    color: #fff;
    box-shadow: 0 0 0 50px #08769b;
    clip-path: inset(0 -100%);
    text-decoration:none ;
}
