/* Keep editable text readable before focus, without disabling pinch zoom. */
@layer tamga-mobile-inputs {
  @media (max-width:900px), (pointer:coarse) {
    :where(input, textarea, select, [contenteditable="true"], [contenteditable="plaintext-only"]):not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="reset"], [type="color"], [type="file"]) {
      font-size:16px !important;
      line-height:1.35 !important;
    }
  }
}
@media (max-width:900px), (pointer:coarse) {
  html body :is(input, textarea, select, [contenteditable="true"], [contenteditable="plaintext-only"]):not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="reset"], [type="color"], [type="file"]) {
    font-size:16px !important;
  }
  html:root[data-tamga-keyboard-focus="1"] .game-container,
  html:root[data-tamga-keyboard-focus="1"] .mc-shell {
    height:var(--tamga-keyboard-layout-height) !important;
    bottom:auto !important;
  }
  html:root[data-tamga-keyboard-focus="1"][data-tamga-mobile-shell="1"] {
    --mc-top:var(--tamga-keyboard-mc-top);
    --mc-bottom:var(--tamga-keyboard-mc-bottom);
    --mc-army:var(--tamga-keyboard-mc-army);
    --mc-unit:var(--tamga-keyboard-mc-unit);
    --mc-image:var(--tamga-keyboard-mc-image);
  }
  .tamga-keyboard-overlay {
    top:var(--tamga-keyboard-visible-top,0px) !important;
    bottom:auto !important;
    height:var(--tamga-keyboard-visible-height) !important;
    max-height:var(--tamga-keyboard-visible-height) !important;
  }
  .tamga-keyboard-panel {
    max-height:calc(var(--tamga-keyboard-visible-height) - 16px) !important;
    overflow-y:auto !important;
    overscroll-behavior:contain;
  }
  dialog.tamga-keyboard-panel {
    top:calc(var(--tamga-keyboard-visible-top,0px) + 8px) !important;
    bottom:auto !important;
    margin-block:0 !important;
  }
}
/* Native scoped modal rules also use !important; layer priority keeps keyboard
   bounds effective while their own inner scroll areas remain in control. */
@layer tamga-mobile-inputs {
  @media (max-width:900px), (pointer:coarse) {
    .tamga-keyboard-overlay {
      top:var(--tamga-keyboard-visible-top,0px) !important;
      bottom:auto !important;
      height:var(--tamga-keyboard-visible-height) !important;
      max-height:var(--tamga-keyboard-visible-height) !important;
    }
    .tamga-keyboard-panel {max-height:calc(var(--tamga-keyboard-visible-height) - 16px) !important;}
    dialog.tamga-keyboard-panel {top:calc(var(--tamga-keyboard-visible-top,0px) + 8px) !important;bottom:auto !important;margin-block:0 !important;}
  }
}
