/* Phone behavior: respect browser chrome and touch without changing game state. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;overscroll-behavior-y:none;color-scheme:dark;}
body{min-height:100dvh;overscroll-behavior-y:none;}
/* Keep selection available on content and fields; suppress it only on controls. */
:where(button,a,[role="button"],[role="tab"],summary,.check){
  touch-action:manipulation;user-select:none;-webkit-user-select:none;
  -webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;
}
:where(button,[role="button"],.check):active:not(:disabled){opacity:.72;}
/* Dialog scroll must stop at its own boundary instead of moving the page behind it. */
.rank-info-overlay{
  padding:max(12px,env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));
}
.rank-info-card{
  max-height:min(85dvh,calc(100dvh - max(12px,env(safe-area-inset-top,0px)) - max(12px,env(safe-area-inset-bottom,0px))));
  overscroll-behavior-y:contain;scroll-padding-block:16px;
}
@media(pointer:coarse){
  /* iPhone focus zoom starts below 16px, including dynamically created fields. */
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea{font-size:16px!important;}
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),select{min-height:44px;}
  input,select,textarea{scroll-margin-block:90px;}
  .sortbar button,.emoji-cats button,.daypick button,.diffpick button,.cal-head button,.rule-add,.edit-actions button,footer button{min-height:44px;}
  .rank-info-close{width:44px;height:44px;top:6px;right:6px;}
  .rank-info-card{padding-top:54px;}
  /* The visible checkbox stays compact; its clear hit area is 44px square. */
  .task .check::before{content:'';position:absolute;inset:-9px;}
  .task .edit-btn,.task .del{position:relative;min-width:32px;min-height:44px;}
  /* While typing, the large status panel must not cover the field being edited. */
  body:has(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus,textarea:focus,select:focus) .rank-strip{position:relative;top:auto;}
}
/* Preserve landscape notch clearance on narrow screens too. */
@media(max-width:380px){.tabs.bottom-nav{width:calc(100% - 16px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));}}
