/* ---------- game rules: home button + rules screen ---------- */

/* "GAME RULES" button under PLAY — CSS pill styled to sit alongside the PLAY artwork */
.rulesBtnWrap{
    width: 46%;
    max-width: 220px;
    aspect-ratio: 745 / 239;
    animation-delay: .55s;
    margin-top:-20px;
  }
#homeRulesBtn{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transform: scale(.8);
  pointer-events: none;
  transition: transform .12s ease;
}
#homeRulesBtn img{
  width:100%;height:auto;display:block;
}
#homeRulesBtn.show{
  opacity:1;transform:scale(1);pointer-events:auto;
  animation:homePlayBtnIn .45s cubic-bezier(.34,1.56,.64,1);
}
#homeRulesBtn.show:active{transform:scale(.93);}

/* overlay lives inside #homeFrame so it inherits the frame's size/radius */
#homeFrame > #rulesScreen{
  position:absolute;inset:0;z-index:10;
  display:flex;align-items:center;justify-content:center;
  box-sizing:border-box;
  /* room above for the title art (top:-60px) and below for the overhanging GOT IT! button */
  padding:68px 16px 48px;
  background:rgba(0,0,0,.55);
  transition:opacity .3s ease;
}
#homeFrame > #rulesScreen.hidden{opacity:0;pointer-events:none;}
#homeFrame > #rulesScreen.hidden .rl-panel{transform:translateY(24px) scale(.9);}

.rl-panel{
  position:relative;
  box-sizing:border-box;
  width:100%;max-width:380px;max-height:100%;
  display:flex;flex-direction:column;align-items:center;
  padding:46px 14px 0;
  border-radius:26px;
  /* stone rim + wooden body */
  border:7px solid #cbb48a;
  outline:3px solid #6e5a3a;
  background:
    radial-gradient(ellipse at 50% 0%,rgba(255,220,160,.18),transparent 60%),
    repeating-linear-gradient(90deg,rgba(0,0,0,.06) 0 2px,transparent 2px 18px),
    linear-gradient(180deg,#9a5a2a 0%,#7a4219 55%,#61330f 100%);
  box-shadow:inset 0 0 0 3px #4a2a0e,inset 0 6px 18px rgba(0,0,0,.45),0 18px 40px rgba(0,0,0,.6);
  transition:transform .4s cubic-bezier(.34,1.56,.64,1);
}
.rl-title{
  position:absolute;top:-60px;left:50%;transform:translateX(-50%);
  white-space:nowrap;
  color:#fff7e6;
  width:100%;max-width:calc(100% - 16px);
  z-index:1;
}
.rl-title img{width:100%;height:auto;display:block;}
.rl-list{
  list-style:none;margin:0;padding:0 2px 4px;width:100%;
  display:flex;flex-direction:column;gap:10px;
  flex:1 1 auto;min-height:0;
  overflow-y:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-color:#e8cf9c transparent;
}
.rl-card{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px 10px 8px;
  border-radius:14px;
  border:2px solid #e8cf9c;
  background:linear-gradient(180deg,#fff3d6 0%,#f5dfae 100%);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.7),0 3px 0 #4a2a0e,0 4px 8px rgba(0,0,0,.3);
  opacity:0;transform:translateX(-16px);
}
#rulesScreen:not(.hidden) .rl-card{animation:rlCardIn .4s ease-out forwards;}
#rulesScreen:not(.hidden) .rl-card:nth-child(1){animation-delay:.1s;}
#rulesScreen:not(.hidden) .rl-card:nth-child(2){animation-delay:.18s;}
#rulesScreen:not(.hidden) .rl-card:nth-child(3){animation-delay:.26s;}
#rulesScreen:not(.hidden) .rl-card:nth-child(4){animation-delay:.34s;}
#rulesScreen:not(.hidden) .rl-card:nth-child(5){animation-delay:.42s;}
@keyframes rlCardIn{to{opacity:1;transform:translateX(0);}}

.rl-icon{position:relative;flex:0 0 auto;width:68px;height:58px;}
.rl-icon img{position:absolute;width:30px;height:30px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.35));}
/* 3-bubble pyramid: two bottom, one top */
.rl-icon img:nth-child(1){left:4px;bottom:3px;}
.rl-icon img:nth-child(2){left:19px;top:3px;}
.rl-icon img:nth-child(3){left:34px;bottom:3px;}
.rl-icon--fall img:nth-child(1){animation:rlFall 1.6s ease-in-out infinite;}
.rl-icon--fall img:nth-child(3){animation:rlFall 1.6s ease-in-out .3s infinite;}
@keyframes rlFall{0%,100%{transform:translateY(0);}50%{transform:translateY(4px);}}
.rl-icon--bomb img{width:48px;height:48px;left:10px;top:5px;}
.rl-icon--multi img{width:48px;height:48px;left:10px;top:5px;object-fit:contain;}

.rl-text{min-width:0;}
.rl-text h3{
  margin:0 0 2px;
  font-family:'Baloo 2',"Segoe UI",Roboto,system-ui,sans-serif;
  font-size:clamp(16px,4.8vw,19px);font-weight:800;line-height:1.15;
  color:#4a220b;
}
.rl-text p{
  margin:0;
  font-family:'Baloo 2',"Segoe UI",Roboto,system-ui,sans-serif;
  font-size:clamp(13px,3.8vw,15px);font-weight:600;line-height:1.25;
  color:#5b3515;
}

.rl-got-it{
  flex:0 0 auto;
  width:62%;max-width:230px;
  margin:14px 0 -39px;
  cursor:pointer;
  color:#fff;
  transition:transform .12s ease;
  background:none;
  outline:none;border:none;
  z-index:2;
}
.rl-got-it img{width:100%;height:auto;display:block;}
.rl-got-it:active{transform:scale(.94);}

@media (max-height:640px){
  .rl-panel{padding-top:40px;}
  .rl-list{gap:7px;}
  .rl-card{padding:7px 10px 7px 6px;}
  .rl-icon{transform:scale(.85);margin:-4px -5px;}
}

