.subtitle-safe-area-probe {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  inset: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* Local coordinates are constrained to the visible player, including a soft keyboard. */
#player.subtitle-mobile-layout #subtitle-menu.subtitle-sheet {
  position: absolute;
  inset: auto;
  left: var(--subtitle-sheet-left, 8px);
  bottom: var(--subtitle-sheet-bottom, 8px);
  top: auto;
  right: auto;
  width: var(--subtitle-sheet-width, calc(100% - 16px));
  max-width: calc(100% - 16px);
  height: auto;
  max-height: var(--subtitle-sheet-height, calc(100% - 16px));
  min-height: 0;
  padding-bottom: 0;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 200;
  transform: none;
  -webkit-transform: none;
  will-change: auto;
  animation: none;
}
#player.subtitle-mobile-layout #subtitle-menu::before { display: none; }
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-header {
  flex: 0 0 auto;
  min-width: 0;
  padding: 8px 10px 10px;
  gap: 6px;
  background: #17171d;
  z-index: 2;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-title-row { gap: 6px; min-width: 0; }
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
  gap: 7px;
  overflow: hidden;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-icon { flex: 0 0 18px; }
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-title {
  min-width: 0;
  font-size: 14px;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-active-badge { display: none; }
#player.subtitle-mobile-layout #subtitle-menu #subtitle-menu-close {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  touch-action: manipulation;
  position: relative;
  z-index: 3;
  pointer-events: auto;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
  padding: 3px;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-tab-btn {
  min-width: 0;
  min-height: 44px;
  padding: 5px 3px;
  gap: 2px;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-tab-btn svg { display: none; }
#player.subtitle-mobile-layout #subtitle-menu .sub-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
#player.subtitle-mobile-layout #subtitle-menu .sub-search-bar { flex-wrap: wrap; }
#player.subtitle-mobile-layout #subtitle-menu #sub-search-input { min-width: 0; width: 100%; min-height: 44px; font-size: 16px; }
#player.subtitle-mobile-layout #subtitle-menu #sub-search-btn { min-height: 44px; }
#player.subtitle-mobile-layout #subtitle-menu .sub-segmented-control { display: flex; min-width: 0; flex-wrap: wrap; }
#player.subtitle-mobile-layout #subtitle-menu .sub-segment-btn { flex: 1 1 70px; }
#player.subtitle-mobile-layout #subtitle-menu .sub-offset-btn-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#player.subtitle-mobile-layout #subtitle-menu .sub-pill-btn,
#player.subtitle-mobile-layout #subtitle-menu .sub-segment-btn,
#player.subtitle-mobile-layout #subtitle-menu .sub-lang-chip { min-height: 44px; touch-action: manipulation; }
#player.subtitle-mobile-layout #subtitle-menu :focus-visible { outline: 3px solid #ff2d55; outline-offset: -3px; }
