/* The Play page: a daily cryptic clue answered in letter beads. */

.play{
  max-width:calc(var(--col) + 2 * var(--gutter));
  min-height:calc(100vh - 52px);
  min-height:calc(100svh - 52px);
  margin-inline:auto;
  padding:var(--gap) var(--gutter);
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.play h1{font-size:17px;line-height:24px;font-weight:400}

.day{color:var(--grey)}

.clue{
  margin-top:40px;
  font-size:24px;
  line-height:34px;
  letter-spacing:-.015em;
  color:var(--black);
  text-wrap:balance;
}

/* the definition gets an underline when asked for, or once solved */
.def{
  text-decoration:underline;
  text-decoration-color:transparent;
  text-decoration-thickness:1.5px;
  text-underline-offset:6px;
  transition:text-decoration-color .3s ease;
}
.def.on{text-decoration-color:var(--black)}

/* one dashed circle per letter; a typed letter becomes a bead */
.slots{
  --size:min(44px, calc((100% - (var(--n) - 1) * 4px) / var(--n)));
  display:flex;
  gap:4px;
  margin-top:36px;
  cursor:text;
}

.slot{
  flex:none;
  width:var(--size);
  aspect-ratio:1;
  border:1px dashed var(--grey);
  border-radius:50%;
  transition:border-color .2s ease;
}
.slot.next{border-color:var(--black);border-style:solid}
.slot[data-ch]:not([data-ch=""]){border-color:transparent}
.slot img{display:block;width:100%;height:100%;animation:drop .28s cubic-bezier(.3,.7,.3,1.3)}
.slot:nth-child(3n+1) img{rotate:-5deg}
.slot:nth-child(3n+2) img{rotate:4deg}
.slot:nth-child(3n) img{rotate:-2deg}

@keyframes drop{from{opacity:0;scale:.6}to{opacity:1;scale:1}}

.slots.no{animation:no .35s ease}
@keyframes no{
  0%,100%{transform:none}
  25%{transform:translateX(-6px)}
  75%{transform:translateX(6px)}
}

.slots.won .slot img{animation:hop .5s cubic-bezier(.3,.7,.3,1) both}
.slots.won .slot:nth-child(2) img{animation-delay:.05s}
.slots.won .slot:nth-child(3) img{animation-delay:.1s}
.slots.won .slot:nth-child(4) img{animation-delay:.15s}
.slots.won .slot:nth-child(5) img{animation-delay:.2s}
.slots.won .slot:nth-child(6) img{animation-delay:.25s}
.slots.won .slot:nth-child(7) img{animation-delay:.3s}
.slots.won .slot:nth-child(8) img{animation-delay:.35s}
.slots.won .slot:nth-child(9) img{animation-delay:.4s}
@keyframes hop{
  0%,100%{translate:0 0}
  40%{translate:0 -10px}
}

/* the real text field sits out of sight; the beads show what is typed */
.typing{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  border:0;
  padding:0;
  font-size:16px;
}

.msg{min-height:24px;margin-top:16px;color:var(--text)}

.helps{display:flex;flex-wrap:wrap;gap:8px 20px;align-items:center;margin-top:20px}

.helps button{
  padding:0;
  border:0;
  background:none;
  font:inherit;
  color:var(--text);
  cursor:pointer;
  text-decoration:underline;
  text-decoration-color:var(--line);
  text-decoration-thickness:1px;
  text-underline-offset:4px;
}
.helps button:hover{color:var(--black);text-decoration-color:var(--black)}
.helps button:disabled{color:var(--grey);cursor:default;text-decoration-color:transparent}

.helps .primary{
  height:36px;
  padding:0 16px;
  background:var(--black);
  color:var(--white);
  text-decoration:none;
}
.helps .primary:hover{color:var(--white)}
.helps .primary:disabled{background:var(--grey);color:var(--white)}

.how{margin-top:24px;padding-left:44px;position:relative;color:var(--black)}
.how::before{content:"";position:absolute;left:0;top:11px;width:28px;height:1.5px;background:var(--black)}

.rules{margin-top:48px;color:var(--text)}
.rules summary{color:var(--grey);cursor:pointer;list-style:none}
.rules summary::-webkit-details-marker{display:none}
.rules summary:hover{color:var(--black)}
.rules p{margin-top:12px}

/* the current page in the navbar */
.top nav a[aria-current="page"]{color:var(--black)}

@media (max-width:560px){
  .clue{font-size:20px;line-height:30px}
}

/* ---------- shared by the play pages ---------- */

.back{margin-bottom:28px}
.back a{color:var(--grey)}
.back a:hover{color:var(--black)}

.beadform{display:flex;gap:6px}
.beadform input{
  width:170px;
  height:36px;
  padding:0 10px;
  border:.5px solid var(--grey);
  border-radius:0;
  background:var(--white);
  font:inherit;
  color:var(--black);
}
.beadform input:focus{outline:1px solid var(--black);outline-offset:0}
.helps .beadform button{height:36px;padding:0 12px;background:var(--black);color:var(--white);text-decoration:none}

/* ---------- the wall ---------- */

.tiles{
  list-style:none;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px;
  margin-top:40px;
}

.tile{display:block}

.tile .pic{
  display:flex;
  align-items:center;
  justify-content:center;
  aspect-ratio:1;
  border:.5px solid var(--grey);
  transition:background .25s ease;
}
.tile:hover .pic{background:var(--wash)}
.tile .pic svg{width:66%;height:auto;transition:transform .35s cubic-bezier(.3,.7,.3,1)}
.tile:hover .pic svg{transform:rotate(-3deg) scale(1.04)}

.minibeads{display:flex;gap:1px}
.minibeads img{width:30px;height:30px;transition:transform .35s cubic-bezier(.3,.7,.3,1)}
.minibeads img:nth-child(odd){transform:rotate(-5deg)}
.minibeads img:nth-child(even){transform:rotate(4deg)}
.tile:hover .minibeads img:nth-child(odd){transform:rotate(7deg) translateY(-2px)}
.tile:hover .minibeads img:nth-child(even){transform:rotate(-7deg) translateY(2px)}

.tile .name{display:block;margin-top:12px}
.tile .about{display:block;color:var(--text)}

/* ---------- slow bake ---------- */

.stage{margin-top:28px;border:.5px solid var(--grey);touch-action:none}
.stage svg{display:block;width:100%;height:auto}
#s-cake{cursor:crosshair}

/* ---------- scrap board ---------- */

.boardpage{max-width:1048px;justify-content:flex-start;padding-top:48px}
.tools{margin-top:24px}
.tools .quiet{margin-left:auto;color:var(--grey)}

.board{
  position:relative;
  height:560px;
  margin-top:20px;
  overflow:hidden;
  border:.5px solid var(--grey);
  background:radial-gradient(var(--line) 1px, transparent 1px) 0 0 / 20px 20px var(--white);
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}

.thing{
  position:absolute;
  transform:rotate(var(--tilt,0deg));
  cursor:grab;
  transition:box-shadow .2s ease,scale .2s ease;
}
.thing.lifted{cursor:grabbing;scale:1.03;box-shadow:0 14px 30px -14px rgba(0,0,0,.35)}

.thing.note .paper{
  min-width:150px;
  max-width:240px;
  min-height:72px;
  padding:14px 16px;
  background:var(--white);
  border:.5px solid var(--grey);
  outline:none;
  user-select:text;
  -webkit-user-select:text;
  cursor:text;
  white-space:pre-wrap;
}

.thing.tape{width:92px;height:26px;background:rgba(0,0,0,.1);border-left:1px dashed rgba(0,0,0,.25);border-right:1px dashed rgba(0,0,0,.25)}

.thing.beadword{display:flex;gap:1px}
.thing.beadword img{display:block;width:38px;height:38px;pointer-events:none}

.thing.photo{padding:8px 8px 26px;background:var(--white);border:.5px solid var(--grey)}
.thing.photo img{display:block;max-width:200px;max-height:200px;filter:grayscale(1);pointer-events:none}

.thing .remove{
  position:absolute;
  left:0;
  top:100%;
  margin-top:4px;
  padding:0;
  border:0;
  background:none;
  font:inherit;
  font-size:12px;
  line-height:20px;
  color:var(--grey);
  cursor:pointer;
  opacity:0;
  pointer-events:none;
  transform:rotate(calc(var(--tilt,0deg) * -1));
}
.thing.chosen .remove{opacity:1;pointer-events:auto}
.thing .remove:hover{color:var(--black)}

@media (max-width:620px){
  .tiles{grid-template-columns:minmax(0,1fr);gap:28px}
  .tile .pic{aspect-ratio:2 / 1}
  .tile .pic svg{width:40%}
  .board{height:480px}
  .tools .quiet{margin-left:0}
  .beadform input{width:140px}
}

/* drawings inside the baking scene are swapped by hiding whole groups */
#scene [hidden]{display:none}

/* decorations on the cake can be picked up and moved */
#scene .movable{cursor:grab}
#scene .movable.held{cursor:grabbing}
#s-cake{cursor:default}
.bake .helps{row-gap:12px}
