/* V157 — header separation, live word context and keyboard-safe entry */
@media (max-width:820px){
  .sh-shell{padding-top:max(8px,env(safe-area-inset-top))!important}
  .sh-nav{
    position:relative!important;top:auto!important;inset:auto!important;
    width:100%!important;margin:0 0 9px!important;z-index:260!important;
    transform:none!important;
  }
  .wrap{margin-top:0!important}
  .sh-hero{position:relative!important;z-index:1!important;margin-top:0!important;padding-top:16px!important}
  .sh-tabs{top:8px!important}
  .sh-game-card{padding-bottom:104px!important}
  .sh-word-row{
    display:grid!important;grid-template-columns:minmax(0,1fr) 32px 66px!important;
    align-items:center!important;gap:7px!important;margin:4px 0 8px!important;
  }
  .wordbox{min-width:0!important;min-height:62px!important;display:grid!important;align-content:center!important;overflow:visible!important}
  .wordbox strong{
    width:100%!important;max-width:100%!important;font-size:clamp(18px,6.3vw,27px)!important;
    line-height:1.08!important;letter-spacing:.055em!important;white-space:normal!important;
    overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;word-break:break-word!important;
  }
  .prefix{width:60px!important;height:60px!important;font-size:31px!important}
  #wordForm{margin-top:6px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .mobile-app-nav-v154{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{
    position:fixed!important;left:8px!important;right:8px!important;
    bottom:76px!important;z-index:2110!important;margin:0 auto!important;
    width:auto!important;max-width:520px!important;padding:6px!important;
    grid-template-columns:minmax(0,1fr) 52px!important;gap:5px!important;
    border:1px solid rgba(213,175,76,.74)!important;border-radius:14px!important;
    background:rgba(249,249,243,.99)!important;box-shadow:0 10px 26px rgba(0,25,38,.28)!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox{min-height:48px!important;max-height:52px!important;padding:5px 8px!important;overflow:hidden!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox small,
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .sh-prefix-box small{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox strong{font-size:clamp(16px,5.2vw,22px)!important;line-height:1.05!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-flow{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-prefix-box{min-height:0!important;height:52px!important;display:grid!important;place-items:center!important;overflow:hidden!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .prefix{width:48px!important;height:48px!important;font-size:27px!important;border-radius:11px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{left:8px!important;right:8px!important;bottom:6px!important;z-index:2120!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .feedback,
  body.wos-mobile-keyboard-open.sh-word-input-active .eventfeed{visibility:hidden!important}
}
@media (max-width:370px){
  .sh-word-row{grid-template-columns:minmax(0,1fr) 26px 58px!important}
  .prefix{width:54px!important;height:54px!important;font-size:28px!important}
}


/* V159 — keep active word area lower and easier to read */
@media (max-width:820px){
  .sh-game-card{padding-top:18px!important;padding-bottom:116px!important}
  .sh-card-head{margin-bottom:10px!important}
  .sh-word-row{margin:12px 0 12px!important}
  .feedback{margin-top:10px!important}
  .eventfeed{margin-top:8px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{bottom:82px!important}
}
@media (max-width:370px){
  .sh-game-card{padding-top:16px!important}
}


/* V160 — stronger keyboard layout for Documents/iPhone */
@media (max-width:820px){
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-game-card{padding-bottom:178px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-card-head,
  body.wos-mobile-keyboard-open.sh-word-input-active .scoreline,
  body.wos-mobile-keyboard-open.sh-word-input-active .feedback,
  body.wos-mobile-keyboard-open.sh-word-input-active .eventfeed{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{
    bottom:84px!important;
    grid-template-columns:minmax(0,1fr) 56px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox strong{font-size:clamp(18px,5.4vw,23px)!important}
}


/* V161 — restore natural board flow and keep keyboard layout only on focus */
@media (max-width:820px){
  body.sh-v111-playing .sh-game-card{
    display:block!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    overflow:visible!important;
    padding:18px 12px 116px!important;
  }
  body.sh-v111-playing .sh-card-head,
  body.sh-v111-playing .sh-word-row,
  body.sh-v111-playing .scoreline,
  body.sh-v111-playing #feedback,
  body.sh-v111-playing #wordAppealButton,
  body.sh-v111-playing #finalBoard{flex:initial!important}
  body.sh-v111-playing #eventFeed{
    display:block!important;flex:none!important;min-height:0!important;max-height:124px!important;height:auto!important;
    overflow:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;
    margin:8px 0 0!important;padding:0!important;gap:0!important;scrollbar-gutter:auto!important;
  }
  body.sh-v111-playing #feedback{height:auto!important;min-height:40px!important;max-height:none!important}
  body.sh-word-input-active:not(.wos-mobile-keyboard-open) #wordForm{
    position:static!important;left:auto!important;right:auto!important;bottom:auto!important;
    width:100%!important;max-width:none!important;margin:6px 0 0!important;z-index:auto!important;
  }
  body.sh-word-input-active:not(.wos-mobile-keyboard-open) .sh-word-row{
    position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;width:auto!important;max-width:none!important;margin:12px 0!important;z-index:auto!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-game-card{padding-bottom:180px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-card-head{display:block!important;margin-bottom:8px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .scoreline{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #feedback{display:block!important;min-height:34px!important;margin-bottom:6px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #eventFeed{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{
    position:fixed!important;left:8px!important;right:8px!important;bottom:86px!important;
    width:auto!important;max-width:520px!important;margin:0 auto!important;z-index:2110!important;
    padding:6px!important;grid-template-columns:minmax(0,1fr) 56px!important;gap:5px!important;
    border:1px solid rgba(213,175,76,.74)!important;border-radius:14px!important;
    background:rgba(249,249,243,.99)!important;box-shadow:0 10px 26px rgba(0,25,38,.28)!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox{min-height:48px!important;max-height:52px!important;padding:5px 8px!important;overflow:hidden!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox small,
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .sh-prefix-box small,
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-flow{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-prefix-box{min-height:0!important;height:52px!important;display:grid!important;place-items:center!important;overflow:hidden!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .prefix{width:48px!important;height:48px!important;font-size:27px!important;border-radius:11px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{
    position:fixed!important;left:8px!important;right:8px!important;bottom:6px!important;width:auto!important;max-width:520px!important;margin:0 auto!important;z-index:2120!important;
  }
}


/* V162 — Son Harf: keep action area in its normal region, only slightly lower on focus */
@media (max-width:820px){
  body.sh-v111-playing .sh-game-card{
    display:block!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    overflow:visible!important;
    padding:20px 12px 118px!important;
  }
  body.sh-v111-playing .sh-card-head{
    position:sticky!important;top:124px!important;z-index:150!important;
    margin:2px 0 10px!important;
  }
  body.sh-v111-playing .sh-word-row{
    position:relative!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
    width:auto!important;max-width:none!important;
    margin:14px 0 12px!important;z-index:auto!important;
  }
  body.sh-v111-playing #wordForm,
  body.sh-word-input-active #wordForm,
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{
    position:relative!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
    width:100%!important;max-width:none!important;margin:8px 0 0!important;z-index:auto!important;
  }
  body.sh-v111-playing #eventFeed{
    display:block!important;flex:none!important;height:auto!important;max-height:118px!important;overflow:auto!important;
    margin:8px 0 0!important;padding:0!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-game-card{
    padding-top:28px!important;padding-bottom:128px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-card-head{
    top:114px!important;margin-bottom:10px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{
    position:relative!important;left:auto!important;right:auto!important;bottom:auto!important;
    width:auto!important;max-width:none!important;margin:18px 0 12px!important;
    padding:8px!important;grid-template-columns:minmax(0,1fr) 30px 64px!important;gap:6px!important;
    background:rgba(249,249,243,.97)!important;border:1px solid rgba(213,175,76,.68)!important;border-radius:14px!important;box-shadow:none!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row .wordbox strong{
    font-size:clamp(20px,5.8vw,24px)!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .prefix{
    width:52px!important;height:52px!important;font-size:30px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .scoreline{display:none!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #feedback{display:block!important;min-height:38px!important;margin-bottom:6px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #eventFeed{max-height:70px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .rules{display:none!important}
}


/* V163 — definitive Son Harf mobile play layout */
@media (max-width:820px){
  body.sh-v111-playing .sh-game-card{
    display:block!important;
    height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;
    padding:18px 12px 108px!important;
  }
  body.sh-v111-playing .sh-card-head{
    position:sticky!important;top:122px!important;z-index:120!important;
    margin:4px 0 10px!important;padding:7px 8px!important;
  }
  body.sh-v111-playing .sh-word-row{
    position:relative!important;top:auto!important;bottom:auto!important;left:auto!important;right:auto!important;
    width:auto!important;max-width:none!important;
    grid-template-columns:minmax(0,1fr) 34px 76px!important;gap:7px!important;
    margin:10px 0 12px!important;padding:8px!important;z-index:auto!important;
  }
  body.sh-v111-playing .scoreline{
    display:flex!important;gap:8px!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none!important;
    margin:8px 0 10px!important;padding-bottom:1px!important;
  }
  body.sh-v111-playing .scorebox{flex:0 0 168px!important;min-width:168px!important}
  body.sh-v111-playing #wordForm,
  body.sh-word-input-active #wordForm,
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{
    position:relative!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
    width:100%!important;max-width:none!important;
    display:grid!important;grid-template-columns:minmax(0,1fr) 152px!important;gap:8px!important;
    margin:0!important;z-index:auto!important;
  }
  body.sh-v111-playing #wordForm input,
  body.sh-v111-playing #wordForm .btn{height:52px!important}
  body.sh-v111-playing #feedback{
    display:block!important;min-height:44px!important;margin:10px 0 0!important;
  }
  body.sh-v111-playing #eventFeed{
    display:block!important;max-height:96px!important;overflow:auto!important;margin-top:8px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-game-card{
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-areas:
      "head"
      "word"
      "score"
      "form"
      "feedback"!important;
    gap:10px!important;
    padding:26px 12px 14px!important;
  }
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-card-head{grid-area:head!important;position:relative!important;top:auto!important;margin:0!important;z-index:auto!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .sh-word-row{grid-area:word!important;margin:0!important;padding:8px!important;grid-template-columns:minmax(0,1fr) 30px 70px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .scoreline{grid-area:score!important;margin:0!important;display:flex!important;overflow-x:auto!important}
  body.wos-mobile-keyboard-open.sh-word-input-active .scorebox{flex:1 1 0!important;min-width:145px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{grid-area:form!important;margin:0!important;display:grid!important;grid-template-columns:minmax(0,1fr) 148px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #feedback{grid-area:feedback!important;margin:0!important;min-height:34px!important}
  body.wos-mobile-keyboard-open.sh-word-input-active #eventFeed,
  body.wos-mobile-keyboard-open.sh-word-input-active #wordAppealButton,
  body.wos-mobile-keyboard-open.sh-word-input-active .rules,
  body.wos-mobile-keyboard-open.sh-word-input-active #finalBoard{display:none!important}
}
@media (max-width:430px){
  body.sh-v111-playing .scorebox{flex-basis:148px!important;min-width:148px!important}
  body.sh-v111-playing #wordForm,
  body.sh-word-input-active #wordForm,
  body.wos-mobile-keyboard-open.sh-word-input-active #wordForm{grid-template-columns:minmax(0,1fr) 132px!important}
}
